ROCm / rocThrust

ROCm Thrust - run Thrust dependent software on AMD GPUs
https://rocm.docs.amd.com/projects/rocThrust/en/latest/
Apache License 2.0
100 stars 44 forks source link

reference to __host__ function 'free'/'malloc' in __host__ __device__ function #355

Open jinz2014 opened 8 months ago

jinz2014 commented 8 months ago

Compiling a HIP program shows the following errors. Thanks for your suggestion.

In file included from /opt/rocm-6.0.0/include/thrust/system/detail/adl/malloc_and_free.h:26:
/opt/rocm-6.0.0/include/thrust/system/detail/sequential/malloc_and_free.h:45:8: error: reference to __host__ function 'free' in __host__ __device__ function
  std::free(thrust::raw_pointer_cast(ptr));

In file included from /opt/rocm-6.0.0/include/thrust/system/detail/adl/malloc_and_free.h:26:
/opt/rocm-6.0.0/include/thrust/system/detail/sequential/malloc_and_free.h:37:15: error: reference to __host__ function 'malloc' in __host__ __device__ function
  return std::malloc(n);
doctorcolinsmith commented 8 months ago

@jinz2014 Thanks for reporting the issue. It is known to our team and we will follow up on it.

jinz2014 commented 8 months ago

I didn't know the issue until migrating CUDA sources and building the HIP codes. If the CUDA sources are needed for your test, please let me know.

doctorcolinsmith commented 8 months ago

@jinz2014 If you have a reproducer you can share, we will include it in our testing.

jinz2014 commented 8 months ago

In the example,

https://github.com/zjin-lcf/HeCBench/tree/master/src/logic-rewrite-hip

Type "make" may reproduce the error.