Commit 62cf5c93 authored by Mark Friedrichs's avatar Mark Friedrichs
Browse files

Update

parent 87542608
......@@ -131,4 +131,4 @@ INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/src)
# SET(FINDCUDA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cuda-cmake)
SUBDIRS (sharedTarget)
SUBDIRS (sharedTarget staticTarget)
......@@ -28,6 +28,7 @@
* -------------------------------------------------------------------------- */
#include "openmm/KernelFactory.h"
#include "windowsExportCuda.h"
namespace OpenMM {
......@@ -37,7 +38,7 @@ namespace OpenMM {
class CudaKernelFactory : public KernelFactory {
public:
KernelImpl* createKernelImpl(std::string name, const Platform& platform, ContextImpl& context) const;
OPENMMCUDA_EXPORT KernelImpl* createKernelImpl(std::string name, const Platform& platform, ContextImpl& context) const;
};
} // namespace OpenMM
......
......@@ -72,7 +72,7 @@ public:
class CudaPlatform::PlatformData {
public:
PlatformData(_gpuContext* gpu);
OPENMMCUDA_EXPORT PlatformData(_gpuContext* gpu);
_gpuContext* gpu;
bool removeCM;
bool hasBonds, hasAngles, hasPeriodicTorsions, hasRB, hasNonbonded, hasCustomNonbonded;
......
......@@ -3,6 +3,7 @@
#
# INCLUDE(${FINDCUDA_DIR}/FindCuda.cmake)
INCLUDE_DIRECTORIES(${CUDA_INCLUDE})
SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -Xcompiler -DOPENMMCUDA_BUILDING_SHARED_LIBRARY")
LINK_DIRECTORIES(${CUDA_TARGET_LINK})
FOREACH(subdir ${OPENMM_SOURCE_SUBDIRS})
FILE(GLOB src_files ${CMAKE_SOURCE_DIR}/platforms/cuda/${subdir}/src/*.cu ${CMAKE_SOURCE_DIR}/platforms/cuda/${subdir}/src/*/*.cu)
......
......@@ -31,7 +31,7 @@
using namespace OpenMM;
KernelImpl* CudaKernelFactory::createKernelImpl(std::string name, const Platform& platform, ContextImpl& context) const {
OPENMMCUDA_EXPORT KernelImpl* CudaKernelFactory::createKernelImpl(std::string name, const Platform& platform, ContextImpl& context) const {
CudaPlatform::PlatformData& data = *static_cast<CudaPlatform::PlatformData*>(context.getPlatformData());
if (name == CalcForcesAndEnergyKernel::Name())
return new CudaCalcForcesAndEnergyKernel(name, platform, data);
......
......@@ -767,8 +767,10 @@ void OPENMMCUDA_EXPORT OpenMM::cudaOpenMMInitializeIntegration(const System& sys
if (!data.hasNonbonded) {
gpuSetCoulombParameters(gpu, (float) ONE_4PI_EPS0, vector<int>(), vector<float>(), vector<float>(), vector<float>(), vector<char>(), vector<vector<int> >(), NO_CUTOFF);
gpuSetLJ14Parameters(gpu, (float) ONE_4PI_EPS0, 1.0f, vector<int>(), vector<int>(), vector<float>(), vector<float>(), vector<float>(), vector<float>());
/*
if (gpu->bIncludeGBSA || gpu->bIncludeGBVI)
throw OpenMMException("CudaPlatform requires GBSAOBCForce and GBVIForce to be used with a NonbondedForce");
*/
}
// Set masses.
......
......@@ -48,7 +48,7 @@ extern void kCalculateCustomTorsionForces(gpuContext gpu);
extern void kCalculateCustomExternalForces(gpuContext gpu);
extern void kCalculateCustomNonbondedForces(gpuContext gpu, bool neighborListValid);
extern void kReduceObcGbsaBornForces(gpuContext gpu);
extern void kCalculateObcGbsaForces2(gpuContext gpu);
extern void OPENMMCUDA_EXPORT kCalculateObcGbsaForces2(gpuContext gpu);
extern void kCalculateGBVIForces2(gpuContext gpu);
extern void kCalculateLocalForces(gpuContext gpu);
extern void kCalculateAndersenThermostat(gpuContext gpu);
......
......@@ -58,6 +58,7 @@ using namespace std;
// make sure that erf() and erfc() are defined.
#include "openmm/internal/MSVC_erfc.h"
#include "openmm/internal/windowsExport.h"
#include "windowsExportCuda.h"
using OpenMM::OpenMMException;
using Lepton::Operation;
......@@ -1788,7 +1789,7 @@ bool gpuIsAvailable()
}
extern "C"
void* gpuInit(int numAtoms, unsigned int device, bool useBlockingSync)
void* gpuInit(int numAtoms, unsigned int device, bool useBlockingSync)
{
gpuContext gpu = new _gpuContext;
int LRFSize = 0;
......
......@@ -272,7 +272,7 @@ extern "C"
void OPENMMCUDA_EXPORT gpuInitializeRandoms(gpuContext gpu);
extern "C"
void* gpuInit(int numAtoms, unsigned int device = 0, bool useBlockingSync = false);
OPENMMCUDA_EXPORT void* gpuInit(int numAtoms, unsigned int device = 0, bool useBlockingSync = false);
extern "C"
void gpuSetLangevinIntegrationParameters(gpuContext gpu, float tau, float deltaT, float temperature, float errorTol);
......
......@@ -133,7 +133,7 @@ void kReduceObcGbsaBornSum_kernel()
}
}
void kReduceObcGbsaBornSum(gpuContext gpu)
void OPENMMCUDA_EXPORT kReduceObcGbsaBornSum(gpuContext gpu)
{
// printf("kReduceObcGbsaBornSum\n");
kReduceObcGbsaBornSum_kernel<<<gpu->sim.blocks, 384>>>();
......@@ -141,7 +141,7 @@ void kReduceObcGbsaBornSum(gpuContext gpu)
LAUNCHERROR("kReduceObcGbsaBornSum");
}
void kCalculateObcGbsaBornSum(gpuContext gpu)
void OPENMMCUDA_EXPORT kCalculateObcGbsaBornSum(gpuContext gpu)
{
// printf("kCalculateObcgbsaBornSum\n");
switch (gpu->sim.nonbondedMethod)
......
......@@ -99,7 +99,7 @@ void GetCalculateObcGbsaForces2Sim(gpuContext gpu)
#define METHOD_NAME(a, b) a##PeriodicByWarp##b
#include "kCalculateObcGbsaForces2.h"
void kCalculateObcGbsaForces2(gpuContext gpu)
void OPENMMCUDA_EXPORT kCalculateObcGbsaForces2(gpuContext gpu)
{
//printf("kCalculateObcGbsaForces2\n");
switch (gpu->sim.nonbondedMethod)
......
......@@ -39,7 +39,7 @@ using namespace std;
static __constant__ cudaGmxSimulation cSim;
void SetForcesSim(gpuContext gpu)
void OPENMMCUDA_EXPORT SetForcesSim(gpuContext gpu)
{
cudaError_t status;
status = cudaMemcpyToSymbol(cSim, &gpu->sim, sizeof(cudaGmxSimulation));
......@@ -65,7 +65,7 @@ void kClearForces_kernel()
}
}
void kClearForces(gpuContext gpu)
void OPENMMCUDA_EXPORT kClearForces(gpuContext gpu)
{
// printf("kClearForces\n");
kClearForces_kernel<<<gpu->sim.blocks, 384>>>();
......@@ -279,7 +279,7 @@ void kReduceForces_kernel()
}
}
void kReduceForces(gpuContext gpu)
void OPENMMCUDA_EXPORT kReduceForces(gpuContext gpu)
{
// printf("kReduceForces\n");
kReduceForces_kernel<<<gpu->sim.blocks, gpu->sim.bsf_reduce_threads_per_block>>>();
......
#
# Include CUDA related files.
#
SET(CUDA_NVCC_BUILD_FLAGS "-DCUDPP_STATIC_LIB" )
INCLUDE(${FINDCUDA_DIR}/FindCuda.cmake)
#INCLUDE(${FINDCUDA_DIR}/FindCuda.cmake)
INCLUDE_DIRECTORIES(${CUDA_INCLUDE})
LINK_DIRECTORIES(${CUDA_TARGET_LINK})
FOREACH(subdir ${OPENMM_SOURCE_SUBDIRS})
......@@ -21,10 +20,10 @@ CUDA_ADD_LIBRARY(${STATIC_TARGET} STATIC ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES}
# required for getting OPENMM_EXPORT to be set correctly in 'class OPENMM_EXPORT CudaStreamFactory', ...
# see OpenMM/openmmapi/include/internal/windowsExport.h for details
SET(CUDA_STATIC_COMPILE_FLAG "-DOPENMMCUDA_BUILDING_STATIC_LIBRARY -DOPENMMCUDA_USE_STATIC_LIBRARIES -DCUDPP_STATIC_LIB")
SET(CUDA_STATIC_COMPILE_FLAG "-DOPENMMCUDA_BUILDING_STATIC_LIBRARY -DOPENMMCUDA_USE_STATIC_LIBRARIES")
SET_TARGET_PROPERTIES(${STATIC_TARGET} PROPERTIES COMPILE_FLAGS ${CUDA_STATIC_COMPILE_FLAG})
TARGET_LINK_LIBRARIES(${STATIC_TARGET} optimized ${OPENMM_LIBRARY_NAME}_static)
TARGET_LINK_LIBRARIES(${STATIC_TARGET} debug ${OPENMM_LIBRARY_NAME}_static_d optimized ${OPENMM_LIBRARY_NAME}_static ${CUFFT_TARGET_LINK})
INSTALL_TARGETS(/lib/plugins RUNTIME_DIRECTORY /lib/plugins ${STATIC_TARGET})
#INSTALL_TARGETS(/lib/plugins RUNTIME_DIRECTORY /lib/plugins ${STATIC_TARGET})
......@@ -23,20 +23,20 @@
*/
#ifndef __RealSimTk_H_
#define __RealSimTk_H__
#ifndef __RealOpenMMOpenMMSimTk_H_
#define __RealOpenMMOpenMMSimTk_H__
#include <math.h>
// Set RealOpenMMType to 2 for double precision, 1 for float
// Set RealOpenMMOpenMMOpenMMType to 2 for double precision, 1 for float
#ifndef RealOpenMMType
#define RealOpenMMType 2
#ifndef RealOpenMMOpenMMOpenMMType
#define RealOpenMMOpenMMOpenMMType 2
#endif
#if RealOpenMMType == 1
#if RealOpenMMOpenMMOpenMMType == 1
#define RealOpenMM float
#define RealOpenMMOpenMMOpenMM float
#define SQRT sqrtf
#define POW powf
#define SIN sinf
......@@ -67,6 +67,7 @@
#else
#define RealOpenMM double
#define Real double
#define SQRT sqrt
#define POW pow
#define SIN sin
......@@ -143,4 +144,4 @@
#define ENM2DEBYE 48.0321 /* Convert electron nm to debye */
#define DEBYE2ENM 0.02081941
#endif // __RealSimTk_H__
#endif // __RealOpenMMOpenMMSimTk_H__
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