Giter VIP home page Giter VIP logo

Comments (6)

isuruf avatar isuruf commented on August 21, 2024

pytorch requires MKL which requires Intel/LLVM openmp and we force one environment to have only one OpenMP implementation only.

from ctng-compilers-feedstock.

pearu avatar pearu commented on August 21, 2024

@isuruf, notice that the current behaviour leads to

$ python -c 'import torch'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/pearu/git/v0dro/pytorch/torch/__init__.py", line 192, in <module>
    from torch._C import *
ImportError: /home/pearu/miniconda3/envs/pytorch-cuda-dev/lib/libgomp.so.1: version `OACC_2.0' not found (required by /home/pearu/git/v0dro/pytorch/torch/lib/libtorch_cpu.so)

$ nm /home/pearu/git/v0dro/pytorch/torch/lib/libtorch_cpu.so | grep OACC
                 w acc_get_device_type@@OACC_2.0

This used to work at least a month ago.. and, IIUC, the issue is related to conda environment rather than to a pytorch build.

from ctng-compilers-feedstock.

isuruf avatar isuruf commented on August 21, 2024

pytorch wants both GNU and Intel OpenMP?

from ctng-compilers-feedstock.

pearu avatar pearu commented on August 21, 2024

good question, I have not found yet where acc_get_device_type sneaks in..

from ctng-compilers-feedstock.

pearu avatar pearu commented on August 21, 2024

It turns out to be a pytorch/cuda issue: one of its components links against libcupti_static.a which references acc_get_device_type@@OACC_2.0. A fix is to build pytorch with USE_KINETO=0.

from ctng-compilers-feedstock.

pearu avatar pearu commented on August 21, 2024

@isuruf, the following script

# main.sh
export PACKAGES="compilers"  # TEST 1 SUCCEEDS
export PACKAGES="compilers mkl"  # TEST 1 FAILS
export TESTENV=gomp-test

CONDA_BASE=$(conda info --base)
rm -rf $CONDA_BASE/envs/$TESTENV
source $CONDA_BASE/etc/profile.d/conda.sh
conda create -y -c conda-forge -n $TESTENV $PACKAGES
conda activate $TESTENV

echo "TEST 1"

printf "#include <openacc.h>\nint main() { acc_device_t dev_type = acc_get_device_type(); return acc_get_num_devices(dev_type)+90; }"|gcc -x c -  -Wl,--trace-symbol='acc_get_device_type' -lgomp -o ./test1 ; readelf -s -W ./test1 | grep acc_get
./test1
echo "-> $?"

illustrates that having the mkl package in conda environment breaks any program using GNU OpenMP, IIUC.

The output is

TEST 1
/home/pearu/miniconda3/envs/gomp-test/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /tmp/ccjry9ti.o: reference to acc_get_device_type
/home/pearu/miniconda3/envs/gomp-test/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/pearu/miniconda3/envs/gomp-test/bin/../x86_64-conda-linux-gnu/sysroot/lib/../lib/libgomp.so: definition of acc_get_device_type
     5: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND acc_get_num_devices@OACC_2.0 (3)
     6: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND acc_get_device_type@OACC_2.0 (3)
    67: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND acc_get_num_devices@@OACC_2.0
    68: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND acc_get_device_type@@OACC_2.0
./test1: /home/pearu/miniconda3/envs/gomp-test/lib/libgomp.so.1: version `OACC_2.0' not found (required by ./test1)
-> 1

I am uncertain which component of the conda world is causing this.

from ctng-compilers-feedstock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.