Skip to content

Commit

Permalink
Remove CUDA code and replace it with Kokkos
Browse files Browse the repository at this point in the history
  • Loading branch information
Rombur committed Jan 24, 2024
1 parent 22b1499 commit c259303
Show file tree
Hide file tree
Showing 31 changed files with 454 additions and 780 deletions.
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ project(adamantine LANGUAGES CXX VERSION 0.1.0)
include(SetupTPLs)
include(SetupAdamantine)

if (ADAMANTINE_ENABLE_CUDA)
enable_language(CUDA)
endif()

add_subdirectory(application)
add_subdirectory(source)

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ The list of configuration options is:
* ADAMANTINE\_ENABLE\_ADIAK=ON/OFF
* ADAMANTINE\_ENABLE\_CALIPER=ON/OFF
* ADAMANTINE\_ENABLE\_COVERAGE=ON/OFF
* ADAMANTINE\_ENABLE\_CUDA=ON/OFF
* ADAMANTINE\_ENABLE\_TESTS=ON/OFF
* BOOST\_DIR=/path/to/boost
* CMAKE\_BUILD\_TYPE=Debug/Release
Expand Down
25 changes: 6 additions & 19 deletions application/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
# Create adamantine executable and link against the static library.
if (ADAMANTINE_ENABLE_CUDA)
add_executable(adamantine adamantine.cu)
target_compile_definitions(adamantine PRIVATE ADAMANTINE_HAVE_CUDA)
set_target_properties(adamantine PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
CUDA_SEPARABLE_COMPILATION ON
CUDA_STANDARD 17
CUDA_STANDARD_REQUIRED ON
)
else()
add_executable(adamantine adamantine.cc)
set_target_properties(adamantine PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
)
endif()
add_executable(adamantine adamantine.cc)
set_target_properties(adamantine PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
)

DEAL_II_SETUP_TARGET(adamantine)
target_link_libraries(adamantine Adamantine)
Expand Down
62 changes: 54 additions & 8 deletions application/adamantine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include "adamantine.hh"

#include "utils.hh"
#include <validate_input_database.hh>

#ifdef ADAMANTINE_WITH_ADIAK
Expand Down Expand Up @@ -39,7 +38,6 @@ int main(int argc, char *argv[])
adiak::cmdline();
adiak::clustername();
adiak::jobsize();
adiak::value("MemorySpace", "Host");
#endif

std::vector<adamantine::Timer> timers;
Expand Down Expand Up @@ -123,20 +121,49 @@ int main(int argc, char *argv[])

unsigned int rank = dealii::Utilities::MPI::this_mpi_process(communicator);

// PropertyTreeInput memory_space
std::string memory_space =
database.get<std::string>("memory_space", "host");

#ifdef ADAMANTINE_WITH_ADIAK
if (memory_space == "device")
adiak::value("MemorySpace", "Device");
else
adiak::value("MemorySpace", "Host");
#endif

if (dim == 2)
{
if (ensemble_calc)
{
if (rank == 0)
std::cout << "Starting ensemble simulation" << std::endl;
run_ensemble<2, dealii::MemorySpace::Host>(communicator, database,
timers);
if (memory_space == "device")
{
// TODO: Add device version of run_ensemble and call it here
adamantine::ASSERT_THROW(
false, "Error: Device version of ensemble simulations not "
"yet implemented.");
}
else
{
run_ensemble<2, dealii::MemorySpace::Host>(communicator, database,
timers);
}
}
else
{
if (rank == 0)
std::cout << "Starting non-ensemble simulation" << std::endl;
run<2, dealii::MemorySpace::Host>(communicator, database, timers);

if (memory_space == "device")
{
run<2, dealii::MemorySpace::Default>(communicator, database, timers);
}
else
{
run<2, dealii::MemorySpace::Host>(communicator, database, timers);
}
}
}
else
Expand All @@ -145,14 +172,33 @@ int main(int argc, char *argv[])
{
if (rank == 0)
std::cout << "Starting ensemble simulation" << std::endl;
run_ensemble<3, dealii::MemorySpace::Host>(communicator, database,
timers);

if (memory_space == "device")
{
// TODO: Add device version of run_ensemble and call it here
adamantine::ASSERT_THROW(
false, "Error: Device version of ensemble simulations not "
"yet implemented.");
}
else
{
run_ensemble<3, dealii::MemorySpace::Host>(communicator, database,
timers);
}
}
else
{
if (rank == 0)
std::cout << "Starting non-ensemble simulation" << std::endl;
run<3, dealii::MemorySpace::Host>(communicator, database, timers);

if (memory_space == "device")
{
run<3, dealii::MemorySpace::Default>(communicator, database, timers);
}
else
{
run<3, dealii::MemorySpace::Host>(communicator, database, timers);
}
}
}

Expand Down
236 changes: 0 additions & 236 deletions application/adamantine.cu

This file was deleted.

0 comments on commit c259303

Please sign in to comment.