Skip to content

Commit acc490b

Browse files
authored
Merge pull request #29 from albarji/bugfix/gpudetectfail
Capture errors while detecting GPUs
2 parents f5ee2d5 + fd1b0f7 commit acc490b

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ RUN curl -o Miniconda3-latest-Linux-x86_64.sh https://repo.continuum.io/minicond
3030
&& ./Miniconda3-latest-Linux-x86_64.sh -b -p "${MINICONDA_HOME}" \
3131
&& rm Miniconda3-latest-Linux-x86_64.sh
3232
COPY conda.txt conda.txt
33-
RUN conda install -y --file=conda.txt
34-
RUN conda clean -y -i -l -p -t && \
33+
RUN conda install -y --file=conda.txt && \
34+
conda clean -y -i -l -p -t && \
3535
rm -f conda.txt
3636
COPY pip.txt pip.txt
3737
RUN pip install -r pip.txt && \

conda.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
numpy
1+
numpy==1.15.3

neuralstyle/algorithms.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,11 @@ def targetshape(content, size=None):
351351

352352
def gpuname():
353353
"""Returns the model name of the first available GPU"""
354-
gpus = GPUtil.getGPUs()
354+
try:
355+
gpus = GPUtil.getGPUs()
356+
except:
357+
LOGGER.warning("Unable to detect GPU model. Is your GPU configured? Are you running with nvidia-docker?")
358+
return "UNKNOWN"
355359
if len(gpus) == 0:
356360
raise ValueError("No GPUs detected in the system")
357361
return gpus[0].name
@@ -365,6 +369,6 @@ def maxtile(alg="gatys"):
365369
"""
366370
gname = gpuname()
367371
if gname not in GPUCONFIG:
368-
LOGGER.warning("Unknown GPU model %s, will use default tiling parameters")
372+
LOGGER.warning(f"Unknown GPU model {gname}, will use default tiling parameters")
369373
gname = "default"
370374
return GPUCONFIG[gname][alg]

pip.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
gputil
1+
gputil==1.3.0

0 commit comments

Comments
 (0)