coin-or / Ipopt

COIN-OR Interior Point Optimizer IPOPT

Home Page:https://coin-or.github.io/Ipopt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compile error with SPRAL GPU support

chemrgineer opened this issue · comments

Hi everyone, I'm trying to compile IPOPT with SPRAL (compiled with GPU support).
As a first step I compiled hwloc with CUDA support. Then I compiled spral with these commands:

git clone https://github.com/ralna/spral
cd spral && ./autogen.sh
mkdir build && cd build
cp ../nvcc_arch_sm.c ./
CFLAGS=-fPIC CPPFLAGS=-fPIC CXXFLAGS=-fPIC FFLAGS=-fPIC FCFLAGS=-fPIC \
../configure --with-blas="-lopenblas" --with-lapack="-llapack" --with-metis="-L/usr/local/lib -lcoinmetis" --with-metis-inc-dir="-I/usr/local/include/coin-or/metis" --prefix=/home/erturk/spral
make && make test
make install

After SPRAL compilation I download and try to compile IPOPT with these commands:

git clone https://github.com/coin-or/Ipopt
cd Ipopt && mkdir build && cd build
../configure --with-spral-lflags="-L/home/erturk/spral/lib -lspral -lgfortran -lhwloc -lm -lcoinmetis -lopenblas -lstdc++ -fopenmp -lcudadevrt -lcudart -lcuda -lcublas" --with-spral-cflags="-I/home/erturk/spral/include"
make -j$(nproc --all) && make test
sudo make install

I get these errors:

/usr/bin/ld: /home/erturk/spral/lib/libspral.a(dense_factor.o): warning: relocation against `_ZN48_GLOBAL__N__16e07778_15_dense_factor_cu_8d0d865713cu_block_cholIdLj8ELj3EEEviiPKT_iPS1_iPi' in read-only section `.text'
/usr/bin/ld: /home/erturk/spral/lib/libspral.a(assemble.o): relocation R_X86_64_PC32 against symbol `_ZN44_GLOBAL__N__78fd96ee_11_assemble_cu_df8d376113cu_load_nodesEPKNS_15load_nodes_typeEPKlPKd' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status

I attached config.log file.

Looks to me as if the -fPIC didn't get applied when dense_factor.o and assemble.o were built. You may want to inspect the log of make from the Spral build (though I used similar flags).

I attached SPRAL build config.log. I don't have extensive knowledge. I have Geforge 1650Ti mobile architecture Turing = sm_75. I installed cuda with "sudo apt install nvidia-cuda-toolkit".

Maybe try NVCCFLAGS=-fPIC when configure Spral. Just a guess. I never tried Spral with GPU. Maybe the Spral project would be a better place for this.

Unfortunately did not work. I will try my luck in SPRAL repo. Thanks for fast response.

make  all-am
make[1]: Entering directory '/home/erturk/Downloads/spral/build_new'
gfortran -fopenmp -fPIC -c -o src/blas_iface.o ../src/blas_iface.f90
gfortran -fopenmp -fPIC -c -o src/core_analyse.o ../src/core_analyse.f90
depbase=`echo src/compat.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
g++ -DHAVE_CONFIG_H -I. -I..   -fPIC -I../include -I../src -std=c++11 -fopenmp  -I/usr/local/include -fPIC -MT src/compat.o -MD -MP -MF $depbase.Tpo -c -o src/compat.o ../src/compat.cxx &&\
mv -f $depbase.Tpo $depbase.Po
nvcc -fPIC -I../include -I../src -Xptxas="-v" -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_87,code=sm_87 -gencode arch=compute_86,code=compute_86 -rdc false -c -o src/cuda/api_wrappers.o ../src/cuda/api_wrappers.cu
nvcc fatal   : Unknown option '-fPIC'
make[1]: *** [Makefile:3246: src/cuda/api_wrappers.o] Error 1
make[1]: Leaving directory '/home/erturk/Downloads/spral/build_new'
make: *** [Makefile:1660: all] Error 2