Kokkos implementation will not compile with GNU Make 4.3
tom91136 opened this issue · 1 comments
tom91136 commented
If we compile the Kokkos implementation with GNU Make 4.3, we get the following:
g++ -I./ -I/home/tom/Downloads/kokkos-3.1.01/core/src -I/home/tom/Downloads/kokkos-3.1.01/containers/src -I/home/tom/Downloads/kokkos-3.1.01/algorithms/src -I/home/tom/Downloads/kokkos-3.1.01/core/src/eti --std=c++11 -fopenmp -I./ -I/home/tom/Downloads/kokkos-3.1.01/core/src -I/home/tom/Downloads/kokkos-3.1.01/containers/src -I/home/tom/Downloads/kokkos-3.1.01/algorithms/src -I/home/tom/Downloads/kokkos-3.1.01/core/src/eti -O3 -c KokkosStream.cpp -o KokkosStream.o
In file included from /home/tom/Downloads/kokkos-3.1.01/core/src/Kokkos_Macros.hpp:64,
from /home/tom/Downloads/kokkos-3.1.01/core/src/Kokkos_Core_fwd.hpp:52,
from /home/tom/Downloads/kokkos-3.1.01/core/src/Kokkos_Core.hpp:51,
from KokkosStream.hpp:12,
from KokkosStream.cpp:8:
./KokkosCore_config.h:5:1: error: stray ‘\’ in program
5 | \#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
| ^
./KokkosCore_config.h:5:2: error: stray ‘#’ in program
5 | \#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
| ^
./KokkosCore_config.h:6:1: error: stray ‘\’ in program
6 | \#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
| ^
./KokkosCore_config.h:6:2: error: stray ‘#’ in progra
Kokkos3's Makefiles build works by generating configuration headers in-place at Makefile inclusion time (i.e include $(KOKKOS_PATH)/Makefile.kokkos
). In the case, the generated KokkosCore_config.h
is actually broken, note the leading \
:
/* ---------------------------------------------
Makefile constructed configuration:
Wed 26 May 06:26:03 BST 2021
----------------------------------------------*/
\#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
\#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
\#else
\#define KOKKOS_CORE_CONFIG_H
\#endif
\#define KOKKOS_VERSION 30101
/* Execution Spaces */
\#define KOKKOS_ENABLE_OPENMP
/* General Settings */
\#define KOKKOS_ENABLE_CXX11
\#define KOKKOS_ENABLE_COMPLEX_ALIGN
\#define KOKKOS_ENABLE_PROFILING
/* Optimization Settings */
/* Cuda Settings */
This only happens in Make 4.3, as confirmed in GEOS-DEV/thirdPartyLibs#136.
The root of the problem is likely this change in Make's changelog:
- WARNING: Backward-incompatibility!
Number signs (#) appearing inside a macro reference or function invocation
no longer introduce comments and should not be escaped with backslashes:
thus a call such as:
foo := $(shell echo '#')
is legal. Previously the number sign needed to be escaped, for example:
foo := $(shell echo '#')
Now this latter will resolve to "#". If you want to write makefiles
portable to both versions, assign the number sign to a variable:
H := #
foo := $(shell echo '$H')
This was claimed to be fixed in 3.81, but wasn't, for some reason.
To detect this change search for 'nocomment' in the .FEATURES variable.
I guess that's more motivation to deprecate Makefiles entirely.
I'm gonna file a separate issue on Kokkos at some point once #102 goes through.