# set(XML_LIBRARIES ${LIBXML2_LIBRARIES})
#endif()
-if(DEFINED HWLOC_LIBRARIES)
- set(Hwloc_FIND_QUIETLY TRUE)
-endif()
-find_package(Hwloc 1.5)
-if (HWLOC_FOUND)
- if (HWLOC_LIBRARIES MATCHES ".a$")
- set(_STATIC_HWLOC TRUE)
+gmx_option_trivalue(
+ GMX_HWLOC
+ "Use hwloc portable hardware locality library"
+ "AUTO")
+
+if (GMX_HWLOC)
+ # Find quietly the second time.
+ if(DEFINED HWLOC_LIBRARIES)
+ set(Hwloc_FIND_QUIETLY TRUE)
endif()
+ find_package(Hwloc 1.5)
- gmx_check_if_changed(HWLOC_FOUND_CHANGED HWLOC_FOUND)
- if (_STATIC_HWLOC AND HWLOC_FOUND_CHANGED)
- message(STATUS "Static hwloc library found, will not attempt using it as it could lead to link-time errors. To use the detected library, manually set GMX_HWLOC=ON and you will likely have to pass appropriate linker flags too to satisfy the link-time dependencies of your hwloc library. Try \"pkg-config --libs --static hwloc\" for suggestions on what you will need.")
- set(GMX_HWLOC_DEFAULT OFF)
- else()
- set(GMX_HWLOC_DEFAULT ON)
- endif()
-else()
- set(GMX_HWLOC_DEFAULT OFF)
-endif()
-option(GMX_HWLOC "Add support for hwloc Portable Hardware locality library" ${GMX_HWLOC_DEFAULT})
-if(GMX_HWLOC)
- if(HWLOC_FOUND)
- include_directories(SYSTEM ${HWLOC_INCLUDE_DIRS})
- list(APPEND GMX_EXTRA_LIBRARIES ${HWLOC_LIBRARIES})
- else()
- message(FATAL_ERROR "Hwloc package support requested, but not found.")
+ if (HWLOC_FOUND)
+ if (HWLOC_LIBRARIES MATCHES ".a$")
+ set(_STATIC_HWLOC TRUE)
+ endif()
+
+ gmx_check_if_changed(HWLOC_FOUND_CHANGED HWLOC_FOUND)
+ if (_STATIC_HWLOC AND HWLOC_FOUND_CHANGED)
+ message(STATUS "Static hwloc library found, will not attempt using it as it could lead to link-time errors. To use the detected library, manually set GMX_HWLOC=ON and you will likely have to pass appropriate linker flags too to satisfy the link-time dependencies of your hwloc library. Try \"pkg-config --libs --static hwloc\" for suggestions on what you will need.")
+ set(GMX_USE_HWLOC OFF)
+ else()
+ set(GMX_USE_HWLOC ON)
+ endif()
+
+ if (GMX_USE_HWLOC)
+ include_directories(SYSTEM ${HWLOC_INCLUDE_DIRS})
+ list(APPEND GMX_EXTRA_LIBRARIES ${HWLOC_LIBRARIES})
+ endif()
+ elseif(GMX_HWLOC_FORCE)
+ message(FATAL_ERROR "Hwloc package support required, but not found.")
endif()
endif()
#cmakedefine01 GMX_OPENMP
/* Use the Portable Hardware Locality package (hwloc) */
-#cmakedefine01 GMX_HWLOC
+#cmakedefine01 GMX_USE_HWLOC
/* Can and should use nice(3) to set priority */
#cmakedefine01 GMX_USE_NICE
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <algorithm>
#include <vector>
-#if GMX_HWLOC
+#if GMX_USE_HWLOC
# include <hwloc.h>
#endif
}
}
-#if GMX_HWLOC
+#if GMX_USE_HWLOC
#if HWLOC_API_VERSION < 0x00010b00
# define HWLOC_OBJ_PACKAGE HWLOC_OBJ_SOCKET
{
HardwareTopology result;
-#if GMX_HWLOC
+#if GMX_USE_HWLOC
parseHwLoc(&result.machine_, &result.supportLevel_, &result.isThisSystem_);
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
<< "Please mail gmx-developers@gromacs.org so we can try to fix it.";
}
-#if GMX_HWLOC
+#if GMX_USE_HWLOC
TEST(HardwareTopologyTest, HwlocExecute)
{
#if defined(__linux__)
#include <extrae_user_events.h>
#endif
-#if GMX_HWLOC
+#if GMX_USE_HWLOC
#include <hwloc.h>
#endif
#else
writer->writeLine("TNG support: disabled");
#endif
-#if GMX_HWLOC
+#if GMX_USE_HWLOC
writer->writeLine(formatString("Hwloc support: hwloc-%d.%d.%d",
HWLOC_API_VERSION>>16,
(HWLOC_API_VERSION>>8) & 0xFF,