Commit 16b53158 authored by Stan Moore's avatar Stan Moore
Browse files

Update Kokkos to v2.04.11

parent 39df9f5d
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
# Change Log
## [2.04.11](https://github.com/kokkos/kokkos/tree/2.04.11) (2017-10-28)
[Full Changelog](https://github.com/kokkos/kokkos/compare/2.04.04...2.04.11)

**Implemented enhancements:**

- Add Subview pattern. [\#648](https://github.com/kokkos/kokkos/issues/648)
- Add Kokkos "global" is\_initialized [\#1060](https://github.com/kokkos/kokkos/issues/1060)
- Add create\_mirror\_view\_and\_copy [\#1161](https://github.com/kokkos/kokkos/issues/1161)
- Add KokkosConcepts SpaceAccessibility function [\#1092](https://github.com/kokkos/kokkos/issues/1092)
- Option to Disable Initialize Warnings [\#1142](https://github.com/kokkos/kokkos/issues/1142)
- Mature task-DAG capability [\#320](https://github.com/kokkos/kokkos/issues/320)
- Promote Work DAG from experimental [\#1126](https://github.com/kokkos/kokkos/issues/1126)
- Implement new WorkGraph push/pop [\#1108](https://github.com/kokkos/kokkos/issues/1108)
- Kokkos\_ENABLE\_Cuda\_Lambda should default ON [\#1101](https://github.com/kokkos/kokkos/issues/1101)
- Add multidimensional parallel for example and improve unit test [\#1064](https://github.com/kokkos/kokkos/issues/1064)
- Fix ROCm:  Performance tests not building [\#1038](https://github.com/kokkos/kokkos/issues/1038)
- Make KOKKOS\_ALIGN\_SIZE a configure-time option [\#1004](https://github.com/kokkos/kokkos/issues/1004)
- Make alignment consistent [\#809](https://github.com/kokkos/kokkos/issues/809)
- Improve subview construction on Cuda backend [\#615](https://github.com/kokkos/kokkos/issues/615)

**Fixed bugs:**

- Kokkos::vector fixes for application [\#1134](https://github.com/kokkos/kokkos/issues/1134)
- DynamicView non-power of two value\_type [\#1177](https://github.com/kokkos/kokkos/issues/1177)
- Memory pool bug [\#1154](https://github.com/kokkos/kokkos/issues/1154)
- Cuda launch bounds performance regression bug [\#1140](https://github.com/kokkos/kokkos/issues/1140)
- Significant performance regression in LAMMPS after updating Kokkos [\#1139](https://github.com/kokkos/kokkos/issues/1139)
- CUDA compile error [\#1128](https://github.com/kokkos/kokkos/issues/1128)
- MDRangePolicy neg idx test failure in debug mode [\#1113](https://github.com/kokkos/kokkos/issues/1113)
- subview construction on Cuda backend [\#615](https://github.com/kokkos/kokkos/issues/615)

## [2.04.04](https://github.com/kokkos/kokkos/tree/2.04.04) (2017-09-11)
[Full Changelog](https://github.com/kokkos/kokkos/compare/2.04.00...2.04.04)
+36 −2
Original line number Diff line number Diff line
@@ -33,6 +33,24 @@ TRIBITS_PACKAGE_DECL(Kokkos) # ENABLE_SHADOWING_WARNINGS)
# HAVE_KOKKOS_DEBUG.  We define KOKKOS_HAVE_DEBUG here instead,
# for compatibility with Kokkos' Makefile build system.

if (TPL_ENABLE_CUDA)
  if (DEFINED CUDA_VERSION)
    # there is a VERSION_GREATER_EQUAL, but only in CMake >= 3.7
    if (CUDA_VERSION VERSION_EQUAL "7.5")
      set(KOKKOS_HAVE_CUDA_GEQ_75 TRUE)
    endif()
    if (CUDA_VERSION VERSION_GREATER "7.5")
      set(KOKKOS_HAVE_CUDA_GEQ_75 TRUE)
    endif()
    if (CUDA_VERSION VERSION_EQUAL "8.0")
      set(KOKKOS_HAVE_CUDA_GEQ_80 TRUE)
    endif()
    if (CUDA_VERSION VERSION_GREATER "8.0")
      set(KOKKOS_HAVE_CUDA_GEQ_80 TRUE)
    endif()
  endif()
endif()

TRIBITS_ADD_OPTION_AND_DEFINE(
  Kokkos_ENABLE_DEBUG
  KOKKOS_HAVE_DEBUG
@@ -51,7 +69,7 @@ TRIBITS_ADD_OPTION_AND_DEFINE(
  Kokkos_ENABLE_Cuda
  KOKKOS_HAVE_CUDA
  "Enable CUDA support in Kokkos."
  "${TPL_ENABLE_CUDA}"
  "${KOKKOS_HAVE_CUDA_TPL}"
  )

TRIBITS_ADD_OPTION_AND_DEFINE(
@@ -68,11 +86,27 @@ TRIBITS_ADD_OPTION_AND_DEFINE(
  OFF
  )

set(Kokkos_ENABLE_Cuda_Lambda_DEFAULT OFF)
if (Kokkos_ENABLE_Cuda)
  if (KOKKOS_HAVE_CUDA_GEQ_75)
    if (CMAKE_CXX_FLAGS MATCHES "-expt-extended-lambda")
      set(Kokkos_ENABLE_Cuda_Lambda_DEFAULT ON)
      message("-- CUDA version is >= 7.5 and CMAKE_CXX_FLAGS contains -expt-extended-lambda,")
      message("--   Kokkos_ENABLE_Cuda_Lambda defaults to ON")
    else()
      message("-- CMAKE_CXX_FLAGS doesn't contain -expt-extended-lambda,")
      message("--   Kokkos_ENABLE_Cuda_Lambda defaults to OFF")
    endif()
  else()
    message("-- CUDA version is < 7.5, Kokkos_ENABLE_Cuda_Lambda defaults to OFF")
  endif()
endif()

TRIBITS_ADD_OPTION_AND_DEFINE(
  Kokkos_ENABLE_Cuda_Lambda
  KOKKOS_HAVE_CUDA_LAMBDA
  "Enable CUDA LAMBDA support in Kokkos."
  OFF
  "${Kokkos_ENABLE_Cuda_Lambda_DEFAULT}"
  )

TRIBITS_ADD_OPTION_AND_DEFINE(
+6 −1
Original line number Diff line number Diff line
@@ -211,12 +211,15 @@ void test_dynamic_view_sort(unsigned int n )

  const size_t upper_bound = 2 * n ;

  const size_t total_alloc_size = n * sizeof(KeyType) * 1.2 ;
  const size_t superblock_size  = std::min(total_alloc_size, size_t(1000000));

  typename KeyDynamicViewType::memory_pool
    pool( memory_space()
        , n * sizeof(KeyType) * 1.2
        ,     500 /* min block size in bytes */
        ,   30000 /* max block size in bytes */
        , 1000000 /* min superblock size in bytes */
        , superblock_size
        );

  KeyDynamicViewType keys("Keys",pool,upper_bound);
@@ -271,8 +274,10 @@ void test_sort(unsigned int N)
{
  test_1D_sort<ExecutionSpace,KeyType>(N*N*N, true);
  test_1D_sort<ExecutionSpace,KeyType>(N*N*N, false);
#if !defined(KOKKOS_ENABLE_ROCM)
  test_3D_sort<ExecutionSpace,KeyType>(N);
  test_dynamic_view_sort<ExecutionSpace,KeyType>(N*N);
#endif
}

}
+44 −0
Original line number Diff line number Diff line
KOKKOS_PATH = ${HOME}/kokkos
KOKKOS_DEVICES = "OpenMP"
KOKKOS_ARCH = "SNB"
EXE_NAME = "test"

SRC = $(wildcard *.cpp)

default: build
	echo "Start Build"


ifneq (,$(findstring Cuda,$(KOKKOS_DEVICES)))
CXX = ${KOKKOS_PATH}/config/nvcc_wrapper
EXE = ${EXE_NAME}.cuda
KOKKOS_CUDA_OPTIONS = "enable_lambda"
else
CXX = g++
EXE = ${EXE_NAME}.host
endif

CXXFLAGS = -O3

LINK = ${CXX}
LINKFLAGS = -O3

DEPFLAGS = -M

OBJ = $(SRC:.cpp=.o)
LIB =

include $(KOKKOS_PATH)/Makefile.kokkos

build: $(EXE)

$(EXE): $(OBJ) $(KOKKOS_LINK_DEPENDS)
	$(LINK) $(KOKKOS_LDFLAGS) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(KOKKOS_LIBS) $(LIB) -o $(EXE)

clean: kokkos-clean 
	rm -f *.o *.cuda *.host

# Compilation rules

%.o:%.cpp $(KOKKOS_CPP_DEPENDS)
	$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) $(EXTRA_INC) -c $<
+124 −0
Original line number Diff line number Diff line
#include<Kokkos_Core.hpp>
#include<impl/Kokkos_Timer.hpp>
#include<Kokkos_Random.hpp>

template<class Scalar>
double test_atomic(int L, int N, int M,int K,int R,Kokkos::View<const int*> offsets) {
  Kokkos::View<Scalar*> output("Output",N);
  Kokkos::Impl::Timer timer;

  for(int r = 0; r<R; r++)
  Kokkos::parallel_for(L, KOKKOS_LAMBDA (const int&i) {
    Scalar s = 2;
    for(int m=0;m<M;m++) {
      for(int k=0;k<K;k++)
        s=s*s+s;
      const int idx = (i+offsets(i,m))%N;
      Kokkos::atomic_add(&output(idx),s);
    }
  }); 
  Kokkos::fence();
  double time = timer.seconds();
 
  return time;
}

template<class Scalar>
double test_no_atomic(int L, int N, int M,int K,int R,Kokkos::View<const int*> offsets) {
  Kokkos::View<Scalar*> output("Output",N);
  Kokkos::Impl::Timer timer;
  for(int r = 0; r<R; r++)
  Kokkos::parallel_for(L, KOKKOS_LAMBDA (const int&i) {
    Scalar s = 2;
    for(int m=0;m<M;m++) {
      for(int k=0;k<K;k++)
        s=s*s+s;
      const int idx = (i+offsets(i,m))%N;
      output(idx) += s;
    }
  });
  Kokkos::fence();
  double time =  timer.seconds();
  return time;
}

int main(int argc, char* argv[]) {
  Kokkos::initialize(argc,argv);
{
  if(argc<8) {
    printf("Arguments: L N M D K R T\n");
    printf("  L:   Number of iterations to run\n");
    printf("  N:   Length of array to do atomics into\n");
    printf("  M:   Number of atomics per iteration to do\n");
    printf("  D:   Distance from index i to do atomics into (randomly)\n");
    printf("  K:   Number of FMAD per atomic\n");
    printf("  R:   Number of repeats of the experiments\n");
    printf("  T:   Type of atomic\n");
    printf("       1 - int\n");
    printf("       2 - long\n");
    printf("       3 - float\n");
    printf("       4 - double\n");
    printf("       5 - complex<double>\n");
    printf("Example Input GPU:\n");
    printf("  Histogram : 1000000 1000 1 1000 1 10 1\n");
    printf("  MD Force : 100000 100000 100 1000 20 10 4\n");
    printf("  Matrix Assembly : 100000 1000000 50 1000 20 10 4\n");
    Kokkos::finalize();
    return 0;
  }


  int L = atoi(argv[1]);
  int N = atoi(argv[2]);
  int M = atoi(argv[3]);
  int D = atoi(argv[4]); 
  int K = atoi(argv[5]);
  int R = atoi(argv[6]); 
  int type = atoi(argv[7]);
 
  Kokkos::View<int*> offsets("Offsets",L,M);
  Kokkos::Random_XorShift64_Pool<> pool(12371);
  Kokkos::fill_random(offsets,pool,D);
  double time = 0;
  if(type==1)
    time  = test_atomic<int>(L,N,M,K,R,offsets);
  if(type==2)
    time = test_atomic<long>(L,N,M,K,R,offsets);
  if(type==3)
    time = test_atomic<float>(L,N,M,K,R,offsets);
  if(type==4)
    time = test_atomic<double>(L,N,M,K,R,offsets);
  if(type==5)
    time = test_atomic<Kokkos::complex<double> >(L,N,M,K,R,offsets);

  double time2 = 1;
  if(type==1)
    time2 = test_no_atomic<int>(L,N,M,K,R,offsets);
  if(type==2)
    time2 = test_no_atomic<long>(L,N,M,K,R,offsets);
  if(type==3)
    time2 = test_no_atomic<float>(L,N,M,K,R,offsets);
  if(type==4)
    time2 = test_no_atomic<double>(L,N,M,K,R,offsets);
  if(type==5)
    time2 = test_no_atomic<Kokkos::complex<double> >(L,N,M,K,R,offsets);

  int size = 0;
  if(type==1) size = sizeof(int);
  if(type==2) size = sizeof(long);
  if(type==3) size = sizeof(float);
  if(type==4) size = sizeof(double);
  if(type==5) size = sizeof(Kokkos::complex<double>);

  printf("%i\n",size);
  printf("Time: %s %i %i %i %i %i %i (t_atomic: %e t_nonatomic: %e ratio: %lf )( GUpdates/s: %lf GB/s: %lf )\n",
    (type==1)?"int": (
    (type==2)?"long": (
    (type==3)?"float": (
    (type==4)?"double":"complex"))),
    L,N,M,D,K,R,time,time2,time/time2,
    1.e-9*L*R*M/time, 1.0*L*R*M*2*size/time/1024/1024/1024);
}
  Kokkos::finalize();
}
Loading