Commit beb589ad authored by Jason Swails's avatar Jason Swails
Browse files

Merge branch 'master' of github.com:/pandegroup/openmm into feature/cuda-docker

parents 1448e1f0 ec5f7a18
...@@ -28,7 +28,7 @@ install: ...@@ -28,7 +28,7 @@ install:
- "set PATH=C:\\fftw;%PATH%" - "set PATH=C:\\fftw;%PATH%"
# Download and install some OpenMM build dependencies (doxygen, swig) # Download and install some OpenMM build dependencies (doxygen, swig)
- choco install -y doxygen.portable swig > null - choco install -y doxygen.install swig > null
# Download OpenCL Headers and build the ICD loader # Download OpenCL Headers and build the ICD loader
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;" - ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;"
......
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vm.box = "gusztavvargadr/windows10ee" config.vm.box = "gusztavvargadr/windows-10"
config.vm.provision :shell, path: "prepare.ps1" config.vm.provision :shell, path: "prepare.ps1"
config.vm.provider :virtualbox do |vb| config.vm.provider :virtualbox do |vb|
......
...@@ -2,8 +2,8 @@ cd C:\Users\vagrant ...@@ -2,8 +2,8 @@ cd C:\Users\vagrant
# Install CUDA. # Install CUDA.
wget https://developer.nvidia.com/compute/cuda/9.2/Prod2/network_installers/cuda_9.2.148_win10_network -UseBasicParsing -OutFile cuda_9.2.148_win10_network.exe wget https://developer.nvidia.com/compute/cuda/10.1/Prod/network_installers/cuda_10.1.168_win10_network.exe -UseBasicParsing -OutFile cuda_10.1.168_win10_network.exe
.\cuda_9.2.148_win10_network.exe -s nvcc_9.2 cudart_9.2 cufft_9.2 cufft_dev_9.2 nvrtc_9.2 nvrtc_dev_9.2 | Out-Null .\cuda_10.1.168_win10_network.exe -s nvcc_10.1 cudart_10.1 cufft_10.1 cufft_dev_10.1 nvrtc_10.1 nvrtc_dev_10.1 | Out-Null
# Install AMD APP SDK. # Install AMD APP SDK.
...@@ -14,10 +14,11 @@ wget https://s3.amazonaws.com/omnia-ci/AMD-APP-SDK-v2.9-1.599.381-GA-Full-window ...@@ -14,10 +14,11 @@ wget https://s3.amazonaws.com/omnia-ci/AMD-APP-SDK-v2.9-1.599.381-GA-Full-window
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe -UseBasicParsing -OutFile Miniconda3-latest-Windows-x86_64.exe wget https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe -UseBasicParsing -OutFile Miniconda3-latest-Windows-x86_64.exe
.\Miniconda3-latest-Windows-x86_64.exe /S /D=C:\Miniconda3 | Out-Null .\Miniconda3-latest-Windows-x86_64.exe /S /D=C:\Miniconda3 | Out-Null
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Miniconda3;C:\Miniconda3\Scripts;C:\Miniconda3\Library\bin", [EnvironmentVariableTarget]::User)
# Install software with conda. # Install software with conda.
&"C:\Miniconda3\Scripts\conda.exe" config --add channels omnia --add channels conda-forge & "C:\Miniconda3\Scripts\conda.exe" config --add channels omnia --add channels conda-forge
& "C:\Miniconda3\Scripts\conda.exe" install -y fftw3f==3.3.4=vc14_2 jinja2 lxml sphinx sphinxcontrib-autodoc_doxygen sphinxcontrib-lunrsearch conda-build anaconda-client & "C:\Miniconda3\Scripts\conda.exe" install -y fftw3f==3.3.4=vc14_2 jinja2 lxml sphinx sphinxcontrib-autodoc_doxygen sphinxcontrib-lunrsearch conda-build anaconda-client
& "C:\Miniconda3\Scripts\pip.exe" install sphinxcontrib.bibtex & "C:\Miniconda3\Scripts\pip.exe" install sphinxcontrib.bibtex
......
# Generate and install examples. # Generate and install examples.
# #
# This is boilerplate code for generating a set of executables, one per # This is boilerplate code for generating a set of executables, one per
# .cpp file in an "examples" subdirectory. # .cpp file in an "examples" subdirectory.
# #
# For IDEs that can deal with PROJECT_LABEL properties (at least # For IDEs that can deal with PROJECT_LABEL properties (at least
# Visual Studio) the projects for building each of these adhoc # Visual Studio) the projects for building each of these adhoc
# executables will be labeled "Example - TheExampleName" if a file # executables will be labeled "Example - TheExampleName" if a file
# TheExampleName.cpp is found in this directory. # TheExampleName.cpp is found in this directory.
# #
# We check the BUILD_TESTING_{SHARED,STATIC} variables to determine # We check the BUILD_TESTING_{SHARED,STATIC} variables to determine
# whether to build dynamically linked, statically linked, or both # whether to build dynamically linked, statically linked, or both
# versions of the executable. # versions of the executable.
SET(OpenMM_CWRAPPER "OpenMMCWrapper") SET(OpenMM_CWRAPPER "OpenMMCWrapper")
SET(OpenMM_FWRAPPER "OpenMMFortranWrapper") SET(OpenMM_FWRAPPER "OpenMMFortranWrapper")
SET(OpenMM_FMODULE "OpenMMFortranModule") SET(OpenMM_FMODULE "OpenMMFortranModule")
SET(CPP_EXAMPLES HelloArgon HelloSodiumChloride HelloEthane HelloWaterBox) SET(CPP_EXAMPLES HelloArgon HelloSodiumChloride HelloEthane HelloWaterBox)
SET(C_EXAMPLES HelloArgonInC HelloSodiumChlorideInC) SET(C_EXAMPLES HelloArgonInC HelloSodiumChlorideInC)
SET(F_EXAMPLES HelloArgonInFortran HelloSodiumChlorideInFortran) SET(F_EXAMPLES HelloArgonInFortran HelloSodiumChlorideInFortran)
FOREACH(EX_ROOT ${CPP_EXAMPLES}) FOREACH(EX_ROOT ${CPP_EXAMPLES})
IF (OPENMM_BUILD_SHARED_LIB) IF (OPENMM_BUILD_SHARED_LIB)
# Link with shared library # Link with shared library
ADD_EXECUTABLE(${EX_ROOT} ${EX_ROOT}.cpp) ADD_EXECUTABLE(${EX_ROOT} ${EX_ROOT}.cpp)
SET_TARGET_PROPERTIES(${EX_ROOT} SET_TARGET_PROPERTIES(${EX_ROOT}
PROPERTIES PROPERTIES
PROJECT_LABEL "Example - ${EX_ROOT}" PROJECT_LABEL "Example - ${EX_ROOT}"
LINK_FLAGS "${EXTRA_LINK_FLAGS}" LINK_FLAGS "${EXTRA_LINK_FLAGS}"
COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS}") COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS}")
TARGET_LINK_LIBRARIES(${EX_ROOT} ${SHARED_TARGET}) TARGET_LINK_LIBRARIES(${EX_ROOT} ${SHARED_TARGET})
ENDIF (OPENMM_BUILD_SHARED_LIB) ENDIF (OPENMM_BUILD_SHARED_LIB)
IF (OPENMM_BUILD_STATIC_LIB) IF (OPENMM_BUILD_STATIC_LIB)
# Link with static library # Link with static library
SET(EX_STATIC ${EX_ROOT}Static) SET(EX_STATIC ${EX_ROOT}Static)
ADD_EXECUTABLE(${EX_STATIC} ${EX_ROOT}.cpp) ADD_EXECUTABLE(${EX_STATIC} ${EX_ROOT}.cpp)
SET_TARGET_PROPERTIES(${EX_STATIC} SET_TARGET_PROPERTIES(${EX_STATIC}
PROPERTIES PROPERTIES
PROJECT_LABEL "Example - ${EX_STATIC}" PROJECT_LABEL "Example - ${EX_STATIC}"
LINK_FLAGS "${EXTRA_LINK_FLAGS}" LINK_FLAGS "${EXTRA_LINK_FLAGS}"
COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_USE_STATIC_LIBRARIES") COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_USE_STATIC_LIBRARIES")
TARGET_LINK_LIBRARIES(${EX_STATIC} ${STATIC_TARGET}) TARGET_LINK_LIBRARIES(${EX_STATIC} ${STATIC_TARGET})
ENDIF (OPENMM_BUILD_STATIC_LIB) ENDIF (OPENMM_BUILD_STATIC_LIB)
INSTALL(FILES ${EX_ROOT}.cpp DESTINATION examples) INSTALL(FILES ${EX_ROOT}.cpp DESTINATION examples)
ENDFOREACH(EX_ROOT ${CPP_EXAMPLES}) ENDFOREACH(EX_ROOT ${CPP_EXAMPLES})
# Only build wrapper examples if wrappers have been built # Only build wrapper examples if wrappers have been built
IF(OPENMM_BUILD_C_AND_FORTRAN_WRAPPERS) IF(OPENMM_BUILD_C_AND_FORTRAN_WRAPPERS)
INCLUDE_DIRECTORIES(BEFORE ${PROJECT_BINARY_DIR}/wrappers) INCLUDE_DIRECTORIES(BEFORE ${PROJECT_BINARY_DIR}/wrappers)
FOREACH(EX_ROOT ${C_EXAMPLES}) FOREACH(EX_ROOT ${C_EXAMPLES})
IF (OPENMM_BUILD_SHARED_LIB) IF (OPENMM_BUILD_SHARED_LIB)
# Link with shared library # Link with shared library
# We need at least one .cpp here to get CMake to include # We need at least one .cpp here to get CMake to include
# C++ libraries on the link line. # C++ libraries on the link line.
ADD_EXECUTABLE(${EX_ROOT} ${EX_ROOT}.c Empty.cpp) ADD_EXECUTABLE(${EX_ROOT} ${EX_ROOT}.c Empty.cpp)
SET_TARGET_PROPERTIES(${EX_ROOT} SET_TARGET_PROPERTIES(${EX_ROOT}
PROPERTIES PROPERTIES
PROJECT_LABEL "Example C - ${EX_ROOT}" PROJECT_LABEL "Example C - ${EX_ROOT}"
LINK_FLAGS "${EXTRA_LINK_FLAGS}" LINK_FLAGS "${EXTRA_LINK_FLAGS}"
COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS}") COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS}")
TARGET_LINK_LIBRARIES(${EX_ROOT} ${SHARED_TARGET}) TARGET_LINK_LIBRARIES(${EX_ROOT} ${SHARED_TARGET})
ADD_DEPENDENCIES(${EX_ROOT} ApiWrappers) ADD_DEPENDENCIES(${EX_ROOT} ApiWrappers)
ENDIF (OPENMM_BUILD_SHARED_LIB) ENDIF (OPENMM_BUILD_SHARED_LIB)
IF (OPENMM_BUILD_STATIC_LIB) IF (OPENMM_BUILD_STATIC_LIB)
# Link with static library # Link with static library
SET(EX_STATIC ${EX_ROOT}Static) SET(EX_STATIC ${EX_ROOT}Static)
# We need at least one .cpp here to get CMake to include # We need at least one .cpp here to get CMake to include
# C++ libraries on the static link line. # C++ libraries on the static link line.
ADD_EXECUTABLE(${EX_STATIC} ${EX_ROOT}.c Empty.cpp) ADD_EXECUTABLE(${EX_STATIC} ${EX_ROOT}.c Empty.cpp)
SET_TARGET_PROPERTIES(${EX_STATIC} SET_TARGET_PROPERTIES(${EX_STATIC}
PROPERTIES PROPERTIES
PROJECT_LABEL "Example C - ${EX_STATIC}" PROJECT_LABEL "Example C - ${EX_STATIC}"
LINK_FLAGS "${EXTRA_LINK_FLAGS}" LINK_FLAGS "${EXTRA_LINK_FLAGS}"
COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_USE_STATIC_LIBRARIES") COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_USE_STATIC_LIBRARIES")
TARGET_LINK_LIBRARIES(${EX_STATIC} ${STATIC_TARGET}) TARGET_LINK_LIBRARIES(${EX_STATIC} ${STATIC_TARGET})
ADD_DEPENDENCIES(${EX_STATIC} ApiWrappers) ADD_DEPENDENCIES(${EX_STATIC} ApiWrappers)
ENDIF (OPENMM_BUILD_STATIC_LIB) ENDIF (OPENMM_BUILD_STATIC_LIB)
ENDFOREACH(EX_ROOT ${C_EXAMPLES}) ENDFOREACH(EX_ROOT ${C_EXAMPLES})
ENDIF(OPENMM_BUILD_C_AND_FORTRAN_WRAPPERS) ENDIF(OPENMM_BUILD_C_AND_FORTRAN_WRAPPERS)
FOREACH(EX_ROOT ${C_EXAMPLES}) FOREACH(EX_ROOT ${C_EXAMPLES})
INSTALL(FILES ${EX_ROOT}.c DESTINATION examples) INSTALL(FILES ${EX_ROOT}.c DESTINATION examples)
ENDFOREACH(EX_ROOT ${C_EXAMPLES}) ENDFOREACH(EX_ROOT ${C_EXAMPLES})
FOREACH(EX_ROOT ${F_EXAMPLES}) FOREACH(EX_ROOT ${F_EXAMPLES})
INSTALL(FILES ${EX_ROOT}.f90 DESTINATION examples) INSTALL(FILES ${EX_ROOT}.f90 DESTINATION examples)
ENDFOREACH(EX_ROOT ${F_EXAMPLES}) ENDFOREACH(EX_ROOT ${F_EXAMPLES})
INSTALL(FILES simulateAmber.py simulatePdb.py simulateGromacs.py benchmark.py argon-chemical-potential.py input.inpcrd input.prmtop input.pdb input.gro input.top 5dfr_minimized.pdb 5dfr_solv-cube_equil.pdb INSTALL(FILES simulateAmber.py simulatePdb.py simulateGromacs.py benchmark.py argon-chemical-potential.py input.inpcrd input.prmtop input.pdb input.gro input.top 5dfr_minimized.pdb 5dfr_solv-cube_equil.pdb apoa1.pdb
DESTINATION examples) DESTINATION examples)
INSTALL(FILES VisualStudio/HelloArgon.vcproj INSTALL(FILES VisualStudio/HelloArgon.vcproj
VisualStudio/HelloArgon.sln VisualStudio/HelloArgon.sln
VisualStudio/HelloArgonInC.sln VisualStudio/HelloArgonInC.sln
VisualStudio/HelloArgonInC.vcproj VisualStudio/HelloArgonInC.vcproj
VisualStudio/HelloArgonInFortran.sln VisualStudio/HelloArgonInFortran.sln
VisualStudio/HelloArgonInFortran.vfproj VisualStudio/HelloArgonInFortran.vfproj
DESTINATION examples/VisualStudio) DESTINATION examples/VisualStudio)
INSTALL(FILES README.txt DESTINATION examples) INSTALL(FILES README.txt DESTINATION examples)
INSTALL(FILES Makefile NMakefile DESTINATION examples) INSTALL(FILES Makefile NMakefile DESTINATION examples)
INSTALL(FILES MakefileNotes.txt Empty.cpp DESTINATION examples) INSTALL(FILES MakefileNotes.txt Empty.cpp DESTINATION examples)
...@@ -20,6 +20,16 @@ PyObject *copyVVec3ToList(std::vector<Vec3> vVec3) { ...@@ -20,6 +20,16 @@ PyObject *copyVVec3ToList(std::vector<Vec3> vVec3) {
return pyList; return pyList;
} }
int isNumpyAvailable() {
static bool initialized = false;
static bool available = false;
if (!initialized) {
initialized = true;
available = (_import_array() >= 0);
}
return available;
}
} // namespace OpenMM } // namespace OpenMM
%} %}
......
...@@ -156,13 +156,49 @@ OpenMM::Vec3 Py_SequenceToVec3(PyObject* obj, int& status) { ...@@ -156,13 +156,49 @@ OpenMM::Vec3 Py_SequenceToVec3(PyObject* obj, int& status) {
%fragment("Py_SequenceToVecDouble", "header", fragment="Py_StripOpenMMUnits") { %fragment("Py_SequenceToVecDouble", "header", fragment="Py_StripOpenMMUnits") {
int Py_SequenceToVecDouble(PyObject* obj, std::vector<double>& out) { int Py_SequenceToVecDouble(PyObject* obj, std::vector<double>& out) {
PyObject* stripped = NULL; PyObject* stripped = Py_StripOpenMMUnits(obj);
PyObject* item = NULL; PyObject* item = NULL;
PyObject* item1 = NULL; PyObject* item1 = NULL;
PyObject* iterator = NULL;
stripped = Py_StripOpenMMUnits(obj);
iterator = PyObject_GetIter(stripped);
if (isNumpyAvailable()) {
if (PyArray_Check(stripped) && PyArray_ISCARRAY_RO(stripped) && PyArray_NDIM(stripped) == 1) {
int type = PyArray_TYPE(stripped);
int length = PyArray_SIZE(stripped);
void* data = PyArray_DATA((PyArrayObject*) stripped);
if (type == NPY_DOUBLE) {
out.resize(length);
memcpy(&out[0], data, sizeof(double)*length);
Py_DECREF(stripped);
return SWIG_OK;
}
if (type == NPY_FLOAT) {
out.resize(length);
float* floatData = (float*) data;
for (int i = 0; i < length; i++)
out[i] = floatData[i];
Py_DECREF(stripped);
return SWIG_OK;
}
if (type == NPY_INT32) {
out.resize(length);
int* intData = (int*) data;
for (int i = 0; i < length; i++)
out[i] = intData[i];
Py_DECREF(stripped);
return SWIG_OK;
}
if (type == NPY_INT64) {
out.resize(length);
long long* longData = (long long*) data;
for (int i = 0; i < length; i++)
out[i] = longData[i];
Py_DECREF(stripped);
return SWIG_OK;
}
}
}
PyObject* iterator = PyObject_GetIter(stripped);
if (iterator == NULL) { if (iterator == NULL) {
Py_DECREF(stripped); Py_DECREF(stripped);
return SWIG_ERROR; return SWIG_ERROR;
...@@ -194,16 +230,6 @@ int Py_SequenceToVecDouble(PyObject* obj, std::vector<double>& out) { ...@@ -194,16 +230,6 @@ int Py_SequenceToVecDouble(PyObject* obj, std::vector<double>& out) {
} }
%fragment("Py_SequenceToVecVec3", "header", fragment="Py_SequenceToVec3") { %fragment("Py_SequenceToVecVec3", "header", fragment="Py_SequenceToVec3") {
int isNumpyAvailable() {
static bool initialized = false;
static bool available = false;
if (!initialized) {
initialized = true;
available = (_import_array() >= 0);
}
return available;
}
int Py_SequenceToVecVec3(PyObject* obj, std::vector<Vec3>& out) { int Py_SequenceToVecVec3(PyObject* obj, std::vector<Vec3>& out) {
PyObject* stripped = Py_StripOpenMMUnits(obj); // new reference PyObject* stripped = Py_StripOpenMMUnits(obj); // new reference
if (isNumpyAvailable()) { if (isNumpyAvailable()) {
......
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