-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from xsdk-project/add-cuda
Add CUDA with a couple CUDA enabled examples
- Loading branch information
Showing
13 changed files
with
1,574 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# SUNDIALS Copyright Start | ||
# Copyright (c) 2002-2021, Lawrence Livermore National Security | ||
# and Southern Methodist University. | ||
# All rights reserved. | ||
# | ||
# See the top-level LICENSE and NOTICE files for details. | ||
# | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# SUNDIALS Copyright End | ||
# ----------------------------------------------------------------------------- | ||
# Find module that locates the MAGMA linear algebra library. | ||
# ----------------------------------------------------------------------------- | ||
|
||
# find the MAGMA include path | ||
find_path(MAGMA_INCLUDE_DIR magma_v2.h | ||
NAMES magma_v2.h | ||
HINTS ${MAGMA_DIR} $ENV{MAGMA_DIR} | ||
PATH_SUFFIXES include | ||
NO_DEFAULT_PATH | ||
DOC "Directory with MAGMA header" | ||
) | ||
|
||
# find the main MAGMA library | ||
find_library(MAGMA_LIBRARY | ||
NAMES magma | ||
HINTS ${MAGMA_DIR} $ENV{MAGMA_DIR} | ||
PATH_SUFFIXES lib lib64 | ||
NO_DEFAULT_PATH | ||
DOC "The MAGMA library.") | ||
|
||
# Find the optional sparse component | ||
if("SPARSE" IN_LIST MAGMA_FIND_COMPONENTS) | ||
set(_sparse_required MAGMA_SPARSE_LIBRARY) | ||
find_library(MAGMA_SPARSE_LIBRARY | ||
NAMES magma_sparse | ||
HINTS ${MAGMA_DIR} $ENV{MAGMA_DIR} | ||
PATH_SUFFIXES lib lib64 | ||
NO_DEFAULT_PATH | ||
DOC "The MAGMA sparse library.") | ||
else() | ||
set(_sparse_required ) | ||
endif() | ||
|
||
# Determine MAGMA version and libraries it depends on | ||
if(MAGMA_LIBRARY AND MAGMA_INCLUDE_DIR) | ||
get_filename_component(libdir ${MAGMA_LIBRARY} DIRECTORY) | ||
find_file(MAGMA_PKG_CONFIG_PATH magma.pc PATHS "${libdir}/pkgconfig") | ||
|
||
if(MAGMA_PKG_CONFIG_PATH) | ||
file(STRINGS ${MAGMA_PKG_CONFIG_PATH} _version_string REGEX "Version: [0-9].[0-9].[0-9]") | ||
string(REGEX MATCHALL "[0-9]" _version_full "${_version_string}") | ||
|
||
list(GET _version_full 0 _version_major) | ||
list(GET _version_full 1 _version_minor) | ||
list(GET _version_full 2 _version_patch) | ||
|
||
set(MAGMA_VERSION "${_version_major}.${_version_minor}.${_version_patch}") | ||
|
||
file(STRINGS ${MAGMA_PKG_CONFIG_PATH} _libraries_string REGEX "Libs:.*") | ||
string(REPLACE " " ";" _libraries_list ${_libraries_string}) | ||
list(SUBLIST _libraries_list 1 -1 _libraries_list) # remove 'Libs:' part | ||
|
||
set(_interface_libraires ) | ||
foreach(lib ${_libraries_list}) | ||
if(NOT (lib STREQUAL "-lmagma" OR lib STREQUAL "-lmagma_sparse" OR lib STREQUAL "-L\${libdir}" OR lib STREQUAL "") ) | ||
string(REPLACE "-l" "" lib ${lib}) | ||
list(APPEND _interface_libraires ${lib}) | ||
endif() | ||
endforeach() | ||
endif() | ||
endif() | ||
|
||
set(MAGMA_LIBRARIES "${MAGMA_LIBRARY};${_interface_libraires}") | ||
|
||
find_package_handle_standard_args(MAGMA | ||
REQUIRED_VARS | ||
MAGMA_LIBRARY | ||
MAGMA_LIBRARIES | ||
MAGMA_INCLUDE_DIR | ||
${_sparse_required} | ||
VERSION_VAR | ||
MAGMA_VERSION | ||
) | ||
|
||
# Create target for MAGMA | ||
if(MAGMA_FOUND) | ||
|
||
if(NOT TARGET XSDK::MAGMA) | ||
add_library(XSDK::MAGMA UNKNOWN IMPORTED) | ||
endif() | ||
|
||
set_target_properties(XSDK::MAGMA PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES "${MAGMA_INCLUDE_DIR}" | ||
INTERFACE_LINK_LIBRARIES "${_interface_libraires}" | ||
IMPORTED_LOCATION "${MAGMA_LIBRARY}") | ||
|
||
if(MAGMA_SPARSE_LIBRARY) | ||
if(NOT TARGET XSDK::MAGMA_SPARSE) | ||
add_library(XSDK::MAGMA_SPARSE UNKNOWN IMPORTED) | ||
endif() | ||
|
||
set_target_properties(XSDK::MAGMA_SPARSE PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES "${MAGMA_INCLUDE_DIR}" | ||
INTERFACE_LINK_LIBRARIES "${MAGMA_LIBRARY};${_interface_libraires}" | ||
IMPORTED_LOCATION "${MAGMA_SPARSE_LIBRARY}") | ||
endif() | ||
|
||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
MFEM mesh v1.0 | ||
|
||
# | ||
# MFEM Geometry Types (see mesh/geom.hpp): | ||
# | ||
# POINT = 0 | ||
# SEGMENT = 1 | ||
# TRIANGLE = 2 | ||
# SQUARE = 3 | ||
# TETRAHEDRON = 4 | ||
# CUBE = 5 | ||
# | ||
|
||
dimension | ||
2 | ||
|
||
# format: <attribute> <geometry type> <vertex 0> <vertex 1> ... | ||
elements | ||
12 | ||
|
||
1 3 0 2 8 5 | ||
1 3 2 1 3 8 | ||
1 3 5 8 6 11 | ||
1 3 8 3 0 6 | ||
|
||
2 3 0 4 9 6 | ||
2 3 4 1 2 9 | ||
2 3 6 9 7 11 | ||
2 3 9 2 0 7 | ||
|
||
3 3 0 3 10 7 | ||
3 3 3 1 4 10 | ||
3 3 7 10 5 11 | ||
3 3 10 4 0 5 | ||
|
||
boundary | ||
0 | ||
|
||
vertices | ||
12 | ||
|
||
nodes | ||
FiniteElementSpace | ||
FiniteElementCollection: L2_T1_2D_P1 | ||
VDim: 2 | ||
Ordering: 1 | ||
|
||
-0.50 -0.8660254037844386 | ||
0.00 -0.8660254037844386 | ||
-0.25 -0.4330127018922193 | ||
0.25 -0.4330127018922193 | ||
|
||
0.00 -0.8660254037844386 | ||
0.50 -0.8660254037844386 | ||
0.25 -0.4330127018922193 | ||
0.75 -0.4330127018922193 | ||
|
||
-0.25 -0.4330127018922193 | ||
0.25 -0.4330127018922193 | ||
0.00 0.0 | ||
0.50 0.0 | ||
|
||
0.25 -0.4330127018922193 | ||
0.75 -0.4330127018922193 | ||
0.50 0.0 | ||
1.00 0.0 | ||
|
||
1.00 0.0 | ||
0.75 0.4330127018922193 | ||
0.50 0.0 | ||
0.25 0.4330127018922193 | ||
|
||
0.75 0.4330127018922193 | ||
0.50 0.8660254037844386 | ||
0.25 0.4330127018922193 | ||
0.00 0.8660254037844386 | ||
|
||
0.50 0.0 | ||
0.25 0.4330127018922193 | ||
0.00 0.0 | ||
-0.25 0.4330127018922193 | ||
|
||
0.25 0.4330127018922193 | ||
0.00 0.8660254037844386 | ||
-0.25 0.4330127018922193 | ||
-0.50 0.8660254037844386 | ||
|
||
-0.50 0.8660254037844386 | ||
-0.75 0.4330127018922193 | ||
-0.25 0.4330127018922193 | ||
-0.50 0.0 | ||
|
||
-0.75 0.4330127018922193 | ||
-1.00 0.0 | ||
-0.50 0.0 | ||
-0.75 -0.4330127018922193 | ||
|
||
-0.25 0.4330127018922193 | ||
-0.50 0.0 | ||
0.00 0.0 | ||
-0.25 -0.4330127018922193 | ||
|
||
-0.50 0.0 | ||
-0.75 -0.4330127018922193 | ||
-0.25 -0.4330127018922193 | ||
-0.50 -0.8660254037844386 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
project(transient-heat | ||
DESCRIPTION "Transient Heat Conduction using MFEM + SUNDIALS + HYPRE" | ||
LANGUAGES C) | ||
LANGUAGES C CXX) | ||
|
||
set(CMAKE_C_COMPILER ${MPI_C_COMPILER}) | ||
set(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER}) | ||
|
||
add_executable(transient-heat transient-heat.cpp) | ||
target_link_libraries(transient-heat PRIVATE XSDK::MFEM XSDK::SUNDIALS XSDK::HYPRE PETSC::ALL ZLIB::ZLIB) | ||
|
||
add_executable(advection advection.cpp) | ||
target_link_libraries(advection PRIVATE XSDK::MFEM XSDK::SUNDIALS XSDK::HYPRE PETSC::ALL ZLIB::ZLIB) | ||
|
||
install(TARGETS transient-heat RUNTIME DESTINATION bin) |
Oops, something went wrong.