Skip to content

Commit 29abf1a

Browse files
authored
Make torchtext & torchaudio load libomp
http://b/255757999
1 parent c72a84a commit 29abf1a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Dockerfile.tmpl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ RUN conda config --add channels nvidia && \
9090
# b/232247930: uninstall pyarrow to avoid double installation with the GPU specific version.
9191
RUN pip uninstall -y pyarrow && \
9292
conda install -c conda-forge mamba && \
93-
mamba install cudf cuml cudatoolkit && \
93+
mamba install -y cudf cuml cudatoolkit && \
9494
/tmp/clean-layer.sh
9595
{{ end }}
9696

@@ -108,6 +108,13 @@ RUN conda install implicit && \
108108
COPY --from=torch_whl /tmp/whl/*.whl /tmp/torch/
109109
RUN conda install -c pytorch magma-cuda${CUDA_MAJOR_VERSION}${CUDA_MINOR_VERSION} && \
110110
pip install /tmp/torch/*.whl && \
111+
# b/255757999 openmp (libomp.so) is an dependency of libtorchtext and libtorchaudio but
112+
# the built from source versions don't seem to properly link it in. This forces the dep
113+
# which makes sure that libomp is loaded when these libraries are loaded.
114+
conda install -y openmp && \
115+
pip install patchelf && \
116+
patchelf --add-needed libomp.so.5 /opt/conda/lib/python3.7/site-packages/torchtext/lib/libtorchtext.so && \
117+
patchelf --add-needed libomp.so.5 /opt/conda/lib/python3.7/site-packages/torchaudio/lib/libtorchaudio.so && \
111118
rm -rf /tmp/torch && \
112119
/tmp/clean-layer.sh
113120
{{ else }}

0 commit comments

Comments
 (0)