"wrappers/vscode:/vscode.git/clone" did not exist on "076f8d7b71e8ed6c47a67aed3aab9cdf2bd6edf0"
Commit 537221a0 authored by Peter Eastman's avatar Peter Eastman
Browse files

Fixed a problem under Nvidia's OpenCL implementation

parent 1acb7fa9
......@@ -39,6 +39,7 @@ using namespace OpenMM;
using namespace std;
OpenCLContext::OpenCLContext(int numParticles, int deviceIndex) : time(0.0), stepCount(0) {
try {
context = cl::Context(CL_DEVICE_TYPE_ALL);
vector<cl::Device> devices = context.getInfo<CL_CONTEXT_DEVICES>();
const int minThreadBlockSize = 32;
......@@ -59,7 +60,8 @@ OpenCLContext::OpenCLContext(int numParticles, int deviceIndex) : time(0.0), ste
if (device.getInfo<CL_DEVICE_MAX_WORK_ITEM_SIZES>()[0] < minThreadBlockSize)
throw OpenMMException("The specified OpenCL device is not compatible with OpenMM");
compilationOptions = "-cl-fast-relaxed-math";
if (device.getInfo<CL_DEVICE_VENDOR>() == "NVIDIA")
string vendor = device.getInfo<CL_DEVICE_VENDOR>();
if (vendor.size() >= 6 && vendor.substr(0, 6) == "NVIDIA")
compilationOptions += " -DWARPS_ARE_ATOMIC";
queue = cl::CommandQueue(context, device);
numAtoms = numParticles;
......@@ -69,6 +71,12 @@ OpenCLContext::OpenCLContext(int numParticles, int deviceIndex) : time(0.0), ste
nonbonded = new OpenCLNonbondedUtilities(*this);
posq = new OpenCLArray<mm_float4>(*this, paddedNumAtoms, "posq", true);
velm = new OpenCLArray<mm_float4>(*this, paddedNumAtoms, "velm", true);
}
catch (cl::Error err) {
std::stringstream str;
str<<"Error initializing context: "<<err.what()<<" ("<<err.err()<<")";
throw OpenMMException(str.str());
}
// Create utility kernels that are used in multiple places.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment