Skip to content

more examples? #26

@lukeczapla

Description

@lukeczapla

Hey, I had some fun with the archive but the kernel is just this:

real3 delta = make_real3(pos2.x-pos1.x, pos2.y-pos1.y, pos2.z-pos1.z);
real r = SQRT(delta.x*delta.x + delta.y*delta.y + delta.z*delta.z);
float2 bondParams = PARAMS[index];
real deltaIdeal = r-bondParams.x;
real deltaIdeal2 = deltaIdeal*deltaIdeal;
energy += bondParams.y*deltaIdeal2*deltaIdeal2;
real dEdR = 4*bondParams.y*deltaIdeal2*deltaIdeal;
dEdR = (r > 0) ? (dEdR/r) : 0;
delta *= dEdR;
real3 force1 = delta;
real3 force2 = -delta;

So a lot of the rest is a sort of boilerplate you need, I like that you used the ternary ? : (fun in JavaScript too with React), and I suppose I could understand how since you probably also have some definition defining "real double" (or float depending on precision mode) somewhere in the main source that you might paste this inside a CUDA or OpenCL kernel for compilation. But no .cl file here to work with at all.

But it basically does close to nothing 😺 are there some more examples floating around anywhere or should I go back to the main source openmm/openmm and just dig further into the full source code? I am trying to look for some more sophisticated examples where, for example, we are declaring some memory on the GPU in OpenCL. I have this issue where I'm trying to make a faster solution than just a loop that does 1 simulation step and then saves some global variables and I have very little to go on here.

I do like, however, that you can skip the Lepton. I was trying to implement a Lowe-Andersen thermostat and realized that the limitations of the Lepton sort of makes it close to impossible to just make a "simple" solution in it. I need atoms within certain distances and could piggyback off of existing code there.

So an example where say the kernels are more detailed and work with memory and/or existing cutoff implementations might be more helpful for me to see what the options are for the two use cases (saving global variables regularly and Lowe-Andersen). This is nice as a start though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions