-
Notifications
You must be signed in to change notification settings - Fork 88
/
unit_tests.C
73 lines (62 loc) · 2.54 KB
/
unit_tests.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright 2017 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS), National Renewable Energy Laboratory, University of Texas Austin,
// Northwest Research Associates. Under the terms of Contract DE-NA0003525
// with NTESS, the U.S. Government retains certain rights in this software.
//
// This software is released under the BSD 3-clause license. See LICENSE file
// for more details.
//
#include "gtest/gtest.h" // for InitGoogleTest, etc
#include "mpi.h" // for MPI_Comm_rank, MPI_Finalize, etc
#include "Kokkos_Core.hpp"
#include "stk_util/parallel/Parallel.hpp"
#include "NaluVersionInfo.h"
#include "NaluEnv.h"
#include "master_element/MasterElementRepo.h"
int
main(int argc, char** argv)
{
MPI_Init(&argc, &argv);
sierra::nalu::NaluEnv::self();
Kokkos::initialize(argc, argv);
int returnVal = 0;
#if defined(KOKKOS_ENABLE_CUDA)
const size_t nalu_stack_size = 16384;
cudaDeviceSetLimit(cudaLimitStackSize, nalu_stack_size);
#elif defined(KOKKOS_ENABLE_HIP)
const size_t nalu_stack_size = 16384;
hipError_t err = hipDeviceSetLimit(hipLimitStackSize, nalu_stack_size);
if (err != hipSuccess) {
/*
This might be useful at some point so keeping it and commenting out.
sierra::nalu::NaluEnv::self().naluOutputP0()
<< __FILE__ << " " << __FUNCTION__ << " " << __LINE__
<< " : Failure " << hipGetErrorString(err) << " in hipDeviceSetLimit\n"
<< std::endl;
*/
}
#endif
// Create a dummy nested scope to ensure destructors are called before
// Kokkos::finalize_all. The instances owning threaded Kokkos loops must be
// cleared out before Kokkos::finalize is called.
{
// clang-format off
namespace version = sierra::nalu::version;
sierra::nalu::NaluEnv::self().naluOutputP0()
<< " Nalu-Wind Version: " << version::NaluVersionTag << std::endl
<< " Nalu-Wind GIT Commit SHA: " << version::NaluGitCommitSHA
<< ((version::RepoIsDirty == "DIRTY") ? ("-" + version::RepoIsDirty) : "") << std::endl
<< " Trilinos Version: " << version::TrilinosVersionTag << std::endl << std::endl;
// clang-format on
testing::InitGoogleTest(&argc, argv);
returnVal = RUN_ALL_TESTS();
// Force deallocation of all MasterElements created. This is necessary
// when specific unit tests are run using the gtest_filter option that
// provides no mechanism for call the destructors of the master elements
// created for those tests.
sierra::nalu::MasterElementRepo::clear();
}
Kokkos::finalize();
MPI_Finalize();
return returnVal;
}