Update Kokkos library to r2.6.00
This commit is contained in:
@ -35,7 +35,7 @@
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Questions? Contact H. Carter Edwards (hcedwar@sandia.gov)
|
||||
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
|
||||
//
|
||||
// ************************************************************************
|
||||
//@HEADER
|
||||
@ -73,8 +73,8 @@ struct init_view {
|
||||
// access on a for optimal performance. I.e. a should be LayoutRight.
|
||||
// On GPUs threads should do coalesced loads and stores. That means
|
||||
// that i should be the stride one access for optimal performance.
|
||||
for (typename ViewType::size_type j = 0; j < a.dimension_1 (); ++j) {
|
||||
a(i,j) = 1.0*a.dimension_0()*i + 1.0*j;
|
||||
for (typename ViewType::size_type j = 0; j < a.extent(1); ++j) {
|
||||
a(i,j) = 1.0*a.extent(0)*i + 1.0*j;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -104,7 +104,7 @@ struct contraction {
|
||||
// LayoutLeft and v2 LayoutRight.
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator() (const view_type::size_type i) const {
|
||||
for (view_type::size_type j = 0; j < v1.dimension_1 (); ++j) {
|
||||
for (view_type::size_type j = 0; j < v1.extent(1); ++j) {
|
||||
a(i) = v1(i,j)*v2(j,i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Questions? Contact H. Carter Edwards (hcedwar@sandia.gov)
|
||||
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
|
||||
//
|
||||
// ************************************************************************
|
||||
//@HEADER
|
||||
@ -87,10 +87,10 @@ struct localsum {
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator() (const int i) const {
|
||||
double tmp = 0.0;
|
||||
for (int j = 0; j < (int) idx.dimension_1 (); ++j) {
|
||||
for (int j = 0; j < (int) idx.extent(1); ++j) {
|
||||
// This is an indirect access on src
|
||||
const double val = src(idx(i,j));
|
||||
tmp += val*val + 0.5*(idx.dimension_0()*val -idx.dimension_1()*val);
|
||||
tmp += val*val + 0.5*(idx.extent(0)*val -idx.extent(1)*val);
|
||||
}
|
||||
dest(i) = tmp;
|
||||
}
|
||||
@ -110,7 +110,7 @@ int main(int narg, char* arg[]) {
|
||||
srand(134231);
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
for (view_type::size_type j = 0; j < h_idx.dimension_1 (); ++j) {
|
||||
for (view_type::size_type j = 0; j < h_idx.extent(1); ++j) {
|
||||
h_idx(i,j) = (size + i + (rand () % 500 - 250)) % size;
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Questions? Contact H. Carter Edwards (hcedwar@sandia.gov)
|
||||
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
|
||||
//
|
||||
// ************************************************************************
|
||||
//@HEADER
|
||||
@ -81,7 +81,7 @@ struct set_boundary {
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator() (const typename ViewType::size_type i) const {
|
||||
for (typename ViewType::size_type j = 0; j < a.dimension_1 (); ++j) {
|
||||
for (typename ViewType::size_type j = 0; j < a.extent(1); ++j) {
|
||||
a(i,j) = value;
|
||||
}
|
||||
}
|
||||
@ -102,8 +102,8 @@ struct set_inner {
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator () (const typename ViewType::size_type i) const {
|
||||
typedef typename ViewType::size_type size_type;
|
||||
for (size_type j = 0; j < a.dimension_1 (); ++j) {
|
||||
for (size_type k = 0; k < a.dimension_2 (); ++k) {
|
||||
for (size_type j = 0; j < a.extent(1); ++j) {
|
||||
for (size_type k = 0; k < a.extent(2); ++k) {
|
||||
a(i,j,k) = value;
|
||||
}
|
||||
}
|
||||
@ -125,8 +125,8 @@ struct update {
|
||||
void operator() (typename ViewType::size_type i) const {
|
||||
typedef typename ViewType::size_type size_type;
|
||||
i++;
|
||||
for (size_type j = 1; j < a.dimension_1()-1; j++) {
|
||||
for (size_type k = 1; k < a.dimension_2()-1; k++) {
|
||||
for (size_type j = 1; j < a.extent(1)-1; j++) {
|
||||
for (size_type k = 1; k < a.extent(2)-1; k++) {
|
||||
a(i,j,k) += dt* (a(i,j,k+1) - a(i,j,k-1) +
|
||||
a(i,j+1,k) - a(i,j-1,k) +
|
||||
a(i+1,j,k) - a(i-1,j,k));
|
||||
@ -170,19 +170,19 @@ int main (int narg, char* arg[]) {
|
||||
yz_plane_type Xpos_halo = subview(A, 101, ALL (), ALL ());
|
||||
|
||||
// Set the boundaries to their initial conditions.
|
||||
parallel_for (Zneg_halo.dimension_0 (), set_boundary<xy_plane_type> (Zneg_halo, 1));
|
||||
parallel_for (Zpos_halo.dimension_0 (), set_boundary<xy_plane_type> (Zpos_halo, -1));
|
||||
parallel_for (Yneg_halo.dimension_0 (), set_boundary<xz_plane_type> (Yneg_halo, 2));
|
||||
parallel_for (Ypos_halo.dimension_0 (), set_boundary<xz_plane_type> (Ypos_halo, -2));
|
||||
parallel_for (Xneg_halo.dimension_0 (), set_boundary<yz_plane_type> (Xneg_halo, 3));
|
||||
parallel_for (Xpos_halo.dimension_0 (), set_boundary<yz_plane_type> (Xpos_halo, -3));
|
||||
parallel_for (Zneg_halo.extent(0), set_boundary<xy_plane_type> (Zneg_halo, 1));
|
||||
parallel_for (Zpos_halo.extent(0), set_boundary<xy_plane_type> (Zpos_halo, -1));
|
||||
parallel_for (Yneg_halo.extent(0), set_boundary<xz_plane_type> (Yneg_halo, 2));
|
||||
parallel_for (Ypos_halo.extent(0), set_boundary<xz_plane_type> (Ypos_halo, -2));
|
||||
parallel_for (Xneg_halo.extent(0), set_boundary<yz_plane_type> (Xneg_halo, 3));
|
||||
parallel_for (Xpos_halo.extent(0), set_boundary<yz_plane_type> (Xpos_halo, -3));
|
||||
|
||||
// Set the interior of the mesh to its initial condition.
|
||||
parallel_for (Ai.dimension_0 (), set_inner<inner_mesh_type> (Ai, 0));
|
||||
parallel_for (Ai.extent(0), set_inner<inner_mesh_type> (Ai, 0));
|
||||
|
||||
// Update the interior of the mesh.
|
||||
// This simulates one timestep with dt = 0.1.
|
||||
parallel_for (Ai.dimension_0 (), update<mesh_type> (A, 0.1));
|
||||
parallel_for (Ai.extent(0), update<mesh_type> (A, 0.1));
|
||||
|
||||
printf ("Done\n");
|
||||
Kokkos::finalize ();
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Questions? Contact H. Carter Edwards (hcedwar@sandia.gov)
|
||||
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
|
||||
//
|
||||
// ************************************************************************
|
||||
//@HEADER
|
||||
@ -127,9 +127,9 @@ struct localsum {
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator() (const int i) const {
|
||||
double tmp = 0.0;
|
||||
for (int j = 0; j < (int) idx.dimension_1(); ++j) {
|
||||
for (int j = 0; j < (int) idx.extent(1); ++j) {
|
||||
const double val = src(idx(i,j));
|
||||
tmp += val*val + 0.5*(idx.dimension_0()*val -idx.dimension_1()*val);
|
||||
tmp += val*val + 0.5*(idx.extent(0)*val -idx.extent(1)*val);
|
||||
}
|
||||
dest(i) += tmp;
|
||||
}
|
||||
@ -173,7 +173,7 @@ int main (int narg, char* arg[]) {
|
||||
// idx.view<idx_type::host_mirror_space>() )
|
||||
idx_type::t_host h_idx = idx.h_view;
|
||||
for (int i = 0; i < size; ++i) {
|
||||
for (view_type::size_type j = 0; j < h_idx.dimension_1 (); ++j) {
|
||||
for (view_type::size_type j = 0; j < h_idx.extent(1); ++j) {
|
||||
h_idx(i,j) = (size + i + (rand () % 500 - 250)) % size;
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Questions? Contact H. Carter Edwards (hcedwar@sandia.gov)
|
||||
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
|
||||
//
|
||||
// ************************************************************************
|
||||
//@HEADER
|
||||
@ -72,9 +72,9 @@ struct localsum {
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator() (int i) const {
|
||||
double tmp = 0.0;
|
||||
for(int j = 0; j < int(idx.dimension_1()); j++) {
|
||||
for(int j = 0; j < int(idx.extent(1)); j++) {
|
||||
const double val = src(idx(i,j));
|
||||
tmp += val*val + 0.5*(idx.dimension_0()*val -idx.dimension_1()*val);
|
||||
tmp += val*val + 0.5*(idx.extent(0)*val -idx.extent(1)*val);
|
||||
}
|
||||
dest(i) += tmp;
|
||||
}
|
||||
@ -96,7 +96,7 @@ int main(int narg, char* arg[]) {
|
||||
|
||||
// When using UVM Cuda views can be accessed on the Host directly
|
||||
for(int i=0; i<size; i++) {
|
||||
for(int j=0; j<int(idx.dimension_1()); j++)
|
||||
for(int j=0; j<int(idx.extent(1)); j++)
|
||||
idx(i,j) = (size + i + (rand()%500 - 250))%size;
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Questions? Contact H. Carter Edwards (hcedwar@sandia.gov)
|
||||
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
|
||||
//
|
||||
// ************************************************************************
|
||||
//@HEADER
|
||||
|
||||
Reference in New Issue
Block a user