Get CMake build system to take advantage of kokkos/Makefile.kokkos in setting compilers, compiler options etc.
Created by: bartlettroscoe
CC: @kruger, @crtrott, @nmhamster, @dsunder, @ibaned
Next Action Status:
A new plan was discussed in detail on 8/1/2017. Next:@kruger will write up the detailed plan in kokkos/kokkos#878 and then track work there ...
Description:
The native Kokkos Makefile system takes advantage of fairly sophisticated makefile logic to define compilers, compiler options, and libraries given the input variables:
KOKKOS_ARCH
KOKKOS_DEBUG
KOKKS_CXX_STANDARD
- etc. (could be more)
All of this logic is contain in the file kokkos/Makefile.kokkos shown at:
and this is in the Trilinos snapshot of kokkos shown here:
The goal is to leverage kokkos/Makefile.kokkos as much as possible in the CMake build system for Kokkos under Trilinos. We want the Trilinos CMake build of kokkos to produce, as much as possible, to create identical build lines to what the native Kokkos makefile system does.
The process might be to to:
-
Define CMake cache
Trilinos_ARCH
(and other already-defined Trilinos CMake vars) and then set the Kokkos input vars shown above. -
Execute a dummy makefile pulling in Makefile.kokkos and extracting the out
KOKKOS_CXXFLAGS
,KOKKOS_LDFLAGS
, etc., and the generated file KokkosCore_config.h file (and use it for the Kokkos_config.h file). -
Set
CMAKE_CXX_FLAGS
, etc. using these outputs.
I think this needs to be done at the global level during the env probing (so it might need a new TriBITS callback function). But we will have to see.
Repos, Issues, PRs, and Branches:
The ATDM Tools & Dev Env issue tracking this work is:
The three GitHub repos, Issues, PRs, and branches involved are:
-
Trilinos: git@github.com:trilinos/Trilinos.git
- Issue: https://github.com/trilinos/Trilinos/pull/1400
- PR: https://github.com/trilinos/Trilinos/pull/1884
- Branch: https://github.com/Tech-XCorp/Trilinos/tree/trilinos-kokkos-1400 (fork of trilinos/Trilinos) (Currently the branch
trilinos-kokkos-1400
is merged into the branch https://github.com/trilinos/Trilinos/tree/kokkos-promotion and will be merged todevelop
as part of mergingkokkos-promotion
).
-
TriBITS: git@github.com:TriBITSPub/TriBITS.git
- Issue: https://github.com/TriBITSPub/TriBITS/issues/207 [Closed]
- PR: https://github.com/TriBITSPub/TriBITS/pull/233 [Merged]
- Branch: https://github.com/TriBITSPub/TriBITS/tree/kokkos-config-207 [Merged]
-
kokkos: git@github.com:kokkos/kokkos.git
- Issue: https://github.com/kokkos/kokkos/issues/878 [Closed]
- PR: https://github.com/kokkos/kokkos/pull/1106 [Merged]
- Branch: https://github.com/Tech-XCorp/kokkos/tree/issue-878 (fork of kokkos/kokkos) [Merged]
To setup the repos and branches from scratch, do:
$ git clone git@github.com:trilinos/Trilinos.git
$ cd Trilinos/
$ git remote add tech-xcorp git@github.com:Tech-XCorp/Trilinos.git
$ git fetch tech-xcorp
$ git checkout --track tech-xcorp/trilinos-kokkos-1400
$ git clone git@github.com:TriBITSPub/TriBITS.git
$ cd TriBITS/
$ git checkout --track origin/kokkos-config-207
$ cd ..
$ git clone git@github.com:kokkos/kokkos.git
$ cd kokkos/
$ git remote add tech-xcorp git@github.com:Tech-XCorp/kokkos.git
$ git fetch tech-xcorp
$ git checkout --track tech-xcorp/issue-878
$ cd ..
With that setup, you should see:
$ ./cmake/tribits/python_utils/gitdist --dist-repos=.,TriBITS,kokkos dist-repo-status
---------------------------------------------------------------------------------------------
| ID | Repo Dir | Branch | Tracking Branch | C | M | ? |
|----|-----------------|----------------------|---------------------------------|---|---|---|
| 0 | Trilinos (Base) | trilinos-kokkos-1400 | tech-xcorp/trilinos-kokkos-1400 | | | |
| 1 | TriBITS | kokkos-config-207 | orign/kokkos-config-207 | | | |
| 2 | kokkos | issue-878 | tech-xcorp/issue-878 | | | |
---------------------------------------------------------------------------------------------
With that, one can configure and bulid Trilinos using the version of TriBITS and kokkos in those branches by adding the cmake configure options:
$ cmake \
-DTrilinos_TRIBITS_DIR:STRING=TriBITS/tribits \
-DKokkos_SOURCE_DIR_OVERRIDE:STRING=kokkos \
[option options] \
${TRILINOS_SRC_DIR}