"vscode:/vscode.git/clone" did not exist on "6f1885d8fabb5d70e362045f1380b81776e2aed4"
Unverified Commit 8e8923a7 authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Converted AMOEBA to common platform (#3120)

* Began converting AMOEBA to common platform

* Beginning of OpenCL platform for AMOEBA

* Converted AmoebaVdwForce to common platform

* Cleaned up reference AMOEBA tests

* Began converting AmoebaMultipoleForce to common platform

* Continue converting AmoebaMultipoleForce to common platform

* Bug fixes

* Bug fix

* Continue converting AmoebaMultipoleForce to common platform

* Converting AmoebaMultipoleForce and AmoebaGeneralizedKirkwoodForce to common platform

* Converting AmoebaMultipoleForce and AmoebaGeneralizedKirkwoodForce to common platform

* Creating OpenCL version of AmoebaMultipoleForce and AmoebaGeneralizedKirkwoodForce

* Creating OpenCL version of AmoebaMultipoleForce and AmoebaGeneralizedKirkwoodForce

* Creating OpenCL version of AmoebaMultipoleForce and AmoebaGeneralizedKirkwoodForce

* Converted arrays from real3 to real

* Bug fix to OpenCL AmoebaGeneralizedKirkwoodForce

* Fixes for AMD GPUs

* Began converting HippoNonbondedForce to common platform

* Continuing to convert HippoNonbondedForce to common platform

* Continuing to convert HippoNonbondedForce to common platform

* Working on unifying PME kernels

* Fixed error on devices without 64 bit atomics

* Unified PME kernels

* Converted HippoNonbondedForce to common platform

* Creating OpenCL implementation of HippoNonbondedForce

* Continuing OpenCL implementation of HippoNonbondedForce

* Mostly finished OpenCL implementation of HippoNonbondedForce

* Eliminated three component vector types in host code

* Fix errors on CPU OpenCL

* Skip double precision tests for AMOEBA on OpenCL

* Bug fixes

* Bug fixes

* Fixed compilation error
parent 393a4dbd
...@@ -32,7 +32,7 @@ real bn3 = (5*bn2+alsq2n*exp2a)*invR2; ...@@ -32,7 +32,7 @@ real bn3 = (5*bn2+alsq2n*exp2a)*invR2;
// Calculate the field at particle 1 due to multipoles at particle 2 // Calculate the field at particle 1 due to multipoles at particle 2
real fdamp3, fdamp5, fdamp7; real fdamp3, fdamp5, fdamp7;
computeDirectFieldDampingFactors(alpha2, r, fdamp3, fdamp5, fdamp7); computeDirectFieldDampingFactors(alpha2, r, &fdamp3, &fdamp5, &fdamp7);
#ifndef COMPUTING_EXCEPTIONS #ifndef COMPUTING_EXCEPTIONS
real scale = 1; real scale = 1;
#endif #endif
...@@ -58,7 +58,7 @@ tempField1 = -delta*factor2 - dipole2*rr3j + qDotDelta2*2*rr5j; ...@@ -58,7 +58,7 @@ tempField1 = -delta*factor2 - dipole2*rr3j + qDotDelta2*2*rr5j;
// Calculate the field at particle 2 due to multipoles at particle 1 // Calculate the field at particle 2 due to multipoles at particle 1
computeDirectFieldDampingFactors(alpha1, r, fdamp3, fdamp5, fdamp7); computeDirectFieldDampingFactors(alpha1, r, &fdamp3, &fdamp5, &fdamp7);
#ifdef USE_EWALD #ifdef USE_EWALD
real rr3i = bn1 - (1-scale*fdamp3)*invR3; real rr3i = bn1 - (1-scale*fdamp3)*invR3;
real rr5i = bn2 - (1-scale*fdamp5)*3*invR5; real rr5i = bn2 - (1-scale*fdamp5)*3*invR5;
......
real fdamp3, fdamp5; real fdamp3, fdamp5;
computeMutualFieldDampingFactors(alpha1, alpha2, r, fdamp3, fdamp5); computeMutualFieldDampingFactors(alpha1, alpha2, r, &fdamp3, &fdamp5);
#ifdef COMPUTING_EXCEPTIONS #ifdef COMPUTING_EXCEPTIONS
fdamp3 *= scale; fdamp3 *= scale;
fdamp5 *= scale; fdamp5 *= scale;
......
This diff is collapsed.
__device__ void buildQIRotationMatrix(real3 deltaR, real rInv, real (&rotationMatrix)[3][3]) { DEVICE void buildQIRotationMatrix(real3 deltaR, real rInv, real rotationMatrix[][3]) {
real3 vectorZ = deltaR*rInv; real3 vectorZ = deltaR*rInv;
real3 vectorX = vectorZ; real3 vectorX = vectorZ;
if (deltaR.y != 0 || deltaR.z != 0) if (deltaR.y != 0 || deltaR.z != 0)
...@@ -23,14 +23,13 @@ __device__ void buildQIRotationMatrix(real3 deltaR, real rInv, real (&rotationMa ...@@ -23,14 +23,13 @@ __device__ void buildQIRotationMatrix(real3 deltaR, real rInv, real (&rotationMa
rotationMatrix[2][2] = vectorY.y; rotationMatrix[2][2] = vectorY.y;
} }
__device__ real3 rotateDipole(real3& dipole, const real (&rotationMatrix)[3][3]) { DEVICE real3 rotateDipole(real3 dipole, const real rotationMatrix[][3]) {
return make_real3(rotationMatrix[0][0]*dipole.x + rotationMatrix[0][1]*dipole.y + rotationMatrix[0][2]*dipole.z, return make_real3(rotationMatrix[0][0]*dipole.x + rotationMatrix[0][1]*dipole.y + rotationMatrix[0][2]*dipole.z,
rotationMatrix[1][0]*dipole.x + rotationMatrix[1][1]*dipole.y + rotationMatrix[1][2]*dipole.z, rotationMatrix[1][0]*dipole.x + rotationMatrix[1][1]*dipole.y + rotationMatrix[1][2]*dipole.z,
rotationMatrix[2][0]*dipole.x + rotationMatrix[2][1]*dipole.y + rotationMatrix[2][2]*dipole.z); rotationMatrix[2][0]*dipole.x + rotationMatrix[2][1]*dipole.y + rotationMatrix[2][2]*dipole.z);
} }
DEVICE void rotateQuadrupoles(const real rotationMatrix[][3], const real* quad1, LOCAL_ARG const real* quad2, real* rotated1, real* rotated2) {
__device__ void rotateQuadupoles(const real (&rotationMatrix)[3][3], const real* quad1, const real* quad2, real* rotated1, real* rotated2) {
real sqrtThree = SQRT((real) 3); real sqrtThree = SQRT((real) 3);
real element; real element;
element = 0.5f*(3.0f*rotationMatrix[0][0]*rotationMatrix[0][0] - 1.0f); element = 0.5f*(3.0f*rotationMatrix[0][0]*rotationMatrix[0][0] - 1.0f);
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# The source is organized into subdirectories, but we handle them all from # The source is organized into subdirectories, but we handle them all from
# this CMakeLists file rather than letting CMake visit them as SUBDIRS. # this CMakeLists file rather than letting CMake visit them as SUBDIRS.
SET(OPENMM_SOURCE_SUBDIRS .) SET(OPENMM_SOURCE_SUBDIRS . ../common)
# Collect up information about the version of the OpenMM library we're building # Collect up information about the version of the OpenMM library we're building
...@@ -61,11 +61,17 @@ FOREACH(subdir ${OPENMM_SOURCE_SUBDIRS}) ...@@ -61,11 +61,17 @@ FOREACH(subdir ${OPENMM_SOURCE_SUBDIRS})
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/include) INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/include)
ENDFOREACH(subdir) ENDFOREACH(subdir)
SET(COMMON_KERNELS_CPP ${CMAKE_CURRENT_BINARY_DIR}/../common/src/CommonAmoebaKernelSources.cpp)
SET(SOURCE_FILES ${SOURCE_FILES} ${COMMON_KERNELS_CPP})
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/src) INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../common/src)
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/platforms/cuda/include) INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/platforms/cuda/include)
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/platforms/cuda/src) INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/platforms/cuda/src)
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_BINARY_DIR}/platforms/cuda/src) INCLUDE_DIRECTORIES(BEFORE ${CMAKE_BINARY_DIR}/platforms/cuda/src)
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/platforms/common/include) INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/platforms/common/include)
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_BINARY_DIR}/platforms/common/src)
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/../common/src)
# Set variables needed for encoding kernel sources into a C++ class # Set variables needed for encoding kernel sources into a C++ class
...@@ -80,6 +86,8 @@ INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/src) ...@@ -80,6 +86,8 @@ INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/src)
INCLUDE_DIRECTORIES(${CUDA_TOOLKIT_INCLUDE}) INCLUDE_DIRECTORIES(${CUDA_TOOLKIT_INCLUDE})
SET_SOURCE_FILES_PROPERTIES(${COMMON_KERNELS_CPP} PROPERTIES GENERATED TRUE)
FILE(GLOB CUDA_KERNELS ${KERNEL_SOURCE_DIR}/kernels/*.cu) FILE(GLOB CUDA_KERNELS ${KERNEL_SOURCE_DIR}/kernels/*.cu)
ADD_CUSTOM_COMMAND(OUTPUT ${KERNELS_CPP} ${KERNELS_H} ADD_CUSTOM_COMMAND(OUTPUT ${KERNELS_CPP} ${KERNELS_H}
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
...@@ -92,6 +100,7 @@ SET_SOURCE_FILES_PROPERTIES(${KERNELS_CPP} ${KERNELS_H} PROPERTIES GENERATED TRU ...@@ -92,6 +100,7 @@ SET_SOURCE_FILES_PROPERTIES(${KERNELS_CPP} ${KERNELS_H} PROPERTIES GENERATED TRU
IF (OPENMM_BUILD_SHARED_LIB) IF (OPENMM_BUILD_SHARED_LIB)
ADD_LIBRARY(${SHARED_TARGET} SHARED ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_ABS_INCLUDE_FILES}) ADD_LIBRARY(${SHARED_TARGET} SHARED ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_ABS_INCLUDE_FILES})
ADD_DEPENDENCIES(${SHARED_TARGET} AmoebaCommonKernels)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME} ${PTHREADS_LIB}) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME} ${PTHREADS_LIB})
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}CUDA) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}CUDA)
......
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