Error when including device_functions.hpp in the code

I am getting the following error in the function that I wrote that replays CUDA API calls based on logs. It uses a switch statement to determine which CUDA API function to call by reading the Cuda_Fncs_t enum from the log.
These are the header files included:

#include <cuda_runtime_api.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <driver_types.h>
#include <cusparse_v2.h>
#include <cublas.h>
#include <assert.h>
#include <stdio.h>

#include "getmmap.h"
#include "common.h"

#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
#define __CUDA_INTERNAL_COMPILATION__
// #define __CUDACC__
#endif
#include "crt/host_runtime.h"
#include "crt/device_functions.h"
#include "log_and_replay.h"

This is the error:

In file included from **/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.h:3612**,

from **lh/replay_cuda_calls.cpp:43**:

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:102:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

102 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** int __vimax_s32_relu(const int a, const int b){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:115:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

115 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __vimax_s16x2_relu(const unsigned int a, const unsigned int b){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:155:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

155 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** int __vimin_s32_relu(const int a, const int b){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:168:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

168 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __vimin_s16x2_relu(const unsigned int a, const unsigned int b){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:208:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

208 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** int __vimax3_s32(const int a, const int b, const int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:222:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

222 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __vimax3_s16x2(const unsigned int a, const unsigned int b, const unsigned int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:268:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

268 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __vimax3_u32(const unsigned int a, const unsigned int b, const unsigned int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:282:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

282 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __vimax3_u16x2(const unsigned int a, const unsigned int b, const unsigned int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:313:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

313 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** int __vimin3_s32(const int a, const int b, const int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:327:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

327 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __vimin3_s16x2(const unsigned int a, const unsigned int b, const unsigned int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:372:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

372 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __vimin3_u32(const unsigned int a, const unsigned int b, const unsigned int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:386:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

386 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __vimin3_u16x2(const unsigned int a, const unsigned int b, const unsigned int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:417:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

417 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** int __vimax3_s32_relu(const int a, const int b, const int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:433:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

433 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __vimax3_s16x2_relu(const unsigned int a, const unsigned int b, const unsigned int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:482:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

482 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** int __vimin3_s32_relu(const int a, const int b, const int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:498:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

498 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __vimin3_s16x2_relu(const unsigned int a, const unsigned int b, const unsigned int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:547:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

547 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** int __viaddmax_s32(const int a, const int b, const int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:561:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

561 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __viaddmax_s16x2(const unsigned int a, const unsigned int b, const unsigned int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:606:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

606 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __viaddmax_u32(const unsigned int a, const unsigned int b, const unsigned int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:620:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

620 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __viaddmax_u16x2(const unsigned int a, const unsigned int b, const unsigned int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:651:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

651 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** int __viaddmin_s32(const int a, const int b, const int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:665:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

665 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __viaddmin_s16x2(const unsigned int a, const unsigned int b, const unsigned int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:710:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

710 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __viaddmin_u32(const unsigned int a, const unsigned int b, const unsigned int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:724:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

724 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __viaddmin_u16x2(const unsigned int a, const unsigned int b, const unsigned int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:755:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

755 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** int __viaddmax_s32_relu(const int a, const int b, const int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:771:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

771 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __viaddmax_s16x2_relu(const unsigned int a, const unsigned int b, const unsigned int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:819:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

819 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** int __viaddmin_s32_relu(const int a, const int b, const int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:835:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

835 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __viaddmin_s16x2_relu(const unsigned int a, const unsigned int b, const unsigned int c){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:885:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

885 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** int __vibmax_s32(const int a, const int b, bool* const pred){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:906:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

906 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __vibmax_u32(const unsigned int a, const unsigned int b, bool* const pred){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:928:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

928 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** int __vibmin_s32(const int a, const int b, bool* const pred){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:950:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

950 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __vibmin_u32(const unsigned int a, const unsigned int b, bool* const pred){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:971:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

971 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __vibmax_s16x2(const unsigned int a, const unsigned int b, bool* const pred_hi, bool* const pred_lo){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:1024:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

1024 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __vibmax_u16x2(const unsigned int a, const unsigned int b, bool* const pred_hi, bool* const pred_lo){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:1066:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

1066 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __vibmin_s16x2(const unsigned int a, const unsigned int b, bool* const pred_hi, bool* const pred_lo){

| **^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/include/crt/device_functions.hpp:1119:1:** **error:** ‘**__DEVICE_HOST_FUNCTIONS_STATIC_DECL__**’ does not name a type

1119 | **__DEVICE_HOST_FUNCTIONS_STATIC_DECL__** unsigned int __vibmin_u16x2(const unsigned int a, const unsigned int b, bool* const pred_hi, bool* const pred_lo){

This file (device_functions.hpp) generally does not need to be included in any file compiled by nvcc, and should not be included in other situations. If you are writing a log parser that replays CUDA API calls, that sounds like mostly host code, and so device functions should not be needed anyway.

This sort of construct is not there for general use:

#if !defined(**CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS** )
#define::tag **CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS**
#define::tag **CUDA_INTERNAL_COMPILATION**

You should not be doing that. Trying to push the buttons of the internal compilation process yourself is resulting in an undefined tag. I won’t be able to assist further; don’t do that is my suggestion.

Can you please restore your question for other people with the same problem?