Skip to content

Commit f3d48e3

Browse files
authored
Merge pull request #9 from E3SM-Project/develop
Develop
2 parents 600e9f4 + 27a8794 commit f3d48e3

40 files changed

+1094
-429
lines changed

CMakeLists.txt

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,25 @@ function (prc var)
77
message ("${var}: ${${var}}")
88
endfunction ()
99

10+
function (list2str list str)
11+
string (REPLACE ";" " " tmp "${list}")
12+
set (${str} ${tmp} PARENT_SCOPE)
13+
endfunction ()
14+
1015
set (COMPOSE_DEBUG_MPI FALSE CACHE LOGICAL "If true, insert debugging code into MPI wrappers.")
16+
set (COMPOSE_MIMIC_GPU FALSE CACHE LOGICAL "If true, use non-optimal OpenMP threading to debug GPU-like parallelism.")
17+
set (COMPOSE_QLT_TIME FALSE CACHE LOGICAL "If true, time QLT operations and display timers at the end.")
1118

1219
if (Kokkos_DIR)
1320
include (${Kokkos_DIR}/kokkos_generated_settings.cmake)
1421
set (Kokkos_INCLUDE ${Kokkos_DIR}/include)
22+
list2str ("${KOKKOS_CXXFLAGS}" Kokkos_CXX_FLAGS)
23+
list2str ("${KOKKOS_LD_FLAGS}" Kokkos_LD_FLAGS)
24+
string (FIND "${KOKKOS_GMAKE_DEVICES}" "Cuda" cuda_str_pos)
25+
set (CUDA_BUILD FALSE)
26+
if (${cuda_str_pos} GREATER -1)
27+
set (CUDA_BUILD TRUE)
28+
endif ()
1529
else ()
1630
message (FATAL_ERROR "COMPOSE requires Kokkos_DIR")
1731
endif ()
@@ -65,12 +79,16 @@ if ("${cmake_build_type_str}" STREQUAL "debug")
6579
endif ()
6680

6781
if (DEBUG_BUILD)
68-
message ("Enable COMPOSE_DEBUG_MPI because build type is DEBUG.")
82+
message ("Enable COMPOSE_DEBUG_MPI and COMPOSE_MIMIC_GPU because build type is DEBUG.")
6983
set (COMPOSE_DEBUG_MPI TRUE)
84+
set (COMPOSE_MIMIC_GPU TRUE)
7085
endif ()
7186

72-
set (COMPOSE_COMPILE_FLAGS "-g ${KOKKOS_LINK_FLAGS} ${CMAKE_CXX_FLAGS}")
73-
set (COMPOSE_LINK_FLAGS "-L${Kokkos_DIR}/lib ${KOKKOS_LINK_FLAGS}")
87+
set (COMPOSE_COMPILE_FLAGS "-g ${Kokkos_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
88+
if (CUDA_BUILD)
89+
set (COMPOSE_COMPILE_FLAGS "${COMPOSE_COMPILE_FLAGS} --expt-relaxed-constexpr")
90+
endif ()
91+
set (COMPOSE_LINK_FLAGS "-L${Kokkos_DIR}/lib ${Kokkos_LD_FLAGS}")
7492
set (COMPOSE_INCLUDES ${Kokkos_INCLUDE} ${CMAKE_CURRENT_SOURCE_DIR}/share ${CMAKE_BINARY_DIR}/config)
7593
set (COMPOSE_LIBRARIES ${KOKKOS_LIBS_LIST})
7694

@@ -85,8 +103,8 @@ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/compose_config.h.in ${CMAKE_BINARY_D
85103

86104
add_library (${PROJECT_NAME} ${SOURCES})
87105
set_target_properties (${PROJECT_NAME} PROPERTIES
88-
COMPILE_FLAGS ${COMPOSE_COMPILE_FLAGS}
89-
LINK_FLAGS ${COMPOSE_LINK_FLAGS})
106+
COMPILE_FLAGS "${COMPOSE_COMPILE_FLAGS}"
107+
LINK_FLAGS "${COMPOSE_LINK_FLAGS}")
90108
target_include_directories (${PROJECT_NAME} PUBLIC cedr siqk)
91109
target_include_directories (${PROJECT_NAME} PRIVATE siqk cedr)
92110
target_include_directories (${PROJECT_NAME} PUBLIC ${COMPOSE_INCLUDES})

LICENSE

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
COMPOSE version 1.0: Copyright 2018 National Technology & Engineering Solutions
2+
of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the
3+
U.S. Government retains certain rights in this software.
4+
5+
Redistribution and use in source and binary forms, with or without modification,
6+
are permitted provided that the following conditions are met:
7+
8+
1. Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
2. Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation and/or
13+
other materials provided with the distribution.
14+
15+
3. Neither the name of the copyright holder nor the names of its contributors
16+
may be used to endorse or promote products derived from this software without
17+
specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## COMPOSE: Compact Multi-moment Performance-Portable Semi-Lagrangian methods
2+
3+
COMPOSE provides libraries for semi-Lagrangian transport and, together or
4+
separately, property preservation:
5+
6+
* CEDR: Communication-Efficient Constrained Density Reconstructors.
7+
* SIQK: Spherical Polygon Intersection and Quadrature.
8+
9+
# Building and installing
10+
11+
First, install [Kokkos](https://github.com/kokkos/kokkos).
12+
For example, in a typical environment using OpenMP, run:
13+
```
14+
git clone https://github.com/kokkos/kokkos.git
15+
./kokkos/generate_makefile.bash --with-serial --with-openmp --prefix=/path/to/my/kokkos/install --compiler=g++
16+
make -j8 install
17+
```
18+
19+
Second, configure, build, and test COMPOSE:
20+
```
21+
cmake \
22+
-D Kokkos_DIR=/path/to/my/kokkos/install \
23+
-D CMAKE_INSTALL_PREFIX=/path/to/my/compose/install \
24+
/path/to/compose/repo
25+
make -j8
26+
ctest
27+
```
28+
29+
Optionally, third, install COMPOSE:
30+
```
31+
make install
32+
```
33+
34+
# Licence
35+
36+
COMPOSE version 1.0: Copyright 2018 National Technology & Engineering Solutions
37+
of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the
38+
U.S. Government retains certain rights in this software.
39+
40+
This software is released under the BSD licence; see [LICENSE](./LICENSE).

README.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.

cedr/CMakeLists.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
add_executable (cedr_test cedr_test.cpp)
2-
set_target_properties (cedr_test PROPERTIES
3-
COMPILE_FLAGS ${COMPOSE_COMPILE_FLAGS}
4-
LINK_FLAGS ${COMPOSE_LINK_FLAGS})
5-
6-
target_include_directories (cedr_test PRIVATE ${COMPOSE_INCLUDES})
7-
target_link_libraries (cedr_test ${PROJECT_NAME} ${COMPOSE_LIBRARIES})
1+
foreach (exe cedr_test cedr_test_mpi_device_ptr)
2+
add_executable (${exe} ${exe}.cpp)
3+
set_target_properties (${exe} PROPERTIES
4+
COMPILE_FLAGS ${COMPOSE_COMPILE_FLAGS}
5+
LINK_FLAGS ${COMPOSE_LINK_FLAGS})
6+
target_include_directories (${exe} PRIVATE ${COMPOSE_INCLUDES})
7+
target_link_libraries (${exe} ${PROJECT_NAME} ${COMPOSE_LIBRARIES})
8+
endforeach ()
89

910
add_test (NAME cedr-test-unit
1011
COMMAND $<TARGET_FILE:cedr_test> -t)
12+
add_test (NAME cedr-test-mpi-device-ptr
13+
COMMAND $<TARGET_FILE:cedr_test_mpi_device_ptr>)
1114
add_test (NAME cedr-test-unit-mpi
1215
COMMAND ${COMPOSE_TEST_MPIRUN} ${COMPOSE_TEST_MPIFLAGS} -np ${COMPOSE_TEST_NRANK}
1316
$<TARGET_FILE:cedr_test> -t --proc-random -nc 111 -nt 11)

cedr/cedr.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// COMPOSE version 1.0: Copyright 2018 NTESS. This software is released under
2+
// the BSD license; see LICENSE in the top-level directory.
3+
14
#ifndef INCLUDE_CEDR_HPP
25
#define INCLUDE_CEDR_HPP
36

0 commit comments

Comments
 (0)