Skip to content

Commit

Permalink
make test_field_acc run again, albeit with a bad cuda->openacc C++/API
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrdar committed Mar 18, 2024
1 parent 75dc213 commit 69bab3f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/tests/field/test_field_acc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,20 @@ CASE("test_field_acc") {

auto view = array::make_view<double,2>(field);
double* cpu_ptr = static_cast<double*>(view.data());
cpu_ptr[0] = 1.;
cpu_ptr[view.index(3,2)] = 1.;

field.updateDevice();

std::cerr << cpu_ptr << std::endl;
#pragma acc kernels present(cpu_ptr)
{
cpu_ptr[0] = 2.;
cpu_ptr[view.index(3,2)] = 2.;
}

field.updateHost();

std::cout << "field_v = " << view(0,0) << std::endl;
EXPECT_EQ( cpu_ptr[0], 2. );
EXPECT_EQ( view(0,0), 2. );
std::cout << "field(3,2) = " << view(3,2) << std::endl;
EXPECT_EQ( cpu_ptr[view.index(3,2)], 2. );
EXPECT_EQ( view(3,2), 2. );
}

//-----------------------------------------------------------------------------
Expand Down

0 comments on commit 69bab3f

Please sign in to comment.