23 Commits

Author SHA1 Message Date
Stefan Doerr
d1861af768 Fix windows build (#164)
* added NOMINMAX flag for Windows builds

* fix link paths for Windows conda

* add C++ 17 standard to the python library compilation as well

* Revert "add C++ 17 standard to the python library compilation as well"

This reverts commit c69b68a073.

* fix the c++17 flag for Windows

* modify setup.py to fix issues for Windows

* change setup.py again

* fix for dll detection on Windows

* handle at feedstock

* windows cuda fixes

* undo CUDA patches which were not working

* try to manually point the linker to cuda.lib

* make the string raw
2025-02-19 11:52:09 -08:00
Peter Eastman
9ef733c071 Changes for PyPI wheels (#161)
* Changes needed for wheels

* Remove version pin

* Update version number

* Set version number in CMake

* Store version number in CMake cache

* Fixed typo
2024-11-11 15:41:08 -08:00
Peter Eastman
5510c23811 Add pytorch lib dir to rpath (#158) 2024-11-05 15:37:17 -08:00
Peter Eastman
681adc2329 Update Mac build to newer versions (#153)
* Update Mac build to newer versions

* Fixed filename

* Debugging

* Try a more tolerant check
2024-08-23 14:20:06 -07:00
Peter Eastman
d4476435f5 Attempts at fixing CI (#144)
* Try to fix CI on Linux

* Don't install POCL on Mac

* Don't install khronos-opencl-icd-loader

* Update OpenMM version

* Updated tested versions

* Fixed version number

* Install correct packages for CUDA 12

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Try different method of installing CUDA

* Try not installing CUDA packages from conda

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Don't build OpenCL on Mac

* Don't try to run tests that can't run correctly

* Update C++ version and minimum macOS version

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Fixed working directory for tests

* Fixes to testing

* Try using PyTorch 2.3

* Try using PyTorch 2.2

* Switch back to PyTorch 2.1
2024-05-27 09:26:16 -07:00
Peter Eastman
0fc454b37f Python interface for parameter derivatives 2024-05-15 10:35:37 -07:00
Peter Eastman
4fe23f6869 Use setuptools instead of distutils (#123) 2023-10-03 09:21:43 -07:00
Raul
e196c8d527 Torch2 compatibility (#106)
* Update ci

* port the latest CI versions to the self-hosted runner

* forgot to remove bit from version I copy

* see if cuda 11.7 works

* Update swig typecheck to use py::isinstance instead of as_module

* run CUDA tests on GPU runner

* Update TorchForce swig input typemap to avoid as_module

* Fix formatting

* Switch to using micromamba

* Make sure temporary files are deleted even if there was an error

* Update swig typemaps to not use a temp file

* Revert "Merge remote-tracking branch 'origin/feat/add_aws_gpu_runner' into torch2"

This reverts commit 0a58de459b, reversing
changes made to a1c16c6f56.

* run gpu tests on this branch

* actually test with pytorch2

* Revert "actually test with pytorch2"

This reverts commit 4e7a4fbc1e.

* Revert "Merge remote-tracking branch 'origin/feat/add_aws_gpu_runner' into torch2"

This reverts commit 0a58de459b, reversing
changes made to a1c16c6f56.

---------

Co-authored-by: Mike Henry <11765982+mikemhenry@users.noreply.github.com>
2023-07-24 11:11:26 +02:00
Raul
b76deb4df8 Making TorchForce CUDA-graph aware (#103)
* Add CUDA graph draft

* Initialize energy and force tensors in the GPU.

* Add comment on graph capture

* Catch torch exception if the model fails to capture.

* Replay graph just after construction
Finish capturing before rethrowing if an exception occurred during capture

* Add python-side test script for CUDA graphs

* Implement properties

* Update the Python bindings

* Unify the API for properties

* Pass the propery map to the constructor

* Skip graph tests if no GPU is present

* Guard CUDA graph behavior with the CUDA_GRAPH_ENABLE macro

* Check validity of the useCUDAGraphs property

* Add missing bracket to openmmtorch.i

* Fix bug in useCUDAgraph selection

* Update tests

* Add test for get/setProperty

* Update documentation with new functionality

* Add a CUDA graph test for a model that returns only energy

* Add contributors

* Reset pos grads after graph capture. Make energy and force tensors persistent.

* Add tests that execute the model many times to catch bugs related with
CUDA graph capture

* Run formatter

* Warmup model for several steps

* Include gradient reset into the graph

* Do not reset energy and force tensors before graph capture

* Remove unnecessary line

* Add tests for larger number of particles

* Remove unnecessary compilation guard now that Pytorch 1.10 is not supported

* Simplify getTensorPointer now that Pytorch 1.7 is not supported

* Change addForcesToOpenMM to addForces

* Change execute_graph to executeGraph

* Wrap graph warming up in a try/catch block

* Add correctness test for modules that only provide energy

* Revert "Add correctness test for modules that only provide energy"

This reverts commit d20f4bfa83.

* Explicit conversion to correct type in getTensorPointer

* Added a new property for TorchForce, CUDAGraphWarmupSteps.

* Clarify docs

* Document properties

* Throw if requested property does not exist

* Change getProperty(string) to getProperties()

* Add getProperties to python wrappers

* Fix formatting

* Set default properties

* Update tests

* Update some comments

---------

Co-authored-by: Raimondas Galvelis <r.galvelis@acellera.com>
2023-04-21 14:52:39 +02:00
Raul
769302afd3 Add a constructor to TorchForce that takes a torch::jit::Module (#97)
* Add version number as a member to TorchForceProxy

* Encode the model file contents when serializing TorchForce

* Add tests for new TorchForce serialization

* Fix test not finding Python executable

* Format include directives correctly

* Hardcode TorchForceProxy version number

* Fix formatting issues

* Move Python serialization test to the correct place

* Make function encodeFromFileName static

* Update serialization python test to correctly remove temporary files after executing

* Use the base64 encoding capabilities of openssl to serialize model file

* Update TorchForce serializer

* Add a constructor to TorchForce that takes a torch::jit::Module.
 TorchForce(string fileName) is implemented by delegating to the new
 constructor.
 Update serialization test accordingly to compare the module file name
 and the module itself.

* Remove unnecessary include

* Change i_file to file in TorchForce constructor

* Add swig typemaps to new TorchForce constructor

* Add setup.py as a dependency for the PythonInstall CMake rule

* Fix swig out typemap for torch::jit::Module
 Now it is possible to call getModule() on a TorchForce object from
 Python, which will return a module of the same type as, for instance, torch.jit.load()

* Remove commented line in CMakeLists.txt

* Remove unnecessary dependency in setup.py

* Add more tests for new constructor

* Add some comments for the new constructor

* Updates to TorchForce serialization

* Use hex encoding instead of base64 for serialization.
SSL no longer a direct dependency.

* Remove unnecessary header

* Update Python serialization test

* Minor changes

* Improve temporary path handling in python serialization tests

* More informative exception when failing to serialize TorchForce

* Remove unnecessary check in TorchForce serialization

* Changes to C++ serialization tests

* Changes to C++ serialization tests
2023-02-10 14:58:03 -08:00
Peter Eastman
c76684f737 Attempt at fixing SWIG issues (#96) 2023-01-31 11:04:03 -08:00
Raimondas Galvelis
5dc727951b Fix interoperability with CustomCVForce (#80)
* Add a test with CustomCVForce

* Test all the platforms

* Add an iteroperability test for TorchANI and NNPOps

* Add a missing dependencies

* Skip for MacOS

* Move imports

* Fix import

* Retain the primary context

* Switch properly the contexts

* Set the oldest CUDA to 11.0

* Fix nvcc version

* Enable an extra check

* Clean up a temporary file

* Add more checks

* Add comments

* Remove a sync and clean up

* Move the primary context activation
2022-07-08 08:02:19 -07:00
Peter Eastman
84f7d884ec Add PyTorch lib directory to library path (#72) 2022-03-07 13:18:57 -08:00
Raimondas Galvelis
db7c009e47 Move the PyTorch module to a correct device (#70)
* Move the PyTorch module into a correct device

* Add a test

* Make the device constant
2022-03-01 01:08:55 +01:00
Raimondas Galvelis
13e87155b5 Fix the Python wrapper of "setOutputsForces" and "getOutputsForces" (#60)
* Fix the wrapper for "setOutputsForces" and "getOutputsForces"

* Implement a test

* Clean up
2022-01-21 23:41:19 +01:00
Raimondas Galvelis
4614813608 Test if a PyTorch module receives corrects arguments (#50)
* Test if a PyTorch module receives corrects arguments

* Skip if CUDA is not available
2022-01-08 01:10:10 +01:00
Raimondas Galvelis
77d6ac32a2 Update CI (#53)
* Update Python and CUDA

* Update GLIBC

* Debug 1

* Add sysroot 2.17

* Clean up Linux dependencies

* Fix OpenCL tests

* Update CUDA installation

* Fix CUDA version

* Try to fix CUDA installation

* Debug

* Rename env file

* Don't set NVCC version

* Set NVCC version

* Clean up

* Fix GCC version

* Clean up

* Update tests

* Exclude the CUDA tests

* Fix

* Set names

* Set PyTorch version

* Fix

* Add the latest versions

* Remove an obsolete script

* Try to fix MacOS

* Downgrade to CUDA 11.2

* Reduce verbosity

* Debug MacOS

* Show test results on the failure

* Clean up MacOS dependencies

* Clean up

* Use MacOS 11

* Set the PyTorch version on MacOS

* Set PyTorch to 1.9 on MacOS

* Clean up

* Properly set the PyTorch version for MacOS

* Remove unused flags

* Remove more unused flags

* Remove more unused flags
2022-01-07 21:02:35 +01:00
Peter Eastman
6472507abd Added global parameters to Python wrapper (#29) 2021-04-11 13:24:44 -07:00
Peter Eastman
6c11437e4f Created Python test 2020-01-09 15:58:26 -08:00
peastman
ca3499ce2a Renamed class and namespace 2020-01-09 14:30:54 -08:00
peastman
996982054c Added functions for casting 2020-01-09 11:38:50 -08:00
Peter Eastman
fe4ebb5d87 Removed some obsolete code from build scripts 2019-10-22 14:59:27 -07:00
Peter Eastman
81e5775b54 Converted openmm-nn plugin to PyTorch 2019-09-27 11:18:47 -07:00