reframe-hpc / reframe

A powerful Python framework for writing and running portable regression tests and benchmarks for HPC systems.
https://reframe-hpc.readthedocs.org
BSD 3-Clause "New" or "Revised" License
214 stars 101 forks source link

compilation gpu burn with hip #3231

Open cedricjourdain opened 1 month ago

cedricjourdain commented 1 month ago

When I try to compile it with makefile.hip, i.e with the following compilation line hipcc -O3 gpu_burn.cu -o gpu_burn.x -DTARGET_HIP -std=c++14 -I/opt/rocm/rocm_smi/include -lnuma -lrocm_smi64 -lrocblas, I get the following error :

gpu_burn.cu:182:24: error: __host__ function 'compute' cannot overload __host__ __device__ function 'compute'
void GemmTest<double>::compute()
                       ^
gpu_burn.cu:164:8: note: previous declaration is here
  void compute() = delete;
       ^
gpu_burn.cu:200:23: error: __host__ function 'compute' cannot overload __host__ __device__ function 'compute'
void GemmTest<float>::compute()
                      ^
gpu_burn.cu:164:8: note: previous declaration is here
  void compute() = delete;
       ^
3 warnings and 2 errors generated when compiling for gfx803.
make: *** [makefile.hip:4: gpu_burn] Error 1

after correcting the error I have an error in the link

ok maintenant j'ai cette erreur :
ld.lld: error: undefined symbol: pthread_create
>>> referenced by gpu_burn.cu
>>>               /tmp/gpu_burn-92c6db.o:(void launch<double>(int, std::vector<int, std::allocator<int>> const&))
>>> referenced by gpu_burn.cu
>>>               /tmp/gpu_burn-92c6db.o:(void launch<float>(int, std::vector<int, std::allocator<int>> const&))
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [makefile.hip:4: gpu_burn] Error 1

On our AMD machine it would seem that adding pthread to the LDFLAGS is necessary.