Unverified Commit 68c97c5b authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Replace pthreads with C++ threads (#4833)

* Replace pthreads with C++ threads

* Try to fix CI errors

* Try including -pthread linker option
parent 55b3c86d
...@@ -85,7 +85,7 @@ IF (OPENMM_BUILD_SHARED_LIB) ...@@ -85,7 +85,7 @@ 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) ADD_DEPENDENCIES(${SHARED_TARGET} AmoebaCommonKernels)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME} ${PTHREADS_LIB}) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME})
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}OpenCL) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}OpenCL)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_AMOEBA_TARGET}) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_AMOEBA_TARGET})
SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY") SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY")
...@@ -98,7 +98,7 @@ ENDIF (OPENMM_BUILD_SHARED_LIB) ...@@ -98,7 +98,7 @@ ENDIF (OPENMM_BUILD_SHARED_LIB)
IF(OPENMM_BUILD_STATIC_LIB) IF(OPENMM_BUILD_STATIC_LIB)
ADD_LIBRARY(${STATIC_TARGET} STATIC ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_ABS_INCLUDE_FILES}) ADD_LIBRARY(${STATIC_TARGET} STATIC ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_ABS_INCLUDE_FILES})
TARGET_LINK_LIBRARIES(${STATIC_TARGET} ${OPENMM_LIBRARY_NAME} ${PTHREADS_LIB}) TARGET_LINK_LIBRARIES(${STATIC_TARGET} ${OPENMM_LIBRARY_NAME})
TARGET_LINK_LIBRARIES(${STATIC_TARGET} ${OPENMM_LIBRARY_NAME}OpenCL) TARGET_LINK_LIBRARIES(${STATIC_TARGET} ${OPENMM_LIBRARY_NAME}OpenCL)
TARGET_LINK_LIBRARIES(${STATIC_TARGET} ${STATIC_AMOEBA_TARGET}) TARGET_LINK_LIBRARIES(${STATIC_TARGET} ${STATIC_AMOEBA_TARGET})
SET_TARGET_PROPERTIES(${STATIC_TARGET} PROPERTIES COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_STATIC_LIBRARY") SET_TARGET_PROPERTIES(${STATIC_TARGET} PROPERTIES COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_STATIC_LIBRARY")
......
...@@ -71,7 +71,7 @@ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/libraries/include/pocketfft") ...@@ -71,7 +71,7 @@ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/libraries/include/pocketfft")
IF (OPENMM_BUILD_SHARED_LIB) IF (OPENMM_BUILD_SHARED_LIB)
ADD_LIBRARY(${SHARED_TARGET} SHARED ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_INCLUDE_FILES}) ADD_LIBRARY(${SHARED_TARGET} SHARED ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_INCLUDE_FILES})
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME} ${PTHREADS_LIB}) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME})
SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_LINK_FLAGS}" COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_PME_BUILDING_SHARED_LIBRARY") SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_LINK_FLAGS}" COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_PME_BUILDING_SHARED_LIBRARY")
INSTALL_TARGETS(/lib/plugins RUNTIME_DIRECTORY /lib/plugins ${SHARED_TARGET}) INSTALL_TARGETS(/lib/plugins RUNTIME_DIRECTORY /lib/plugins ${SHARED_TARGET})
...@@ -81,7 +81,7 @@ ENDIF (OPENMM_BUILD_SHARED_LIB) ...@@ -81,7 +81,7 @@ ENDIF (OPENMM_BUILD_SHARED_LIB)
IF(OPENMM_BUILD_STATIC_LIB) IF(OPENMM_BUILD_STATIC_LIB)
ADD_LIBRARY(${STATIC_TARGET} STATIC ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_INCLUDE_FILES}) ADD_LIBRARY(${STATIC_TARGET} STATIC ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_INCLUDE_FILES})
TARGET_LINK_LIBRARIES(${STATIC_TARGET} ${OPENMM_LIBRARY_NAME}_static ${PTHREADS_LIB}) TARGET_LINK_LIBRARIES(${STATIC_TARGET} ${OPENMM_LIBRARY_NAME}_static)
SET_TARGET_PROPERTIES(${STATIC_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_LINK_FLAGS}" COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_PME_BUILDING_STATIC_LIBRARY") SET_TARGET_PROPERTIES(${STATIC_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_LINK_FLAGS}" COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_PME_BUILDING_STATIC_LIBRARY")
INSTALL_TARGETS(/lib/plugins RUNTIME_DIRECTORY /lib/plugins ${STATIC_TARGET}) INSTALL_TARGETS(/lib/plugins RUNTIME_DIRECTORY /lib/plugins ${STATIC_TARGET})
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2013-2022 Stanford University and the Authors. * * Portions copyright (c) 2013-2025 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -460,17 +460,15 @@ void CpuCalcPmeReciprocalForceKernel::initialize(int xsize, int ysize, int zsize ...@@ -460,17 +460,15 @@ void CpuCalcPmeReciprocalForceKernel::initialize(int xsize, int ysize, int zsize
// Initialize threads. // Initialize threads.
isFinished = false; isFinished = false;
pthread_cond_init(&startCondition, NULL); mainThread = thread(threadBody, this);
pthread_cond_init(&endCondition, NULL);
pthread_mutex_init(&lock, NULL);
pthread_create(&mainThread, NULL, threadBody, this);
// Wait until the main thread is up and running. // Wait until the main thread is up and running.
pthread_mutex_lock(&lock); {
while (!isFinished) unique_lock<mutex> ul(lock);
pthread_cond_wait(&endCondition, &lock); while (!isFinished)
pthread_mutex_unlock(&lock); endCondition.wait(ul);
}
// Initialize the FFT grids. // Initialize the FFT grids.
...@@ -535,26 +533,23 @@ void CpuCalcPmeReciprocalForceKernel::initialize(int xsize, int ysize, int zsize ...@@ -535,26 +533,23 @@ void CpuCalcPmeReciprocalForceKernel::initialize(int xsize, int ysize, int zsize
CpuCalcPmeReciprocalForceKernel::~CpuCalcPmeReciprocalForceKernel() { CpuCalcPmeReciprocalForceKernel::~CpuCalcPmeReciprocalForceKernel() {
isDeleted = true; isDeleted = true;
pthread_mutex_lock(&lock); lock.lock();
pthread_cond_broadcast(&startCondition); startCondition.notify_all();
pthread_mutex_unlock(&lock); lock.unlock();
pthread_join(mainThread, NULL); mainThread.join();
pthread_mutex_destroy(&lock);
pthread_cond_destroy(&startCondition);
pthread_cond_destroy(&endCondition);
} }
void CpuCalcPmeReciprocalForceKernel::runMainThread() { void CpuCalcPmeReciprocalForceKernel::runMainThread() {
// This is the main thread that coordinates all the other ones. // This is the main thread that coordinates all the other ones.
pthread_mutex_lock(&lock); unique_lock<mutex> ul(lock);
isFinished = true; isFinished = true;
pthread_cond_signal(&endCondition); endCondition.notify_one();
ThreadPool threads(numThreads); ThreadPool threads(numThreads);
while (true) { while (true) {
// Wait for the signal to start. // Wait for the signal to start.
pthread_cond_wait(&startCondition, &lock); startCondition.wait(ul);
if (isDeleted) if (isDeleted)
break; break;
posq = io->getPosq(); posq = io->getPosq();
...@@ -584,9 +579,8 @@ void CpuCalcPmeReciprocalForceKernel::runMainThread() { ...@@ -584,9 +579,8 @@ void CpuCalcPmeReciprocalForceKernel::runMainThread() {
lastBoxVectors[0] = periodicBoxVectors[0]; lastBoxVectors[0] = periodicBoxVectors[0];
lastBoxVectors[1] = periodicBoxVectors[1]; lastBoxVectors[1] = periodicBoxVectors[1];
lastBoxVectors[2] = periodicBoxVectors[2]; lastBoxVectors[2] = periodicBoxVectors[2];
pthread_cond_signal(&endCondition); endCondition.notify_one();
} }
pthread_mutex_unlock(&lock);
} }
void CpuCalcPmeReciprocalForceKernel::runWorkerThread(ThreadPool& threads, int index) { void CpuCalcPmeReciprocalForceKernel::runWorkerThread(ThreadPool& threads, int index) {
...@@ -640,18 +634,18 @@ void CpuCalcPmeReciprocalForceKernel::beginComputation(IO& io, const Vec3* perio ...@@ -640,18 +634,18 @@ void CpuCalcPmeReciprocalForceKernel::beginComputation(IO& io, const Vec3* perio
// Do the calculation. // Do the calculation.
pthread_mutex_lock(&lock); unique_lock<mutex> ul(lock);
isFinished = false; isFinished = false;
pthread_cond_signal(&startCondition); startCondition.notify_one();
pthread_mutex_unlock(&lock);
} }
double CpuCalcPmeReciprocalForceKernel::finishComputation(IO& io) { double CpuCalcPmeReciprocalForceKernel::finishComputation(IO& io) {
pthread_mutex_lock(&lock); {
while (!isFinished) { unique_lock<mutex> ul(lock);
pthread_cond_wait(&endCondition, &lock); while (!isFinished) {
endCondition.wait(ul);
}
} }
pthread_mutex_unlock(&lock);
io.setForce(&force[0]); io.setForce(&force[0]);
return energy; return energy;
} }
...@@ -742,18 +736,15 @@ void CpuCalcDispersionPmeReciprocalForceKernel::initialize(int xsize, int ysize, ...@@ -742,18 +736,15 @@ void CpuCalcDispersionPmeReciprocalForceKernel::initialize(int xsize, int ysize,
// Initialize threads. // Initialize threads.
isFinished = false; isFinished = false;
pthread_cond_init(&startCondition, NULL); mainThread = thread(dispersionThreadBody, this);
pthread_cond_init(&endCondition, NULL);
pthread_mutex_init(&lock, NULL);
pthread_create(&mainThread, NULL, dispersionThreadBody, this);
// Wait until the main thread is up and running. // Wait until the main thread is up and running.
pthread_mutex_lock(&lock); {
while (!isFinished) unique_lock<mutex> ul(lock);
pthread_cond_wait(&endCondition, &lock); while (!isFinished)
pthread_mutex_unlock(&lock); endCondition.wait(ul);
}
// Initialize the FFT grids. // Initialize the FFT grids.
...@@ -818,26 +809,23 @@ void CpuCalcDispersionPmeReciprocalForceKernel::initialize(int xsize, int ysize, ...@@ -818,26 +809,23 @@ void CpuCalcDispersionPmeReciprocalForceKernel::initialize(int xsize, int ysize,
CpuCalcDispersionPmeReciprocalForceKernel::~CpuCalcDispersionPmeReciprocalForceKernel() { CpuCalcDispersionPmeReciprocalForceKernel::~CpuCalcDispersionPmeReciprocalForceKernel() {
isDeleted = true; isDeleted = true;
pthread_mutex_lock(&lock); lock.lock();
pthread_cond_broadcast(&startCondition); startCondition.notify_all();
pthread_mutex_unlock(&lock); lock.unlock();
pthread_join(mainThread, NULL); mainThread.join();
pthread_mutex_destroy(&lock);
pthread_cond_destroy(&startCondition);
pthread_cond_destroy(&endCondition);
} }
void CpuCalcDispersionPmeReciprocalForceKernel::runMainThread() { void CpuCalcDispersionPmeReciprocalForceKernel::runMainThread() {
// This is the main thread that coordinates all the other ones. // This is the main thread that coordinates all the other ones.
pthread_mutex_lock(&lock); unique_lock<mutex> ul(lock);
isFinished = true; isFinished = true;
pthread_cond_signal(&endCondition); endCondition.notify_one();
ThreadPool threads(numThreads); ThreadPool threads(numThreads);
while (true) { while (true) {
// Wait for the signal to start. // Wait for the signal to start.
pthread_cond_wait(&startCondition, &lock); startCondition.wait(ul);
if (isDeleted) if (isDeleted)
break; break;
posq = io->getPosq(); posq = io->getPosq();
...@@ -868,9 +856,8 @@ void CpuCalcDispersionPmeReciprocalForceKernel::runMainThread() { ...@@ -868,9 +856,8 @@ void CpuCalcDispersionPmeReciprocalForceKernel::runMainThread() {
lastBoxVectors[0] = periodicBoxVectors[0]; lastBoxVectors[0] = periodicBoxVectors[0];
lastBoxVectors[1] = periodicBoxVectors[1]; lastBoxVectors[1] = periodicBoxVectors[1];
lastBoxVectors[2] = periodicBoxVectors[2]; lastBoxVectors[2] = periodicBoxVectors[2];
pthread_cond_signal(&endCondition); endCondition.notify_one();
} }
pthread_mutex_unlock(&lock);
} }
void CpuCalcDispersionPmeReciprocalForceKernel::runWorkerThread(ThreadPool& threads, int index) { void CpuCalcDispersionPmeReciprocalForceKernel::runWorkerThread(ThreadPool& threads, int index) {
...@@ -926,18 +913,18 @@ void CpuCalcDispersionPmeReciprocalForceKernel::beginComputation(CalcPmeReciproc ...@@ -926,18 +913,18 @@ void CpuCalcDispersionPmeReciprocalForceKernel::beginComputation(CalcPmeReciproc
// Do the calculation. // Do the calculation.
pthread_mutex_lock(&lock); unique_lock<mutex> ul(lock);
isFinished = false; isFinished = false;
pthread_cond_signal(&startCondition); startCondition.notify_one();
pthread_mutex_unlock(&lock);
} }
double CpuCalcDispersionPmeReciprocalForceKernel::finishComputation(CalcPmeReciprocalForceKernel::IO& io) { double CpuCalcDispersionPmeReciprocalForceKernel::finishComputation(CalcPmeReciprocalForceKernel::IO& io) {
pthread_mutex_lock(&lock); {
while (!isFinished) { unique_lock<mutex> ul(lock);
pthread_cond_wait(&endCondition, &lock); while (!isFinished) {
endCondition.wait(ul);
}
} }
pthread_mutex_unlock(&lock);
io.setForce(&force[0]); io.setForce(&force[0]);
return energy; return energy;
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2013-2022 Stanford University and the Authors. * * Portions copyright (c) 2013-2025 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -39,7 +39,9 @@ ...@@ -39,7 +39,9 @@
#include "openmm/internal/ThreadPool.h" #include "openmm/internal/ThreadPool.h"
#include <atomic> #include <atomic>
#include <complex> #include <complex>
#include <pthread.h> #include <condition_variable>
#include <mutex>
#include <thread>
#include <vector> #include <vector>
namespace OpenMM { namespace OpenMM {
...@@ -123,9 +125,9 @@ private: ...@@ -123,9 +125,9 @@ private:
std::vector<std::size_t> gridShape, fftAxes; std::vector<std::size_t> gridShape, fftAxes;
std::vector<std::ptrdiff_t> realGridStride, complexGridStride; std::vector<std::ptrdiff_t> realGridStride, complexGridStride;
int waitCount; int waitCount;
pthread_cond_t startCondition, endCondition; std::condition_variable startCondition, endCondition;
pthread_mutex_t lock; std::mutex lock;
pthread_t mainThread; std::thread mainThread;
// The following variables are used to store information about the calculation currently being performed. // The following variables are used to store information about the calculation currently being performed.
IO* io; IO* io;
float energy; float energy;
...@@ -217,9 +219,9 @@ private: ...@@ -217,9 +219,9 @@ private:
std::vector<std::size_t> gridShape, fftAxes; std::vector<std::size_t> gridShape, fftAxes;
std::vector<std::ptrdiff_t> realGridStride, complexGridStride; std::vector<std::ptrdiff_t> realGridStride, complexGridStride;
int waitCount; int waitCount;
pthread_cond_t startCondition, endCondition; std::condition_variable startCondition, endCondition;
pthread_mutex_t lock; std::mutex lock;
pthread_t mainThread; std::thread mainThread;
// The following variables are used to store information about the calculation currently being performed. // The following variables are used to store information about the calculation currently being performed.
CalcPmeReciprocalForceKernel::IO* io; CalcPmeReciprocalForceKernel::IO* io;
float energy; float energy;
......
...@@ -79,7 +79,7 @@ SET_SOURCE_FILES_PROPERTIES(${COMMON_KERNELS_CPP} PROPERTIES GENERATED TRUE) ...@@ -79,7 +79,7 @@ SET_SOURCE_FILES_PROPERTIES(${COMMON_KERNELS_CPP} PROPERTIES GENERATED TRUE)
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} DrudeCommonKernels) ADD_DEPENDENCIES(${SHARED_TARGET} DrudeCommonKernels)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME} ${PTHREADS_LIB}) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME})
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}CUDA) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}CUDA)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_DRUDE_TARGET}) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_DRUDE_TARGET})
SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY") SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY")
......
...@@ -77,7 +77,7 @@ SET_SOURCE_FILES_PROPERTIES(${COMMON_KERNELS_CPP} PROPERTIES GENERATED TRUE) ...@@ -77,7 +77,7 @@ SET_SOURCE_FILES_PROPERTIES(${COMMON_KERNELS_CPP} PROPERTIES GENERATED TRUE)
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} DrudeCommonKernels) ADD_DEPENDENCIES(${SHARED_TARGET} DrudeCommonKernels)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME} ${PTHREADS_LIB}) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME})
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}HIP) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}HIP)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_DRUDE_TARGET}) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_DRUDE_TARGET})
SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY") SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY")
......
...@@ -79,7 +79,7 @@ SET_SOURCE_FILES_PROPERTIES(${COMMON_KERNELS_CPP} PROPERTIES GENERATED TRUE) ...@@ -79,7 +79,7 @@ SET_SOURCE_FILES_PROPERTIES(${COMMON_KERNELS_CPP} PROPERTIES GENERATED TRUE)
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} DrudeCommonKernels) ADD_DEPENDENCIES(${SHARED_TARGET} DrudeCommonKernels)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME} ${OPENCL_LIBRARIES} ${PTHREADS_LIB}) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME} ${OPENCL_LIBRARIES})
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}OpenCL) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}OpenCL)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_DRUDE_TARGET}) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_DRUDE_TARGET})
SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_LINK_FLAGS}" COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY") SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_LINK_FLAGS}" COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY")
......
...@@ -79,7 +79,7 @@ SET_SOURCE_FILES_PROPERTIES(${COMMON_KERNELS_CPP} PROPERTIES GENERATED TRUE) ...@@ -79,7 +79,7 @@ SET_SOURCE_FILES_PROPERTIES(${COMMON_KERNELS_CPP} PROPERTIES GENERATED TRUE)
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} RpmdCommonKernels) ADD_DEPENDENCIES(${SHARED_TARGET} RpmdCommonKernels)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME} ${PTHREADS_LIB}) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME})
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}CUDA) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}CUDA)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_RPMD_TARGET}) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_RPMD_TARGET})
SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY") SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY")
......
...@@ -77,7 +77,7 @@ SET_SOURCE_FILES_PROPERTIES(${COMMON_KERNELS_CPP} PROPERTIES GENERATED TRUE) ...@@ -77,7 +77,7 @@ SET_SOURCE_FILES_PROPERTIES(${COMMON_KERNELS_CPP} PROPERTIES GENERATED TRUE)
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} RpmdCommonKernels) ADD_DEPENDENCIES(${SHARED_TARGET} RpmdCommonKernels)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME} ${PTHREADS_LIB}) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME})
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}HIP) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}HIP)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_RPMD_TARGET}) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_RPMD_TARGET})
SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY") SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY")
......
...@@ -79,7 +79,7 @@ SET_SOURCE_FILES_PROPERTIES(${COMMON_KERNELS_CPP} PROPERTIES GENERATED TRUE) ...@@ -79,7 +79,7 @@ SET_SOURCE_FILES_PROPERTIES(${COMMON_KERNELS_CPP} PROPERTIES GENERATED TRUE)
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} RpmdCommonKernels) ADD_DEPENDENCIES(${SHARED_TARGET} RpmdCommonKernels)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME} ${OPENCL_LIBRARIES} ${PTHREADS_LIB}) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME} ${OPENCL_LIBRARIES})
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}OpenCL) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}OpenCL)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_RPMD_TARGET}) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_RPMD_TARGET})
SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_LINK_FLAGS}" COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY") SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_LINK_FLAGS}" COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY")
......
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