Skip to content

Commit

Permalink
Squashed 'lib/mdi/' changes from 0176b43..666e039
Browse files Browse the repository at this point in the history
666e039 Update documentation
b6f8a1b Merge pull request lammps#58 from MolSSI/role
237c970 Add MDI_Get_Role function
aa2a534 Merge pull request lammps#57 from MolSSI/lgtm
4eda6f4 Switch to integers for version number
66bdbbc Add c_ptr_to_py_str function
bd78f2c Merge pull request lammps#56 from MolSSI/coverage
9443684 Update tests
d5202a8 Add testing for MDI_Init errors
8d62a73 Update tests
5404dbd Update tests
f191c8f Add tests for MDI initialization
dffa825 Merge pull request lammps#55 from MolSSI/units
55d9f1e Add physconst.h
a96def3 Merge pull request lammps#54 from MolSSI/coverage
9513007 Update .travis.yml
15ad6da Update .travis.yml
b95e0e1 Update .travis.yml
10745d0 Merge pull request lammps#53 from MolSSI/coverage
5b2e76b Update test codes
e89c29f Update test codes
da951f8 Update test codes
98cde24 Update test codes
ebf6185 Update test codes
c34ae8c Update test codes
6417d96 Update Python engine
b0b1a50 Remove old mpi4py functions
f672237 Update .travis.yml
d6d24a7 Update .travis.yml
2391e76 Update .travis.yml
1c40013 Merge pull request lammps#52 from MolSSI/coverage
cb6e245 Update Python test codes to use local build
230df9b Update test_mdi.py
cace71e Update .travis.yml
ea92372 Update .travis.yml
7fba0a0 Update .travis.yml
7ac54f2 Update test_mdi.py
7075fb6 Update .travis.yml
203307f Merge pull request lammps#51 from MolSSI/coverage
7dde3b9 Update .travis.yml
db78c02 Update .travis.yml
aae0985 Update .travis.yml
7948fba Update .travis.yml
cadaa91 Update .travis.yml
c03f7f0 Add codecov badge
eb6e888 Merge pull request lammps#50 from MolSSI/coverage
d8c4ec8 Update .travis.yml
6c00d36 Update .travis.yml
e19ab56 Update .travis.yml
a6fc00e Update .travis.yml
bf832dc Update .travis.yml
53b441b Update .travis.yml
464caf7 Update .travis.yml
1a5edd1 Update .travis.yml
9a78fcb Update .travis.yml
f4e05c9 Add code coverage token to .travis.yml
6294082 Merge pull request lammps#49 from MolSSI/test_codes
dcdbeff Update exceptions in mdi.py
62b7940 Update mdi.py
ac467d8 Clean mdi.py
504022e Fix bug in mdi.py
95d9130 Fix LGTM alerts
14c9289 Delete old test scripts
076a275 Update .travis.yml
655ee00 Update .travis.yml
0720394 Add test_codes cmake option
fcdd571 Merge pull request lammps#48 from MolSSI/test_codes
c622556 Add .travis.yml
5ddfc3c Update .travis.yml
a7ea283 Update .travis.yml
097d083 Update .travis.yml
5d061dc Update .travis.yml
15ae02f Add test_mdi.py
435697a Update .travis.yml
9604c01 Update .travis.yml
be4ab0d Update .travis.yml
bf238a3 Update .travis.yml
eb1aa88 Update cmake paths
f59a995 Update Fortran MPI stubs path
8e0e11b Add MDI_Test_Codes
6ae309b Merge pull request lammps#47 from MolSSI/library
720439a Remove mdi_mpi4py.py test
a80caea Remove mdi_mpi4py.py
7bdf5af Add support for communicator creation and destruction
8f4df18 Improve Python and Fortran support for the LIBRARY method
d1b4a39 Merge pull request lammps#46 from MolSSI/lib_method
4e0e22f Add LIBRARY communication method
5a1eb8a Merge pull request lammps#45 from MolSSI/nodes
3b8cad4 Fix LGTM alert
1477cde Fix LGTM alerts
94bcb90 Automate communication of node information
6e1e73c Fix MPI stubs
9eec2c1 Update documentation
a7db05f Merge branch 'master' of github.com:MolSSI/MDI_Library
4d22171 Expand MPI stubs
3544ab4 Merge pull request lammps#44 from MolSSI/node
526c60e Update Fortran wrapper
c7c6f7a Update wrappers
8662f22 Update mdi.py
241c34f Update mdi.py
54b7218 Update mdi_general.c
d748576 Update .travis.yml
01c73b4 Add functions to support the Node System
2b92632 Update MDI_Conversion_Factor arguments
78d1101 Update documentation
a7b3c85 Add STRESS commands to the standard
0ec1dd7 Add nanometer and picometer conversions
caa23f5 Update conversion factor names
1ec1d8e Update CMakeLists.txt
4dd4413 Merge pull request lammps#43 from MolSSI/brew
0e2e9fa Update .travis.yml
63baab3 Add QCEngine documentation
f359923 Add Azure Pipelines badge
aac1866 Merge pull request lammps#42 from MolSSI/openmpi
b1bccc6 Add f2c MPI communicator conversions
493a26c Merge pull request lammps#41 from MolSSI/windows
482491f Correct pointer type in mdi_tcp.c
2bff48c Update .travis.yml
7b64c7b Update .travis.yml
19e23b1 Update .travis.yml
afbebe7 Update .travis.yml
113a723 Update .travis.yml
fb615d2 Update .travis.yml
98967ee Update .travis.yml
f2fdc8f Update test scripts for Windows
b97ba61 Update .travis.yml
82d4e61 Update .travis.yml
30d7921 Make cxx-cxx test Windows compatible
bfd7f75 Update .travis.yml
ecde6ac Update .travis.yml
bfe4ae7 Update .travis.yml
fdbdef4 Update .travis.yml
ad28384 Merge pull request lammps#40 from MolSSI/fortran_windows
158b05b Check for Windows test executables in travis build
7e665c8 Build Fortran tests on Windows
c2e266d Use MDI_WINDOWS definition in Fortran wrapper
41ced04 Merge pull request lammps#39 from MolSSI/test_scripts
e998b7e Add test scripts to .travis.yml
d85b3cc Add test scripts
1ed0bff Add cxx-cxx_tcp.sh
8523bbf Add MDI_WINDOWS definition
ec2dec5 Improve Fortran DLL export
230a431 Fix bug in Fortran install
fe677e0 Add ecosystem documentation section
32cafbf Update mdiConfig.cmake.in
d155a16 Fix bug in CMake export
8b83737 Remove extra argument to EXPORT
21166d3 Update export target name
f9372e7 Add CMake find_package support
503aaac Update tutorial documentation
a0e5e17 Update Driver Development tutorial
99f8677 Update documentation of MDI commands Resolves lammps#24
860fe91 Document -out command-line option Resolves lammps#30.
853c1f0 Fix bug when -Dlanguage=Python

git-subtree-dir: lib/mdi
git-subtree-split: 666e039bcb95fc8baff307eaa3c90651a460ab99
  • Loading branch information
taylor-a-barnes committed Jan 8, 2020
1 parent 411da6e commit 3626237
Show file tree
Hide file tree
Showing 245 changed files with 17,039 additions and 5,394 deletions.
106 changes: 95 additions & 11 deletions .travis.yml
Expand Up @@ -5,40 +5,124 @@ matrix:
include:
- os: linux
compiler: gcc
env:
- TESTS="not mpi"
- CMAKE_COVERAGE_FLAGS="-O0 -coverage"
- CODECOV_TOKEN="99465b5f-26b4-4487-8355-fbcac5249a05"
before_install:
- sudo apt-get install gfortran
- sudo pip install -U pytest pytest-cov
- os: linux
compiler: gcc
env:
- TESTS=""
- CMAKE_COVERAGE_FLAGS="-O0 -coverage"
- CODECOV_TOKEN="99465b5f-26b4-4487-8355-fbcac5249a05"
before_install:
- sudo apt-get install gfortran
- sudo apt-get install mpich2
- sudo apt-get install mpich libmpich-dev
- sudo pip install mpi4py
- sudo pip install numpy
- sudo pip install -U pytest pytest-cov
- os: linux
compiler: gcc
env:
- TESTS=""
- OMPI_MCA_btl_base_warn_component_unused=0
- CMAKE_COVERAGE_FLAGS="-O0 -coverage"
- CODECOV_TOKEN="99465b5f-26b4-4487-8355-fbcac5249a05"
before_install:
- sudo apt-get install gfortran
- sudo apt-get install openmpi-bin openmpi-doc libopenmpi-dev
- sudo pip install mpi4py
- sudo pip install numpy
- sudo pip install -U pytest pytest-cov
- os: osx
compiler: gcc
env:
- TESTS="not mpi"
- CODECOV_TOKEN="99465b5f-26b4-4487-8355-fbcac5249a05"
- CMAKE_COVERAGE_FLAGS=""
before_install:
- brew install gcc > /dev/null
- brew update > /dev/null
#- brew install gcc > /dev/null
- export FC=gfortran
- sudo pip install -U pytest pytest-cov
- os: windows
compiler: gcc
env:
- TESTS="not mpi"
- PATH=/c/Python36:/c/Python36/Scripts:$PATH
- CMAKE_COVERAGE_FLAGS=""
- CODECOV_TOKEN="99465b5f-26b4-4487-8355-fbcac5249a05"
before_install:
# remove the sh.exe file, which prevents MinGW from working
- where sh > sh_loc.txt
- powershell -command "cat sh_loc.txt | rm"
# install pytest
- choco install python --version 3.6.8
- choco install codecov
- python -m pip install --upgrade pip
- pip install -U pytest pytest-cov

# remove the sh.exe file, which prevents MinGW from working
- where sh > sh_loc.txt
- powershell -command "cat sh_loc.txt | rm"
install:
- mkdir build
- cd build
- cmake -G "MinGW Makefiles" -Dlanguage=Python ../
- mingw32-make
# Make Python package build
- mkdir python_build
- cd python_build
- cmake -G "MinGW Makefiles" -Dpython_package=ON ..
- mingw32-make VERBOSE=1
- mingw32-make install
- cd ..

# Make local install build
- mkdir build
- cd build
- cmake -G "MinGW Makefiles" -Dtest_codes=ON -DCMAKE_INSTALL_PREFIX=./install ..
- mingw32-make VERBOSE=1
- mingw32-make install
before_script:
- ls
- export PATH=$PATH:~/build/MolSSI/MDI_Library/build/install/lib/MDI_Library
- export PATH=$PATH:~/build/MolSSI/MDI_Library/build/install/include/MDI_Library

# Fortran executables don't seem to search the $PATH variable
- cp ~/build/MolSSI/MDI_Library/build/install/lib/MDI_Library/*.dll* .
- ls tests/MDI_Test_Codes/STUBS_MPI
- cp tests/MDI_Test_Codes/STUBS_MPI/*.dll* .
- ls

after_success:
- codecov.exe -f coverage.xml -t "99465b5f-26b4-4487-8355-fbcac5249a05"

install:
# Make Python package build
- mkdir python_build
- cd python_build
- cmake -Dpython_package=ON ..
- make
- sudo make install
- cd ..

# Make local install build
- mkdir build
- cd build
- cmake ../
- cmake -Dtest_codes=ON
-DCMAKE_INSTALL_PREFIX=./install
-DCMAKE_C_FLAGS="$CMAKE_COVERAGE_FLAGS"
-DCMAKE_CXX_FLAGS="$CMAKE_COVERAGE_FLAGS"
-DCMAKE_Fortran_FLAGS="$CMAKE_COVERAGE_FLAGS"
..
- make
- make install
- ls
- ls MDI_Library

script:
- ls
- cd ../tests
- pytest --cov-report=xml --cov=MDI_Library -k "${TESTS}"

after_success:
# get code coverage
- ls -a -l
- ls -a -l ../build/MDI_Library/CMakeFiles/mdi.dir
- bash <(curl -s https://codecov.io/bash)
18 changes: 15 additions & 3 deletions CMakeLists.txt
Expand Up @@ -4,29 +4,41 @@ option(language "language")
option(libtype "libtype")
option(mpi "on or off" ON)
option(python_package "on or off" OFF)
option(test_codes "on or off" OFF)

set(use_C "")
set(use_CXX "")
set(use_Fortran "")
set(use_Python "")

if( NOT language )
# By default, compile for all languages
set(use_C "C")
set(use_CXX "CXX")
set(use_Fortran "Fortran")
set(use_Python "Python")
elseif( language STREQUAL "C" )
set(use_C "C")
elseif( language STREQUAL "CXX" )
set(use_C "C")
set(use_CXX "CXX")
elseif( language STREQUAL "Fortran" )
set(use_C "C")
set(use_Fortran "Fortran")
elseif( language STREQUAL "Python" )
set(use_C "C")
set(use_Python "")
set(use_Python "Python")
else()
message( FATAL_ERROR "Language not supported. Supported languages: C, Fortran, Python" )
endif()

project(MDI
LANGUAGES ${use_C} ${use_Fortran})
project(mdi
VERSION 0.6.5
LANGUAGES ${use_C} ${use_CXX} ${use_Fortran})

add_subdirectory(MDI_Library)

# compile test codes
if ( test_codes )
add_subdirectory(tests)
endif()
51 changes: 42 additions & 9 deletions MDI_Library/CMakeLists.txt
@@ -1,7 +1,6 @@
################################# MDI Project ##################################
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
set(PN ${PROJECT_NAME})


#check for MPI
Expand Down Expand Up @@ -38,21 +37,33 @@ list(APPEND sources "mdi_tcp.h")
list(APPEND sources "mdi_tcp.c")
list(APPEND sources "mdi_test.h")
list(APPEND sources "mdi_test.c")
list(APPEND sources "mdi_lib.h")
list(APPEND sources "mdi_lib.c")
if( mpi STREQUAL "OFF" )
list(APPEND sources "${CMAKE_CURRENT_SOURCE_DIR}/STUBS_MPI/mpi.h")
endif()
if( (NOT language) OR (language STREQUAL "Fortran") )
list(APPEND sources "mdi_f90.f90")
list(APPEND sources "mdi_f90.F90")
endif()

add_library(mdi ${libtype}
${sources})

# set API version of MDI Library
set_target_properties(mdi PROPERTIES SOVERSION 1) # bump whenever interface has changes or removals

#if this is a Windows build, link to ws2_32
if(WIN32)
target_link_libraries(mdi wsock32 ws2_32)
endif()

# gfortran has trouble identifying windows, so use CMake to set the appropriate defines
if(WIN32)
add_definitions(-DMDI_WINDOWS=1)
else()
add_definitions(-DMDI_WINDOWS=0)
endif()

#include and link to MPI
if( mpi STREQUAL "ON" )

Expand Down Expand Up @@ -84,7 +95,6 @@ if( (NOT language) OR (language STREQUAL "Python") )
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mdi.py ${CMAKE_CURRENT_BINARY_DIR}/mdi.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mdi_mpi4py.py ${CMAKE_CURRENT_BINARY_DIR}/mdi_mpi4py.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_CURRENT_BINARY_DIR}/__init__.py COPYONLY)

# Write the name of the mdi library, for use by mdi.py
Expand All @@ -104,6 +114,8 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mdi.h ${CMAKE_CURRENT_BINARY_DIR}/mdi
# ----------------------------------------------------------------------------------------------------
# Install

set(PN ${PROJECT_NAME})

# Determine where the files should be installed
if( python_package STREQUAL "ON" )

Expand All @@ -126,18 +138,39 @@ else()
endif()

# Perform the installation
install(FILES ${CMAKE_BINARY_DIR}/MDI_Library/mdi.h
DESTINATION ${MDI_INSTALL_INCLUDEDIR})
if( (NOT language) OR (language STREQUAL "Fortran") )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mdi.h
${CMAKE_CURRENT_BINARY_DIR}/mdi.mod
DESTINATION ${MDI_INSTALL_INCLUDEDIR})
else()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mdi.h
DESTINATION ${MDI_INSTALL_INCLUDEDIR})
endif()
if( (NOT language) OR (language STREQUAL "Python") )
install(FILES ${CMAKE_BINARY_DIR}/MDI_Library/mdi.py
${CMAKE_BINARY_DIR}/MDI_Library/mdi_name
${CMAKE_BINARY_DIR}/MDI_Library/__init__.py
${CMAKE_BINARY_DIR}/MDI_Library/mdi_mpi4py.py
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mdi.py
${CMAKE_CURRENT_BINARY_DIR}/mdi_name
${CMAKE_CURRENT_BINARY_DIR}/__init__.py
DESTINATION ${MDI_INSTALL_LIBDIR})
endif()

install(TARGETS mdi
EXPORT "${PN}Targets"
RUNTIME DESTINATION ${MDI_INSTALL_LIBDIR}
LIBRARY DESTINATION ${MDI_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${MDI_INSTALL_LIBDIR})

# Provide support for packages

set(CMAKECONFIG_INSTALL_DIR "share/cmake/${PN}")
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/../cmake/${PN}Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${PN}Config.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR})
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PN}ConfigVersion.cmake
VERSION ${${PN}_VERSION}
COMPATIBILITY AnyNewerVersion)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PN}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PN}ConfigVersion.cmake
DESTINATION ${CMAKECONFIG_INSTALL_DIR})
install(EXPORT "${PN}Targets"
NAMESPACE "${PN}::"
DESTINATION ${CMAKECONFIG_INSTALL_DIR})
7 changes: 7 additions & 0 deletions MDI_Library/STUBS_MPI/mpi.h
Expand Up @@ -8,13 +8,18 @@
typedef int MPI_Comm;
typedef int MPI_Datatype;
typedef int MPI_Status;
typedef int MPI_Fint;

#define MPI_STATUS_IGNORE 0
#define MPI_COMM_WORLD 0
#define MPI_INT 1
#define MPI_DOUBLE 4
#define MPI_CHAR 5

static int MPI_Init( int *argc, char ***argv) { return 0;};
static int MPI_Finalize(void) { return 0; };
static int MPI_Get_processor_name( char *name, int *resultlen ) {return 0;};

static int MPI_Comm_rank( MPI_Comm comm, int *rank ) { return 0; };
static int MPI_Comm_size( MPI_Comm comm, int *size ) { return 0; };

Expand All @@ -30,5 +35,7 @@ static int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest,
static int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag,
MPI_Comm comm, MPI_Status *status) { return 0; };
static int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *newcomm) { return 0; };
static MPI_Comm MPI_Comm_f2c( MPI_Fint comm ) { return comm; };
static MPI_Fint MPI_Comm_c2f( MPI_Comm comm ) { return comm; };

#endif
10 changes: 8 additions & 2 deletions MDI_Library/__init__.py
@@ -1,6 +1,12 @@
from .mdi import MDI_COMMAND_LENGTH, MDI_NAME_LENGTH, MDI_NULL_COMM
from .mdi import MDI_INT, MDI_DOUBLE, MDI_CHAR, MDI_INT_NUMPY, MDI_DOUBLE_NUMPY
from .mdi import MDI_VERSION
from .mdi import MDI_TCP, MDI_MPI, MDI_LIB, MDI_TEST
from .mdi import MDI_DRIVER, MDI_ENGINE
from .mdi import MDI_MAJOR_VERSION, MDI_MINOR_VERSION, MDI_PATCH_VERSION
from .mdi import MDI_Init, MDI_Accept_Communicator
from .mdi import MDI_Send, MDI_Recv, MDI_Send_Command, MDI_Recv_Command
from .mdi import MDI_Conversion_Factor, MDI_Get_Intra_Code_MPI_Comm
from .mdi import MDI_Conversion_Factor, MDI_Get_Role, MDI_Get_Intra_Code_MPI_Comm
from .mdi import MDI_Set_Execute_Command_Func
from .mdi import MDI_Register_Node, MDI_Check_Node_Exists, MDI_Get_NNodes, MDI_Get_Node
from .mdi import MDI_Register_Command, MDI_Check_Command_Exists, MDI_Get_NCommands, MDI_Get_Command
from .mdi import MDI_Register_Callback, MDI_Check_Callback_Exists, MDI_Get_NCallbacks, MDI_Get_Callback

0 comments on commit 3626237

Please sign in to comment.