OpenPose  1.0.0rc2
OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
cuda.hpp
Go to the documentation of this file.
1 #ifndef OPENPOSE_UTILITIES_CUDA_HPP
2 #define OPENPOSE_UTILITIES_CUDA_HPP
3 
4 #include <utility> // std::pair
5 #include <cuda.h>
6 #include <cuda_runtime.h>
8 
9 namespace op
10 {
11  const auto CUDA_NUM_THREADS = 512u;
12 
13  OP_API void cudaCheck(const int line = -1, const std::string& function = "", const std::string& file = "");
14 
15  OP_API int getGpuNumber();
16 
17  inline unsigned int getNumberCudaBlocks(const unsigned int totalRequired, const unsigned int numberCudaThreads = CUDA_NUM_THREADS)
18  {
19  return (totalRequired + numberCudaThreads - 1) / numberCudaThreads;
20  }
21 
22  OP_API dim3 getNumberCudaBlocks(const Point<int>& frameSize, const dim3 numberCudaThreads = dim3{ CUDA_NUM_THREADS, CUDA_NUM_THREADS, 1 });
23 
24  OP_API std::pair<dim3, dim3> getNumberCudaThreadsAndBlocks(const Point<int>& frameSize);
25 }
26 
27 #endif // OPENPOSE_UTILITIES_CUDA_HPP
unsigned int getNumberCudaBlocks(const unsigned int totalRequired, const unsigned int numberCudaThreads=CUDA_NUM_THREADS)
Definition: cuda.hpp:17
OP_API void cudaCheck(const int line=-1, const std::string &function="", const std::string &file="")
#define OP_API
Definition: macros.hpp:5
const auto CUDA_NUM_THREADS
Definition: cuda.hpp:11
OP_API int getGpuNumber()
OP_API std::pair< dim3, dim3 > getNumberCudaThreadsAndBlocks(const Point< int > &frameSize)