NVIDIA / libcudacxx

[ARCHIVED] The C++ Standard Library for your entire system. See https://github.com/NVIDIA/cccl

Home Page:https://nvidia.github.io/libcudacxx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

annotated_ptr compile error

jdwapman opened this issue · comments

I'm running into compile errors with the annotated_ptr that I believe should be working given the example docs here: https://nvidia.github.io/libcudacxx/extended_api/memory_access_properties/associate_access_property.html. If I'm doing something incorrectly please let me know. Otherwise, please let me know if this is a bug that needs to be fixed.

Example code:

#include <cuda/annotated_ptr>
#include <thrust/device_vector.h>

__global__ void foo(int* v) {
  int* pin =
      cuda::associate_access_property(v, cuda::access_property::persisting);
}

int main() {
  thrust::device_vector<int> v(100);

  foo<<<1, 1>>>(v.data().get());
  cudaDeviceSynchronize();
}

Compiler command:

nvcc main.cu -arch=sm_86 && ./a.out

Output:

main.cu(6): error: type name is not allowed

System specs:
Ubuntu 22.04
CUDA 11.7.0

Update: the compile error seems to disappear if I use brackets as shown in https://nvidia.github.io/libcudacxx/extended_api/memory_access_properties/access_property.html

For example:

  int* pin =
      cuda::associate_access_property(v, cuda::access_property::persisting{});

Seems like inconsistent documentation in the libcu++ "Memory access properties" section.

Sorry for taking so long to respond. This is indeed an error on your side. cuda::access_property::persisting is a type not an object. So you need to instantiate an object of that type to pass it to a function. AFAIK this is also how it is done in the linked documentation.

I am closing this, if there are other problems please open another issue