Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Integrator HIP Compiler Error #20

Open
swhitcomb1 opened this issue Jul 26, 2024 · 0 comments
Open

Custom Integrator HIP Compiler Error #20

swhitcomb1 opened this issue Jul 26, 2024 · 0 comments

Comments

@swhitcomb1
Copy link

swhitcomb1 commented Jul 26, 2024

When using HIP as a platform, I encountered the HIP compiler errors below while trying to create a simple leapfrog integrator with a gaussian noise term.

CustomIntegrator Function | vvvvvvvvvvvvvvvv
def myintegrator(temperature,friction,dt): integrator=mm.CustomIntegrator(dt); integrator.addGlobalVariable("a", exp(-friction*dt)); integrator.addGlobalVariable("b", sqrt((1-exp(-2*friction*dt))); integrator.addUpdateContextState(); integrator.addComputePerDof("v", "a*v + b*sqrt(1/m)*gaussian"); integrator.addComputePerDof("x", "x + 0.5 * dt*v"); return integrator

ERRORS | vvvvvvvvvvvvvvvv

File "/usr/local/lib/python3.10/dist-packages/openmm/app/simulation.py", line 147, in step
self._simulate(endStep=self.currentStep+steps)
File "/usr/local/lib/python3.10/dist-packages/openmm/app/simulation.py", line 212, in _simulate
self.integrator.step(10) # Only take 10 steps at a time, to give Python more chances to respond to a control-c.
File "/usr/local/lib/python3.10/dist-packages/openmm/openmm.py", line 9185, in step
return _openmm.CustomIntegrator_step(self, steps)
openmm.OpenMMException: Error launching HIP compiler: 256
/tmp/openmmTempKernel0x563223b219d0_94919.hip.cpp:681:18: error: no matching function for call to '__frcp_rn'
double3 temp12 = RECIP(mass);
^~~~~
/tmp/openmmTempKernel0x563223b219d0_94919.hip.cpp:23:15: note: expanded from macro 'RECIP'
#define RECIP __frcp_rn
^~~~~~~~~
/opt/rocm-5.5.0/llvm/lib/clang/16.0.0/include/__clang_hip_math.h:700:7: note: candidate function not viable: no known conversion from 'TempType3' (aka 'HIP_vector_type<double, 3>') to 'float' for 1st argument
float __frcp_rn(float __x) { return 1.0f / _x; }
^
/tmp/openmmTempKernel0x563223b219d0_94919.hip.cpp:681:9: error: no viable conversion from 'float' to 'double3' (aka 'HIP_vector_type<double, 3>')
double3 temp12 = RECIP(mass);
^ ~~~~~~~~~~~
/opt/rocm-5.5.0/include/hip/amd_detail/amd_hip_vector_types.h:470:9: note: candidate constructor not viable: no known conversion from 'float' to 'const HIP_vector_type<double, 3> &' for 1st argument
HIP_vector_type(const HIP_vector_type&) = default;
^
/opt/rocm-5.5.0/include/hip/amd_detail/amd_hip_vector_types.h:473:9: note: candidate constructor not viable: no known conversion from 'float' to 'HIP_vector_type<double, 3> &&' for 1st argument
HIP_vector_type(HIP_vector_type&&) = default;
^
/opt/rocm-5.5.0/include/hip/amd_detail/amd_hip_vector_types.h:465:9: note: candidate template ignored: requirement 'sizeof...(Us) == 3U' was not satisfied [with Us = ]
HIP_vector_type(Us... xs) noexcept
^
/opt/rocm-5.5.0/include/hip/amd_detail/amd_hip_vector_types.h:456:9: note: explicit constructor is not a candidate
HIP_vector_type(U x
) noexcept
^
/tmp/openmmTempKernel0x563223b219d0_94919.hip.cpp:692:8: warning: unused variable 'gaussian' [-Wunused-variable]
float4 gaussian = gaussianValues[gaussianIndex+index];
^
1 warning and 2 errors generated when compiling for gfx906.

This error went away when replacing the b*sqrt(1/m) expression with b/sqrt(m). Additionally, this error does not happen if the 1 in sqrt(1/m) is replaced by a global variable (possibly with an integer value) or when floats such as 0.99 or 1.01 are given. However, when passing floats that can easily be converted into an integer such as '1.0/m' or '1.2/1.2/m' in the place of '1/m', the above errors are obtained. This error is not reproducible using the OpenCL platform.

@swhitcomb1 swhitcomb1 changed the title Custom Leapfrog Integrator HIP Compiler Error Custom Integrator HIP Compiler Error Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant