Skip to content

Commit

Permalink
Merge pull request #1461 from NexGenAnalytics/fix-kokkos-initargs
Browse files Browse the repository at this point in the history
Fix GitHub CI failing on broken `develop`
  • Loading branch information
lucbv authored Jul 13, 2022
2 parents 838ab1f + 0060bcd commit 979cffa
Show file tree
Hide file tree
Showing 24 changed files with 62 additions and 55 deletions.
4 changes: 3 additions & 1 deletion example/graph/KokkosKernels_Example_Distance2GraphColor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,9 @@ int main(int argc, char* argv[]) {
params.use_openmp; // Assumption is that use_openmp variable is provided
// as number of threads
const int device_id = 0;
Kokkos::initialize(Kokkos::InitArguments(num_threads, -1, device_id));
Kokkos::initialize(Kokkos::InitializationSettings()
.set_num_threads(num_threads)
.set_device_id(device_id));

// Print out information about the configuration of the run if verbose_level
// >= 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,9 @@ int main(int argc, char* argv[]) {
params.use_openmp; // Assumption is that use_openmp variable is provided
// as number of threads

Kokkos::initialize(Kokkos::InitArguments(num_threads, -1, device_id));
Kokkos::initialize(Kokkos::InitializationSettings()
.set_num_threads(num_threads)
.set_device_id(device_id));

if (params.verbose) {
Kokkos::print_configuration(std::cout);
Expand Down
4 changes: 3 additions & 1 deletion perf_test/blas/blas1/KokkosBlas_dot_mv_perf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ int main(int argc, char** argv) {

const int num_threads = std::max(params.use_openmp, params.use_threads);

Kokkos::initialize(Kokkos::InitArguments(num_threads, -1, device_id));
Kokkos::initialize(Kokkos::InitializationSettings()
.set_num_threads(num_threads)
.set_device_id(device_id));

bool useThreads = params.use_threads != 0;
bool useOMP = params.use_openmp != 0;
Expand Down
4 changes: 3 additions & 1 deletion perf_test/blas/blas1/KokkosBlas_dot_perf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ int main(int argc, char** argv) {

const int num_threads = std::max(params.use_openmp, params.use_threads);

Kokkos::initialize(Kokkos::InitArguments(num_threads, -1, device_id));
Kokkos::initialize(Kokkos::InitializationSettings()
.set_num_threads(num_threads)
.set_device_id(device_id));

bool useThreads = params.use_threads != 0;
bool useOMP = params.use_openmp != 0;
Expand Down
4 changes: 3 additions & 1 deletion perf_test/blas/blas1/KokkosBlas_team_dot_perf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ int main(int argc, char** argv) {

const int num_threads = std::max(params.use_openmp, params.use_threads);

Kokkos::initialize(Kokkos::InitArguments(num_threads, -1, device_id));
Kokkos::initialize(Kokkos::InitializationSettings()
.set_num_threads(num_threads)
.set_device_id(device_id));

bool useThreads = params.use_threads != 0;
bool useOMP = params.use_openmp != 0;
Expand Down
4 changes: 3 additions & 1 deletion perf_test/blas/blas2/KokkosBlas2_gemv_perf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ int main(int argc, char** argv) {
const int num_threads = std::max(params.use_openmp, params.use_threads);

const int device_id = std::max(params.use_cuda, params.use_hip) - 1;
Kokkos::initialize(Kokkos::InitArguments(num_threads, -1, device_id));
Kokkos::initialize(Kokkos::InitializationSettings()
.set_num_threads(num_threads)
.set_device_id(device_id));

// Create booleans to handle pthreads, openmp and cuda params and initialize
// to true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ int main(int argc, char** argv) {
// as number of threads
const int device_id = params.use_cuda - 1;

Kokkos::initialize(Kokkos::InitArguments(num_threads, -1, device_id));
Kokkos::initialize(Kokkos::InitializationSettings()
.set_num_threads(num_threads)
.set_device_id(device_id));

bool useOMP = params.use_openmp != 0;
bool useCUDA = params.use_cuda != 0;
Expand Down
4 changes: 3 additions & 1 deletion perf_test/graph/KokkosGraph_color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,9 @@ int main(int argc, char **argv) {
params.use_openmp; // Assumption is that use_openmp variable is provided
// as number of threads
const int device_id = std::max(params.use_cuda, params.use_hip) - 1;
Kokkos::initialize(Kokkos::InitArguments(num_threads, -1, device_id));
Kokkos::initialize(Kokkos::InitializationSettings()
.set_num_threads(num_threads)
.set_device_id(device_id));
Kokkos::print_configuration(std::cout);

#if defined(KOKKOS_ENABLE_OPENMP)
Expand Down
4 changes: 3 additions & 1 deletion perf_test/graph/KokkosGraph_color_d2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,9 @@ int main(int argc, char* argv[]) {
device_id = params.use_cuda - 1;
else if (params.use_hip)
device_id = params.use_hip - 1;
Kokkos::initialize(Kokkos::InitArguments(num_threads, -1, device_id));
Kokkos::initialize(Kokkos::InitializationSettings()
.set_num_threads(num_threads)
.set_device_id(device_id));

// Print out verbose information about the configuration of the run.
// Kokkos::print_configuration(std::cout);
Expand Down
10 changes: 6 additions & 4 deletions perf_test/graph/KokkosGraph_triangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,14 @@ int main(int argc, char **argv) {
params.use_openmp; // Assumption is that use_openmp variable is provided
// as number of threads
const int device_id = 0;
Kokkos::initialize(Kokkos::InitArguments(num_threads, -1, device_id));
Kokkos::initialize(Kokkos::InitializationSettings()
.set_num_threads(num_threads)
.set_device_id(device_id));

#if defined(KOKKOS_ENABLE_OPENMP)

if (params.use_openmp) {
Kokkos::OpenMP::print_configuration(std::cout);
Kokkos::OpenMP().print_configuration(std::cout);
#ifdef KOKKOSKERNELS_MULTI_MEM
KokkosKernels::Experiment::run_multi_mem_triangle<
size_type, idx, Kokkos::OpenMP, Kokkos::OpenMP::memory_space,
Expand All @@ -317,7 +319,7 @@ int main(int argc, char **argv) {

#if defined(KOKKOS_ENABLE_CUDA)
if (params.use_cuda) {
Kokkos::Cuda::print_configuration(std::cout);
Kokkos::Cuda().print_configuration(std::cout);
#ifdef KOKKOSKERNELS_MULTI_MEM
KokkosKernels::Experiment::run_multi_mem_triangle<
size_type, idx, Kokkos::Cuda, Kokkos::Cuda::memory_space,
Expand All @@ -333,7 +335,7 @@ int main(int argc, char **argv) {

#if defined(KOKKOS_ENABLE_HIP)
if (params.use_hip) {
Kokkos::Experimental::HIP::print_configuration(std::cout);
Kokkos::Experimental::HIP().print_configuration(std::cout);
KokkosKernels::Experiment::run_multi_mem_triangle<
size_type, idx, Kokkos::Experimental::HIP,
Kokkos::Experimental::HIPSpace, Kokkos::Experimental::HIPSpace>(params);
Expand Down
16 changes: 9 additions & 7 deletions perf_test/sparse/KokkosSparse_block_pcg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,17 +381,19 @@ int main(int argc, char **argv) {
int cmdline[CMD_COUNT];
char *mtx_bin_file = NULL;
int block_size = 5;
struct Kokkos::InitArguments kargs;
struct Kokkos::InitializationSettings kargs;

for (int i = 0; i < CMD_COUNT; ++i) cmdline[i] = 0;

for (int i = 1; i < argc; ++i) {
if (0 == Test::string_compare_no_case(argv[i], "--serial")) {
cmdline[CMD_USE_SERIAL] = 1;
} else if (0 == Test::string_compare_no_case(argv[i], "--threads")) {
kargs.num_threads = cmdline[CMD_USE_THREADS] = atoi(argv[++i]);
cmdline[CMD_USE_THREADS] = atoi(argv[++i]);
kargs.set_num_threads(cmdline[CMD_USE_THREADS]);
} else if (0 == Test::string_compare_no_case(argv[i], "--openmp")) {
kargs.num_threads = cmdline[CMD_USE_OPENMP] = atoi(argv[++i]);
cmdline[CMD_USE_OPENMP] = atoi(argv[++i]);
kargs.set_num_threads(cmdline[CMD_USE_OPENMP]);
} else if (0 == Test::string_compare_no_case(argv[i], "--cuda")) {
cmdline[CMD_USE_CUDA] = 1;
} else if (0 == Test::string_compare_no_case(argv[i], "--mtx")) {
Expand Down Expand Up @@ -435,7 +437,7 @@ int main(int argc, char **argv) {

if (cmdline[CMD_USE_SERIAL]) {
using myExecSpace = Kokkos::Serial;
Kokkos::Serial::print_configuration(std::cout);
myExecSpace().print_configuration(std::cout);

using crsMat_t =
typename KokkosSparse::CrsMatrix<SCALAR_TYPE, INDEX_TYPE, myExecSpace,
Expand All @@ -458,7 +460,7 @@ int main(int argc, char **argv) {

if (cmdline[CMD_USE_THREADS]) {
using myExecSpace = Kokkos::Threads;
Kokkos::Threads::print_configuration(std::cout);
myExecSpace().print_configuration(std::cout);

using crsMat_t =
typename KokkosSparse::CrsMatrix<SCALAR_TYPE, INDEX_TYPE, myExecSpace,
Expand All @@ -481,7 +483,7 @@ int main(int argc, char **argv) {

if (cmdline[CMD_USE_OPENMP]) {
using myExecSpace = Kokkos::OpenMP;
Kokkos::OpenMP::print_configuration(std::cout);
myExecSpace().print_configuration(std::cout);

using crsMat_t =
typename KokkosSparse::CrsMatrix<SCALAR_TYPE, INDEX_TYPE, myExecSpace,
Expand All @@ -504,7 +506,7 @@ int main(int argc, char **argv) {
if (cmdline[CMD_USE_CUDA]) {
// Use the last device:
using myExecSpace = Kokkos::Cuda;
Kokkos::Cuda::print_configuration(std::cout);
myExecSpace().print_configuration(std::cout);

using crsMat_t =
typename KokkosSparse::CrsMatrix<SCALAR_TYPE, INDEX_TYPE, myExecSpace,
Expand Down
17 changes: 8 additions & 9 deletions perf_test/sparse/KokkosSparse_pcg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,17 +370,16 @@ int main(int argc, char **argv) {
return 0;
}

Kokkos::InitArguments init_args; // Construct with default args, change
// members based on exec space
// Construct with default args, change members based on exec space
Kokkos::InitializationSettings init_args;

init_args.device_id = cmdline[CMD_DEVICE];
init_args.set_device_id(cmdline[CMD_DEVICE]);
init_args.set_num_threads(
std::max(cmdline[CMD_USE_THREADS], cmdline[CMD_USE_OPENMP]));
if (cmdline[CMD_USE_NUMA] && cmdline[CMD_USE_CORE_PER_NUMA]) {
init_args.num_threads =
std::max(cmdline[CMD_USE_THREADS], cmdline[CMD_USE_OPENMP]);
init_args.num_numa = cmdline[CMD_USE_NUMA];
} else {
init_args.num_threads =
std::max(cmdline[CMD_USE_THREADS], cmdline[CMD_USE_OPENMP]);
KokkosKernels::Impl::throw_runtime_exception(
"NUMA init arg is no longer supported by Kokkos");
// init_args.num_numa = cmdline[CMD_USE_NUMA];
}

Kokkos::initialize(init_args);
Expand Down
4 changes: 3 additions & 1 deletion perf_test/sparse/KokkosSparse_spadd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,9 @@ int main(int argc, char** argv) {
// as number of threads
const int device_id = params.use_cuda - 1;

Kokkos::initialize(Kokkos::InitArguments(num_threads, -1, device_id));
Kokkos::initialize(Kokkos::InitializationSettings()
.set_num_threads(num_threads)
.set_device_id(device_id));
// Kokkos::print_configuration(std::cout);

// First, make sure that requested TPL (if any) is actually available
Expand Down
4 changes: 3 additions & 1 deletion perf_test/sparse/KokkosSparse_spgemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,9 @@ int main(int argc, char** argv) {
const int device_id =
params.use_cuda ? params.use_cuda - 1 : params.use_hip - 1;

Kokkos::initialize(Kokkos::InitArguments(num_threads, -1, device_id));
Kokkos::initialize(Kokkos::InitializationSettings()
.set_num_threads(num_threads)
.set_device_id(device_id));
Kokkos::print_configuration(std::cout);

#if defined(KOKKOS_ENABLE_OPENMP)
Expand Down
4 changes: 3 additions & 1 deletion perf_test/sparse/KokkosSparse_spgemm_jacobi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ int main(int argc, char** argv) {
const int num_threads = std::max(params.use_openmp, params.use_threads);
const int device_id = params.use_cuda - 1;

Kokkos::initialize(Kokkos::InitArguments(num_threads, -1, device_id));
Kokkos::initialize(Kokkos::InitializationSettings()
.set_num_threads(num_threads)
.set_device_id(device_id));
Kokkos::print_configuration(std::cout);

#if defined(KOKKOS_ENABLE_OPENMP)
Expand Down
2 changes: 0 additions & 2 deletions src/batched/dense/impl/KokkosBatched_Gesv_Impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,6 @@ struct TeamGesv<MemberType, Gesv::StaticPivoting> {
#endif
using ScratchPadMatrixViewType = Kokkos::View<
typename MatrixType::non_const_value_type **,
typename MatrixType::array_layout,
typename MatrixType::execution_space::scratch_memory_space>;

const int n = A.extent(0);
Expand Down Expand Up @@ -682,7 +681,6 @@ struct TeamVectorGesv<MemberType, Gesv::StaticPivoting> {
#endif
using ScratchPadMatrixViewType = Kokkos::View<
typename MatrixType::non_const_value_type **,
typename MatrixType::array_layout,
typename MatrixType::execution_space::scratch_memory_space>;

const int n = A.extent(0);
Expand Down
1 change: 0 additions & 1 deletion src/graph/impl/KokkosGraph_Distance2Color_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
#include <type_traits>

#include <Kokkos_Core.hpp>
#include <Kokkos_UniqueToken.hpp>

#include <KokkosKernels_Uniform_Initialized_MemoryPool.hpp>
#include <KokkosKernels_HashmapAccumulator.hpp>
Expand Down
9 changes: 1 addition & 8 deletions src/sparse/KokkosSparse_csc2csr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,7 @@
*/

#include "KokkosKernels_Utils.hpp"
#include <std_algorithms/Kokkos_BeginEnd.hpp>
#include <std_algorithms/Kokkos_AdjacentDifference.hpp>
#include <std_algorithms/Kokkos_Reduce.hpp>
#include <std_algorithms/Kokkos_TransformReduce.hpp>
#include <std_algorithms/Kokkos_ExclusiveScan.hpp>
#include <std_algorithms/Kokkos_TransformExclusiveScan.hpp>
#include <std_algorithms/Kokkos_InclusiveScan.hpp>
#include <std_algorithms/Kokkos_TransformInclusiveScan.hpp>
#include <Kokkos_StdAlgorithms.hpp>

#ifndef _KOKKOSSPARSE_CSC2CSR_HPP
#define _KOKKOSSPARSE_CSC2CSR_HPP
Expand Down
2 changes: 0 additions & 2 deletions src/sparse/impl/KokkosSparse_spgemm_mkl2phase_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
#endif

#include "KokkosKernels_Utils.hpp"
#include <Kokkos_Concepts.hpp>
#include <vector>

namespace KokkosSparse {
namespace Impl {
Expand Down
4 changes: 0 additions & 4 deletions unit_test/common/Test_Common_set_bit_count.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,9 @@
#include "KokkosKernels_BitUtils.hpp"
#include "KokkosKernels_SimpleUtils.hpp"
#include "KokkosKernels_PrintUtils.hpp"
#include <Kokkos_Concepts.hpp>
#include <string>
#include <stdexcept>

#include <gtest/gtest.h>
#include <Kokkos_Core.hpp>

// const char *input_filename = "sherman1.mtx";
// const char *input_filename = "Si2.mtx";
// const char *input_filename = "wathen_30_30.mtx";
Expand Down
1 change: 0 additions & 1 deletion unit_test/sparse/Test_Sparse_spgemm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@

#include "KokkosSparse_Utils.hpp"
#include "KokkosSparse_SortCrs.hpp"
#include <Kokkos_Concepts.hpp>
#include <string>
#include <stdexcept>

Expand Down
1 change: 0 additions & 1 deletion unit_test/sparse/Test_Sparse_spgemm_jacobi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@

#include "KokkosSparse_Utils.hpp"
#include "KokkosSparse_SortCrs.hpp"
#include <Kokkos_Concepts.hpp>
#include <string>
#include <stdexcept>

Expand Down
1 change: 0 additions & 1 deletion unit_test/sparse/Test_Sparse_spiluk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include <gtest/gtest.h>
#include <Kokkos_Core.hpp>

#include <Kokkos_Concepts.hpp>
#include <string>
#include <stdexcept>

Expand Down
5 changes: 2 additions & 3 deletions unit_test/sparse/Test_Sparse_sptrsv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include <gtest/gtest.h>
#include <Kokkos_Core.hpp>

#include <Kokkos_Concepts.hpp>
#include <string>
#include <stdexcept>

Expand Down Expand Up @@ -122,7 +121,7 @@ void run_test_sptrsv_mtx() {
bool is_lower_tri = true;
std::cout << "Create handle" << std::endl;
kh.create_sptrsv_handle(SPTRSVAlgorithm::SEQLVLSCHD_TP1, nrows, is_lower_tri);

std::cout << "Prepare linear system" << std::endl;
// Create known_lhs, generate rhs, then solve for lhs to compare to known_lhs
ValuesType known_lhs("known_lhs", nrows);
Expand Down Expand Up @@ -239,7 +238,7 @@ void run_test_sptrsv_mtx() {
bool is_lower_tri = false;
std::cout << "Create handle" << std::endl;
kh.create_sptrsv_handle(SPTRSVAlgorithm::SEQLVLSCHD_TP1, nrows, is_lower_tri);

std::cout << "Prepare linear system" << std::endl;
// Create known_lhs, generate rhs, then solve for lhs to compare to known_lhs
ValuesType known_lhs("known_lhs", nrows);
Expand Down

0 comments on commit 979cffa

Please sign in to comment.