From 75c2f3f9e3bf4ae5c673089ddc05b59acabcf8bb Mon Sep 17 00:00:00 2001 From: Chris Maffeo <cmaffeo2@illinois.edu> Date: Mon, 20 Feb 2017 14:03:51 -0600 Subject: [PATCH] Added <cassert> includes --- src/ComputeForce.cuh | 4 ++-- src/Configuration.cpp | 4 ++-- src/RigidBodyType.cu | 4 ++-- src/TabulatedMethods.cuh | 10 +++++----- src/myAssert.cu | 8 -------- src/myAssert.h | 4 ---- 6 files changed, 11 insertions(+), 23 deletions(-) delete mode 100644 src/myAssert.cu delete mode 100644 src/myAssert.h diff --git a/src/ComputeForce.cuh b/src/ComputeForce.cuh index 71eb69a..3291dab 100644 --- a/src/ComputeForce.cuh +++ b/src/ComputeForce.cuh @@ -3,7 +3,7 @@ // Terrance Howard <heyterrance@gmail.com> #pragma once -#include "myAssert.h" +#include <cassert> #include "CudaUtil.cuh" #include "TabulatedMethods.cuh" @@ -286,7 +286,7 @@ void createPairlists(Vector3* __restrict__ pos, const int num, const int numRepl // Skip excludes // Implementation requires that aj increases monotonically - myAssert( ajLast < aj ); ajLast = aj; // TODO: remove this sanity check + assert( ajLast < aj ); ajLast = aj; // TODO: remove this sanity check while (nextEx >= 0 && nextEx < (aj - repID * num)) // TODO get rid of this nextEx = (currEx < ex_end - 1) ? excludes[++currEx].ind2 : -1; if (nextEx == (aj - repID * num)) { diff --git a/src/Configuration.cpp b/src/Configuration.cpp index 3ba6601..07b2796 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -1,5 +1,5 @@ #include "Configuration.h" -#include "myAssert.h" +#include <cassert> #define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); } @@ -1235,7 +1235,7 @@ void Configuration::readExcludes() for (int i = 0; i < numExcludes; i++) { if (excludes[i].ind1 != currPart) { currPart = excludes[i].ind1; - myAssert(currPart < num); + assert(currPart < num); excludeMap[currPart].x = i; if (lastPart >= 0) excludeMap[lastPart].y = i; diff --git a/src/RigidBodyType.cu b/src/RigidBodyType.cu index 5d4d3a4..107020d 100644 --- a/src/RigidBodyType.cu +++ b/src/RigidBodyType.cu @@ -1,4 +1,4 @@ -#include "myAssert.h" +#include <cassert> #include "Configuration.h" #include "RigidBodyType.h" #include "Reservoir.h" @@ -298,7 +298,7 @@ void RigidBodyType::initializeParticleLists() { if (gridNames[k] == gridName) { // Copy type j particles to particles[i] memcpy( &(particles[i][pid]), tmp, sizeof(int)*currId ); - myAssert(currId == conf->numPartsOfType[j]); + assert(currId == conf->numPartsOfType[j]); pid += conf->numPartsOfType[j]; } } diff --git a/src/TabulatedMethods.cuh b/src/TabulatedMethods.cuh index 564cee9..f3af187 100644 --- a/src/TabulatedMethods.cuh +++ b/src/TabulatedMethods.cuh @@ -44,8 +44,8 @@ __device__ inline void computeAngle(const TabulatedAnglePotential* __restrict__ // tableAngle[1] stores the potential at angle_step * 2, etc. // 'home' is the index after which 'convertedAngle' would appear if it were stored in the table int home = int(floor(angle)); - myAssert(home >= 0); - myAssert(home+1 < a->size); + assert(home >= 0); + assert(home+1 < a->size); // // Make angle the distance from [0,1) from the first index in the potential array index // angle -= home; @@ -112,8 +112,8 @@ __device__ inline void computeDihedral(const TabulatedDihedralPotential* __restr int home = (int) floorf(t); t = t - home; - myAssert(home >= 0); - myAssert(home < d->size); + assert(home >= 0); + assert(home < d->size); // home = home % size; int home1 = (home + 1) >= d->size ? (home+1-d->size) : home+1; @@ -127,7 +127,7 @@ __device__ inline void computeDihedral(const TabulatedDihedralPotential* __restr // avoid singularity when one angle is straight force = (crossABC.rLength() > 1.0f || crossBCD.rLength() > 1.0f) ? 0.0f : force; - myAssert( force < 10000.0f ); + assert( force < 10000.0f ); f1 *= force; f2 *= force; f3 *= force; diff --git a/src/myAssert.cu b/src/myAssert.cu deleted file mode 100644 index 99f57d2..0000000 --- a/src/myAssert.cu +++ /dev/null @@ -1,8 +0,0 @@ -#include "myAssert.h" - -#ifdef __APPLE__ -__host__ __device__ void myAssert(bool statement) { } -#else -#include <assert.h> -__host__ __device__ void myAssert(bool statement) { assert(statement); } -#endif \ No newline at end of file diff --git a/src/myAssert.h b/src/myAssert.h deleted file mode 100644 index a50c1ce..0000000 --- a/src/myAssert.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once -// #include <assert.h> - -__host__ __device__ void myAssert(bool statement); -- GitLab