Skip to content

Commit

Permalink
compile without cuda
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpintarelli committed Aug 28, 2022
1 parent fcfd605 commit 9fd50ce
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 190 deletions.
22 changes: 8 additions & 14 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ NLCGLIB_SETUP_TARGET(test3)
add_executable(test_traits test_traits.cpp)
NLCGLIB_SETUP_TARGET(test_traits)

add_executable(test_kokkos test_kokkos.cpp)
NLCGLIB_SETUP_TARGET(test_kokkos)

add_executable(test_view test_view.cpp)
NLCGLIB_SETUP_TARGET(test_view)

add_executable(test_gpu test_gpu.cpp)
NLCGLIB_SETUP_TARGET(test_gpu)

Expand All @@ -28,14 +22,14 @@ NLCGLIB_SETUP_TARGET(test_solver)
add_executable(test_mvector_cuda test_mvector_cuda.cpp)
NLCGLIB_SETUP_TARGET(test_mvector_cuda)

add_executable(test_deep_copy test_deep_copy.cpp)
NLCGLIB_SETUP_TARGET(test_deep_copy)

add_executable(test_smearing test_smearing.cpp)
NLCGLIB_SETUP_TARGET(test_smearing)

add_executable(test_nvcc test_nvcc.cpp)
NLCGLIB_SETUP_TARGET(test_nvcc)

add_executable(test_check_alignment test_check_alignment.cpp)
NLCGLIB_SETUP_TARGET(test_check_alignment)
if(USE_CUDA)
add_executable(test_deep_copy test_deep_copy.cpp)
NLCGLIB_SETUP_TARGET(test_deep_copy)
add_executable(test_view test_view.cpp)
NLCGLIB_SETUP_TARGET(test_view)
add_executable(test_nvcc test_nvcc.cpp)
NLCGLIB_SETUP_TARGET(test_nvcc)
endif()
9 changes: 9 additions & 0 deletions test/test_gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <iostream>
#include <random>

#ifdef __NLCGLIB__CUDA
#include "cudaProfiler.h"

using namespace nlcglib;
Expand Down Expand Up @@ -71,3 +72,11 @@ int main(int argc, char *argv[])
Communicator::finalize();
return 0;
}
#else
int main(int argc, char *argv[])
{

return 0;
}

#endif
170 changes: 0 additions & 170 deletions test/test_kokkos.cpp

This file was deleted.

12 changes: 8 additions & 4 deletions test/test_mvector_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "smearing.hpp"
#include "la/mvector.hpp"


#ifdef __NLCGLIB__CUDA
void run()
{
int n = 10;
Expand All @@ -22,14 +22,18 @@ void run()

vector_t copy(a_view);

double foo = 1;
double f = 1;

Kokkos::parallel_for(
"scale", Kokkos::RangePolicy<Kokkos::Cuda>(0, a_view.size()), KOKKOS_LAMBDA(int i) {
a_view(i) = foo / sqrt(a_view(i));
a_view(i) = f / sqrt(a_view(i));
});
}

#else
void run()
{
}
#endif

int
main(int argc, char *argv[])
Expand Down
2 changes: 2 additions & 0 deletions test/test_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ int main(int argc, char *argv[])
std::cout << "run on HOST" << "\n";
run_unmanaged<Kokkos::HostSpace>();

#ifdef __NLCGLIB__CUDA
std::cout << "run on DEVICE"
<< "\n";
run_unmanaged<Kokkos::CudaSpace>();
#endif

// std::cout << "run non GPU" << "\n";
// run_unmanaged<Kokkos::CudaSpace>();
Expand Down
4 changes: 2 additions & 2 deletions unit_tests/local/test_la_wrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ TEST_F(CPUKokkosVectors, TransformCPU)
std::cout << "\n";
}


#ifdef __NLCGLIB__CUDA
class GPUKokkosVectors : public ::testing::Test
{
public:
Expand Down Expand Up @@ -268,7 +268,7 @@ TEST(EigenValues, EigHermitian)
EXPECT_NEAR(wh(i), eigs[i], 1e-8);
}
}

#endif /* CUDA */

int
main(int argc, char *argv[])
Expand Down
6 changes: 6 additions & 0 deletions unit_tests/local/test_solver_wrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ void TestSymSolve<T>::SetUp()
}

// https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#typed-tests

#ifdef __NLCGLIB__CUDA
using KokkosMemTypes = ::testing::Types<Kokkos::CudaSpace, Kokkos::HostSpace>;
#else
using KokkosMemTypes = ::testing::Types<Kokkos::HostSpace>;
#endif

// TYPED_TEST_SUITE_P(TestSymSolve);
TYPED_TEST_CASE(TestSymSolve, KokkosMemTypes);

Expand Down

0 comments on commit 9fd50ce

Please sign in to comment.