Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ set(SRC_FILES src/ani/CpuANISymmetryFunctions.cpp
# Build the library
set(LIBRARY ${NAME}PyTorch)
add_library(${LIBRARY} SHARED ${SRC_FILES})
set_property(TARGET ${LIBRARY} PROPERTY CXX_STANDARD 14)
set_property(TARGET ${LIBRARY} PROPERTY CXX_STANDARD 17)
target_include_directories(${LIBRARY} PRIVATE ${Python3_INCLUDE_DIRS}
src/ani src/pytorch src/schnet)
target_link_libraries(${LIBRARY} ${TORCH_LIBRARIES} ${Python3_LIBRARIES})
if(ENABLE_CUDA)
set_property(TARGET ${LIBRARY} PROPERTY CUDA_STANDARD 14)
set_property(TARGET ${LIBRARY} PROPERTY CUDA_STANDARD 17)
target_compile_definitions(${LIBRARY} PRIVATE ENABLE_CUDA)
endif(ENABLE_CUDA)

Expand Down
9 changes: 8 additions & 1 deletion src/pytorch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@
High-performance PyTorch operations for neural network potentials
'''
import os.path
import platform
import torch

torch.ops.load_library(os.path.join(os.path.dirname(__file__), 'libNNPOpsPyTorch.so'))
if platform.system() == 'Darwin':
libname = 'libNNPOpsPyTorch.dylib'
elif platform.system() == 'Windows':
libname = 'NNPOpsPyTorch.dll'
else:
libname = 'libNNPOpsPyTorch.so'
torch.ops.load_library(os.path.join(os.path.dirname(__file__), libname))


from NNPOps.OptimizedTorchANI import OptimizedTorchANI
Loading