Merge "improve build with OpenMM, still not 100% fixed" into release-4-6
authorMark Abraham <mark.j.abraham@gmail.com>
Fri, 10 May 2013 11:53:04 +0000 (13:53 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Fri, 10 May 2013 11:53:04 +0000 (13:53 +0200)
CMakeLists.txt
admin/installguide/installguide.tex
src/contrib/BuildMdrunOpenMM.cmake
src/contrib/CMakeLists.txt
src/contrib/mdrun_openmm.c
src/contrib/openmm_wrapper.cpp
src/kernel/CMakeLists.txt

index d78d99dde85a7dd256d4ce50970fb4b3fcb15393..187fc992ab07a1bccb6afdbe2257621a1fcd9544 100644 (file)
@@ -153,7 +153,7 @@ mark_as_advanced(GMX_FORCE_CXX)
 option(GMX_COOL_QUOTES "Enable Gromacs cool quotes" ON)
 mark_as_advanced(GMX_COOL_QUOTES)
 
-if(GMX_GPU OR GMX_FORCE_CXX)
+if(GMX_GPU OR GMX_FORCE_CXX OR GMX_OPENMM)
     enable_language(CXX)
 endif()
 set(CMAKE_PREFIX_PATH "" CACHE STRING "Extra locations to search for external libraries and tools (give directory without lib, bin, or include)")
index a7783e53faa1074d28b8214b2d339a968784ea94..3f3bd4d060e22b4c8cb3170fabbf86f9d5dd811b 100644 (file)
@@ -148,13 +148,13 @@ capability 2.0 are required, e.g. Fermi or Kepler cards.
 The GPU support from \gromacs{} version 4.5 using \openmm{}
 \url{https://simtk.org/home/openmm} is still contained in the code,
 but in the ``user contributions'' section (\verb+src/contrib+). You
-will need to edit \verb+src/contrib/CMakeLists.txt+ to enable it. It
-also requires \cuda{}, and remains the only hardware-based
-acceleration available for implicit solvent simulations in
-\gromacs{} at the moment. However, the long-term plan is to enable 
-this functionality in core Gromacs, and not have the OpenMM
-interface supported by the \gromacs team. Right now there are
-some build issues for OpenMM.
+will need to set
+\verb+-DGMX_OPENMM=on -DGMX_GPU=off -DGMX_MPI=off
+-DGMX_THREAD_MPI=off\+ in order to build it. It also requires \cuda{},
+and remains the only hardware-based acceleration available for
+implicit solvent simulations in \gromacs{} at the moment. However, the
+long-term plan is to enable this functionality in core Gromacs, and
+not have the OpenMM interface supported by the \gromacs team.
 
 If you wish to run in parallel on multiple machines across a network,
 you will need to have
index bc954d60e7d0de2a43db8978b2c84f4279f3a2ad..097f4b80a197640acce9b9a9bf7fe7939553d363 100644 (file)
@@ -39,14 +39,15 @@ link_directories(${OpenMM_LIBRARY_DIR})
 # if the same OpenMM installation is used for running and building 
 add_definitions( -DOPENMM_PLUGIN_DIR="${OpenMM_PLUGIN_DIR}" ) 
 file(TO_CMAKE_PATH ${OpenMM_PLUGIN_DIR} _path)
-add_library(openmm_api_wrapper STATIC openmm_wrapper.cpp)
+add_library(openmm_api_wrapper STATIC ${CMAKE_SOURCE_DIR}/src/contrib/openmm_wrapper.cpp)
 target_link_libraries(openmm_api_wrapper ${OpenMM_LIBRARIES})
-list(APPEND GMX_EXTRA_LIBRARIES openmm_api_wrapper ${OpenMM_LIBRARIES})   
 
-list(REMOVE_ITEM MDRUN_SOURCES mdrun.c)
+list(REMOVE_ITEM MDRUN_SOURCES mdrun.c runner.c)
 list(APPEND MDRUN_SOURCES
-    ${CMAKE_CURRENT_SOURCE_DIR}/src/contrib/md_openmm.c
-    ${CMAKE_CURRENT_SOURCE_DIR}/src/contrib/mdrun_openmm.c)
+    ${CMAKE_SOURCE_DIR}/src/contrib/md_openmm.c
+    ${CMAKE_SOURCE_DIR}/src/contrib/mdrun_openmm.c
+    ${CMAKE_SOURCE_DIR}/src/contrib/runner_openmm.c
+    )
 
 # this is to circumvent the following MSVC error: 
 # warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs
index 7c5bb8318e9ec881544859774665594cbd43a6b4..1382ee10c18eaa200d3c6c512ccaabb8be711cf7 100644 (file)
@@ -49,9 +49,11 @@ if(GMX_OPENMM)
         message(FATAL_ERROR "The OpenMM build is not compatible with the native GPU build")
     endif()
 
-    enable_language(CXX)
-    set (GMX_BINARY_SUFFIX "-openmm")
-    set (GMX_LIBS_SUFFIX "_openmm")
+    # These won't actually do anything unless they precede the
+    # definition of these options elsewhere. However, they can't be
+    # FORCE-d either.
+    set(GMX_BINARY_SUFFIX "-openmm" CACHE STRING "Suffix to distinguish OpenMM build from normal")
+    set(GMX_LIBS_SUFFIX "_openmm" CACHE STRING "Suffix to distinguish OpenMM build from normal")
 
 #######################################################################
 # Check for options incompatible with OpenMM build                    #
@@ -99,8 +101,6 @@ if(GMX_OPENMM)
     if(CMAKE_BUILD_TYPE STREQUAL "DEBUG")    
         set(CUDA_VERBOSE_BUILD ON)
     endif()
-    list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/contrib)
-    find_package(OpenMM) 
 
     # mark as advanced the unused variables
     mark_as_advanced(FORCE GMX_CPU_ACCELERATION GMX_MPI GMX_FFT_LIBRARY 
index 7771dcd35f079f597feca7084bbc882d857fa623..aeedeb4a75c3d9c71dabec2ed77f93403c892b1e 100644 (file)
@@ -153,7 +153,7 @@ int cmain(int argc,char *argv[])
     { efXVG, "-tpi",    "tpi",      ffOPTWR },
     { efXVG, "-tpid",   "tpidist",  ffOPTWR },
     { efEDI, "-ei",     "sam",      ffOPTRD },
-    { efEDO, "-eo",     "sam",      ffOPTWR },
+    { efXVG, "-eo",     "sam",      ffOPTWR },
     { efGCT, "-j",      "wham",     ffOPTRD },
     { efGCT, "-jo",     "bam",      ffOPTWR },
     { efXVG, "-ffout",  "gct",      ffOPTWR },
@@ -205,6 +205,8 @@ int cmain(int argc,char *argv[])
     { NULL, "interleave", "pp_pme", "cartesian", NULL };
   const char *dddlb_opt[] =
     { NULL, "auto", "no", "yes", NULL };
+  const char   *thread_aff_opt[threadaffNR+1] =
+    { NULL, "auto", "no", "yes", NULL };
   const char *nbpu_opt[] =
     { NULL, "auto", "cpu", "gpu", "gpu_cpu", NULL };
   real rdd=0.0,rconstr=0.0,dlb_scale=0.8,pforce=-1;
@@ -236,12 +238,12 @@ int cmain(int argc,char *argv[])
       "Number of OpenMP threads per MPI process/thread to start (0 is guess)" },
     { "-ntomp_pme", FALSE, etINT, {&hw_opt.nthreads_omp_pme},
       "Number of OpenMP threads per MPI process/thread to start (0 is -ntomp)" },
-    { "-pin",     FALSE, etBOOL, {&hw_opt.bThreadPinning},
+    { "-pin",     FALSE, etBOOL, {thread_aff_opt},
       "Pin OpenMP threads to cores" },
-    { "-pinht",   FALSE, etBOOL, {&hw_opt.bPinHyperthreading},
-      "Always pin threads to Hyper-Threading cores" },
     { "-pinoffset", FALSE, etINT, {&hw_opt.core_pinning_offset},
       "Core offset for pinning (for running multiple mdrun processes on a single physical node)" },
+    { "-pinstride", FALSE, etINT, {&hw_opt.core_pinning_stride},
+      "Pinning distance in logical cores for threads, use 0 to minimize the number of threads per physical core" },
     { "-gpu_id",  FALSE, etSTR, {&hw_opt.gpu_id},
       "List of GPU id's to use" },
     { "-ddcheck", FALSE, etBOOL, {&bDDBondCheck},
@@ -413,7 +415,7 @@ int cmain(int argc,char *argv[])
 
       if (MULTISIM(cr) && MASTER(cr))
       {
-          check_multi_int(stdout,cr->ms,sim_part,"simulation part");
+          check_multi_int(stdout,cr->ms,sim_part,"simulation part", TRUE);
       }
   } 
   else
index a0650ed2b13aadefd8f3ecd165c761fa4f091664..3343aba94fa07f606d151be8bcbf5fbff0be54ac 100644 (file)
@@ -63,6 +63,7 @@ using namespace std;
 #include "mdrun.h"
 #include "physics.h"
 #include "string2.h"
+#include "openmm_gpu_utils.h"
 #include "gpu_utils.h"
 #include "mtop_util.h"
 
index 50624792f1189c574ad7d61ea40092ead9851b41..e2125333387440d266eb0e6e77f23e8adb635511 100644 (file)
@@ -88,7 +88,10 @@ if(GMX_OPENMM)
     # Even though the OpenMM build has "moved to contrib", many things
     # have be be done from within the scope of the CMakeLists.txt that
     # builds its mdrun, and that is here
-    include(../contrib/BuildMdrunOpenMM)
+    list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/src/contrib)
+    find_package(OpenMM)
+    include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+    include(${CMAKE_SOURCE_DIR}/src/contrib/BuildMdrunOpenMM.cmake)
 endif(GMX_OPENMM)
 
 if(GMX_GPU OR GMX_FORCE_CXX)
@@ -123,6 +126,10 @@ gmx_add_man_page(mdrun)
 target_link_libraries(mdrun gmxpreprocess md gmx ${OpenMP_LINKER_FLAGS})
 set_target_properties(mdrun PROPERTIES OUTPUT_NAME "mdrun${GMX_BINARY_SUFFIX}" COMPILE_FLAGS "${OpenMP_C_FLAGS}")
 
+if(GMX_OPENMM)
+    target_link_libraries(mdrun openmm_api_wrapper)
+endif()
+
 # Construct component groups for installation; note that a component may
 # belong to only one group
 foreach(PROGRAM ${GMX_KERNEL_PROGRAMS})