Skip to content

Commit 211fb2f

Browse files
pcaspersjenkins
authored andcommitted
QPR-12493 do not release context, it has global scope
1 parent 26baba9 commit 211fb2f

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

QuantExt/qle/math/openclenvironment.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ void OpenClFramework::init() {
326326
supportsDoublePrecision || std::string(deviceExtensions).find("cl_khr_fp64");
327327
#endif
328328

329-
// create context
329+
// create context, this is static and will be deleted at program end (no clReleaseContext() necessary ?)
330330

331331
cl_int err;
332332
context_[p][d] = clCreateContext(NULL, 1, &devices_[p][d], &errorCallback, NULL, &err);
@@ -350,14 +350,6 @@ OpenClFramework::~OpenClFramework() {
350350
for (auto& [_, c] : contexts_) {
351351
delete c;
352352
}
353-
cl_int err;
354-
for (cl_uint p = 0; p < nPlatforms_; ++p) {
355-
for (cl_uint d = 0; d < nDevices_[p]; ++d) {
356-
if (err = clReleaseContext(context_[p][d]); err != CL_SUCCESS) {
357-
std::cerr << "OpenClFramework: error during clReleaseContext: " + errorText(err) << std::endl;
358-
}
359-
}
360-
}
361353
}
362354

363355
OpenClContext::OpenClContext(cl_device_id* device, cl_context* context,

0 commit comments

Comments
 (0)