mxnet
rtc.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
26 #ifndef MXNET_COMMON_CUDA_RTC_H_
27 #define MXNET_COMMON_CUDA_RTC_H_
28 
29 #include "mxnet/base.h"
30 #include "mxnet/op_attr_types.h"
31 
32 #if MXNET_USE_CUDA
33 
34 #include <cuda.h>
35 #include <cuda_runtime_api.h>
36 
37 #include <mutex>
38 #include <string>
39 #include <vector>
40 
41 namespace mxnet {
42 namespace common {
43 namespace cuda {
44 namespace rtc {
45 
46 namespace util {
47 
51 std::string to_string(OpReqType req);
52 
53 } // namespace util
54 
56 
57 extern std::mutex lock;
58 
66 CUfunction get_function(const std::string& parameters,
67  const std::string& kernel_name,
68  const std::string& code,
69  int dev_id);
70 
79 void launch(CUfunction function,
80  const dim3 grid_dim,
81  const dim3 block_dim,
82  unsigned int shared_mem_bytes,
83  mshadow::Stream<gpu>* stream,
84  std::vector<const void*>* args);
85 
86 } // namespace rtc
87 } // namespace cuda
88 } // namespace common
89 } // namespace mxnet
90 
91 #endif // MXNET_USE_CUDA
92 
93 #endif // MXNET_COMMON_CUDA_RTC_H_
mxnet
namespace of mxnet
Definition: api_registry.h:33
mxnet::OpReqType
OpReqType
operation request type to Forward and Backward
Definition: op_attr_types.h:45
mxnet::common::cuda::rtc::util::to_string
std::string to_string(OpReqType req)
Convert OpReqType to string.
mxnet::common::cuda::rtc::GetMaxSupportedArch
int GetMaxSupportedArch()
mxnet::common::cuda::rtc::lock
std::mutex lock
mshadow::Stream< gpu >
Definition: stream_gpu-inl.h:37
mxnet::common::cuda::rtc::get_function
CUfunction get_function(const std::string &parameters, const std::string &kernel_name, const std::string &code, int dev_id)
Compile and get the GPU kernel. Uses cache in order to eliminate the overhead of compilation.
op_attr_types.h
Additional operator attributes beside the ones provided by NNVM.
mxnet::common::cuda::rtc::launch
void launch(CUfunction function, const dim3 grid_dim, const dim3 block_dim, unsigned int shared_mem_bytes, mshadow::Stream< gpu > *stream, std::vector< const void * > *args)
Launch a GPU kernel.
base.h
configuration of MXNet as well as basic data structure.