Update Kokkos library in LAMMPS to v3.5.0

This commit is contained in:
Stan Gerald Moore
2021-11-04 12:45:59 -06:00
parent 515ef7bece
commit 564098e629
396 changed files with 21892 additions and 8508 deletions

View File

@ -47,7 +47,8 @@
#include <Kokkos_Macros.hpp>
#if defined(KOKKOS_ENABLE_MPI)
//#define USE_MPI
#if defined(USE_MPI)
#include <mpi.h>
#endif
@ -61,7 +62,7 @@ int main(int argc, char** argv) {
(void)argc;
(void)argv;
#if defined(KOKKOS_ENABLE_MPI)
#if defined(USE_MPI)
MPI_Init(&argc, &argv);
@ -72,7 +73,7 @@ int main(int argc, char** argv) {
msg << "MPI rank(" << mpi_rank << ") ";
#endif
Kokkos::initialize(argc, argv);
msg << "{" << std::endl;
if (Kokkos::hwloc::available()) {
@ -82,15 +83,13 @@ int main(int argc, char** argv) {
<< std::endl;
}
#if defined(KOKKOS_ENABLE_CUDA)
Kokkos::Cuda::print_configuration(msg);
#endif
Kokkos::print_configuration(msg);
msg << "}" << std::endl;
std::cout << msg.str();
#if defined(KOKKOS_ENABLE_MPI)
Kokkos::finalize();
#if defined(USE_MPI)
MPI_Finalize();

View File

@ -107,8 +107,8 @@ int main(int argc, char* argv[]) {
// ViewType aliases for Rank<2>, Rank<3> for example usage
using ScalarType = double;
using ViewType_2D = typename Kokkos::View<ScalarType**>;
using ViewType_3D = typename Kokkos::View<ScalarType***>;
using ViewType_2D = Kokkos::View<ScalarType**>;
using ViewType_3D = Kokkos::View<ScalarType***>;
/////////////////////////////////////////////////////////////////////////////
// Explanation of MDRangePolicy usage, template parameters, constructor
@ -160,8 +160,7 @@ int main(int argc, char* argv[]) {
long incorrect_count_2d = 0;
{
// Rank<2> Case: Rank is provided, all other parameters are default
using MDPolicyType_2D = typename Kokkos::Experimental::MDRangePolicy<
Kokkos::Experimental::Rank<2> >;
using MDPolicyType_2D = Kokkos::MDRangePolicy<Kokkos::Rank<2> >;
// Construct 2D MDRangePolicy: lower and upper bounds provided, tile dims
// defaulted
@ -185,9 +184,8 @@ int main(int argc, char* argv[]) {
long incorrect_count_3d = 0;
{
// Rank<3> Case: Rank, inner iterate pattern, outer iterate pattern provided
using MDPolicyType_3D = typename Kokkos::Experimental::MDRangePolicy<
Kokkos::Experimental::Rank<3, Kokkos::Experimental::Iterate::Left,
Kokkos::Experimental::Iterate::Left> >;
using MDPolicyType_3D = Kokkos::MDRangePolicy<
Kokkos::Rank<3, Kokkos::Iterate::Left, Kokkos::Iterate::Left> >;
// Construct 3D MDRangePolicy: lower, upper bounds, tile dims provided
MDPolicyType_3D mdpolicy_3d({{0, 0, 0}}, {{n, n, n}}, {{4, 4, 4}});

View File

@ -43,7 +43,7 @@
*/
#include <Kokkos_Core.hpp>
#include <impl/Kokkos_Timer.hpp>
#include <Kokkos_Timer.hpp>
#include <cstdio>
// These two View types are both 2-D arrays of double. However, they

View File

@ -43,7 +43,7 @@
*/
#include <Kokkos_Core.hpp>
#include <impl/Kokkos_Timer.hpp>
#include <Kokkos_Timer.hpp>
#include <cstdio>
#include <cstdlib>

View File

@ -49,7 +49,7 @@
// the mesh.
#include <Kokkos_Core.hpp>
#include <impl/Kokkos_Timer.hpp>
#include <Kokkos_Timer.hpp>
#include <cstdio>
using mesh_type = Kokkos::View<double***, Kokkos::LayoutRight>;

View File

@ -44,7 +44,7 @@
#include <Kokkos_Core.hpp>
#include <Kokkos_DualView.hpp>
#include <impl/Kokkos_Timer.hpp>
#include <Kokkos_Timer.hpp>
#include <cstdio>
#include <cstdlib>

View File

@ -44,7 +44,7 @@
#include <Kokkos_Core.hpp>
#include <Kokkos_DualView.hpp>
#include <impl/Kokkos_Timer.hpp>
#include <Kokkos_Timer.hpp>
#include <cstdio>
#include <cstdlib>

View File

@ -46,7 +46,7 @@
#include <cstdio>
#include <typeinfo>
#include <cmath>
#include <impl/Kokkos_Timer.hpp>
#include <Kokkos_Timer.hpp>
struct FillDevice {
double value;

View File

@ -45,7 +45,7 @@
#include <Kokkos_Core.hpp>
#include <Kokkos_Random.hpp>
#include <Kokkos_DualView.hpp>
#include <impl/Kokkos_Timer.hpp>
#include <Kokkos_Timer.hpp>
#include <cstdlib>
using DefaultHostType = Kokkos::HostSpace::execution_space;
@ -74,7 +74,7 @@ using DefaultHostType = Kokkos::HostSpace::execution_space;
template <class GeneratorPool>
struct generate_random {
// Output View for the random numbers
Kokkos::View<uint64_t*> vals;
Kokkos::View<uint64_t**> vals;
// The GeneratorPool
GeneratorPool rand_pool;
@ -82,7 +82,7 @@ struct generate_random {
int samples;
// Initialize all members
generate_random(Kokkos::View<uint64_t*> vals_, GeneratorPool rand_pool_,
generate_random(Kokkos::View<uint64_t**> vals_, GeneratorPool rand_pool_,
int samples_)
: vals(vals_), rand_pool(rand_pool_), samples(samples_) {}
@ -94,8 +94,7 @@ struct generate_random {
// Draw samples numbers from the pool as urand64 between 0 and
// rand_pool.MAX_URAND64 Note there are function calls to get other type of
// scalars, and also to specify Ranges or get a normal distributed float.
for (int k = 0; k < samples; k++)
vals(i * samples + k) = rand_gen.urand64();
for (int k = 0; k < samples; k++) vals(i, k) = rand_gen.urand64();
// Give the state back, which will allow another thread to acquire it
rand_pool.free_state(rand_gen);
@ -103,11 +102,11 @@ struct generate_random {
};
int main(int argc, char* args[]) {
Kokkos::initialize(argc, args);
if (argc != 3) {
printf("Please pass two integers on the command line\n");
} else {
// Initialize Kokkos
Kokkos::initialize(argc, args);
int size = std::stoi(args[1]);
int samples = std::stoi(args[2]);
@ -117,7 +116,7 @@ int main(int argc, char* args[]) {
// pool.
Kokkos::Random_XorShift64_Pool<> rand_pool64(5374857);
Kokkos::Random_XorShift1024_Pool<> rand_pool1024(5374857);
Kokkos::DualView<uint64_t*> vals("Vals", size * samples);
Kokkos::DualView<uint64_t**> vals("Vals", size, samples);
// Run some performance comparisons
Kokkos::Timer timer;
@ -151,8 +150,7 @@ int main(int argc, char* args[]) {
1.0e-9 * samples * size / time_1024);
Kokkos::deep_copy(vals.h_view, vals.d_view);
Kokkos::finalize();
}
Kokkos::finalize();
return 0;
}

View File

@ -44,7 +44,7 @@
#include <Kokkos_Core.hpp>
#include <Kokkos_DualView.hpp>
#include <impl/Kokkos_Timer.hpp>
#include <Kokkos_Timer.hpp>
#include <cstdio>
#include <cstdlib>