-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
215 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
From 20d1d14ed17e5e6e2badfe94b08bac53a59fc5eb Mon Sep 17 00:00:00 2001 | ||
From: Isuru Fernando <[email protected]> | ||
Date: Fri, 8 Mar 2024 08:56:04 -0600 | ||
Subject: [PATCH] wheels | ||
|
||
--- | ||
wrappers/python/CMakeLists.txt | 2 ++ | ||
wrappers/python/openmm-cuda/setup.py | 12 ++++++++++++ | ||
wrappers/python/setup.py | 4 +++- | ||
3 files changed, 17 insertions(+), 1 deletion(-) | ||
create mode 100644 wrappers/python/openmm-cuda/setup.py | ||
|
||
diff --git a/wrappers/python/CMakeLists.txt b/wrappers/python/CMakeLists.txt | ||
index 5e8355cad..16ed4d4a6 100644 | ||
--- a/wrappers/python/CMakeLists.txt | ||
+++ b/wrappers/python/CMakeLists.txt | ||
@@ -294,6 +294,8 @@ else() | ||
endif() | ||
configure_file(pysetup.cmake.in | ||
"${CMAKE_CURRENT_BINARY_DIR}/pysetupinstall.cmake" @ONLY) | ||
+configure_file(openmm-cuda/setup.py | ||
+ "${OPENMM_PYTHON_STAGING_DIR}/openmm-cuda/setup.py" @ONLY) | ||
add_custom_target(PythonInstall | ||
COMMAND ${CMAKE_COMMAND} | ||
-P "${CMAKE_CURRENT_BINARY_DIR}/pysetupinstall.cmake" | ||
diff --git a/wrappers/python/openmm-cuda/setup.py b/wrappers/python/openmm-cuda/setup.py | ||
new file mode 100644 | ||
index 000000000..82d74ad7a | ||
--- /dev/null | ||
+++ b/wrappers/python/openmm-cuda/setup.py | ||
@@ -0,0 +1,12 @@ | ||
+from setuptools import setup, find_packages | ||
+ | ||
+cuda_ver = r"@CUDAToolkit_VERSION@" | ||
+cuda_vers = cuda_ver.split(".") | ||
+ | ||
+cuda_ver = cuda_vers[0] if int(cuda_vers[0]) > 11 else ".".join(cuda_vers[:2]) | ||
+ | ||
+setup( | ||
+ name=f"openmm-cuda", | ||
+ version=f"@OPENMM_VERSION@.{cuda_ver}", | ||
+ packages=find_packages(), | ||
+) | ||
diff --git a/wrappers/python/setup.py b/wrappers/python/setup.py | ||
index d2a147065..4cbac13a8 100644 | ||
--- a/wrappers/python/setup.py | ||
+++ b/wrappers/python/setup.py | ||
@@ -85,12 +85,13 @@ def writeVersionPy(filename="openmm/version.py", major_version_num=MAJOR_VERSION | ||
|
||
cnt = """ | ||
# THIS FILE IS GENERATED FROM OPENMM SETUP.PY | ||
+import os | ||
short_version = '%(version)s' | ||
version = '%(version)s' | ||
full_version = '%(full_version)s' | ||
git_revision = '%(git_revision)s' | ||
release = %(isrelease)s | ||
-openmm_library_path = r'%(path)s' | ||
+openmm_library_path = os.path.join(os.path.dirname(__file__), "..", "OpenMM.libs", "lib") | ||
|
||
if not release: | ||
version = full_version | ||
@@ -164,6 +165,7 @@ def buildKeywordDictionary(major_version_num=MAJOR_VERSION_NUM, | ||
(through custom forces and integrators), openness, and high performance | ||
(especially on recent GPUs) that make it truly unique among simulation codes. | ||
""" | ||
+ setupKeywords["extras_require"] = {"cuda12": f"openmm-cuda=={__version__}.12", "cuda11.2": f"openmm-cuda=={__version__}.11.2"} | ||
|
||
define_macros = [('MAJOR_VERSION', major_version_num), | ||
('MINOR_VERSION', minor_version_num)] | ||
-- | ||
2.42.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
BSD-3-Clause license | ||
Copyright (c) 2015-2022, conda-forge contributors | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||
DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import sys | ||
from os.path import join as pjoin | ||
import os | ||
import shutil | ||
from glob import glob | ||
import tempfile | ||
import subprocess | ||
|
||
from delocate import wheeltools | ||
|
||
cwd = os.getcwd() | ||
|
||
def add_library(lib_paths, wheel_name): | ||
print('Processing', wheel_name) | ||
with wheeltools.InWheel(wheel_name, wheel_name): | ||
for lib_path in lib_paths: | ||
d = os.path.dirname(pjoin('OpenMM.libs', lib_path)) | ||
os.makedirs(d, exist_ok=True) | ||
f = pjoin(cwd, lib_path) | ||
if os.path.isdir(f): | ||
shutil.copytree(f, pjoin('OpenMM.libs', lib_path), dirs_exist_ok=True) | ||
else: | ||
shutil.copy2(f, pjoin('OpenMM.libs', lib_path)) | ||
|
||
def main(): | ||
args = list(sys.argv) | ||
args.pop(0) | ||
dist_path = args.pop(0) | ||
add_library(args, dist_path) | ||
|
||
if __name__ == '__main__': | ||
main() |