Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/usr/include/cuda_runtime_api.h ==> d: Error: undefined identifier cudaError_t #280

Open
mw66 opened this issue Jun 7, 2022 · 6 comments

Comments

@mw66
Copy link

mw66 commented Jun 7, 2022

$ dstep --version
1.0.3-2-g2f6e8ae

$ dstep /usr/include/cuda_runtime_api.h -o cuda_runtime_api.d

# but the generated file cannot be compiled:

source/cuda_runtime_api.d(3625,13): Error: undefined identifier `cudaError_t`
source/cuda_runtime_api.d(3625,13): Error: undefined identifier `cudaExternalSemaphore_t`
source/cuda_runtime_api.d(3625,13): Error: undefined identifier `cudaExternalSemaphoreSignalParams`
source/cuda_runtime_api.d(3625,13): Error: undefined identifier `cudaStream_t`
source/cuda_runtime_api.d(3701,13): Error: undefined identifier `cudaError_t`
source/cuda_runtime_api.d(3701,13): Error: undefined identifier `cudaExternalSemaphore_t`
source/cuda_runtime_api.d(3701,13): Error: undefined identifier `cudaExternalSemaphoreWaitParams`
source/cuda_runtime_api.d(3701,13): Error: undefined identifier `cudaStream_t`
source/cuda_runtime_api.d(158,22): Error: undefined identifier `__device__`
source/cuda_runtime_api.d(200,13): Error: undefined identifier `cudaError_t`
source/cuda_runtime_api.d(221,13): Error: undefined identifier `cudaError_t`
source/cuda_runtime_api.d(308,13): Error: undefined identifier `cudaError_t`
source/cuda_runtime_api.d(308,13): Error: undefined identifier `cudaLimit`
source/cuda_runtime_api.d(343,13): Error: undefined identifier `cudaError_t`
source/cuda_runtime_api.d(343,13): Error: undefined identifier `cudaLimit`
source/cuda_runtime_api.d(365,13): Error: undefined identifier `cudaError_t`
source/cuda_runtime_api.d(365,13): Error: undefined identifier `cudaChannelFormatDesc`
source/cuda_runtime_api.d(398,13): Error: undefined identifier `cudaError_t`
source/cuda_runtime_api.d(398,13): Error: undefined identifier `cudaFuncCache`
source/cuda_runtime_api.d(435,13): Error: undefined identifier `cudaError_t`

Shall this generated cuda_runtime_api.d be self-contained? or I need to find the .h which defined cudaError_t, and include those files in the D/step build?

@mw66
Copy link
Author

mw66 commented Jun 7, 2022

btw, it's defined in another included file:

/usr/include/driver_types.h

typedef __device_builtin__ enum cudaError cudaError_t;

@mw66
Copy link
Author

mw66 commented Jun 7, 2022

Found work-around: let dstep work on the cpp preprocessed output .i file:

$ gcc -E /usr/include/cuda_runtime_api.h > cuda_runtime_api.i
$ dstep ./cuda_runtime_api.i -o cuda_runtime_api.d

Maybe you can add this tip to the README to help other users?

@jacob-carlborg
Copy link
Owner

Please include the input and the expected output.

@jacob-carlborg
Copy link
Owner

Shall this generated cuda_runtime_api.d be self-contained? or I need to find the .h which defined cudaError_t, and include those files in the D/step build?

Most generated D files will not be self contained if the header file is not. So yes, you need to find where the symbols are defined and generate D files for those as well and manually import the D files.

@jacob-carlborg
Copy link
Owner

At one point I would like to make DStep operate on a whole directory of header files. Then it can hopefully import the D files automatically.

@mw66
Copy link
Author

mw66 commented Jun 7, 2022

Please include the input and the expected output.

$ dpkg -S /usr/include/cuda_runtime_api.h
nvidia-cuda-dev:amd64: /usr/include/cuda_runtime_api.h

$ wc /usr/include/cuda_runtime_api.h
12077 67841 509599 /usr/include/cuda_runtime_api.h

$ dpkg -l nvidia-cuda-dev
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=====================-===============-============-=================================
ii nvidia-cuda-dev:amd64 11.2.2-1ubuntu1 amd64 NVIDIA CUDA development files

It needs lots of related headers to be compiled, so that's why in the end, I choose to run dstep on the cpp output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants