Skip to content
Snippets Groups Projects
Unverified Commit 2023b8e0 authored by Benjamin Cumming's avatar Benjamin Cumming Committed by GitHub
Browse files

Enrichen configuration information available via version.hpp (#1038)

* Add VECTORIZE configuration feature macro to config, record in python lib.
* Add  ARB_ARCH configuration string as preprocessor define and character string in config and version info respectively.
parent 7e9d9bd0
No related branches found
No related tags found
No related merge requests found
......@@ -42,11 +42,14 @@ if(ARB_WITH_PROFILING)
# define ARB_PROFILE_ENABLED in version.hpp
list(APPEND arb_features PROFILE)
endif()
if(ARB_VECTORIZE)
list(APPEND arb_features VECTORIZE)
endif()
add_custom_command(
OUTPUT version.hpp-test
DEPENDS _always_rebuild
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/git-source-id ${FULL_VERSION_STRING} ${arb_features} > version.hpp-test
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/git-source-id ${FULL_VERSION_STRING} ${ARB_ARCH} ${arb_features} > version.hpp-test
)
set(version_hpp_path arbor/version.hpp)
......
......@@ -3,7 +3,8 @@
# arguments: version-string [feature...]
version="$1"
shift
arch="$2"
shift 2
if gitlog=$(git log -1 --pretty=format:'%ci %H' 2>/dev/null); then
git diff --quiet HEAD 2>/dev/null || gitlog="${gitlog} modified"
......@@ -16,10 +17,12 @@ cat << __end__
#define ARB_VERSION "${version}"
#define ARB_SOURCE_ID "${gitlog}"
#define ARB_ARCH "${arch}"
namespace arb {
extern const char version[];
extern const char source_id[];
extern const char arch[];
}
__end__
......
......@@ -3,4 +3,5 @@
namespace arb {
const char version[] = ARB_VERSION;
const char source_id[] = ARB_SOURCE_ID;
const char arch[] = ARB_ARCH;
}
......@@ -60,8 +60,8 @@ target_link_libraries(pyarb PRIVATE arbor pybind11::module)
if (ARB_WITH_MPI)
find_python_module(mpi4py)
if (HAVE_MPI4PY)
target_include_directories(pyarb PRIVATE "${PY_MPI4PY}/include")
target_compile_definitions(pyarb PRIVATE -DARB_WITH_MPI4PY)
target_include_directories(pyarb_obj PRIVATE "${PY_MPI4PY}/include")
target_compile_definitions(pyarb_obj PRIVATE -DARB_WITH_MPI4PY)
endif()
endif()
......
......@@ -28,8 +28,15 @@ pybind11::dict config() {
dict[pybind11::str("gpu")] = pybind11::bool_(true);
#else
dict[pybind11::str("gpu")] = pybind11::bool_(false);
#endif
#ifdef ARB_VECTORIZE_ENABLED
dict[pybind11::str("vectorize")] = pybind11::bool_(true);
#else
dict[pybind11::str("vectorize")] = pybind11::bool_(false);
#endif
dict[pybind11::str("version")] = pybind11::str(ARB_VERSION);
dict[pybind11::str("source")] = pybind11::str(ARB_SOURCE_ID);
dict[pybind11::str("arch")] = pybind11::str(ARB_ARCH);
return dict;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment