MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / Context

Method Context

extensions/include/cuMat/src/Context.h:146–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144
145public:
146 Context(int device = 0)
147 : device_(device)
148 , stream_(nullptr)
149 {
150#if 0
151 //stream creation must be synchronized
152 //TODO: seems to work without
153 static std::mutex mutex;
154 std::lock_guard<std::mutex> lock(mutex);
155#endif
156
157#if CUMAT_SINGLE_THREAD_CONTEXT==0
158 //each context has its own stream
159 CUMAT_SAFE_CALL(cudaStreamCreateWithFlags(&stream_, cudaStreamNonBlocking));
160#endif
161 //for a global context, use the global stream
162
163 //TODO: init BLAS context and so on
164
165 CUMAT_LOG_DEBUG("Context initialized for thread 0x" << std::hex << std::this_thread::get_id() << ", stream: 0x" << stream_);
166 }
167
168 ~Context()
169 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected