Skip to content

Commit

Permalink
Merge pull request #63 from SNLComputation/kokkos_deprecated_fix
Browse files Browse the repository at this point in the history
Kokkos deprecated fix. Resolves issue #62
  • Loading branch information
kuberry committed Jul 16, 2019
2 parents 50da83c + 7b30be1 commit a5af83f
Show file tree
Hide file tree
Showing 13 changed files with 103 additions and 103 deletions.
8 changes: 4 additions & 4 deletions examples/GMLS_Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,16 @@ bool all_passed = true;

// need Kokkos View storing true solution
Kokkos::View<double*, Kokkos::DefaultExecutionSpace> sampling_data_device("samples of true solution",
source_coords_device.dimension_0());
source_coords_device.extent(0));

Kokkos::View<double**, Kokkos::DefaultExecutionSpace> gradient_sampling_data_device("samples of true gradient",
source_coords_device.dimension_0(), dimension);
source_coords_device.extent(0), dimension);

Kokkos::View<double**, Kokkos::DefaultExecutionSpace> divergence_sampling_data_device
("samples of true solution for divergence test", source_coords_device.dimension_0(), dimension);
("samples of true solution for divergence test", source_coords_device.extent(0), dimension);

Kokkos::parallel_for("Sampling Manufactured Solutions", Kokkos::RangePolicy<Kokkos::DefaultExecutionSpace>
(0,source_coords.dimension_0()), KOKKOS_LAMBDA(const int i) {
(0,source_coords.extent(0)), KOKKOS_LAMBDA(const int i) {

// coordinates of source site i
double xval = source_coords_device(i,0);
Expand Down
10 changes: 5 additions & 5 deletions examples/GMLS_Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ bool all_passed = true;
// randomly fill neighbor lists
for (int i=0; i<number_target_coords; i++) {
// int r = gen_num_neighbors(rng);
// assert(r<source_coords.dimension_0()-offset);
// assert(r<source_coords.extent(0)-offset);
int r = max_neighbors;
neighbor_lists(i,0) = r; // number of neighbors is random between max and min

Expand Down Expand Up @@ -162,10 +162,10 @@ bool all_passed = true;


// need Kokkos View storing true solution
Kokkos::View<double*, Kokkos::HostSpace> sampling_data("samples of true solution", source_coords.dimension_0());
Kokkos::View<double**, Kokkos::HostSpace> gradient_sampling_data("samples of true gradient", source_coords.dimension_0(), dimension);
Kokkos::View<double**, Kokkos::LayoutLeft, Kokkos::HostSpace> divergence_sampling_data("samples of true solution for divergence test", source_coords.dimension_0(), dimension);
Kokkos::parallel_for("Sampling Manufactured Solutions", Kokkos::RangePolicy<Kokkos::DefaultHostExecutionSpace>(0,source_coords.dimension_0()), KOKKOS_LAMBDA(const int i) {
Kokkos::View<double*, Kokkos::HostSpace> sampling_data("samples of true solution", source_coords.extent(0));
Kokkos::View<double**, Kokkos::HostSpace> gradient_sampling_data("samples of true gradient", source_coords.extent(0), dimension);
Kokkos::View<double**, Kokkos::LayoutLeft, Kokkos::HostSpace> divergence_sampling_data("samples of true solution for divergence test", source_coords.extent(0), dimension);
Kokkos::parallel_for("Sampling Manufactured Solutions", Kokkos::RangePolicy<Kokkos::DefaultHostExecutionSpace>(0,source_coords.extent(0)), KOKKOS_LAMBDA(const int i) {
double xval = source_coords(i,0);
double yval = (dimension>1) ? source_coords(i,1) : 0;
double zval = (dimension>2) ? source_coords(i,2) : 0;
Expand Down
10 changes: 5 additions & 5 deletions examples/GMLS_Manifold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,18 +196,18 @@ Kokkos::initialize(argc, args);

// need Kokkos View storing true solution (for samples)
Kokkos::View<double*, Kokkos::DefaultExecutionSpace> sampling_data_device("samples of true solution",
source_coords_device.dimension_0());
source_coords_device.extent(0));

Kokkos::View<double*, Kokkos::DefaultExecutionSpace> ones_data_device("samples of ones",
source_coords_device.dimension_0());
source_coords_device.extent(0));
Kokkos::deep_copy(ones_data_device, 1.0);

// need Kokkos View storing true vector solution (for samples)
Kokkos::View<double**, Kokkos::DefaultExecutionSpace> sampling_vector_data_device("samples of vector true solution",
source_coords_device.dimension_0(), 3);
source_coords_device.extent(0), 3);

Kokkos::parallel_for("Sampling Manufactured Solutions", Kokkos::RangePolicy<Kokkos::DefaultExecutionSpace>
(0,source_coords.dimension_0()), KOKKOS_LAMBDA(const int i) {
(0,source_coords.extent(0)), KOKKOS_LAMBDA(const int i) {

// coordinates of source site i
double xval = source_coords_device(i,0);
Expand Down Expand Up @@ -439,7 +439,7 @@ Kokkos::initialize(argc, args);
//auto output_gradient_device_mirror = Kokkos::create_mirror(Kokkos::DefaultExecutionSpace::memory_space(), output_gradient);
//Kokkos::deep_copy(output_gradient_device_mirror, output_gradient);
//Kokkos::parallel_for("Create Velocity From Surface Gradient", Kokkos::RangePolicy<Kokkos::DefaultExecutionSpace>
// (0,target_coords.dimension_0()), KOKKOS_LAMBDA(const int i) {
// (0,target_coords.extent(0)), KOKKOS_LAMBDA(const int i) {
//
// // coordinates of target site i
// double xval = target_coords_device(i,0);
Expand Down
10 changes: 5 additions & 5 deletions examples/GMLS_Manifold_Multiple_Evaluation_Sites.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,17 @@ Kokkos::initialize(argc, args);

// need Kokkos View storing true solution (for samples)
Kokkos::View<double*, Kokkos::DefaultExecutionSpace> sampling_data_device("samples of true solution",
source_coords_device.dimension_0());
source_coords_device.extent(0));
Kokkos::View<double*, Kokkos::DefaultExecutionSpace> ones_data_device("samples of ones",
source_coords_device.dimension_0());
source_coords_device.extent(0));
Kokkos::deep_copy(ones_data_device, 1.0);

// need Kokkos View storing true vector solution (for samples)
Kokkos::View<double**, Kokkos::DefaultExecutionSpace> sampling_vector_data_device("samples of vector true solution",
source_coords_device.dimension_0(), 3);
source_coords_device.extent(0), 3);

Kokkos::parallel_for("Sampling Manufactured Solutions", Kokkos::RangePolicy<Kokkos::DefaultExecutionSpace>
(0,source_coords.dimension_0()), KOKKOS_LAMBDA(const int i) {
(0,source_coords.extent(0)), KOKKOS_LAMBDA(const int i) {

// coordinates of source site i
double xval = source_coords_device(i,0);
Expand Down Expand Up @@ -485,7 +485,7 @@ Kokkos::initialize(argc, args);
//auto output_gradient_device_mirror = Kokkos::create_mirror(Kokkos::DefaultExecutionSpace::memory_space(), output_gradient);
//Kokkos::deep_copy(output_gradient_device_mirror, output_gradient);
//Kokkos::parallel_for("Create Velocity From Surface Gradient", Kokkos::RangePolicy<Kokkos::DefaultExecutionSpace>
// (0,target_coords.dimension_0()), KOKKOS_LAMBDA(const int i) {
// (0,target_coords.extent(0)), KOKKOS_LAMBDA(const int i) {
//
// // coordinates of target site i
// double xval = target_coords_device(i,0);
Expand Down
8 changes: 4 additions & 4 deletions examples/GMLS_Multiple_Evaluation_Sites.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,16 @@ bool all_passed = true;

// need Kokkos View storing true solution
Kokkos::View<double*, Kokkos::DefaultExecutionSpace> sampling_data_device("samples of true solution",
source_coords_device.dimension_0());
source_coords_device.extent(0));

Kokkos::View<double**, Kokkos::DefaultExecutionSpace> gradient_sampling_data_device("samples of true gradient",
source_coords_device.dimension_0(), dimension);
source_coords_device.extent(0), dimension);

Kokkos::View<double**, Kokkos::DefaultExecutionSpace> divergence_sampling_data_device
("samples of true solution for divergence test", source_coords_device.dimension_0(), dimension);
("samples of true solution for divergence test", source_coords_device.extent(0), dimension);

Kokkos::parallel_for("Sampling Manufactured Solutions", Kokkos::RangePolicy<Kokkos::DefaultExecutionSpace>
(0,source_coords.dimension_0()), KOKKOS_LAMBDA(const int i) {
(0,source_coords.extent(0)), KOKKOS_LAMBDA(const int i) {

// coordinates of source site i
double xval = source_coords_device(i,0);
Expand Down
8 changes: 4 additions & 4 deletions examples/GMLS_SmallBatchReuse_Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,16 @@ bool all_passed = true;

// need Kokkos View storing true solution
Kokkos::View<double*, Kokkos::DefaultExecutionSpace> sampling_data_device("samples of true solution",
source_coords_device.dimension_0());
source_coords_device.extent(0));

Kokkos::View<double**, Kokkos::DefaultExecutionSpace> gradient_sampling_data_device("samples of true gradient",
source_coords_device.dimension_0(), dimension);
source_coords_device.extent(0), dimension);

Kokkos::View<double**, Kokkos::DefaultExecutionSpace> divergence_sampling_data_device
("samples of true solution for divergence test", source_coords_device.dimension_0(), dimension);
("samples of true solution for divergence test", source_coords_device.extent(0), dimension);

Kokkos::parallel_for("Sampling Manufactured Solutions", Kokkos::RangePolicy<Kokkos::DefaultExecutionSpace>
(0,source_coords.dimension_0()), KOKKOS_LAMBDA(const int i) {
(0,source_coords.extent(0)), KOKKOS_LAMBDA(const int i) {

// coordinates of source site i
double xval = source_coords_device(i,0);
Expand Down
6 changes: 3 additions & 3 deletions examples/GMLS_Staggered_Manifold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@ Kokkos::initialize(argc, args);

// need Kokkos View storing true solution (for samples)
Kokkos::View<double*, Kokkos::DefaultExecutionSpace> sampling_data_device("samples of true solution",
source_coords_device.dimension_0());
source_coords_device.extent(0));

// need Kokkos View storing true vector solution (for samples)
Kokkos::View<double**, Kokkos::DefaultExecutionSpace> sampling_vector_data_device("samples of vector true solution",
source_coords_device.dimension_0(), 3);
source_coords_device.extent(0), 3);

Kokkos::parallel_for("Sampling Manufactured Solutions", Kokkos::RangePolicy<Kokkos::DefaultExecutionSpace>
(0,source_coords.dimension_0()), KOKKOS_LAMBDA(const int i) {
(0,source_coords.extent(0)), KOKKOS_LAMBDA(const int i) {

// coordinates of source site i
double xval = source_coords_device(i,0);
Expand Down
8 changes: 4 additions & 4 deletions examples/GMLS_Vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,16 @@ bool all_passed = true;

// need Kokkos View storing true solution
Kokkos::View<double*, Kokkos::DefaultExecutionSpace> sampling_data_device("samples of true solution",
source_coords_device.dimension_0());
source_coords_device.extent(0));

Kokkos::View<double**, Kokkos::DefaultExecutionSpace> gradient_sampling_data_device("samples of true gradient",
source_coords_device.dimension_0(), dimension);
source_coords_device.extent(0), dimension);

Kokkos::View<double**, Kokkos::DefaultExecutionSpace> divergence_sampling_data_device
("samples of true solution for divergence test", source_coords_device.dimension_0(), dimension);
("samples of true solution for divergence test", source_coords_device.extent(0), dimension);

Kokkos::parallel_for("Sampling Manufactured Solutions", Kokkos::RangePolicy<Kokkos::DefaultExecutionSpace>
(0,source_coords.dimension_0()), KOKKOS_LAMBDA(const int i) {
(0,source_coords.extent(0)), KOKKOS_LAMBDA(const int i) {

// coordinates of source site i
double xval = source_coords_device(i,0);
Expand Down
2 changes: 1 addition & 1 deletion examples/UnitTest_ThreadedLapack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Kokkos::initialize(argc, args);


// call SVD on all num_matrices
GMLS_LinearAlgebra::batchSVDFactorize(all_P.ptr_on_device(), P_rows, P_cols, all_RHS.ptr_on_device(), RHS_rows, RHS_rows, P_rows, P_cols, num_matrices);
GMLS_LinearAlgebra::batchSVDFactorize(all_P.data(), P_rows, P_cols, all_RHS.data(), RHS_rows, RHS_rows, P_rows, P_cols, num_matrices);


const double tol = 1e-10;
Expand Down
24 changes: 12 additions & 12 deletions src/Compadre_Evaluator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ struct SubviewND {

auto get1DView(const int column_num) -> decltype(Kokkos::subview(_data_in, Kokkos::ALL, column_num)) {
if (!_scalar_as_vector_if_needed) {
compadre_assert_debug((column_num<_data_in.dimension_1()) && "Subview asked for column > second dimension of input data.");
compadre_assert_debug((column_num<_data_in.extent(1)) && "Subview asked for column > second dimension of input data.");
}
if (column_num<_data_in.dimension_1())
if (column_num<_data_in.extent(1))
return Kokkos::subview(_data_in, Kokkos::ALL, column_num);
else // scalar treated as a vector (being reused for each component of the vector input that was expected)
return Kokkos::subview(_data_in, Kokkos::ALL, 0);
Expand All @@ -36,12 +36,12 @@ struct SubviewND {
auto get2DView(const int column_num, const int block_size) -> decltype(Kokkos::subview(_data_in, Kokkos::ALL,
Kokkos::make_pair(column_num*block_size, (column_num+1)*block_size))) {
if (!_scalar_as_vector_if_needed) {
compadre_assert_debug((((column_num+1)*block_size-1)<_data_in.dimension_1()) && "Subview asked for column > second dimension of input data.");
compadre_assert_debug((((column_num+1)*block_size-1)<_data_in.extent(1)) && "Subview asked for column > second dimension of input data.");
}
if (((column_num+1)*block_size-1)<_data_in.dimension_1())
if (((column_num+1)*block_size-1)<_data_in.extent(1))
return Kokkos::subview(_data_in, Kokkos::ALL, Kokkos::make_pair(column_num*block_size, (column_num+1)*block_size));
else
compadre_assert_debug(((block_size-1)<_data_in.dimension_1()) && "Subview asked for column > second dimension of input data.");
compadre_assert_debug(((block_size-1)<_data_in.extent(1)) && "Subview asked for column > second dimension of input data.");
return Kokkos::subview(_data_in, Kokkos::ALL, Kokkos::make_pair(0,block_size));
}

Expand Down Expand Up @@ -214,7 +214,7 @@ class Evaluator {
auto alphas = _gmls->getAlphas();
auto prestencil_weights = _gmls->getPrestencilWeights();

const int num_targets = neighbor_lists.dimension_0(); // one row for each target
const int num_targets = neighbor_lists.extent(0); // one row for each target

// make sure input and output views have same memory space
compadre_assert_debug((std::is_same<typename view_type_data_out::memory_space, typename view_type_data_in::memory_space>::value) &&
Expand Down Expand Up @@ -310,7 +310,7 @@ class Evaluator {

// gather needed information for evaluation
auto neighbor_lists = _gmls->getNeighborLists();
const int num_targets = neighbor_lists.dimension_0(); // one row for each target
const int num_targets = neighbor_lists.extent(0); // one row for each target

auto tangent_directions = _gmls->getTangentDirections();

Expand Down Expand Up @@ -380,7 +380,7 @@ class Evaluator {
auto sro = (problem_type==MANIFOLD && sro_in==VectorPointSample) ? ManifoldVectorPointSample : sro_in;

// create view on whatever memory space the user specified with their template argument when calling this function
output_view_type target_output("output of target operation", neighbor_lists.dimension_0() /* number of targets */,
output_view_type target_output("output of target operation", neighbor_lists.extent(0) /* number of targets */,
output_dimensions);

// make sure input and output columns make sense under the target operation
Expand Down Expand Up @@ -452,7 +452,7 @@ class Evaluator {

// create view on whatever memory space the user specified with their template argument when calling this function
output_view_type ambient_target_output("output of transform to ambient space",
neighbor_lists.dimension_0() /* number of targets */, global_dimensions);
neighbor_lists.extent(0) /* number of targets */, global_dimensions);
auto transformed_output_subview_maker = CreateNDSliceOnDeviceView(ambient_target_output, false);
// output will always be the correct dimension
for (int i=0; i<global_dimensions; ++i) {
Expand Down Expand Up @@ -507,7 +507,7 @@ class Evaluator {
// hold a 0 when the input index is greater than 0
// this can be detected for the polynomial coefficients by noticing that the input_component_axis_1 is greater than 0,
// but the offset this would produce into the coefficients matrix is larger than its dimensions
auto max_num_neighbors = (neighbor_lists.dimension_1() - 1);
auto max_num_neighbors = (neighbor_lists.extent(1) - 1);
if (input_component_axis_1*max_num_neighbors >= coefficient_matrix_tile_size) return;

auto global_dimensions = _gmls->getGlobalDimensions();
Expand All @@ -517,7 +517,7 @@ class Evaluator {
auto tangent_directions = _gmls->getTangentDirections();
auto prestencil_weights = _gmls->getPrestencilWeights();

const int num_targets = neighbor_lists.dimension_0(); // one row for each target
const int num_targets = neighbor_lists.extent(0); // one row for each target

// make sure input and output views have same memory space
compadre_assert_debug((std::is_same<typename view_type_data_out::memory_space, typename view_type_data_in::memory_space>::value) &&
Expand Down Expand Up @@ -664,7 +664,7 @@ class Evaluator {
const SamplingFunctional sro = _gmls->getDataSamplingFunctional();

// create view on whatever memory space the user specified with their template argument when calling this function
output_view_type coefficient_output("output coefficients", neighbor_lists.dimension_0() /* number of targets */,
output_view_type coefficient_output("output coefficients", neighbor_lists.extent(0) /* number of targets */,
output_dimensions*_gmls->getPolynomialCoefficientsSize() /* number of coefficients */);

// make sure input and output columns make sense under the target operation
Expand Down

0 comments on commit a5af83f

Please sign in to comment.