lwang-astro / PeTar

PeTar is a high-performance N-body code for modelling the evolution of star clusters and tidal streams, including the effect of galactic potential, dynamics of binary and hierarchical system, single and binary stellar evolution.
MIT License
71 stars 19 forks source link

c++11 or c++17 ? #32

Closed WassimTenachi closed 2 years ago

WassimTenachi commented 2 years ago

Hello,

I am trying to install PeTar and I think I might have missed something regarding the c++ requirements.

My config:

1) slurm/slurm(latest) 2) gcc/gcc-8 3) openmpi/openmpi-3.1.gcc8 4) cuda/cuda-7.5

My python path looks like:

/mypath/PeTar_setup/include

My path looks like:

/usr/local/bin: /usr/local/cuda/cuda-7.5/bin: /usr/local/openmpi/openmpi-3.1.3-g8/bin: /usr/local/gcc/gcc-8.2.0/bin: /mypath/anaconda3/bin: /mypath/anaconda3/condabin: /usr/local/bin: /usr/local/Modules/5.0.1/bin: /usr/lib64/qt-3.3/bin: /usr/local/bin: /usr/bin: /usr/local/sbin: /usr/sbin: /usr/local/slurm/bin: /mypath/bin: /mypath/PeTar_setup/bin: /mypath/anaconda3/lib/python3.9/site-packages/galpy:


I am running this command to create the makefile:

./configure --with-fdps-prefix=/mypath/PeTar_setup/FDPS --with-sdar-prefix=/mypath/PeTar_setup/SDAR --with-mpi=yes --with-external=galpy --with-galpy-prefix=/mypath/anaconda3/lib/python3.9/site-packages/galpy --with-interrupt=bse --enable-cuda --with-cuda-sdk-prefix=/usr/local/cuda/cuda-7.5 CC=mpic++


When running make I get the following output:

nvcc -std=c++17 -I /usr/local/cuda/cuda-7.5/samples/common/inc -Xcompiler="-O3 -Wall -std=c++17 -fopenmp -D PARTICLE_SIMULATOR_THREAD_PARALLEL -D USE_GPU -D GPU_PROFILE -DINTRINSIC_X86 -march=core-avx2 -D DIV_FIX -D USE_SIMD -D PROFILE -D PARTICLE_SIMULATOR_GPU_MULIT_WALK_INDEX -D USE_QUAD -D SOFT_PERT -D AR_TTL -D AR_SLOWDOWN_TREE -D AR_SLOWDOWN_TIMESCALE -D CLUSTER_VELOCITY -D HARD_CHECK_ENERGY -D HARD_COUNT_NO_NEIGHBOR -D ADJUST_GROUP_PRINT -D TIDAL_TENSOR_3RD -D STELLAR_EVOLUTION -D BSEBBF -D BSE_BASE -D EXTERNAL_POT_IN_PTCL -D RECORD_CM_IN_HEADER -D GALPY" -I ./bse-interface -I ./galpy-interface -I/mypath/anaconda3/lib/python3.9/site-packages/galpy -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/snapshot -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/snapshot/pycache -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/orbit -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/orbit/orbit_c_ext -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/orbit/pycache -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/util -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/util/interp_2d -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/util/pycache -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/df -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/df/data -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/df/pycache -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/actionAngle -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/actionAngle/actionAngle_c_ext -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/actionAngle/pycache -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/actionAngle/actionAngleTorus_c_ext -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/potential -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/potential/potential_c_ext -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/potential/interppotential_c_ext -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/potential/pycache -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/pycache -I/mypath/anaconda3/include -I./src -I/mypath/PeTar_setup/FDPS/src -I/mypath/PeTar_setup/SDAR/src -c ./src/force_gpu_cuda.cu -o build/force_gpu_cuda.o nvcc fatal : Value 'c++17' is not defined for option 'std' make: *** [build/force_gpu_cuda.o] Error 1


I noticed that in the makefile c++17 is used, I tried replacing it with c++11 (as c++11 is mentioned in the readme) which gives me the following output (sorry for the long output) see below. Do you have an idea of how to solve this problem ? Thanks a lot for your help and sorry if this is a silly question.

nvcc -std=c++11 -I /usr/local/cuda/cuda-7.5/samples/common/inc -Xcompiler="-O3 -Wall -std=c++11 -fopenmp -D PARTICLE_SIMULATOR_THREAD_PARALLEL -D USE_GPU -D GPU_PROFILE -DINTRINSIC_X86 -march=core-avx2 -D DIV_FIX -D USE_SIMD -D PROFILE -D PARTICLE_SIMULATOR_GPU_MULIT_WALK_INDEX -D USE_QUAD -D SOFT_PERT -D AR_TTL -D AR_SLOWDOWN_TREE -D AR_SLOWDOWN_TIMESCALE -D CLUSTER_VELOCITY -D HARD_CHECK_ENERGY -D HARD_COUNT_NO_NEIGHBOR -D ADJUST_GROUP_PRINT -D TIDAL_TENSOR_3RD -D STELLAR_EVOLUTION -D BSEBBF -D BSE_BASE -D EXTERNAL_POT_IN_PTCL -D RECORD_CM_IN_HEADER -D GALPY" -I ./bse-interface -I ./galpy-interface -I/mypath/anaconda3/lib/python3.9/site-packages/galpy -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/snapshot -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/snapshot/pycache -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/orbit -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/orbit/orbit_c_ext -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/orbit/pycache -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/util -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/util/interp_2d -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/util/pycache -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/df -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/df/data -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/df/pycache -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/actionAngle -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/actionAngle/actionAngle_c_ext -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/actionAngle/pycache -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/actionAngle/actionAngleTorus_c_ext -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/potential -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/potential/potential_c_ext -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/potential/interppotential_c_ext -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/potential/pycache -I/mypath/anaconda3/lib/python3.9/site-packages/galpy/pycache -I/mypath/anaconda3/include -I./src -I/mypath/PeTar_setup/FDPS/src -I/mypath/PeTar_setup/SDAR/src -c ./src/force_gpu_cuda.cu -o build/force_gpu_cuda.o /usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/type_traits(1049): error: identifier "__is_assignable" is undefined

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/type_traits(1049): error: type name is not allowed

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/type_traits(1049): error: type name is not allowed

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/utility(307): error: identifier "__integer_pack" is undefined

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/utility(307): error: pack expansion does not make use of any argument packs

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/functional(545): error: expression must have a constant value


lwang-astro commented 2 years ago

I notice that for compiling cuda code, a lot of include pathes from anaconda3 are shown in your log. Not sure whether this is the reason. I have committed a update of Makefile.in in the master branch together with a few updates. Could you try to update PeTar (git pull), configure and make again?

WassimTenachi commented 2 years ago

Hi, Thank you very much for your answer. I 've updated but it seems to give the same kind of errors (here are the first lines) . Do you think it might have something to do with my modules versions (gcc, mpi, cuda) ? I yes do you have a combination that you know works well ? Thanks a lot for your time !

nvcc -std=c++11 -I /usr/local/cuda/cuda-7.5/samples/common/inc -Xcompiler="-O3 -Wall -std=c++11 -fopenmp -D PARTICLE_SIMULATOR_THREAD_PARALLEL -D USE_GPU -D GPU_PROFILE -DINTRINSIC_X86 -march=core-avx2 -D DIV_FIX -D USE_SIMD -D PROFILE -D PARTICLE_SIMULATOR_GPU_MULIT_WALK_INDEX -D USE_QUAD -D SOFT_PERT -D AR_TTL -D AR_SLOWDOWN_TREE -D AR_SLOWDOWN_TIMESCALE -D CLUSTER_VELOCITY -D HARD_CHECK_ENERGY -D HARD_COUNT_NO_NEIGHBOR -D ADJUST_GROUP_PRINT -D TIDAL_TENSOR_3RD -D STELLAR_EVOLUTION -D BSEBBF -D BSE_BASE -D EXTERNAL_POT_IN_PTCL -D RECORD_CM_IN_HEADER -D GALPY " -I ./bse-interface -I./src -I/mypath/PeTar_setup/FDPS/src -I/mypath/PeTar_setup/SDAR/src -c ./src/force_gpu_cuda.cu -o build/force_gpu_cuda.o /usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/type_traits(1049): error: identifier "__is_assignable" is undefined

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/type_traits(1049): error: type name is not allowed

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/type_traits(1049): error: type name is not allowed

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/utility(307): error: identifier "__integer_pack" is undefined

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/utility(307): error: pack expansion does not make use of any argument packs

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/functional(545): error: expression must have a constant value

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/functional(549): error: expression must have a constant value

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/bits/stl_tree.h(452): error: expression must have a constant value

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/bits/stl_tree.h(1679): error: identifier "_Compare" is undefined

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/bits/stl_tree.h(2012): error: identifier "_Compare" is undefined

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/type_traits(2431): error: class "std::enable_if<, void>" has no member "type" detected during instantiation of "std::swap" based on template argument <std::__c_file *> /usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/x86_64-pc-linux-gnu/bits/basic_file.h(79): here

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/x86_64-pc-linux-gnu/bits/basic_file.h(80): error: no instance of overloaded function "std::swap" matches the argument list argument types are: (__nv_bool, __nv_bool)

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/bits/stl_pair.h(378): error: invalid redeclaration of member function "std::pair<_T1, _T2>::operator=(std::conditional<std::and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2>>::value, const std::pair<_T1, _T2> &, const std::__nonesuch_no_braces &>::type) [with _T1=nv_bool, _T2=std::size_t]" (367): here detected during instantiation of class "std::pair<_T1, _T2> [with _T1=__nv_bool, _T2=std::size_t]" /usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/bits/hashtable_policy.h(582): here

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/bits/stl_pair.h(378): error: invalid redeclaration of member function "std::pair<_T1, _T2>::operator=(std::conditional<std::and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2>>::value, const std::pair<_T1, _T2> &, const std::__nonesuch_no_braces &>::type) [with _T1=nv_bool, _T2=int]" (367): here detected during instantiation of class "std::pair<_T1, _T2> [with _T1=__nv_bool, _T2=int]" /usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/bits/hashtable_policy.h(594): here

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/bits/hashtable.h(192): error: expression must have a constant value

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/bits/hashtable.h(195): error: expression must have a constant value

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/bits/hashtable.h(197): error: expression must have a constant value

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/bits/hashtable.h(1383): error: identifier "_H1" is undefined

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/bits/hashtable.h(1384): error: identifier "_Equal" is undefined

/usr/local/gcc/gcc-8.2.0/include/c++/8.2.0/bits/stl_tree.h(700): error: identifier "_Node_allocator" is undefined detected during instantiation of "std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Rb_tree_impl<_Key_compare, >::_Rb_tree_impl() [with _Key=const char , _Val=std::pair<const char const, IOParams >, _KeyOfValue=std::_Select1st<std::pair<const char const, IOParams >>, _Compare=IOParamsContainer::char_cmp, _Alloc=std::allocator<std::pair<const char const, IOParams *>>, _Key_compare=IOParamsContainer::char_cmp, =true]" ./bse-interface/../src/io.hpp(207): here

lwang-astro commented 2 years ago

I can succesfully compile the code with CUDA on Ubuntu 18.04/20.04 LTS, where the gcc/g++ version is 9.4.0 and cuda version is 11.0. From your error message, I guess that your g++ version may not match your cuda (nvcc) version.

WassimTenachi commented 2 years ago

Hi, I was able to make it work with cuda disabled ! :) Thanks again for your help.