OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NvidiaKernel.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 MapD Technologies, Inc.
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 
17 #ifndef QUERYENGINE_NVIDIAKERNELLAUNCH_H
18 #define QUERYENGINE_NVIDIAKERNELLAUNCH_H
19 
20 #include "../CudaMgr/CudaMgr.h"
21 
22 #ifdef HAVE_CUDA
23 #include <cuda.h>
24 #else
25 #include "../Shared/nocuda.h"
26 #endif // HAVE_CUDA
27 #include <string>
28 #include <vector>
29 
30 struct CubinResult {
31  void* cubin;
32  std::vector<CUjit_option> option_keys;
33  std::vector<void*> option_values;
35 };
36 
37 CubinResult ptx_to_cubin(const std::string& ptx,
38  const unsigned block_size,
39  const CudaMgr_Namespace::CudaMgr* cuda_mgr);
40 
42  public:
43  GpuCompilationContext(const void* image,
44  const std::string& kernel_name,
45  const int device_id,
46  const void* cuda_mgr,
47  unsigned int num_options,
48  CUjit_option* options,
49  void** option_vals);
51  CUfunction kernel() { return kernel_; }
52  CUmodule module() { return module_; }
53 
54  private:
57 #ifdef HAVE_CUDA
58  const int device_id_;
59  const CudaMgr_Namespace::CudaMgr* cuda_mgr_;
60 #endif // HAVE_CUDA
61 };
62 
63 #define checkCudaErrors(err) CHECK_EQ(err, CUDA_SUCCESS);
64 
65 #endif // QUERYENGINE_NVIDIAKERNELLAUNCH_H
int CUjit_option
Definition: nocuda.h:25
void * cubin
Definition: NvidiaKernel.h:31
std::vector< CUjit_option > option_keys
Definition: NvidiaKernel.h:32
void * CUfunction
Definition: nocuda.h:24
std::vector< void * > option_values
Definition: NvidiaKernel.h:33
int CUlinkState
Definition: nocuda.h:26
CUfunction kernel()
Definition: NvidiaKernel.h:51
GpuCompilationContext(const void *image, const std::string &kernel_name, const int device_id, const void *cuda_mgr, unsigned int num_options, CUjit_option *options, void **option_vals)
CUlinkState link_state
Definition: NvidiaKernel.h:34
CubinResult ptx_to_cubin(const std::string &ptx, const unsigned block_size, const CudaMgr_Namespace::CudaMgr *cuda_mgr)
void * CUmodule
Definition: nocuda.h:23