You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

cuda.h 2.7 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /**
  2. * Copyright 2020 Huawei Technologies Co., Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef TESTS_UT_STUB_RUNTIME_INCLUDE_CUDA_H_
  17. #define TESTS_UT_STUB_RUNTIME_INCLUDE_CUDA_H_
  18. typedef enum cudaError_enum {
  19. CUDA_SUCCESS = 0,
  20. CUDA_ERROR_INVALID_IMAGE = 1,
  21. CUDA_ERROR_DEINITIALIZED = 2,
  22. } CUresult;
  23. typedef enum CUjit_option_enum {
  24. CU_JIT_MAX_REGISTERS = 0,
  25. CU_JIT_THREADS_PER_BLOCK,
  26. CU_JIT_WALL_TIME,
  27. CU_JIT_INFO_LOG_BUFFER,
  28. CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES,
  29. CU_JIT_ERROR_LOG_BUFFER,
  30. CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES,
  31. CU_JIT_OPTIMIZATION_LEVEL,
  32. CU_JIT_TARGET_FROM_CUCONTEXT,
  33. CU_JIT_TARGET,
  34. CU_JIT_FALLBACK_STRATEGY,
  35. CU_JIT_GENERATE_DEBUG_INFO,
  36. CU_JIT_LOG_VERBOSE,
  37. CU_JIT_GENERATE_LINE_INFO,
  38. CU_JIT_CACHE_MODE,
  39. CU_JIT_NEW_SM3X_OPT,
  40. CU_JIT_FAST_COMPILE,
  41. CU_JIT_GLOBAL_SYMBOL_NAMES,
  42. CU_JIT_GLOBAL_SYMBOL_ADDRESSES,
  43. CU_JIT_GLOBAL_SYMBOL_COUNT,
  44. CU_JIT_NUM_OPTIONS
  45. } CUjit_option;
  46. typedef enum CUdevice_attribute_enum {
  47. CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR,
  48. CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR,
  49. } CUdevice_attribute;
  50. struct CUctx_st {
  51. int arch;
  52. };
  53. struct CUmod_st {
  54. int arch;
  55. };
  56. struct CUfunc_st {
  57. int arch;
  58. };
  59. struct CUstream_st {
  60. int arch;
  61. };
  62. typedef struct CUctx_st *CUcontext;
  63. typedef struct CUmod_st *CUmodule;
  64. typedef struct CUfunc_st *CUfunction;
  65. typedef struct CUstream_st *CUstream;
  66. CUresult cuModuleLoadData(CUmodule *module, const void *image);
  67. CUresult cuModuleLoadDataEx(CUmodule *module, const void *image, unsigned int numOptions, CUjit_option *options,
  68. void **optionValues);
  69. CUresult cuModuleGetFunction(CUfunction *hfunc, CUmodule hmod, const char *name);
  70. CUresult cuLaunchKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ,
  71. unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ,
  72. unsigned int sharedMemBytes, CUstream hStream, void **kernelParams, void **extra);
  73. CUresult cuModuleUnload(CUmodule hmod);
  74. CUresult cuGetErrorName(CUresult error, const char **pStr);
  75. CUresult cuDeviceGetAttribute(int *pi, CUdevice_attribute attrib, int dev);
  76. #endif // TESTS_UT_STUB_RUNTIME_INCLUDE_CUDA_H_