CUDAMacros.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #ifndef C10_USING_CUSTOM_GENERATED_MACROS
  3. // We have not yet modified the AMD HIP build to generate this file so
  4. // we add an extra option to specifically ignore it.
  5. #ifndef C10_CUDA_NO_CMAKE_CONFIGURE_FILE
  6. #include <c10/cuda/impl/cuda_cmake_macros.h>
  7. #endif // C10_CUDA_NO_CMAKE_CONFIGURE_FILE
  8. #endif
  9. // See c10/macros/Export.h for a detailed explanation of what the function
  10. // of these macros are. We need one set of macros for every separate library
  11. // we build.
  12. #ifdef _WIN32
  13. #if defined(C10_CUDA_BUILD_SHARED_LIBS)
  14. #define C10_CUDA_EXPORT __declspec(dllexport)
  15. #define C10_CUDA_IMPORT __declspec(dllimport)
  16. #else
  17. #define C10_CUDA_EXPORT
  18. #define C10_CUDA_IMPORT
  19. #endif
  20. #else // _WIN32
  21. #if defined(__GNUC__)
  22. #define C10_CUDA_EXPORT __attribute__((__visibility__("default")))
  23. #else // defined(__GNUC__)
  24. #define C10_CUDA_EXPORT
  25. #endif // defined(__GNUC__)
  26. #define C10_CUDA_IMPORT C10_CUDA_EXPORT
  27. #endif // _WIN32
  28. // This one is being used by libc10_cuda.so
  29. #ifdef C10_CUDA_BUILD_MAIN_LIB
  30. #define C10_CUDA_API C10_CUDA_EXPORT
  31. #else
  32. #define C10_CUDA_API C10_CUDA_IMPORT
  33. #endif
  34. /**
  35. * The maximum number of GPUs that we recognizes. Increasing this beyond the
  36. * initial limit of 16 broke Caffe2 testing, hence the ifdef guards.
  37. * This value cannot be more than 128 because our DeviceIndex is a uint8_t.
  38. o */
  39. #ifdef FBCODE_CAFFE2
  40. // fbcode depends on this value being 16
  41. #define C10_COMPILE_TIME_MAX_GPUS 16
  42. #else
  43. #define C10_COMPILE_TIME_MAX_GPUS 120
  44. #endif