Commit df2b723d authored by leeping's avatar leeping
Browse files

Merge branch 'master' of github.com:SimTk/openmm

parents a0f16cc0 7be6e8fb
......@@ -3,6 +3,9 @@ compiler:
- clang
env:
matrix:
- OPENMM_BUILD_STATIC_LIB="OFF"
- OPENMM_BUILD_STATIC_LIB="ON"
global:
# encrypted AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to push docs to s3
- secure: "VVKz+yOMbKsskR+PfU1HfKBWdGYYrmIXNWQz4nqXCjtg2MRCQmjDulFZaPVDvsBzis9BUhnzAQrBYUrAtN8bZSTYRg7ADFVGdPFicg3Sv0owcghTQwokIvbw3G+HDz/WAnFmqEhqm3t5pNVWNinyHpMM3zYZOVKagyj53cwAM0M="
......@@ -17,7 +20,7 @@ before_install:
- export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.3
script:
- cmake -DCMAKE_INSTALL_PREFIX=$HOME/OpenMM .
- cmake -DCMAKE_INSTALL_PREFIX=$HOME/OpenMM -DOPENMM_BUILD_STATIC_LIB=$OPENMM_BUILD_STATIC_LIB .
- make -j2
- make -j2 install
- sudo make PythonInstall
......
......@@ -470,10 +470,12 @@ FILE(GLOB CORE_HEADERS include/*.h */include/*.h)
FILE(GLOB TOP_HEADERS include/openmm/*.h */include/openmm/*.h)
FILE(GLOB INTERNAL_HEADERS include/openmm/internal/*.h */include/openmm/internal/*.h )
FILE(GLOB REFERENCE_HEADERS platforms/reference/include/*.h)
FILE(GLOB LEPTON_HEADERS libraries/lepton/include/lepton/*.h)
INSTALL_FILES(/include FILES ${CORE_HEADERS})
INSTALL_FILES(/include/openmm FILES ${TOP_HEADERS})
INSTALL_FILES(/include/openmm/internal FILES ${INTERNAL_HEADERS})
INSTALL_FILES(/include/openmm/reference FILES ${REFERENCE_HEADERS})
INSTALL_FILES(/include/lepton FILES ${LEPTON_HEADERS})
# Serialization support
......@@ -528,6 +530,10 @@ ADD_SUBDIRECTORY(docs-source)
IF(BUILD_TESTING)
ADD_SUBDIRECTORY(tests)
ENDIF(BUILD_TESTING)
ADD_SUBDIRECTORY(examples)
SET(OPENMM_BUILD_EXAMPLES ON CACHE BOOL "Build example executables")
IF(OPENMM_BUILD_EXAMPLES)
ADD_SUBDIRECTORY(examples)
ENDIF(OPENMM_BUILD_EXAMPLES)
ENDIF(NOT cmv EQUAL "2.4") # This whole file...
......@@ -33,6 +33,7 @@ find_path(OPENCL_INCLUDE_DIR
"/usr/local/cuda"
"/usr/local/streamsdk"
"/usr"
"${CUDA_TOOLKIT_ROOT_DIR}"
PATH_SUFFIXES "include"
)
......@@ -78,6 +79,7 @@ find_library(OPENCL_LIBRARY
"/usr/local/cuda"
"/usr/local/streamsdk"
"/usr"
"${CUDA_TOOLKIT_ROOT_DIR}"
PATH_SUFFIXES ${path_suffixes} "lib"
)
......
This is a recipe for building the current development package into a conda binary.
The installation on travis-ci is done by building the conda package, installing
it, running the tests, and then if successful pushing the package to binstar
(and the docs to AWS S3). The binstar auth token is an encrypted environment
variable generated using:
binstar auth -n openmm-travis -o omnia --max-age 22896000 -c --scopes api:write
and then saved in the environment variable BINSTAR_TOKEN.
You can set up travis to store an encrypted token via
gem install travis travis encrypt BINSTAR_TOKEN=xx
where xx is the token output by binstar. The final command should print a line (containing 'secure') for inclusion in your .travis.yml file.
#!/bin/bash
CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=$PREFIX"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
# setting the rpath so that libOpenMMPME.so finds the right libfftw3
CMAKE_FLAGS+=" -DCMAKE_INSTALL_RPATH=.."
CMAKE_FLAGS+=" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++"
CMAKE_FLAGS+=" -DOPENCL_LIBRARY=/opt/AMDAPP/lib/x86_64/libOpenCL.so" # TEST
elif [[ "$OSTYPE" == "darwin"* ]]; then
export MACOSX_DEPLOYMENT_TARGET="10.7"
CMAKE_FLAGS+=" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++"
fi
# Set location for FFTW3 on both linux and mac
CMAKE_FLAGS+=" -DFFTW_INCLUDES=$PREFIX/include"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
CMAKE_FLAGS+=" -DFFTW_LIBRARY=$PREFIX/lib/libfftw3f.so"
CMAKE_FLAGS+=" -DFFTW_THREADS_LIBRARY=$PREFIX/lib/libfftw3f_threads.so"
elif [[ "$OSTYPE" == "darwin"* ]]; then
CMAKE_FLAGS+=" -DFFTW_LIBRARY=$PREFIX/lib/libfftw3f.dylib"
CMAKE_FLAGS+=" -DFFTW_THREADS_LIBRARY=$PREFIX/lib/libfftw3f_threads.dylib"
fi
# Copy source to current directory.
cp -r $RECIPE_DIR/../.. .
# Build in subdirectory.
mkdir build
cd build
cmake .. $CMAKE_FLAGS
make -j4
make install
# Run C tests.
# Exclude OpenCL tests because @peastman suspects mesa on travis implementation is broken.
# @jchodera and @pgrinaway suspect travis is working, but AMD OpenCL tests are actually failing due to a bug.
#ctest -j2 -V -E "[A-Za-z]+OpenCL[A-Za-z]+"
# Install Python wrappers.
export OPENMM_INCLUDE_PATH=$PREFIX/include
export OPENMM_LIB_PATH=$PREFIX/lib
cd python
$PYTHON setup.py install
cd ..
# Remove one random file
#rm $PREFIX/bin/TestReferenceHarmonicBondForce
# Copy all tests to bin directory so they will be distributed with install package.
cp `find . -name "Test*" -type f -maxdepth 1` $PREFIX/bin
package:
name: openmm
version: !!str dev
requirements:
build:
- cmake
- python
- fftw3f
- swig
run:
- python
- fftw3f
- numpy
about:
home: https://simtk.org/home/openmm
license: GPL
diff --git wrappers/python/simtk/openmm/__init__.py wrappers/python/simtk/openmm/__init__.py
index 7e47b11..0ef290a 100644
--- wrappers/python/simtk/openmm/__init__.py
+++ wrappers/python/simtk/openmm/__init__.py
@@ -13,6 +13,10 @@ import os, os.path
from simtk.openmm.openmm import *
from simtk.openmm.vec3 import Vec3
from simtk.openmm import version
-if os.getenv('OPENMM_PLUGIN_DIR') is None and os.path.isdir(version.openmm_library_path):
+_plugin_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..', 'plugins'))
+if os.path.isdir(_plugin_dir):
+ pluginLoadedLibNames = Platform.loadPluginsFromDirectory(_plugin_dir)
+ del _plugin_dir
+elif os.getenv('OPENMM_PLUGIN_DIR') is None and os.path.isdir(version.openmm_library_path):
pluginLoadedLibNames = Platform.loadPluginsFromDirectory(os.path.join(version.openmm_library_path, 'plugins'))
else:
pluginLoadedLibNames = Platform.loadPluginsFromDirectory(Platform.getDefaultPluginsDirectory())
\ No newline at end of file
......@@ -19,13 +19,13 @@ CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=$INSTALL"
# setting the rpath so that libOpenMMPME.so finds the right libfftw3
#CMAKE_FLAGS+=" -DCMAKE_INSTALL_RPATH=.."
CMAKE_FLAGS+=" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++"
CMAKE_FLAGS+=" -DCUDA_CUDART_LIBRARY=/usr/local/cuda-6.5/lib64/libcudart.so"
CMAKE_FLAGS+=" -DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-6.5/bin/nvcc"
CMAKE_FLAGS+=" -DCUDA_SDK_ROOT_DIR=/usr/local/cuda-6.5/"
CMAKE_FLAGS+=" -DCUDA_TOOLKIT_INCLUDE=/usr/local/cuda-6.5/include"
CMAKE_FLAGS+=" -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-6.5/"
CMAKE_FLAGS+=" -DOPENCL_INCLUDE_DIR=/usr/local/cuda-6.5/include"
CMAKE_FLAGS+=" -DOPENCL_LIBRARY=/usr/local/cuda-6.5/lib64/libOpenCL.so"
CMAKE_FLAGS+=" -DCUDA_CUDART_LIBRARY=/usr/local/cuda-7.0/lib64/libcudart.so"
CMAKE_FLAGS+=" -DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-7.0/bin/nvcc"
CMAKE_FLAGS+=" -DCUDA_SDK_ROOT_DIR=/usr/local/cuda-7.0/"
CMAKE_FLAGS+=" -DCUDA_TOOLKIT_INCLUDE=/usr/local/cuda-7.0/include"
CMAKE_FLAGS+=" -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-7.0/"
CMAKE_FLAGS+=" -DOPENCL_INCLUDE_DIR=/usr/local/cuda-7.0/include"
CMAKE_FLAGS+=" -DOPENCL_LIBRARY=/usr/local/cuda-7.0/lib64/libOpenCL.so"
# Set location for FFTW3
PREFIX="$WORKSPACE/miniconda"
......
......@@ -25,7 +25,7 @@ for filename in $( cat openmm/devtools/packaging/manifests/binary/manifest.txt )
done
# Add the install.sh script
CMD="cp -r openmm/install.sh $PACKAGE_DIR/$PACKAGE_SUBDIR"
CMD="cp -r openmm/devtools/packaging/install.sh $PACKAGE_DIR/$PACKAGE_SUBDIR"
echo $CMD
`$CMD`
......
......@@ -22,11 +22,6 @@ CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=$INSTALL"
CMAKE_FLAGS+=" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++"
CMAKE_FLAGS+=" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9"
CMAKE_FLAGS+=" -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk"
CMAKE_FLAGS+=" -DOPENMM_BUILD_OPENCL_LIB=OFF"
CMAKE_FLAGS+=" -DOPENMM_BUILD_DRUDE_OPENCL_LIB=OFF"
CMAKE_FLAGS+=" -DOPENMM_BUILD_RPMD_OPENCL_LIB=OFF"
CMAKE_FLAGS+=" -DOPENMM_BUILD_OPENCL_TESTS=FALSE"
CMAKE_FLAGS+=" -DOPENMM_BUILD_OPENCL_DOUBLE_PRECISION_TESTS=FALSE"
# Build in subdirectory.
# Set location for FFTW3
......
......@@ -22,7 +22,7 @@ for filename in $( cat openmm/devtools/packaging/manifests/binary/manifest.txt )
done
# Add the install.sh script
CMD="cp -r openmm/install.sh $PACKAGE_DIR/$PACKAGE_SUBDIR"
CMD="cp -r openmm/devtools/packaging/install.sh $PACKAGE_DIR/$PACKAGE_SUBDIR"
echo $CMD
`$CMD`
......
......@@ -61,7 +61,7 @@ and tell it to install the command line tools. With Xcode 4.2 and earlier, the
command line tools are automatically installed when you install Xcode.)
3. (Optional) If you have an Nvidia GPU and want to use the CUDA platform,
download CUDA 6.5 from https://developer.nvidia.com/cuda-downloads. Be sure to
download CUDA 7.0 from https://developer.nvidia.com/cuda-downloads. Be sure to
install both the drivers and toolkit.
4. (Optional) If you plan to use the CPU platform, it is recommended that you
......@@ -96,15 +96,6 @@ This will affect only the particular Terminal window you type it into. If you
want to run OpenMM in another Terminal window, you must type the above command
in the new window.
If you plan to use the CUDA platform, OpenMM also needs to locate the CUDA
kernel compiler (:program:`nvcc`). By default it looks for it in the location
:file:`/usr/local/cuda/bin/nvcc`. If you have installed the CUDA toolkit in a different
location, you can set :envvar:`OPENMM_CUDA_COMPILER` to tell OpenMM where to find it. For
example,
::
export OPENMM_CUDA_COMPILER=/opt/CUDA/cuda-6.0/bin/nvcc
7. Verify your installation by typing the following command:
::
......@@ -135,7 +126,7 @@ into a console window.
3. (Optional) If you want to run OpenMM on a GPU, install CUDA and/or OpenCL.
* If you have an Nvidia GPU, download CUDA 6.5 from
* If you have an Nvidia GPU, download CUDA 7.0 from
https://developer.nvidia.com/cuda-downloads. Be sure to install both the
drivers and toolkit. OpenCL is included with the CUDA drivers.
* If you have an AMD GPU, download the latest version of the Catalyst driver
......@@ -175,15 +166,6 @@ This will affect only the particular console window you type it into. If you
want to run OpenMM in another console window, you must type the above command in
the new window.
If you plan to use the CUDA platform, OpenMM also needs to locate the CUDA
kernel compiler (:program:`nvcc`). By default it looks for it in the location
:file:`/usr/local/cuda/bin/nvcc`. If you have installed the CUDA toolkit in a different
location, you can set :envvar:`OPENMM_CUDA_COMPILER` to tell OpenMM where to find it. For
example,
::
export OPENMM_CUDA_COMPILER=/opt/CUDA/cuda-6.0/bin/nvcc
7. Verify your installation by typing the following command:
::
......@@ -199,10 +181,9 @@ Installing on Windows
*********************
1. Download the pre-compiled binary of OpenMM for Windows, then double click the
.zip file to expand it. Move the files to :file:`C:\\Program Files\\OpenMM`. (On 64 bit
Windows, use :file:`C:\\Program Files (x86)\\OpenMM`).
.zip file to expand it. Move the files to :file:`C:\\Program Files\\OpenMM`.
2. Make sure you have the 32-bit version of Python 3.3 (other versions will not
2. Make sure you have the 64-bit version of Python 3.3 or 3.4 (other versions will not
work) installed on your computer. To do this, launch the Python program (either
the command line version or the GUI version). The first line in the Python
window will indicate the version you have, as well as whether you have a 32-bit
......@@ -216,7 +197,7 @@ and ignore it.)
4. (Optional) If you want to run OpenMM on a GPU, install CUDA and/or OpenCL.
* If you have an Nvidia GPU, download CUDA 6.5 from
* If you have an Nvidia GPU, download CUDA 7.0 from
https://developer.nvidia.com/cuda-downloads. Be sure to install both the
drivers and toolkit. OpenCL is included with the CUDA drivers.
* If you have an AMD GPU, download the latest version of the Catalyst driver
......@@ -225,9 +206,8 @@ and ignore it.)
5. (Optional) If you plan to use the CPU platform, it is recommended that you
install FFTW. Precompiled binaries are available from http://www.fftw.org.
Even on 64-bit machines you should use the 32-bit version since the OpenMM
binary is 32-bit. OpenMM will still work without FFTW, but the performance of
particle mesh Ewald (PME) will be much worse.
OpenMM will still work without FFTW, but the performance of particle mesh Ewald
(PME) will be much worse.
6. Before running OpenMM, you must add the OpenMM and FFTW libraries to your
PATH environment variable. You may also need to add the Python executable to
......@@ -266,7 +246,7 @@ your PATH.
If you installed OpenMM somewhere other than the default location, you must also
set :envvar:`OPENMM_PLUGIN_DIR` to point to the plugins directory. If this variable is
not set, it will assume plugins are in the default location (:file:`C:\\Program
Files\\OpenMM\\lib\\plugins` or :file:`C:\\Program Files (x86)\\OpenMM\\lib\\plugins`).
Files\\OpenMM\\lib\\plugins`).
7. Verify your installation by typing the following command:
::
......
......@@ -1850,7 +1850,8 @@ The CUDA Platform recognizes the following Platform-specific properties:
might (or might not) improve performance. To use this option, you must have
FFTW (single precision, multithreaded) installed, and your CPU must support SSE
4.1.
* CudaCompiler: This specifies the path to the CUDA kernel compiler. If you do
* CudaCompiler: This specifies the path to the CUDA kernel compiler. Versions
of CUDA before 7.0 require a separate compiler executable. If you do
not specify this, OpenMM will try to locate the compiler itself. Specify this
only when you want to override the default location. The logic used to pick the
default location depends on the operating system:
......@@ -2711,10 +2712,6 @@ multiply operator (‘*’) or the explicit Quantity constructor:
# or more verbosely
bond_length = Quantity(value=1.53, unit=nanometer)
When working with Numpy arrays you *must* use the explicit constructor. You cannot
multiply them by a unit, because the Numpy array class overloads the multiply operator.
Arithmetic with units
---------------------
......@@ -2864,7 +2861,7 @@ in and out.
[[10.0, 20.0, 30.0], [40.0, 50.0, 60.0]]
>>> import numpy
>>> a = Quantity(numpy.array([1,2,3]), centimeter)
>>> a = numpy.array([1,2,3]) * centimeter
>>> print(a)
[1 2 3] cm
>>> print(a/millimeter)
......
......@@ -59,7 +59,7 @@ ExpressionTreeNode::ExpressionTreeNode(Operation* operation) : operation(operati
throw Exception("wrong number of arguments to function: "+operation->getName());
}
ExpressionTreeNode::ExpressionTreeNode(const ExpressionTreeNode& node) : operation(&node.getOperation() == NULL ? NULL : node.getOperation().clone()), children(node.getChildren()) {
ExpressionTreeNode::ExpressionTreeNode(const ExpressionTreeNode& node) : operation(node.operation == NULL ? NULL : node.operation->clone()), children(node.getChildren()) {
}
ExpressionTreeNode::ExpressionTreeNode() : operation(NULL) {
......
......@@ -54,9 +54,12 @@
#include <sys/timeb.h>
#include <process.h>
#ifndef ETIMEDOUT
#define ETIMEDOUT 110
#endif
#ifndef ENOTSUP
#define ENOTSUP 134
#endif
#define PTHREAD_CANCEL_DISABLE 0
#define PTHREAD_CANCEL_ENABLE 0x01
......
......@@ -171,6 +171,10 @@ public:
* Get a registered Platform by index.
*/
static Platform& getPlatform(int index);
/**
* Get any failures caused during the last call to loadPluginsFromDirectory
*/
static std::vector<std::string> getPluginLoadFailures();
/**
* Get the registered Platform with a particular name. If no Platform with that name has been
* registered, this throws an exception.
......@@ -201,7 +205,7 @@ public:
* Load multiple dynamic libraries (DLLs) which contain OpenMM plugins from a single directory.
* This method loops over every file contained in the specified directory and calls loadPluginLibrary()
* for each one. If an error occurs while trying to load a particular file, that file is simply
* ignored.
* ignored. You can retrieve a list of all such errors by calling getPluginLoadFailures().
*
* @param directory the path to the directory containing libraries to load
* @return the names of all files which were successfully loaded as libraries
......@@ -233,8 +237,10 @@ private:
std::map<std::string, KernelFactory*> kernelFactories;
std::map<std::string, std::string> defaultProperties;
static std::vector<Platform*>& getPlatforms();
static std::vector<std::string> pluginLoadFailures;
};
} // namespace OpenMM
#endif /*OPENMM_PLATFORM_H_*/
......@@ -51,6 +51,8 @@
using namespace OpenMM;
using namespace std;
std::vector<std::string> Platform::pluginLoadFailures;
static int registerPlatforms() {
// Register the Platforms built into the main library. This should eventually be moved elsewhere.
......@@ -140,6 +142,10 @@ Platform& Platform::getPlatform(int index) {
throw OpenMMException("Invalid platform index");
}
std::vector<std::string> Platform::getPluginLoadFailures() {
return pluginLoadFailures;
}
Platform& Platform::getPlatformByName(const string& name) {
for (int i = 0; i < getNumPlatforms(); i++)
if (getPlatform(i).getName() == name)
......@@ -196,8 +202,9 @@ static void* loadOneLibrary(const string& file) {
throw OpenMMException("Loading dynamic libraries is not supported on PNaCl");
#else
void *handle = dlopen(file.c_str(), RTLD_LAZY | RTLD_GLOBAL);
if (handle == NULL)
if (handle == NULL) {
throw OpenMMException("Error loading library "+file+": "+dlerror());
}
return handle;
#endif
}
......@@ -261,12 +268,14 @@ vector<string> Platform::loadPluginsFromDirectory(const string& directory) {
vector<void*> plugins;
#endif
vector<string> loadedLibraries;
pluginLoadFailures.resize(0);
for (unsigned int i = 0; i < files.size(); ++i) {
try {
plugins.push_back(loadOneLibrary(directory+dirSeparator+files[i]));
loadedLibraries.push_back(files[i]);
} catch (OpenMMException& ex) {
// Just ignore it.
pluginLoadFailures.push_back(ex.what());
}
}
initializePlugins(plugins);
......
......@@ -72,6 +72,8 @@ double BrownianIntegrator::computeKineticEnergy() {
}
void BrownianIntegrator::step(int steps) {
if (context == NULL)
throw OpenMMException("This Integrator is not bound to a context!");
for (int i = 0; i < steps; ++i) {
context->updateContextState();
context->calcForcesAndEnergy(true, false);
......
......@@ -94,6 +94,8 @@ double CustomIntegrator::computeKineticEnergy() {
}
void CustomIntegrator::step(int steps) {
if (context == NULL)
throw OpenMMException("This Integrator is not bound to a context!");
globalsAreCurrent = false;
for (int i = 0; i < steps; ++i) {
kernel.getAs<IntegrateCustomStepKernel>().execute(*context, *this, forcesAreValid);
......
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