David,
Specifically, this is on RHEL 7.9, and the include file is coming from
readline-devel-6.2-11.el7.x86_64
Looking again at this today, I think the problem is that Amber's CMake files are trying to compile a 'readline' test program in an invalid way.
In particular, according to the man page, one must start a program that intends to call readline with these lines:
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
The Amber CMake file only uses the second of these three lines.
If I patch the code as below, the compilation proceeds past this point:
$ git diff
diff --git a/AmberTools/src/quick/cmake/FindReadline.cmake b/AmberTools/src/quick/cmake/FindReadline.cmake
index 56f7999..cf2d02b 100644
--- a/AmberTools/src/quick/cmake/FindReadline.cmake
+++ b/AmberTools/src/quick/cmake/FindReadline.cmake
.. -44,7 +44,11 .. if(EXISTS "${READLINE_LIBRARY}")
FUNCTION rl_initialize
LIBRARIES ${READLINE_LIBRARY}
INCLUDES ${READLINE_INCLUDE_DIR}
- FUNC_DECLARATION "#include <readline/readline.h>")
+ FUNC_DECLARATION "
+#include <stdio.h>
+#include <readline/readline.h>"
+#include <readline/history.h>"
+ )
endif()
mark_as_advanced(READLINE_INCLUDE_DIR READLINE_LIBRARY READLINE_WORKS)
diff --git a/cmake/FindReadline.cmake b/cmake/FindReadline.cmake
index 56f7999..cf2d02b 100644
--- a/cmake/FindReadline.cmake
+++ b/cmake/FindReadline.cmake
.. -44,7 +44,11 .. if(EXISTS "${READLINE_LIBRARY}")
FUNCTION rl_initialize
LIBRARIES ${READLINE_LIBRARY}
INCLUDES ${READLINE_INCLUDE_DIR}
- FUNC_DECLARATION "#include <readline/readline.h>")
+ FUNC_DECLARATION "
+#include <stdio.h>
+#include <readline/readline.h>"
+#include <readline/history.h>"
+ )
endif()
mark_as_advanced(READLINE_INCLUDE_DIR READLINE_LIBRARY READLINE_WORKS)
There are then a lot of warnings and perhaps errors, which I will look further at. The final fatal messages are:
...
-- Amber will be installed to /packages/amber/amber20/
-- Configuring done
CMake Error at AmberTools/src/packmol_memgen/packmol_memgen/lib/packmol/CMakeLists.txt:6 (add_executable):
Cannot find source file:
packmol.f90
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .h .hh .h++
.hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .ispc
CMake Error at AmberTools/src/packmol_memgen/packmol_memgen/lib/packmol/CMakeLists.txt:6 (add_executable):
No SOURCES given to target: packmol
CMake Generate step failed. Build files cannot be regenerated correctly.
...
Mike
-----Original Message-----
From: David A Case <david.case.rutgers.edu>
Sent: Tuesday, January 25, 2022 6:22 AM
To: AMBER Mailing List <amber.ambermd.org>
Subject: Re: [AMBER] any working singularity or docker recipe? (esp for CUDA and MPI)
On Mon, Jan 24, 2022, Michael Coleman wrote:
>and then run './run_cmake' on what I believe is a clean tree.
>
>This fails with
>
>In file included from /usr/include/readline/readline.h:35:0,
> from /packages/amber/amber20_src/build/CMakeFiles/CMakeTmp/TryLinkLibrary.c:2:
>/usr/include/readline/rltypedefs.h:64:28: error: unknown type name 'FILE'
> typedef int rl_getc_func_t PARAMS((FILE *));
Can you say (again?) what OS and version you are using? The error is in
your system /usr/include/readline/readline.h file (at line 35).
>src.c:(.text+0x6c): undefined reference to `pthread_atfork'
>collect2: error: ld returned 1 exit status
>gmake[1]: *** [cmTC_ccb50] Error 1
>
>I'm uncertain whether this is an actual failure or just a failed attempt to
>find pthread in one place, perhaps followed by a second successful attempt
>later.
This doesn't look like an error. CMake gives lots of info about what it is
doing, many of which can look like errors.
>
>Regarding the CUDA gencode options, it looks like these might be set in a
>lot of places, and I'm not sure all of these are cross-consistent:
>
>$ ls -ld $(fgrep -rle compute_50 amber20_src/)
>-rwxr-xr-x 1 mcolema5 swmgr 85502 Apr 26 2021 amber20_src/AmberTools/src/cpptraj/configure
>-rw-r--r-- 1 mcolema5 swmgr 5646 Apr 26 2021 amber20_src/AmberTools/src/quick/cmake/CudaConfig.cmake
>-rw-r--r-- 1 mcolema5 swmgr 7090 Apr 26 2021 amber20_src/AmberTools/src/quick/quick-cmake/QUICKCudaConfig.cmake
>-rw-r--r-- 1 mcolema5 swmgr 5749 Apr 26 2021 amber20_src/cmake/CudaConfig.cmake
>
>Hard to know what to suggest, but it would be nice if there was just one
>place where the gencode options were configured. Certainly, guidance would
>be handy on which options are best and are possible for each card and
>version of CUDA. And of course, an obvious diagnostic if this should fail.
Thanks for the comment. The file you want is the last one listed. The
other files arise from the fact that the "upstream" versions of cpptraj and
quick are actually separate from Amber, and just bundled in. We can try to
make that bundling process smoother.
As for diagnostics, this is beyond my sphere of knowledge. We don't know at
compile time what GPU card will be used. Since it's printed in the output,
the code knows about this, and I suspect that this happens before any Amber
cuda code is executed. So, it seems possible that we could store the
allowed values in the executable, and try to get a better error message.
But it also seems like a big task.
Thanks for the report...dac
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
https://urldefense.com/v3/__http://lists.ambermd.org/mailman/listinfo/amber__;!!C5qS4YX3!QhoZTbRPHBc3dLcO-2eirLjtW4uA-bNFDygt7CPK1FDQHCEKZVcXM-wsqmO8FwXBx4g$
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Tue Feb 01 2022 - 17:30:02 PST