Fix building on Solaris with GCC
authorVedran Miletić <vedran@miletic.net>
Fri, 26 Jul 2019 14:48:58 +0000 (16:48 +0200)
committerJenkins Buildbot on bs-gpu01 <jenkins@gromacs.org>
Wed, 20 Nov 2019 22:46:09 +0000 (23:46 +0100)
GROMACS now compiles on Solaris x86, specifically illumos distribution
openindiana. GCC complained about a missing sqrt() variant which was
addressed with static_cast and linker complained about missing
libsocket which was addressed with SunOS-specific entry in
target_link_libraries.

Refs #3050

Change-Id: Ic14a9327fa353270ef0e787b4d2357e86e71da53

docs/release-notes/2020/major/portability.rst
src/gromacs/CMakeLists.txt
src/gromacs/ewald/tests/pmesplinespreadtest.cpp

index ae268a83a704f54edbe1b781289a6ecb08581589..4186794e8f08888e329ccba8a78265652658c8ed 100644 (file)
@@ -17,3 +17,8 @@ Enabled PME offload support with OpenCL on NVIDIA and Intel GPUs
 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 Thanks to portability improvements, the previously disabled PME OpenCL offload
 is now enabled also on NVIDIA and Intel GPUs.
+
+Fixed building on Solaris with GCC
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+GROMACS now builds on Solaris with GCC (tested on illumos distribution
+openindiana, "Hipster" rolling release, using GCC 5, 6, 7, and 8).
index 2462d1a989513a7936ca5c72a07b7584bcac0bfb..c0adfafe2b9216f33693dd2389287b24da9e4aef 100644 (file)
@@ -287,6 +287,7 @@ target_link_libraries(libgromacs
                       ${FFT_LIBRARIES} ${LINEAR_ALGEBRA_LIBRARIES}
                       ${THREAD_LIB} ${GMX_SHARED_LINKER_FLAGS}
                       ${OpenCL_LIBRARIES}
+                      $<$<PLATFORM_ID:SunOS>:socket>
                       PUBLIC
                       ${GMX_PUBLIC_LIBRARIES}
                       )
index 4da26ccd686c9828fe574a89e3fa070e610506fb..43a459420e10a9666323e5a7e4e26b5d8ff30cb5 100644 (file)
@@ -234,7 +234,8 @@ public:
                     TestReferenceChecker gridValuesChecker(
                             rootChecker.checkCompound("NonZeroGridValues", "RealSpaceGrid"));
                     const auto ulpToleranceGrid =
-                            2 * ulpToleranceSplineValues * static_cast<int>(ceil(sqrt(atomCount)));
+                            2 * ulpToleranceSplineValues
+                            * static_cast<int>(ceil(sqrt(static_cast<real>(atomCount))));
                     /* 2 is empiric; sqrt(atomCount) assumes all the input charges may spread onto the same cell */
                     SCOPED_TRACE(formatString("Testing grid values with tolerance of %d", ulpToleranceGrid));
                     if (!gridValuesSizeAssigned)