Skip to content

Commit

Permalink
Merge Pull Request #12855 from uliegecsm/Trilinos/stokhos_unittest_op…
Browse files Browse the repository at this point in the history
…enmp

Automatically Merged using Trilinos Pull Request AutoTester
PR Title: b'Stokhos: Initialize Kokkos from cml args in unit tests in stokhos'
PR Author: maartenarnst
  • Loading branch information
trilinos-autotester authored Apr 4, 2024
2 parents 1c9277f + 25ea15f commit 28faf46
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,11 @@ TEUCHOS_UNIT_TEST( Kokkos_SG_SpMv, double_OpenMP_CrsMatrixFree_MKL ) {
#endif

int main( int argc, char* argv[] ) {
// Setup the MPI session
Teuchos::GlobalMPISession mpiSession(&argc, &argv);

const size_t team_count =
Kokkos::hwloc::get_available_numa_count() *
Kokkos::hwloc::get_available_cores_per_numa();
const size_t threads_per_team =
Kokkos::hwloc::get_available_threads_per_core();

// Initialize openmp
Kokkos::InitializationSettings init_args;
init_args.set_num_threads(team_count*threads_per_team);
Kokkos::initialize( init_args );
//Kokkos::print_configuration( std::cout );
// Initialize Kokkos
Kokkos::initialize(argc, argv);

// Setup (has to happen after initialization)
setup.setup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,11 @@ TEUCHOS_UNIT_TEST_TEMPLATE_2_DECL(
CRS_MATRIX_MP_VECTOR_MULTIPLY_TESTS_ORDINAL_SCALAR_DEVICE(int, double, OpenMP)

int main( int argc, char* argv[] ) {
// Setup the MPI session
Teuchos::GlobalMPISession mpiSession(&argc, &argv);

// Initialize threads
num_cores =
Kokkos::hwloc::get_available_numa_count() *
Kokkos::hwloc::get_available_cores_per_numa();
num_hyper_threads =
Kokkos::hwloc::get_available_threads_per_core();

Kokkos::InitializationSettings init_args;
init_args.set_num_threads(num_cores*num_hyper_threads);
Kokkos::initialize( init_args );
//Kokkos::print_configuration(std::cout);
// Initialize Kokkos
Kokkos::initialize(argc, argv);

// Run tests
int ret = Teuchos::UnitTestRepository::runUnitTestsFromMain(argc, argv);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,11 @@ using Kokkos::OpenMP;
CRSMATRIX_UQ_PCE_TESTS_DEVICE( OpenMP )

int main( int argc, char* argv[] ) {
// Setup the MPI session
Teuchos::GlobalMPISession mpiSession(&argc, &argv);

// Initialize threads
const size_t num_cores =
Kokkos::hwloc::get_available_numa_count() *
Kokkos::hwloc::get_available_cores_per_numa();
const size_t num_hyper_threads =
Kokkos::hwloc::get_available_threads_per_core();

Kokkos::InitializationSettings init_args;
init_args.set_num_threads(num_cores*num_hyper_threads);
Kokkos::initialize( init_args );
Kokkos::print_configuration(std::cout);
// Initialize Kokkos
Kokkos::initialize(argc, argv);

// Run tests
int ret = Teuchos::UnitTestRepository::runUnitTestsFromMain(argc, argv);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,11 @@ using Kokkos::OpenMP;
VIEW_FAD_MP_VECTOR_TESTS_DEVICE( OpenMP )

int main( int argc, char* argv[] ) {
// Setup the MPI session
Teuchos::GlobalMPISession mpiSession(&argc, &argv);

// Initialize threads
size_t num_cores =
Kokkos::hwloc::get_available_numa_count() *
Kokkos::hwloc::get_available_cores_per_numa();
size_t num_hyper_threads =
Kokkos::hwloc::get_available_threads_per_core();

Kokkos::InitializationSettings init_args;
init_args.set_num_threads(num_cores*num_hyper_threads);
Kokkos::initialize( init_args );
//Kokkos::print_configuration(std::cout);
// Initialize Kokkos
Kokkos::initialize(argc, argv);

// Run tests
int ret = Teuchos::UnitTestRepository::runUnitTestsFromMain(argc, argv);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,11 @@ using Kokkos::OpenMP;
VIEW_MP_VECTOR_TESTS_DEVICE( OpenMP )

int main( int argc, char* argv[] ) {
// Setup the MPI session
Teuchos::GlobalMPISession mpiSession(&argc, &argv);

// Initialize threads
size_t num_cores =
Kokkos::hwloc::get_available_numa_count() *
Kokkos::hwloc::get_available_cores_per_numa();
size_t num_hyper_threads =
Kokkos::hwloc::get_available_threads_per_core();

Kokkos::InitializationSettings init_args;
init_args.set_num_threads(num_cores*num_hyper_threads);
Kokkos::initialize( init_args );
//Kokkos::print_configuration(std::cout);
// Initialize Kokkos
Kokkos::initialize(argc, argv);

// Run tests
int ret = Teuchos::UnitTestRepository::runUnitTestsFromMain(argc, argv);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,11 @@ using Kokkos::OpenMP;
VIEW_UQ_PCE_TESTS_DEVICE( OpenMP )

int main( int argc, char* argv[] ) {
// Setup the MPI session
Teuchos::GlobalMPISession mpiSession(&argc, &argv);

// Initialize threads
const size_t num_cores =
Kokkos::hwloc::get_available_numa_count() *
Kokkos::hwloc::get_available_cores_per_numa();
const size_t num_hyper_threads =
Kokkos::hwloc::get_available_threads_per_core();
// const size_t num_cores = 1;
// const size_t num_hyper_threads = 1;

Kokkos::InitializationSettings init_args;
init_args.set_num_threads(num_cores*num_hyper_threads);
Kokkos::initialize( init_args );
//Kokkos::print_configuration(std::cout);
// Initialize Kokkos
Kokkos::initialize(argc, argv);

// Run tests
int ret = Teuchos::UnitTestRepository::runUnitTestsFromMain(argc, argv);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,13 @@ typedef Tpetra::KokkosCompat::KokkosDeviceWrapperNode<Kokkos::OpenMP> OpenMPWrap
CRSMATRIX_MP_VECTOR_TESTS_N( OpenMPWrapperNode )

int main( int argc, char* argv[] ) {
// Setup the MPI session
Teuchos::GlobalMPISession mpiSession(&argc, &argv);

Kokkos::global_sacado_mp_vector_size = VectorSize;

// Initialize threads
const size_t num_cores =
Kokkos::hwloc::get_available_numa_count() *
Kokkos::hwloc::get_available_cores_per_numa();
const size_t num_hyper_threads =
Kokkos::hwloc::get_available_threads_per_core();
// const size_t num_cores = 1;
// const size_t num_hyper_threads = 1;
Kokkos::InitializationSettings init_args;
init_args.set_num_threads(num_cores*num_hyper_threads);
Kokkos::initialize( init_args );
//Kokkos::print_configuration(std::cout);
// Initialize Kokkos
Kokkos::initialize(argc, argv);

// Run tests
Teuchos::UnitTestRepository::setGloballyReduceTestResult(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,11 @@ typedef Tpetra::KokkosCompat::KokkosDeviceWrapperNode<Kokkos::OpenMP> OpenMPWrap
CRSMATRIX_UQ_PCE_TESTS_N( OpenMPWrapperNode )

int main( int argc, char* argv[] ) {
// Setup the MPI session
Teuchos::GlobalMPISession mpiSession(&argc, &argv);

// Initialize threads
const size_t num_cores =
Kokkos::hwloc::get_available_numa_count() *
Kokkos::hwloc::get_available_cores_per_numa();
const size_t num_hyper_threads =
Kokkos::hwloc::get_available_threads_per_core();
// const size_t num_cores = 1;
// const size_t num_hyper_threads = 1;
Kokkos::InitializationSettings init_args;
init_args.set_num_threads(num_cores*num_hyper_threads);
Kokkos::initialize( init_args );
//Kokkos::print_configuration(std::cout);
// Initialize Kokkos
Kokkos::initialize(argc, argv);

// Run tests
Teuchos::UnitTestRepository::setGloballyReduceTestResult(true);
Expand Down

0 comments on commit 28faf46

Please sign in to comment.