Skip to content

Custom Integrator HIP Compiler Error #20

@stephenwhitcomb

Description

@stephenwhitcomb

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions