Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLIBC mismatch for cxx11 libtorch #101

Open
ElliottKasoar opened this issue Mar 28, 2024 · 1 comment
Open

GLIBC mismatch for cxx11 libtorch #101

ElliottKasoar opened this issue Mar 28, 2024 · 1 comment
Labels
bug Something isn't working hackathon

Comments

@ElliottKasoar
Copy link
Contributor

This may not be an FTorch issue, but attempting to link to FTorch installed with the cxx11 libtorch (2.2.1) throws an error due to what seems to be a mismatch between the GLIBC version it references (2.29) and the installed version (ldd (GNU libc) 2.28).

The solution for now seems to be using the non-cxx11 version, as the steps described below work when the URL is swapped for https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-2.2.1%2Bcpu.zip.

Steps to reproduce (also attempted with gcc 9):

  1. Login to CSD3 (login-icelake.hpc.cam.ac.uk)

  2. Run commands along the lines of:

module load cmake/latest
module load gcc/11.3.0

cd /rds/user/ek440/hpc-work/

wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.2.1%2Bcpu.zip
unzip libtorch-cxx11-abi-shared-with-deps-2.2.1+cpu.zip

cd FTorch/src/build

cmake .. -DCMAKE_PREFIX_PATH=/rds/user/ek440/hpc-work/libtorch -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/rds/user/ek440/hpc-work/lib_libtorch -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_Fortran_COMPILER=gfortran

cmake --build . --target install

cd ../../examples/2_ResNet18/build

cmake .. -DCMAKE_PREFIX_PATH=/rds/user/ek440/hpc-work/lib_libtorch/ -DCMAKE_BUILD_TYPE=Release -DCMAKE_Fortran_COMPILER=gfortran

cmake --build .

This throws an error for me:

//rds/user/ek440/hpc-work/libtorch/lib/libtorch_cpu.so: undefined reference to `log2@GLIBC_2.29'
//rds/user/ek440/hpc-work/libtorch/lib/libtorch_cpu.so: undefined reference to `pow@GLIBC_2.29'
//rds/user/ek440/hpc-work/libtorch/lib/libtorch_cpu.so: undefined reference to `exp2@GLIBC_2.29'
//rds/user/ek440/hpc-work/libtorch/lib/libtorch_cpu.so: undefined reference to `exp@GLIBC_2.29'
//rds/user/ek440/hpc-work/libtorch/lib/libc10.so: undefined reference to `log@GLIBC_2.29'
collect2: error: ld returned 1 exit status

I recall there can be issues with LD_LIBRARY_PATH being incorrectly set, but that does not appear to be an the case here, as it seems to find libtorch_cpu.so fine (and I've tried setting it), but also if I set it differently:

LD_LIBRARY_PATH=/rds/user/ek440/hpc-work/libtorch-non-cxx/lib/

I get a different error on the last step:

/rds/user/ek440/hpc-work/lib_libtorch/lib64/libftorch.so: undefined reference to `c10::ListType::get(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, c10::Type::SingletonOrSharedTypePtr<c10::Type>)'

It's odd to me that it gets so far before the error occurs.

The main alternative suggestion other than different versions of libtorch/glibc I've seen is to export CC and CXX, which didn't seem to solve the problem.

I don't plan to look into this much further, but I thought it might be useful to be aware of if nothing else.

@ElliottKasoar ElliottKasoar added the bug Something isn't working label Mar 28, 2024
@jatkinson1000
Copy link
Member

I suggest someone check this in a future hackathon session to see if the issue is still there in the latest versions, then we close the issue as I see little we can do except have this as a point of reference/information for future users that may encounter it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hackathon
Projects
None yet
Development

No branches or pull requests

2 participants