Commit a7ce5784 authored by peastman's avatar peastman
Browse files

Fixed errors in CustomManyParticleForce

parent 90ddfc31
...@@ -17,6 +17,7 @@ env: ...@@ -17,6 +17,7 @@ env:
matrix: matrix:
include: include:
- sudo: required - sudo: required
dist: trusty
env: ==CPU_OPENCL== env: ==CPU_OPENCL==
OPENCL=true OPENCL=true
CUDA=false CUDA=false
...@@ -33,7 +34,9 @@ matrix: ...@@ -33,7 +34,9 @@ matrix:
-DOPENMM_BUILD_AMOEBA_PLUGIN=OFF -DOPENMM_BUILD_AMOEBA_PLUGIN=OFF
-DOPENMM_BUILD_PYTHON_WRAPPERS=OFF -DOPENMM_BUILD_PYTHON_WRAPPERS=OFF
-DOPENMM_BUILD_C_AND_FORTRAN_WRAPPERS=OFF -DOPENMM_BUILD_C_AND_FORTRAN_WRAPPERS=OFF
-DOPENMM_BUILD_EXAMPLES=OFF" -DOPENMM_BUILD_EXAMPLES=OFF
-DOPENCL_INCLUDE_DIR=$HOME/AMDAPPSDK/include
-DOPENCL_LIBRARY=$HOME/AMDAPPSDK/lib/x86_64/libOpenCL.so"
addons: {apt: {packages: []}} addons: {apt: {packages: []}}
- sudo: required - sudo: required
...@@ -107,9 +110,16 @@ before_install: ...@@ -107,9 +110,16 @@ before_install:
sudo easy_install pytest; sudo easy_install pytest;
fi fi
- if [[ "$OPENCL" == "true" ]]; then - if [[ "$OPENCL" == "true" ]]; then
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"; wget https://jenkins.choderalab.org/userContent/AMD-APP-SDKInstaller-v3.0.130.135-GA-linux64.tar.bz2;
sudo apt-get -yq update > /dev/null 2>&1 ; tar -xjf AMD-APP-SDK*.tar.bz2;
sudo apt-get install -qq fglrx=2:8.960-0ubuntu1 opencl-headers; AMDAPPSDK=${HOME}/AMDAPPSDK;
export OPENCL_VENDOR_PATH=${AMDAPPSDK}/etc/OpenCL/vendors;
mkdir -p ${OPENCL_VENDOR_PATH};
sh AMD-APP-SDK*.sh --tar -xf -C ${AMDAPPSDK};
echo libamdocl64.so > ${OPENCL_VENDOR_PATH}/amdocl64.icd;
export LD_LIBRARY_PATH=${AMDAPPSDK}/lib/x86_64:${LD_LIBRARY_PATH};
chmod +x ${AMDAPPSDK}/bin/x86_64/clinfo;
${AMDAPPSDK}/bin/x86_64/clinfo;
fi fi
# Install swig for Python wrappers. However, testing CUDA and OpenCL, we # Install swig for Python wrappers. However, testing CUDA and OpenCL, we
# skip the Python wrapper for speed. We're not using anaconda python, # skip the Python wrapper for speed. We're not using anaconda python,
......
...@@ -59,7 +59,7 @@ inline __device__ real4 computeCross(real4 vec1, real4 vec2) { ...@@ -59,7 +59,7 @@ inline __device__ real4 computeCross(real4 vec1, real4 vec2) {
/** /**
* Determine whether a particular interaction is in the list of exclusions. * Determine whether a particular interaction is in the list of exclusions.
*/ */
inline __device__ bool isInteractionExcluded(int atom1, int atom2, int* __restrict__ exclusions, int* __restrict__ exclusionStartIndex) { inline __device__ bool isInteractionExcluded(int atom1, int atom2, const int* __restrict__ exclusions, const int* __restrict__ exclusionStartIndex) {
int first = exclusionStartIndex[atom1]; int first = exclusionStartIndex[atom1];
int last = exclusionStartIndex[atom1+1]; int last = exclusionStartIndex[atom1+1];
for (int i = last-1; i >= first; i--) { for (int i = last-1; i >= first; i--) {
...@@ -180,7 +180,7 @@ extern "C" __global__ void findNeighbors(real4 periodicBoxSize, real4 invPeriodi ...@@ -180,7 +180,7 @@ extern "C" __global__ void findNeighbors(real4 periodicBoxSize, real4 invPeriodi
const real4* __restrict__ posq, const real4* __restrict__ blockCenter, const real4* __restrict__ blockBoundingBox, int2* __restrict__ neighborPairs, const real4* __restrict__ posq, const real4* __restrict__ blockCenter, const real4* __restrict__ blockBoundingBox, int2* __restrict__ neighborPairs,
int* __restrict__ numNeighborPairs, int* __restrict__ numNeighborsForAtom, int maxNeighborPairs int* __restrict__ numNeighborPairs, int* __restrict__ numNeighborsForAtom, int maxNeighborPairs
#ifdef USE_EXCLUSIONS #ifdef USE_EXCLUSIONS
, int* __restrict__ exclusions, int* __restrict__ exclusionStartIndex , const int* __restrict__ exclusions, const int* __restrict__ exclusionStartIndex
#endif #endif
) { ) {
__shared__ real3 positionCache[FIND_NEIGHBORS_WORKGROUP_SIZE]; __shared__ real3 positionCache[FIND_NEIGHBORS_WORKGROUP_SIZE];
...@@ -265,6 +265,7 @@ extern "C" __global__ void findNeighbors(real4 periodicBoxSize, real4 invPeriodi ...@@ -265,6 +265,7 @@ extern "C" __global__ void findNeighbors(real4 periodicBoxSize, real4 invPeriodi
} }
} }
} }
if (atom1 < NUM_ATOMS)
numNeighborsForAtom[atom1] = totalNeighborsForAtom1; numNeighborsForAtom[atom1] = totalNeighborsForAtom1;
} }
} }
...@@ -308,6 +309,7 @@ extern "C" __global__ void computeNeighborStartIndices(int* __restrict__ numNeig ...@@ -308,6 +309,7 @@ extern "C" __global__ void computeNeighborStartIndices(int* __restrict__ numNeig
numNeighborsForAtom[globalIndex] = 0; // Clear this so the next kernel can use it as a counter numNeighborsForAtom[globalIndex] = 0; // Clear this so the next kernel can use it as a counter
} }
globalOffset += posBuffer[blockDim.x-1]; globalOffset += posBuffer[blockDim.x-1];
__syncthreads();
} }
if (threadIdx.x == 0) if (threadIdx.x == 0)
neighborStartIndex[0] = 0; neighborStartIndex[0] = 0;
......
...@@ -55,7 +55,7 @@ inline real4 computeCross(real4 vec1, real4 vec2) { ...@@ -55,7 +55,7 @@ inline real4 computeCross(real4 vec1, real4 vec2) {
/** /**
* Determine whether a particular interaction is in the list of exclusions. * Determine whether a particular interaction is in the list of exclusions.
*/ */
inline bool isInteractionExcluded(int atom1, int atom2, __global int* restrict exclusions, __global int* restrict exclusionStartIndex) { inline bool isInteractionExcluded(int atom1, int atom2, __global const int* restrict exclusions, __global const int* restrict exclusionStartIndex) {
int first = exclusionStartIndex[atom1]; int first = exclusionStartIndex[atom1];
int last = exclusionStartIndex[atom1+1]; int last = exclusionStartIndex[atom1+1];
for (int i = last-1; i >= first; i--) { for (int i = last-1; i >= first; i--) {
...@@ -174,7 +174,7 @@ __kernel void findNeighbors(real4 periodicBoxSize, real4 invPeriodicBoxSize, rea ...@@ -174,7 +174,7 @@ __kernel void findNeighbors(real4 periodicBoxSize, real4 invPeriodicBoxSize, rea
__global const real4* restrict posq, __global const real4* restrict blockCenter, __global const real4* restrict blockBoundingBox, __global int2* restrict neighborPairs, __global const real4* restrict posq, __global const real4* restrict blockCenter, __global const real4* restrict blockBoundingBox, __global int2* restrict neighborPairs,
__global int* restrict numNeighborPairs, __global int* restrict numNeighborsForAtom, int maxNeighborPairs __global int* restrict numNeighborPairs, __global int* restrict numNeighborsForAtom, int maxNeighborPairs
#ifdef USE_EXCLUSIONS #ifdef USE_EXCLUSIONS
, __global int* restrict exclusions, __global int* restrict exclusionStartIndex , __global const int* restrict exclusions, __global const int* restrict exclusionStartIndex
#endif #endif
) { ) {
__local real4 positionCache[FIND_NEIGHBORS_WORKGROUP_SIZE]; __local real4 positionCache[FIND_NEIGHBORS_WORKGROUP_SIZE];
...@@ -264,7 +264,9 @@ __kernel void findNeighbors(real4 periodicBoxSize, real4 invPeriodicBoxSize, rea ...@@ -264,7 +264,9 @@ __kernel void findNeighbors(real4 periodicBoxSize, real4 invPeriodicBoxSize, rea
} }
} }
} }
if (atom1 < NUM_ATOMS)
numNeighborsForAtom[atom1] = totalNeighborsForAtom1; numNeighborsForAtom[atom1] = totalNeighborsForAtom1;
SYNC_WARPS;
} }
} }
...@@ -307,6 +309,7 @@ __kernel void computeNeighborStartIndices(__global int* restrict numNeighborsFor ...@@ -307,6 +309,7 @@ __kernel void computeNeighborStartIndices(__global int* restrict numNeighborsFor
numNeighborsForAtom[globalIndex] = 0; // Clear this so the next kernel can use it as a counter numNeighborsForAtom[globalIndex] = 0; // Clear this so the next kernel can use it as a counter
} }
globalOffset += posBuffer[get_local_size(0)-1]; globalOffset += posBuffer[get_local_size(0)-1];
barrier(CLK_LOCAL_MEM_FENCE);
} }
if (get_local_id(0) == 0) if (get_local_id(0) == 0)
neighborStartIndex[0] = 0; neighborStartIndex[0] = 0;
......
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