diff --git a/CMakeLists.txt b/CMakeLists.txt
index c95457bc6c19b6467eedabcb97f9d332d5442d1d..343588f5d9c767d075fb80ce3f1ff6487a3685ac 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -286,6 +286,7 @@ add_subdirectory("${PUGS_SOURCE_DIR}/packages/kokkos")
 include_directories(SYSTEM ${KOKKOS_SOURCE_DIR}/core/src)
 include_directories(SYSTEM ${KOKKOS_SOURCE_DIR}/containers/src)
 include_directories(SYSTEM ${KOKKOS_SOURCE_DIR}/tpls/desul/include)
+include_directories(SYSTEM ${KOKKOS_BINARY_DIR}/core/src)
 include_directories(SYSTEM ${KOKKOS_BINARY_DIR})
 
 set(PUGS_BUILD_KOKKOS_DEVICES "")
diff --git a/packages/kokkos/.github/workflows/continuous-integration-workflow-hpx.yml b/packages/kokkos/.github/workflows/continuous-integration-workflow-hpx.yml
index b17d173ba2488891bd0ab3b3c8eb31d797b526eb..35bb5bb2cb2924a5000ab1087457ce6afea6029b 100644
--- a/packages/kokkos/.github/workflows/continuous-integration-workflow-hpx.yml
+++ b/packages/kokkos/.github/workflows/continuous-integration-workflow-hpx.yml
@@ -71,7 +71,7 @@ jobs:
             -DHPX_ROOT=$PWD/../../hpx/install \
             -DKokkos_ARCH_NATIVE=ON \
             -DKokkos_ENABLE_COMPILER_WARNINGS=ON \
-            -DKokkos_ENABLE_DEPRECATED_CODE_3=OFF \
+            -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \
             -DKokkos_ENABLE_EXAMPLES=ON \
             -DKokkos_ENABLE_HPX=ON \
             -DKokkos_ENABLE_HPX_ASYNC_DISPATCH=ON \
diff --git a/packages/kokkos/.github/workflows/continuous-integration-workflow.yml b/packages/kokkos/.github/workflows/continuous-integration-workflow.yml
index 4ae42bc93ff649401818962ee7e4f16c2c468cb2..55b881794868bdccc8408870dc025b7c35d98d76 100644
--- a/packages/kokkos/.github/workflows/continuous-integration-workflow.yml
+++ b/packages/kokkos/.github/workflows/continuous-integration-workflow.yml
@@ -10,7 +10,7 @@ jobs:
     continue-on-error: true
     strategy:
       matrix:
-        distro: ['fedora:latest', 'ubuntu:latest']
+        distro: ['fedora:latest', 'fedora:rawhide', 'ubuntu:latest']
         cxx: ['g++', 'clang++']
         cmake_build_type: ['Release', 'Debug']
         backend: ['OPENMP']
@@ -76,6 +76,13 @@ jobs:
       - name: maybe_disable_death_tests
         if: ${{ matrix.distro == 'fedora:rawhide' }}
         run: echo "GTEST_FILTER=-*DeathTest*" >> $GITHUB_ENV
+# Re-enable when latest is F37+
+#      - name: maybe_use_flang
+#        if: ${{ matrix.cxx == 'clang++' && startsWith(matrix.distro,'fedora:') }}
+#        run: echo "FC=flang" >> $GITHUB_ENV
+      - name: maybe_use_flang_new
+        if: ${{ matrix.cxx == 'clang++' && startsWith(matrix.distro,'fedora:rawhide') }}
+        run: echo "FC=flang-new" >> $GITHUB_ENV
       - name: maybe_use_external_gtest
         if: ${{ matrix.distro == 'ubuntu:latest' }}
         run: sudo apt-get update && sudo apt-get install -y libgtest-dev
@@ -93,8 +100,9 @@ jobs:
             -DKokkos_ENABLE_HWLOC=ON \
             -DKokkos_ENABLE_${{ matrix.backend }}=ON \
             -DKokkos_ENABLE_TESTS=ON \
+            -DKokkos_ENABLE_BENCHMARKS=ON \
             -DKokkos_ENABLE_EXAMPLES=ON \
-            -DKokkos_ENABLE_DEPRECATED_CODE_3=ON \
+            -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \
             -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \
             -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
             -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }}
diff --git a/packages/kokkos/.github/workflows/osx.yml b/packages/kokkos/.github/workflows/osx.yml
index 0e043c5f8f1b6ea81965a7a6e87a33d6bfc7e7b3..dae8343f20d6fc2861c6c4221faada46ca84d99a 100644
--- a/packages/kokkos/.github/workflows/osx.yml
+++ b/packages/kokkos/.github/workflows/osx.yml
@@ -30,10 +30,10 @@ jobs:
           cmake -B build .
             -DKokkos_ENABLE_${{ matrix.backend }}=On
             -DCMAKE_CXX_FLAGS="-Werror"
-            -DCMAKE_CXX_STANDARD=14
+            -DCMAKE_CXX_STANDARD=17
             -DKokkos_ARCH_NATIVE=ON
             -DKokkos_ENABLE_COMPILER_WARNINGS=ON
-            -DKokkos_ENABLE_DEPRECATED_CODE_3=OFF
+            -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF
             -DKokkos_ENABLE_TESTS=On
             -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }}
       - name: build
diff --git a/packages/kokkos/.gitrepo b/packages/kokkos/.gitrepo
index 4c3eed6dba9d2682fd85d2185169ac1f5c8e17a6..a6de31a618c04db9d43e4fd3cadc16cf74b7bd95 100644
--- a/packages/kokkos/.gitrepo
+++ b/packages/kokkos/.gitrepo
@@ -6,7 +6,7 @@
 [subrepo]
 	remote = git@github.com:kokkos/kokkos.git
 	branch = master
-	commit = 5ad609661e570ba6aa7716a26a91cb67d559f8a2
-	parent = db24c19be339723f3a10fffce3075fd72dccdfeb
+	commit = 62d2b6c879b74b6ae7bd06eb3e5e80139c4708e6
+	parent = c1b35ca4d5df2b2052224274c26bea7a8eee8ac5
 	method = merge
-	cmdver = 0.4.5
+	cmdver = 0.4.6
diff --git a/packages/kokkos/.jenkins b/packages/kokkos/.jenkins
index 3025cb558eab0c10d6be328b199515807fbba03b..1775a57d3b2a1d12843ac38fe5e8d38a5f77e8f7 100644
--- a/packages/kokkos/.jenkins
+++ b/packages/kokkos/.jenkins
@@ -32,10 +32,13 @@ pipeline {
                         dockerfile {
                             filename 'Dockerfile.nvhpc'
                             dir 'scripts/docker'
-                            label 'nvidia-docker && large_images'
+                            label 'nvidia-docker && volta && large_images'
                             args '--env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES'
                         }
                     }
+                    environment {
+                        CUDA_HOME = '/opt/nvidia/hpc_sdk/Linux_x86_64/22.3/cuda/11.6'
+                    }
                     steps {
                         sh '''rm -rf build && mkdir -p build && cd build && \
                               /opt/cmake/bin/cmake \
@@ -50,11 +53,12 @@ pipeline {
                               make -j8 && ctest --verbose'''
                     }
                 }
-                stage('CUDA-11.6-NVHPC') {
+                stage('CUDA-11.7-NVHPC') {
                     agent {
                         dockerfile {
                             filename 'Dockerfile.nvhpc'
                             dir 'scripts/docker'
+                            additionalBuildArgs '--build-arg BASE=nvcr.io/nvidia/nvhpc:22.9-devel-cuda11.7-ubuntu20.04'
                             label 'nvidia-docker && large_images'
                             args '-v /tmp/ccache.kokkos:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES'
                         }
@@ -66,18 +70,18 @@ pipeline {
                         OMP_MAX_ACTIVE_LEVELS = 1
                         OMP_PLACES = 'threads'
                         OMP_PROC_BIND = 'spread'
-                        NVCC_WRAPPER_DEFAULT_COMPILER = 'nvc++'
+                        NVHPC_CUDA_HOME = '/opt/nvidia/hpc_sdk/Linux_x86_64/22.9/cuda/11.7'
                     }
                     steps {
                         sh '''rm -rf build && mkdir -p build && cd build && \
                               /opt/cmake/bin/cmake \
-                                -DCMAKE_BUILD_TYPE=Debug \
-                                -DCMAKE_CXX_COMPILER=$WORKSPACE/bin/nvcc_wrapper \
-                                -DCMAKE_CXX_FLAGS=-Werror \
+                                -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+                                -DCMAKE_CXX_COMPILER=nvc++ \
                                 -DCMAKE_CXX_STANDARD=17 \
+                                -DCMAKE_CXX_FLAGS="--diag_suppress=implicit_return_from_non_void_function,no_device_stack" \
                                 -DKokkos_ARCH_NATIVE=ON \
                                 -DKokkos_ENABLE_COMPILER_WARNINGS=ON \
-                                -DKokkos_ENABLE_DEPRECATED_CODE_3=OFF \
+                                -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \
                                 -DKokkos_ENABLE_TESTS=ON \
                                 -DKokkos_ENABLE_CUDA=ON \
                                 -DKokkos_ENABLE_CUDA_LAMBDA=ON \
@@ -106,10 +110,11 @@ pipeline {
                                 -DKokkos_ARCH_NATIVE=ON \
                                 -DKokkos_ARCH_VOLTA70=ON \
                                 -DKokkos_ENABLE_COMPILER_WARNINGS=ON \
-                                -DKokkos_ENABLE_DEPRECATED_CODE_3=OFF \
+                                -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \
                                 -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \
                                 -DKokkos_ENABLE_EXAMPLES=ON \
                                 -DKokkos_ENABLE_TESTS=ON \
+                                -DKokkos_ENABLE_BENCHMARKS=ON \
                                 -DKokkos_ENABLE_SYCL=ON \
                                 -DKokkos_ENABLE_UNSUPPORTED_ARCHS=ON \
                                 -DCMAKE_CXX_STANDARD=17 \
@@ -122,12 +127,12 @@ pipeline {
                         }
                     }
                 }
-                stage('HIP-ROCm-4.5-C++14') {
+                stage('HIP-ROCm-5.2') {
                     agent {
                         dockerfile {
                             filename 'Dockerfile.hipcc'
                             dir 'scripts/docker'
-                            additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-20.04:4.5'
+                            additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-20.04:5.2'
                             label 'rocm-docker && vega'
                             args '-v /tmp/ccache.kokkos:/tmp/ccache --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --env HIP_VISIBLE_DEVICES=$HIP_VISIBLE_DEVICES'
                         }
@@ -146,11 +151,12 @@ pipeline {
                                 -DCMAKE_BUILD_TYPE=Debug \
                                 -DCMAKE_CXX_COMPILER=hipcc \
                                 -DCMAKE_CXX_FLAGS="-Werror -Wno-unused-command-line-argument -DNDEBUG" \
-                                -DCMAKE_CXX_STANDARD=14 \
+                                -DCMAKE_CXX_STANDARD=17 \
                                 -DKokkos_ARCH_NATIVE=ON \
                                 -DKokkos_ENABLE_COMPILER_WARNINGS=ON \
-                                -DKokkos_ENABLE_DEPRECATED_CODE_3=OFF \
+                                -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \
                                 -DKokkos_ENABLE_TESTS=ON \
+                                -DKokkos_ENABLE_BENCHMARKS=ON \
                                 -DKokkos_ENABLE_HIP=ON \
                                 -DKokkos_ENABLE_OPENMP=ON \
                                 -DKokkos_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS=ON \
@@ -163,12 +169,12 @@ pipeline {
                         }
                     }
                 }
-                stage('HIP-ROCm-4.5-C++17') {
+                stage('HIP-ROCm-5.2-C++20') {
                     agent {
                         dockerfile {
                             filename 'Dockerfile.hipcc'
                             dir 'scripts/docker'
-                            additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-20.04:4.5'
+                            additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-20.04:5.2'
                             label 'rocm-docker && vega'
                             args '-v /tmp/ccache.kokkos:/tmp/ccache --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --env HIP_VISIBLE_DEVICES=$HIP_VISIBLE_DEVICES'
                         }
@@ -180,12 +186,13 @@ pipeline {
                                 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
                                 -DCMAKE_CXX_COMPILER=hipcc \
                                 -DCMAKE_CXX_FLAGS="-Werror -Wno-unused-command-line-argument" \
-                                -DCMAKE_CXX_STANDARD=17 \
+                                -DCMAKE_CXX_STANDARD=20 \
                                 -DKokkos_ARCH_NATIVE=ON \
                                 -DKokkos_ENABLE_COMPILER_WARNINGS=ON \
-                                -DKokkos_ENABLE_DEPRECATED_CODE_3=ON \
+                                -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \
                                 -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \
                                 -DKokkos_ENABLE_TESTS=ON \
+                                -DKokkos_ENABLE_BENCHMARKS=ON \
                                 -DKokkos_ENABLE_HIP=ON \
                               .. && \
                               make -j8 && ctest --verbose'''
@@ -197,12 +204,12 @@ pipeline {
                     }
                 }
 /*
-                stage('OPENMPTARGET-ROCm-4.5') {
+                stage('OPENMPTARGET-ROCm-5.2') {
                     agent {
                         dockerfile {
                             filename 'Dockerfile.hipcc'
                             dir 'scripts/docker'
-                            additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-20.04:4.5'
+                            additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-20.04:5.2'
                             label 'rocm-docker && vega && AMD_Radeon_Instinct_MI60'
                             args '-v /tmp/ccache.kokkos:/tmp/ccache --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --env HIP_VISIBLE_DEVICES=$HIP_VISIBLE_DEVICES'
                         }
@@ -225,8 +232,9 @@ pipeline {
                                 -DCMAKE_CXX_STANDARD=17 \
                                 -DKokkos_ARCH_NATIVE=ON \
                                 -DKokkos_ENABLE_COMPILER_WARNINGS=ON \
-                                -DKokkos_ENABLE_DEPRECATED_CODE_3=OFF \
+                                -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \
                                 -DKokkos_ENABLE_TESTS=ON \
+                                -DKokkos_ENABLE_BENCHMARKS=ON \
                                 -DKokkos_ENABLE_OPENMPTARGET=ON \
                                 -DKokkos_ENABLE_OPENMP=ON \
                                 -DKokkos_ARCH_VEGA906=ON \
@@ -260,9 +268,10 @@ pipeline {
                                 -DCMAKE_CXX_FLAGS="-Wno-unknown-cuda-version -Werror -Wno-undefined-internal -Wno-pass-failed" \
                                 -DKokkos_ARCH_NATIVE=ON \
                                 -DKokkos_ENABLE_COMPILER_WARNINGS=ON \
-                                -DKokkos_ENABLE_DEPRECATED_CODE_3=ON \
+                                -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \
                                 -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \
                                 -DKokkos_ENABLE_TESTS=ON \
+                                -DKokkos_ENABLE_BENCHMARKS=ON \
                                 -DKokkos_ENABLE_TUNING=ON \
                                 -DKokkos_ENABLE_OPENMPTARGET=ON \
                                 -DKokkos_ARCH_VOLTA70=ON \
@@ -294,12 +303,13 @@ pipeline {
                                 -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
                                 -DCMAKE_CXX_COMPILER=clang++ \
                                 -DCMAKE_CXX_FLAGS=-Werror \
-                                -DCMAKE_CXX_STANDARD=14 \
+                                -DCMAKE_CXX_STANDARD=17 \
                                 -DKokkos_ARCH_NATIVE=ON \
                                 -DKokkos_ENABLE_COMPILER_WARNINGS=ON \
-                                -DKokkos_ENABLE_DEPRECATED_CODE_3=ON \
+                                -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \
                                 -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \
                                 -DKokkos_ENABLE_TESTS=ON \
+                                -DKokkos_ENABLE_BENCHMARKS=ON \
                                 -DKokkos_ENABLE_CUDA=ON \
                                 -DKokkos_ENABLE_CUDA_LAMBDA=ON \
                                 -DKokkos_ENABLE_TUNING=ON \
@@ -313,12 +323,12 @@ pipeline {
                         }
                     }
                 }
-                stage('CUDA-9.2-NVCC') {
+                stage('CUDA-11.7-NVCC') {
                     agent {
                         dockerfile {
                             filename 'Dockerfile.nvcc'
                             dir 'scripts/docker'
-                            additionalBuildArgs '--build-arg BASE=nvidia/cuda:9.2-devel'
+                            additionalBuildArgs '--build-arg BASE=nvidia/cuda:11.7.0-devel-ubuntu20.04'
                             label 'nvidia-docker && volta'
                             args '-v /tmp/ccache.kokkos:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES'
                         }
@@ -329,7 +339,7 @@ pipeline {
                               ../gnu_generate_makefile.bash \
                                 --with-options=compiler_warnings \
                                 --cxxflags="-Werror" \
-                                --cxxstandard=c++14 \
+                                --cxxstandard=c++17 \
                                 --with-cuda \
                                 --with-cuda-options=enable_lambda \
                                 --arch=Volta70 \
@@ -342,7 +352,7 @@ pipeline {
                         }
                     }
                 }
-                stage('CUDA-11.0-NVCC-C++17-RDC') {
+                stage('CUDA-11.0-NVCC-RDC') {
                     agent {
                         dockerfile {
                             filename 'Dockerfile.nvcc'
@@ -372,12 +382,13 @@ pipeline {
                                 -DCMAKE_CXX_STANDARD=17 \
                                 -DKokkos_ARCH_NATIVE=ON \
                                 -DKokkos_ENABLE_COMPILER_WARNINGS=ON \
-                                -DKokkos_ENABLE_OPENMP=ON \
+                                -DKokkos_ENABLE_OPENMP=OFF \
                                 -DKokkos_ENABLE_CUDA=ON \
                                 -DKokkos_ENABLE_CUDA_LAMBDA=OFF \
                                 -DKokkos_ENABLE_CUDA_UVM=ON \
                                 -DKokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE=ON \
                                 -DKokkos_ENABLE_DEPRECATED_CODE_3=ON \
+                                -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \
                                 -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \
                                 -DCMAKE_INSTALL_PREFIX=${PWD}/../install \
                               .. && \
@@ -431,13 +442,14 @@ pipeline {
                                 -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
                                 -DCMAKE_CXX_COMPILER=$WORKSPACE/bin/nvcc_wrapper \
                                 -DCMAKE_CXX_FLAGS=-Werror \
-                                -DCMAKE_CXX_STANDARD=14 \
+                                -DCMAKE_CXX_STANDARD=17 \
                                 -DKokkos_ARCH_NATIVE=ON \
                                 -DKokkos_ENABLE_COMPILER_WARNINGS=ON \
                                 -DKokkos_ENABLE_DEBUG=ON \
                                 -DKokkos_ENABLE_DEBUG_BOUNDS_CHECK=ON \
-                                -DKokkos_ENABLE_DEPRECATED_CODE_3=OFF \
+                                -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \
                                 -DKokkos_ENABLE_TESTS=ON \
+                                -DKokkos_ENABLE_BENCHMARKS=ON \
                                 -DKokkos_ENABLE_CUDA=ON \
                                 -DKokkos_ENABLE_CUDA_LAMBDA=ON \
                                 -DKokkos_ENABLE_LIBDL=OFF \
@@ -445,7 +457,7 @@ pipeline {
                               make -j8 && ctest --verbose && \
                               cd ../example/build_cmake_in_tree && \
                               rm -rf build && mkdir -p build && cd build && \
-                              cmake -DCMAKE_CXX_STANDARD=14 .. && make -j8 && ctest --verbose'''
+                              cmake -DCMAKE_CXX_STANDARD=17 .. && make -j8 && ctest --verbose'''
                     }
                     post {
                         always {
@@ -453,7 +465,7 @@ pipeline {
                         }
                     }
                 }
-                stage('GCC-5.3.1') {
+                stage('GCC-8.4.0') {
                     agent {
                         dockerfile {
                             filename 'Dockerfile.gcc'
@@ -463,6 +475,7 @@ pipeline {
                     }
                     environment {
                         OMP_NUM_THREADS = 8
+                        OMP_NESTED = 'true'
                         OMP_MAX_ACTIVE_LEVELS = 3
                         OMP_PROC_BIND = 'true'
                     }
@@ -470,18 +483,18 @@ pipeline {
                         sh '''rm -rf build && mkdir -p build && cd build && \
                               cmake \
                                 -DCMAKE_BUILD_TYPE=Release \
-                                -DCMAKE_CXX_STANDARD=14 \
+                                -DCMAKE_CXX_STANDARD=17 \
                                 -DCMAKE_CXX_FLAGS=-Werror \
                                 -DKokkos_ARCH_NATIVE=ON \
                                 -DKokkos_ENABLE_COMPILER_WARNINGS=ON \
-                                -DKokkos_ENABLE_DEPRECATED_CODE_3=ON \
+                                -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \
                                 -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \
                                 -DKokkos_ENABLE_TESTS=ON \
+                                -DKokkos_ENABLE_BENCHMARKS=ON \
                                 -DKokkos_ENABLE_OPENMP=ON \
                                 -DKokkos_ENABLE_LIBDL=OFF \
                                 -DKokkos_ENABLE_LIBQUADMATH=ON \
                                 -DKokkos_ENABLE_SERIAL=ON \
-                                -DCMAKE_PREFIX_PATH=/usr/lib/gcc/x86_64-linux-gnu/5.3.1 \
                               .. && \
                               make -j8 && ctest --verbose && gcc -I$PWD/../core/src/ ../core/unit_test/tools/TestCInterface.c'''
                     }
diff --git a/packages/kokkos/.travis.yml b/packages/kokkos/.travis.yml
deleted file mode 100644
index 87d0fd5cf6ed8b9ebc158d1eb8bbe91d56101963..0000000000000000000000000000000000000000
--- a/packages/kokkos/.travis.yml
+++ /dev/null
@@ -1,108 +0,0 @@
-sudo: false
-
-language: cpp
-
-os:
-  - linux
-
-compiler:
-  - gcc
-  - clang
-
-cache:
-  - ccache
-
-stages:
-  - canary
-  - test
-
-jobs:
-    include:
-        - stage: canary
-          env: CMAKE_BUILD_TYPE=Release BACKEND="OPENMP"
-          os: linux
-
-branches:
-  only:
-  - master
-  - develop
-  - /^release/
-
-env:
-  -
-#  - BACKEND="OPENMP"
-  - BACKEND="PTHREAD"
-  - CMAKE_BUILD_TYPE=Debug COVERAGE=yes GTEST_FILTER="-*DeathTest*"
-  - CMAKE_BUILD_TYPE=Debug BACKEND="OPENMP" COVERAGE=yes GTEST_FILTER="-*DeathTest*"
-#  - CMAKE_BUILD_TYPE=Debug BACKEND="PTHREAD" COVERAGE=yes
-  - CMAKE_BUILD_TYPE=Release
-  - CMAKE_BUILD_TYPE=Release BACKEND="OPENMP"
-#  - CMAKE_BUILD_TYPE=Release BACKEND="PTHREAD"
-
-matrix:
-  exclude:
-    - os: linux
-      compiler: gcc
-      env: CMAKE_BUILD_TYPE=Release BACKEND="OPENMP"
-
-# Install newer CMake. The distribution comes with CMake 3.12.4 but we require at least 3.16
-install:
-  - CMAKE_VERSION=3.17.1
-  - CMAKE_DIR=/opt/cmake
-  - CMAKE_KEY=2D2CEF1034921684 &&
-    CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION} &&
-    CMAKE_SCRIPT=cmake-${CMAKE_VERSION}-Linux-x86_64.sh &&
-    CMAKE_SHA256=cmake-${CMAKE_VERSION}-SHA-256.txt &&
-    wget --quiet ${CMAKE_URL}/${CMAKE_SHA256} &&
-    wget --quiet ${CMAKE_URL}/${CMAKE_SHA256}.asc &&
-    wget --quiet ${CMAKE_URL}/${CMAKE_SCRIPT} &&
-    #gpg --keyserver pool.sks-keyservers.net --recv-keys ${CMAKE_KEY} &&
-    #gpg --verify ${CMAKE_SHA256}.asc ${CMAKE_SHA256} &&
-    #grep ${CMAKE_SCRIPT} ${CMAKE_SHA256} | sha256sum --check &&
-    mkdir -p ${CMAKE_DIR} &&
-    sh ${CMAKE_SCRIPT} --skip-license --prefix=${CMAKE_DIR} &&
-    rm cmake*
-  - PATH=${CMAKE_DIR}/bin:$PATH
-  - cd ${TRAVIS_BUILD_DIR}
-
-before_script:
-  - ccache -z
-  - if [[ ${COVERAGE} ]]; then export CXX="${CXX} --coverage"; fi
-  - if [[ ! ${CMAKE_BUILD_TYPE} ]]; then export CXXFLAGS="${CXXFLAGS} -O2"; fi
-
-script:
-  - export OMP_NUM_THREADS=2
-  - export OMP_PLACES=threads
-  - export OMP_PROC_BIND=spread
-  # LD_LIBRARY_PATH workaround to find clang's libomp: https://github.com/travis-ci/travis-ci/issues/8613
-  - if [[ ${CC} = clang ]]; then export LD_LIBRARY_PATH=/usr/local/clang/lib${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH; fi
-  # enable ccache for clang on linux and add CCACHE_CPP2 to avoid 'Argument unused during compilation -I...' warning
-  - if [[ ${TRAVIS_OS_NAME} = linux && ${CC} = clang ]]; then
-      ln -s /usr/bin/ccache $HOME/bin/clang++;
-      export CCACHE_CPP2=yes;
-    fi
-  - mkdir build &&
-    pushd build &&
-    cmake ..
-          ${BACKEND:+-DKokkos_ENABLE_${BACKEND}=On}
-          -DCMAKE_CXX_FLAGS="${CXXFLAGS} -Werror"
-          -DCMAKE_CXX_STANDARD=14
-          -DKokkos_ENABLE_COMPILER_WARNINGS=ON
-          -DKokkos_ENABLE_TESTS=On
-          ${CMAKE_BUILD_TYPE:+-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}} &&
-    make VERBOSE=1 -j2 &&
-    travis_wait 60 make test CTEST_OUTPUT_ON_FAILURE=1 &&
-    make install DESTDIR=${PWD}/install && rm -rf ${PWD}/install/usr/local && rmdir ${PWD}/install/usr &&
-    popd
-
-after_success:
-  - ccache -s
-  - if [[ ${COVERAGE} ]]; then
-      mkdir -p $HOME/.local/bin && wget -O $HOME/.local/bin/codecov https://codecov.io/bash && chmod +x $HOME/.local/bin/codecov;
-      pushd build &&
-      if [[ ${CC} = clang* ]]; then
-        codecov -x "llvm-cov gcov" -F "${CC}";
-      else
-        codecov -x gcov -F "${CC}";
-      fi;
-    fi
diff --git a/packages/kokkos/BUILD.md b/packages/kokkos/BUILD.md
index a8985ef1fd8c5f8507d646d70bb5b1cf756e711c..b0d603e6db0e9c6f76eda03f1343fce4105d2835 100644
--- a/packages/kokkos/BUILD.md
+++ b/packages/kokkos/BUILD.md
@@ -52,6 +52,10 @@ There are numerous device backends, options, and architecture-specific optimizat
 ````
 which activates the OpenMP backend. All of the options controlling device backends, options, architectures, and third-party libraries (TPLs) are given below.
 
+Kokkos requires as a minimum C++17, however C++20 and C++23 are supported depending on the compiler.
+
+The latest minimum compiler versions can be found in `cmake/kokkos_compiler_id.cmake`.
+
 ## Known Issues<a name="KnownIssues"></a>
 
 ### Cray
@@ -148,12 +152,14 @@ Options can be enabled by specifying `-DKokkos_ENABLE_X`.
     * Whether to activate experimental lambda features
     * BOOL Default: OFF
 * Kokkos_ENABLE_CUDA_LDG_INTRINSIC
+    * Deprecated since 4.0, LDG intrinsics are always enabled.
     * Whether to use CUDA LDG intrinsics
     * BOOL Default: OFF
 * Kokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE
     * Whether to enable relocatable device code (RDC) for CUDA
     * BOOL Default: OFF
 * Kokkos_ENABLE_CUDA_UVM
+    * Deprecated since 4.0
     * Whether to use unified memory (UM) by default for CUDA
     * BOOL Default: OFF
 * Kokkos_ENABLE_DEBUG
@@ -184,10 +190,6 @@ Options can be enabled by specifying `-DKokkos_ENABLE_X`.
     * Whether to enable test suite
     * BOOL Default: OFF
 
-## Other Options
-* Kokkos_CXX_STANDARD
-    * The C++ standard for Kokkos to use: c++14, c++17, or c++20. This should be given in CMake style as 14, 17, or 20.
-    * STRING Default: 14
 
 ## Third-party Libraries (TPLs)
 The following options control enabling TPLs:
diff --git a/packages/kokkos/CHANGELOG.md b/packages/kokkos/CHANGELOG.md
index bdbc75604bab5fbbfd436767531ab30371cc788b..a381f16129fd4846a8f786da0172556ff2cf5034 100644
--- a/packages/kokkos/CHANGELOG.md
+++ b/packages/kokkos/CHANGELOG.md
@@ -1,5 +1,128 @@
 # Change Log
 
+## [4.0.01](https://github.com/kokkos/kokkos/tree/4.0.01) (2023-04-14)
+[Full Changelog](https://github.com/kokkos/kokkos/compare/4.0.00...4.0.01)
+
+### Backend and Architecture Enhancements:
+
+#### CUDA:
+
+- Allow NVCC 12 to compile using C++20 flag [\#6020](https://github.com/kokkos/kokkos/pull/6020)
+- Add CUDA Ada architecture support [\#6022](https://github.com/kokkos/kokkos/pull/6022)
+
+#### HIP:
+
+- Add support for AMDGPU target NAVI31 / RX 7900 XT(X): gfx1100 [\#6021](https://github.com/kokkos/kokkos/pull/6021)
+- HIP: Fix warning from `std::memcpy` [\#6019](https://github.com/kokkos/kokkos/pull/6019)
+
+#### SYCL:
+- Fix `SYCLTeamMember` to take arguments for scratch sizes as `std::size_t` [\#5986](https://github.com/kokkos/kokkos/pull/5986)
+
+### General Enhancements
+- Fixup 4.0 change log [\#6023](https://github.com/kokkos/kokkos/pull/6023)
+
+### Build System Changes
+- Cherry-pick TriBITS update from Trilinos [\#6037](https://github.com/kokkos/kokkos/pull/6037)
+- CMake: update package compatibility mode when building within Trilinos [\#6013](https://github.com/kokkos/kokkos/pull/6013)
+
+### Bug Fixes
+- Fix an incorrectly returning size for SIMD uint64_t in AVX2 [\#6011](https://github.com/kokkos/kokkos/pull/6011)
+- Desul atomics: wrong value for `desul::Impl::numeric_limits_max<uint64_t>` [\#6018](https://github.com/kokkos/kokkos/pull/6018)
+- Fix warning in some user code when using std::memcpy [\#6000](https://github.com/kokkos/kokkos/pull/6000)
+
+## [4.0.0](https://github.com/kokkos/kokkos/tree/4.0.0) (2023-02-21)
+[Full Changelog](https://github.com/kokkos/kokkos/compare/3.7.01...4.0.00)
+
+### Features:
+- Allow value types without default constructor in `Kokkos::View` with `Kokkos::WithoutInitializing` [\#5307](https://github.com/kokkos/kokkos/pull/5307)
+- `parallel_scan` with `View` as result type. [\#5146](https://github.com/kokkos/kokkos/pull/5146)
+- Introduced `SharedSpace`, an alias for a `MemorySpace` that is accessible by every `ExecutionSpace`. The memory is moved and then accessed locally. [\#5289](https://github.com/kokkos/kokkos/pull/5289)
+- Introduced `SharedHostPinnedSpace`, an alias for a `MemorySpace` that is accessible by every `ExecutionSpace`. The memory is pinned to the host and accessed via zero-copy access. [\#5405](https://github.com/kokkos/kokkos/pull/5405)
+- Groundwork for `MDSpan` integration. [\#4973](https://github.com/kokkos/kokkos/pull/4973) and [\#5304](https://github.com/kokkos/kokkos/pull/5304)
+- Introduced MD version of hierarchical parallelism: `TeamThreadMDRange`, `ThreadVectorMDRange` and `TeamVectorMDRange`. [\#5238](https://github.com/kokkos/kokkos/pull/5238)
+
+### Backend and Architecture Enhancements:
+
+#### CUDA:
+- Allow CUDA PTX forward compatibility [\#3612](https://github.com/kokkos/kokkos/pull/3612) [\#5536](https://github.com/kokkos/kokkos/pull/5536) [\#5527](https://github.com/kokkos/kokkos/pull/5527)
+- Add support for NVIDIA Hopper GPU architecture [\#5538](https://github.com/kokkos/kokkos/pull/5538)
+- Don't rely on synchronization behavior of default stream in CUDA and HIP [\#5391](https://github.com/kokkos/kokkos/pull/5391)
+- Improve CUDA cache config settings [\#5706](https://github.com/kokkos/kokkos/pull/5706)
+
+#### HIP:
+ - Move `HIP`, `HIPSpace`, `HIPHostPinnedSpace`, and `HIPManagedSpace` out of the `Experimental` namespace [\#5383](https://github.com/kokkos/kokkos/pull/5383)
+ - Don't rely on synchronization behavior of default stream in CUDA and HIP [\#5391](https://github.com/kokkos/kokkos/pull/5391)
+ - Export AMD architecture flag when using Trilinos [\#5528](https://github.com/kokkos/kokkos/pull/5528)
+ - Fix linking error (see [OLCF issue](https://docs.olcf.ornl.gov/systems/crusher_quick_start_guide.html#olcfdev-1167-kokkos-build-failures-with-prgenv-amd)) when using `amdclang`: [\#5539](https://github.com/kokkos/kokkos/pull/5539)
+ - Remove support for MI25 and added support for Navi 1030 [\#5522](https://github.com/kokkos/kokkos/pull/5522)
+ - Fix race condition when using `HSA_XNACK=1`  [\#5755](https://github.com/kokkos/kokkos/pull/5755)
+ - Add parameter to force using GlobalMemory launch mechanism. This can be used when encountering compiler bugs with ROCm 5.3 and 5.4  [\#5796](https://github.com/kokkos/kokkos/pull/5796)
+
+#### SYCL:
+- Delegate choice of workgroup size for `parallel_reduce` with `RangePolicy` to the compiler. [\#5227](https://github.com/kokkos/kokkos/pull/5227)
+- SYCL `RangePolicy`: manually specify workgroup size through chunk size [\#4875](https://github.com/kokkos/kokkos/pull/4875)
+
+#### OpenMPTarget:
+- Select the right device [\#5492](https://github.com/kokkos/kokkos/pull/5492)
+
+#### OpenMP:
+ - Add `partition_space` [\#5105](https://github.com/kokkos/kokkos/pull/5105)
+
+### General Enhancements
+- Implement `OffsetView` constructor taking `pair`s and `ViewCtorProp` [\#5303](https://github.com/kokkos/kokkos/pull/5303)
+- Promote math constants to `Kokkos::numbers` namespace [\#5434](https://github.com/kokkos/kokkos/pull/5434)
+- Add overloads of `hypot` math function that take 3 arguments [\#5341](https://github.com/kokkos/kokkos/pull/5341)
+- Add `fma` fused multiply-add math function [\#5428](https://github.com/kokkos/kokkos/pull/5428)
+- Views using `MemoryTraits::Atomic` don't need `volatile` overloads for the value type anymore. [\#5455](https://github.com/kokkos/kokkos/pull/5455)
+- Added `is_team_handle` trait [\#5375](https://github.com/kokkos/kokkos/pull/5375)
+- Refactor desul atomics to support compiling CUDA with NVC++ [\#5431](https://github.com/kokkos/kokkos/pull/5431) [\#5497](https://github.com/kokkos/kokkos/pull/5497) [\#5498](https://github.com/kokkos/kokkos/pull/5498)
+- Support finding `libquadmath` with native compiler support [\#5286](https://github.com/kokkos/kokkos/pull/5286)
+- Add architecture flags for MSVC [\#5673](https://github.com/kokkos/kokkos/pull/5673)
+- SIMD backend for ARM NEON [\#5829](https://github.com/kokkos/kokkos/pull/5829)
+
+### Build System Changes
+- Let CMake determine OpenMP flags. [\#4105](https://github.com/kokkos/kokkos/pull/4105)
+- Update minimum compiler versions. [\#5323](https://github.com/kokkos/kokkos/pull/5323)
+- Makefile and CMake support for C++23 [\#5283](https://github.com/kokkos/kokkos/pull/5283)
+- Do not add `-cuda` to the link line with NVHPC compiler when the CUDA backend is not actually enabled [\#5485](https://github.com/kokkos/kokkos/pull/5485)
+- Only add `-latomic` in generated GNU makefiles when OpenMPTarget backend is enabled [\#5501](https://github.com/kokkos/kokkos/pull/5501) [\#5537](https://github.com/kokkos/kokkos/pull/5537) (3.7 patch release candidate)
+- `Kokkos_ENABLE_CUDA_LAMBDA` now `ON` by default with NVCC [\#5580](https://github.com/kokkos/kokkos/pull/5580)
+- Fix enabling of relocatable device code when using CUDA as CMake language [\#5564](https://github.com/kokkos/kokkos/pull/5564)
+- Fix cmake configuration with CUDA 12 [\#5691](https://github.com/kokkos/kokkos/pull/5691)
+
+### Incompatibilities (i.e. breaking changes)
+- ***Require C++17***  [\#5277](https://github.com/kokkos/kokkos/pull/5277)
+- Turn setting `Kokkos_CXX_STANDARD` into an error [\#5293](https://github.com/kokkos/kokkos/pull/5293)
+- Remove all deprecations in Kokkos 3 [\#5297](https://github.com/kokkos/kokkos/pull/5297)
+- Remove `KOKKOS_COMPILER_CUDA_VERSION` [\#5430](https://github.com/kokkos/kokkos/pull/5430)
+- Drop `reciprocal_overflow_threshold` numeric trait [\#5326](https://github.com/kokkos/kokkos/pull/5326)
+- Move `reduction_identity` out of `<Kokkos_NumericTraits.hpp>` into a new `<Kokkos_ReductionIdentity.hpp>` header [\#5450](https://github.com/kokkos/kokkos/pull/5450)
+- Reduction and scan routines will report an error if the `join()` operator they would use takes `volatile`-qualified parameters [\#5409](https://github.com/kokkos/kokkos/pull/5409)
+- `ENABLE_CUDA_UVM` is dropped in favor of using `SharedSpace` as `MemorySpace` explicitly [\#5608](https://github.com/kokkos/kokkos/pull/5608)
+- Remove Kokkos_ENABLE_CUDA_LDG_INTRINSIC option [\#5623](https://github.com/kokkos/kokkos/pull/5623)
+- Don't rely on synchronization behavior of default stream in CUDA and HIP - this potentially will break unintended implicit synchronization with other libraries such as MPI [\#5391](https://github.com/kokkos/kokkos/pull/5391)
+- Make ExecutionSpace::concurrency() a non-static member function [\#5655](https://github.com/kokkos/kokkos/pull/5655) and related PRs
+- Remove code guarded by `KOKKOS_ENABLE_DEPRECATED_CODE_3`
+
+### Deprecations
+- Deprecate `CudaUVMSpace::available()` which always returned `true` [\#5614](https://github.com/kokkos/kokkos/pull/5614)
+- Deprecate `volatile`-qualified members from `Kokkos::pair` and `Kokkos::complex` [\#5412](https://github.com/kokkos/kokkos/pull/5412)
+- Deprecate `KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_*` macros [\#5824](https://github.com/kokkos/kokkos/pull/5824) (oversight in 3.6)
+
+### Bug Fixes
+- Avoid allocating memory for `UniqueToken` [\#5300](https://github.com/kokkos/kokkos/pull/5300)
+- Fix `pragma ivdep` in `Kokkos_OpenMP_Parallel.hpp` [\#5356](https://github.com/kokkos/kokkos/pull/5356)
+- Fix configuring with Threads support when rerunning CMake [\#5486](https://github.com/kokkos/kokkos/pull/5486)
+- Fix View assignment between `LayoutLeft` and `LayoutRight` with static extents [\#5535](https://github.com/kokkos/kokkos/pull/5535) (3.7 patch release candidate)
+- Add `fence()` calls to sorting routine overloads that don't take an execution space parameter [\#5389](https://github.com/kokkos/kokkos/pull/5389)
+- `ClockTic` changed to 64 bit to fix overflow on Power [\#5577](https://github.com/kokkos/kokkos/pull/5577) (incl. in 3.7.01 patch release)
+- Fix incorrect offset in CUDA and HIP `parallel_scan` for < 4 byte types [\#5555](https://github.com/kokkos/kokkos/pull/5555) (3.7 patch release candidate)
+- Fix incorrect alignment behavior of scratch allocations in some corner cases (e.g. very small allocations) [\#5687](https://github.com/kokkos/kokkos/pull/5687) (3.7 patch release candidate)
+- Add missing `ReductionIdentity<char>` specialization [\#5798](https://github.com/kokkos/kokkos/pull/5798)
+- Don't install standard algorithms headers multiple times [\#5670](https://github.com/kokkos/kokkos/pull/5670)
+- Fix max scratch size calculation for level 0 scratch in CUDA and HIP [\#5718](https://github.com/kokkos/kokkos/pull/5718)
+- Fix excessive build times using Makefile.kokkos [\#6068](https://github.com/kokkos/kokkos/pull/6068)
+
 ## [3.7.01](https://github.com/kokkos/kokkos/tree/3.7.01) (2022-12-01)
 [Full Changelog](https://github.com/kokkos/kokkos/compare/3.7.00...3.7.01)
 
diff --git a/packages/kokkos/CMakeLists.txt b/packages/kokkos/CMakeLists.txt
index 7b78f29d7340499aff394302911e59c5ef120d52..aa712f56127aab50c02aa89a6c13a3472036e36f 100644
--- a/packages/kokkos/CMakeLists.txt
+++ b/packages/kokkos/CMakeLists.txt
@@ -5,13 +5,16 @@ if( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" )
   message( FATAL_ERROR "FATAL: In-source builds are not allowed. You should create a separate directory for build files and delete CMakeCache.txt." )
 endif()
 
+if (COMMAND TRIBITS_PACKAGE_DECL)
+  TRIBITS_PACKAGE_DECL(Kokkos)
+endif()
+
 # We want to determine if options are given with the wrong case
 # In order to detect which arguments are given to compare against
 # the list of valid arguments, at the beginning here we need to
 # form a list of all the given variables. If it begins with any
 # case of KoKkOS, we add it to the list.
 
-
 GET_CMAKE_PROPERTY(_variableNames VARIABLES)
 SET(KOKKOS_GIVEN_VARIABLES)
 FOREACH (var ${_variableNames})
@@ -87,6 +90,16 @@ IF(NOT KOKKOS_HAS_TRILINOS)
 
     SET(KOKKOS_COMPILE_LANGUAGE CUDA)
   ENDIF()
+  # use lower case here since we haven't parsed options yet
+  IF (Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE AND Kokkos_ENABLE_HIP)
+
+    # Without this as a language for the package we would get a C++ compiler enabled.
+    # but we still need a C++ compiler even if we build all our cpp files as HIP only
+    # because otherwise the C++ features don't work etc.
+    SET(KOKKOS_INTERNAL_EXTRA_COMPILE_LANGUAGE CXX)
+
+    SET(KOKKOS_COMPILE_LANGUAGE HIP)
+  ENDIF()
 
   IF (Spack_WORKAROUND)
     IF (Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE)
@@ -113,6 +126,8 @@ IF(NOT KOKKOS_HAS_TRILINOS)
           FORCE)
     ENDIF()
   ENDIF()
+ELSE()
+  SET(KOKKOS_COMPILE_LANGUAGE CXX)
 ENDIF()
 
 IF (NOT CMAKE_SIZEOF_VOID_P)
@@ -127,11 +142,17 @@ ELSEIF (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
 ENDIF()
 
 
-set(Kokkos_VERSION_MAJOR 3)
-set(Kokkos_VERSION_MINOR 7)
-set(Kokkos_VERSION_PATCH 01)
+set(Kokkos_VERSION_MAJOR 4)
+set(Kokkos_VERSION_MINOR 0)
+set(Kokkos_VERSION_PATCH 1)
 set(Kokkos_VERSION "${Kokkos_VERSION_MAJOR}.${Kokkos_VERSION_MINOR}.${Kokkos_VERSION_PATCH}")
 math(EXPR KOKKOS_VERSION "${Kokkos_VERSION_MAJOR} * 10000 + ${Kokkos_VERSION_MINOR} * 100 + ${Kokkos_VERSION_PATCH}")
+# mathematical expressions below are not stricly necessary but they eliminate
+# the rather aggravating leading 0 in the releases patch version number, and,
+# in some way, are a sanity check for our arithmetic
+math(EXPR KOKKOS_VERSION_MAJOR "${KOKKOS_VERSION} / 10000")
+math(EXPR KOKKOS_VERSION_MINOR "${KOKKOS_VERSION} / 100 % 100")
+math(EXPR KOKKOS_VERSION_PATCH "${KOKKOS_VERSION} % 100")
 
 # Load either the real TriBITS or a TriBITS wrapper
 # for certain utility functions that are universal (like GLOBAL_SET)
@@ -167,7 +188,7 @@ IF(NOT MSVC)
 ENDIF()
 
 IF(Kokkos_ENABLE_TESTS AND NOT KOKKOS_HAS_TRILINOS)
-  find_package(GTest)
+  find_package(GTest QUIET)
 ENDIF()
 
 # Include a set of Kokkos-specific wrapper functions that
@@ -180,6 +201,14 @@ INCLUDE(${KOKKOS_SRC_PATH}/cmake/kokkos_tribits.cmake)
 # to allow platform-specific checks
 INCLUDE(${KOKKOS_SRC_PATH}/cmake/kokkos_check_env.cmake)
 
+IF(NOT KOKKOS_HAS_TRILINOS)
+  # This does not work in Trilinos and we simply don't care
+  # to fix it for Trilinos
+  # Gather information about the runtime environment
+  INCLUDE(${KOKKOS_SRC_PATH}/cmake/build_env_info.cmake)
+  check_git_setup()
+ENDIF()
+
 # The build environment setup goes in the following steps
 # 1) Check all the enable options. This includes checking Kokkos_DEVICES
 # 2) Check the compiler ID (type and version)
@@ -194,14 +223,8 @@ KOKKOS_SETUP_BUILD_ENVIRONMENT()
 
 OPTION(BUILD_SHARED_LIBS "Build shared libraries" OFF)
 
-SET(KOKKOS_EXT_LIBRARIES Kokkos::kokkos Kokkos::kokkoscore Kokkos::kokkoscontainers Kokkos::kokkosalgorithms)
-SET(KOKKOS_SUB_LIBRARIES kokkoscore kokkoscontainers kokkosalgorithms)
-IF (KOKKOS_CXX_STANDARD GREATER_EQUAL 17)
-  LIST(APPEND KOKKOS_EXT_LIBRARIES Kokkos::kokkossimd)
-  LIST(APPEND KOKKOS_SUB_LIBRARIES kokkossimd)
-ENDIF()
-SET(KOKKOS_INT_LIBRARIES kokkos ${KOKKOS_SUB_LIBRARIES})
-SET_PROPERTY(GLOBAL PROPERTY KOKKOS_INT_LIBRARIES ${KOKKOS_INT_LIBRARIES})
+SET(KOKKOS_COMPONENT_LIBRARIES kokkoscore kokkoscontainers kokkosalgorithms kokkossimd)
+SET_PROPERTY(GLOBAL PROPERTY KOKKOS_INT_LIBRARIES kokkos ${KOKKOS_COMPONENT_LIBRARIES})
 
 IF (KOKKOS_HAS_TRILINOS)
   SET(TRILINOS_INCDIR ${${PROJECT_NAME}_INSTALL_INCLUDE_DIR})
@@ -270,7 +293,9 @@ IF (KOKKOS_HAS_TRILINOS)
     $<$<COMPILE_LANGUAGE:CXX>:${KOKKOS_ALL_COMPILE_OPTIONS}>)
 ENDIF()
 
-KOKKOS_PACKAGE_DECL()
+if (NOT COMMAND TRIBITS_PACKAGE_DECL)
+  KOKKOS_PACKAGE_DECL()
+endif()
 
 
 #------------------------------------------------------------------------------
@@ -295,7 +320,7 @@ IF (NOT KOKKOS_HAS_TRILINOS AND NOT Kokkos_INSTALL_TESTING)
   #Make sure in-tree projects can reference this as Kokkos::
   #to match the installed target names
   ADD_LIBRARY(Kokkos::kokkos ALIAS kokkos)
-  TARGET_LINK_LIBRARIES(kokkos INTERFACE ${KOKKOS_SUB_LIBRARIES})
+  TARGET_LINK_LIBRARIES(kokkos INTERFACE ${KOKKOS_COMPONENT_LIBRARIES})
   KOKKOS_INTERNAL_ADD_LIBRARY_INSTALL(kokkos)
 ENDIF()
 INCLUDE(${KOKKOS_SRC_PATH}/cmake/kokkos_install.cmake)
diff --git a/packages/kokkos/LICENSE b/packages/kokkos/LICENSE
index c6f17087d5a1b160a5fddeaab39ed9380328b485..6572cc2db055e848e53f82c024d75b3404ef0bf8 100644
--- a/packages/kokkos/LICENSE
+++ b/packages/kokkos/LICENSE
@@ -1,43 +1,238 @@
-//@HEADER
-// ************************************************************************
-// 
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
-//               Solutions of Sandia, LLC (NTESS).
-// 
-// Under the terms of Contract DE-NA0003525 with NTESS,
-// the U.S. Government retains certain rights in this software.
-//
-// Kokkos is licensed under 3-clause BSD terms of use:
-// 
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-// 
-// ************************************************************************
-//@HEADER
+ ************************************************************************
+ 
+                        Kokkos v. 4.0
+       Copyright (2022) National Technology & Engineering
+               Solutions of Sandia, LLC (NTESS).
+ 
+ Under the terms of Contract DE-NA0003525 with NTESS,
+ the U.S. Government retains certain rights in this software.
+
+
+ ==============================================================================
+ Kokkos is under the Apache License v2.0 with LLVM Exceptions:
+ ==============================================================================
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+    TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+    1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+    2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+    3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+    4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+    5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+    6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+    7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+    8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+    9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+    END OF TERMS AND CONDITIONS Apache 2.0
+
+ ---- LLVM Exceptions to the Apache 2.0 License ----
+
+ As an exception, if, as a result of your compiling your source code, portions
+ of this Software are embedded into an Object form of such source code, you
+ may redistribute such embedded portions in such Object form without complying
+ with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
+
+ In addition, if you combine or link compiled forms of this Software with
+ software that is licensed under the GPLv2 ("Combined Software") and if a
+ court of competent jurisdiction determines that the patent provision (Section
+ 3), the indemnity provision (Section 9) or other Section of the License
+ conflicts with the conditions of the GPLv2, you may retroactively and
+ prospectively choose to deem waived or otherwise exclude such Section(s) of
+ the License, but only in their entirety and only with respect to the Combined
+ Software.
+
+ ==============================================================================
+ Software from third parties included in Kokkos:
+ ==============================================================================
+
+ Kokkos contains third party software which is under different license
+ terms. All such code will be identified clearly using at least one of two
+ mechanisms:
+ 1) It will be in a separate directory tree with its own `LICENSE.txt` or
+    `LICENSE` file at the top containing the specific license and restrictions
+    which apply to that software, or
+ 2) It will contain specific license and restriction terms at the top of every
+    file.
+
+
+ THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ 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: 
+   Christian R. Trott (crtrott@sandia.gov) and
+   Damien T. Lebrun-Grandie (lebrungrandt@ornl.gov)
+
+ ************************************************************************
diff --git a/packages/kokkos/LICENSE_FILE_HEADER b/packages/kokkos/LICENSE_FILE_HEADER
new file mode 100644
index 0000000000000000000000000000000000000000..03eb04f8bdcb9234d1f22b33dfb62d6e22479dbf
--- /dev/null
+++ b/packages/kokkos/LICENSE_FILE_HEADER
@@ -0,0 +1,15 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
diff --git a/packages/kokkos/Makefile.kokkos b/packages/kokkos/Makefile.kokkos
index 2e32c9d53893bf552381eb618db37acaf8156822..60cef6c7f30eb8fc3525add860d9806fb332a16b 100644
--- a/packages/kokkos/Makefile.kokkos
+++ b/packages/kokkos/Makefile.kokkos
@@ -1,8 +1,8 @@
 # Default settings common options.
 
-KOKKOS_VERSION_MAJOR = 3
-KOKKOS_VERSION_MINOR = 7
-KOKKOS_VERSION_PATCH = 01
+KOKKOS_VERSION_MAJOR = 4
+KOKKOS_VERSION_MINOR = 0
+KOKKOS_VERSION_PATCH = 1
 KOKKOS_VERSION = $(shell echo $(KOKKOS_VERSION_MAJOR)*10000+$(KOKKOS_VERSION_MINOR)*100+$(KOKKOS_VERSION_PATCH) | bc)
 
 # Options: Cuda,HIP,SYCL,OpenMPTarget,OpenMP,Threads,Serial
@@ -10,10 +10,10 @@ KOKKOS_VERSION = $(shell echo $(KOKKOS_VERSION_MAJOR)*10000+$(KOKKOS_VERSION_MIN
 KOKKOS_DEVICES ?= "Threads"
 # Options:
 # Intel:    KNC,KNL,SNB,HSW,BDW,SKL,SKX,ICL,ICX,SPR
-# NVIDIA:   Kepler,Kepler30,Kepler32,Kepler35,Kepler37,Maxwell,Maxwell50,Maxwell52,Maxwell53,Pascal60,Pascal61,Volta70,Volta72,Turing75,Ampere80,Ampere86
+# NVIDIA:   Kepler,Kepler30,Kepler32,Kepler35,Kepler37,Maxwell,Maxwell50,Maxwell52,Maxwell53,Pascal60,Pascal61,Volta70,Volta72,Turing75,Ampere80,Ampere86,Ada89,Hopper90
 # ARM:      ARMv80,ARMv81,ARMv8-ThunderX,ARMv8-TX2,A64FX
 # IBM:      BGQ,Power7,Power8,Power9
-# AMD-GPUS: Vega900,Vega906,Vega908,Vega90A
+# AMD-GPUS: Vega906,Vega908,Vega90A,Navi1030
 # AMD-CPUS: AMDAVX,Zen,Zen2,Zen3
 # Intel-GPUs: Gen9,Gen11,Gen12LP,DG1,XeHP,PVC
 KOKKOS_ARCH ?= ""
@@ -21,8 +21,8 @@ KOKKOS_ARCH ?= ""
 KOKKOS_DEBUG ?= "no"
 # Options: hwloc,librt,experimental_memkind
 KOKKOS_USE_TPLS ?= ""
-# Options: c++14,c++1y,c++17,c++1z,c++2a
-KOKKOS_CXX_STANDARD ?= "c++14"
+# Options: c++17,c++1z,c++20,c++2a,c++23,c++2b
+KOKKOS_CXX_STANDARD ?= "c++17"
 # Options: aggressive_vectorization,disable_profiling,enable_large_mem_tests,disable_complex_align,disable_deprecated_code,enable_deprecation_warnings,disable_desul_atomics
 KOKKOS_OPTIONS ?= ""
 KOKKOS_CMAKE ?= "no"
@@ -57,12 +57,12 @@ kokkos_path_exists=$(if $(wildcard $1),1,0)
 # Check for general settings
 
 KOKKOS_INTERNAL_ENABLE_DEBUG := $(call kokkos_has_string,$(KOKKOS_DEBUG),yes)
-KOKKOS_INTERNAL_ENABLE_CXX14 := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++14)
-KOKKOS_INTERNAL_ENABLE_CXX1Y := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++1y)
 KOKKOS_INTERNAL_ENABLE_CXX17 := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++17)
 KOKKOS_INTERNAL_ENABLE_CXX1Z := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++1z)
-KOKKOS_INTERNAL_ENABLE_CXX2A := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++2a)
 KOKKOS_INTERNAL_ENABLE_CXX20 := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++20)
+KOKKOS_INTERNAL_ENABLE_CXX2A := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++2a)
+KOKKOS_INTERNAL_ENABLE_CXX23 := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++23)
+KOKKOS_INTERNAL_ENABLE_CXX2B := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++2b)
 
 # Check for external libraries.
 KOKKOS_INTERNAL_USE_HWLOC := $(call kokkos_has_string,$(KOKKOS_USE_TPLS),hwloc)
@@ -77,6 +77,7 @@ KOKKOS_INTERNAL_DISABLE_COMPLEX_ALIGN := $(call kokkos_has_string,$(KOKKOS_OPTIO
 KOKKOS_INTERNAL_DISABLE_DUALVIEW_MODIFY_CHECK := $(call kokkos_has_string,$(KOKKOS_OPTIONS),disable_dualview_modify_check)
 KOKKOS_INTERNAL_ENABLE_PROFILING_LOAD_PRINT := $(call kokkos_has_string,$(KOKKOS_OPTIONS),enable_profile_load_print)
 KOKKOS_INTERNAL_ENABLE_LARGE_MEM_TESTS := $(call kokkos_has_string,$(KOKKOS_OPTIONS),enable_large_mem_tests)
+# deprecated
 KOKKOS_INTERNAL_CUDA_USE_LDG := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),use_ldg)
 KOKKOS_INTERNAL_CUDA_USE_UVM := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),force_uvm)
 KOKKOS_INTERNAL_CUDA_USE_RELOC := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),rdc)
@@ -86,6 +87,7 @@ KOKKOS_INTERNAL_HPX_ENABLE_ASYNC_DISPATCH := $(call kokkos_has_string,$(KOKKOS_H
 # deprecated
 KOKKOS_INTERNAL_ENABLE_DESUL_ATOMICS := $(call kokkos_has_string,$(KOKKOS_OPTIONS),enable_desul_atomics)
 KOKKOS_INTERNAL_DISABLE_DESUL_ATOMICS := $(call kokkos_has_string,$(KOKKOS_OPTIONS),disable_desul_atomics)
+KOKKOS_INTERNAL_DISABLE_BUNDLED_MDSPAN := $(call kokkos_has_string,$(KOKKOS_OPTIONS),impl_disable_bundled_mdspan)
 KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE := $(call kokkos_has_string,$(KOKKOS_OPTIONS),disable_deprecated_code)
 KOKKOS_INTERNAL_ENABLE_DEPRECATION_WARNINGS := $(call kokkos_has_string,$(KOKKOS_OPTIONS),enable_deprecation_warnings)
 
@@ -94,14 +96,8 @@ KOKKOS_INTERNAL_HIP_USE_RELOC := $(call kokkos_has_string,$(KOKKOS_HIP_OPTIONS),
 # Check for Kokkos Host Execution Spaces one of which must be on.
 KOKKOS_INTERNAL_USE_OPENMP := $(call kokkos_has_string,$(subst OpenMPTarget,,$(KOKKOS_DEVICES)),OpenMP)
 KOKKOS_INTERNAL_USE_THREADS := $(call kokkos_has_string,$(KOKKOS_DEVICES),Threads)
-# deprecated
-KOKKOS_INTERNAL_USE_PTHREAD := $(call kokkos_has_string,$(KOKKOS_DEVICES),Pthread)
 KOKKOS_INTERNAL_USE_HPX := $(call kokkos_has_string,$(KOKKOS_DEVICES),HPX)
 KOKKOS_INTERNAL_USE_SERIAL := $(call kokkos_has_string,$(KOKKOS_DEVICES),Serial)
-ifeq ($(KOKKOS_INTERNAL_USE_PTHREAD), 1)
-  KOKKOS_INTERNAL_USE_THREADS := 1
-  $(warning Warning: Pthread is deprecated. Use Threads instead! KOKKOS_DEVICES=$(KOKKOS_DEVICES))
-endif
 
 ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 0)
   ifeq ($(KOKKOS_INTERNAL_USE_THREADS), 0)
@@ -116,6 +112,7 @@ KOKKOS_INTERNAL_USE_CUDA := $(call kokkos_has_string,$(KOKKOS_DEVICES),Cuda)
 KOKKOS_INTERNAL_USE_HIP := $(call kokkos_has_string,$(KOKKOS_DEVICES),HIP)
 KOKKOS_INTERNAL_USE_SYCL := $(call kokkos_has_string,$(KOKKOS_DEVICES),SYCL)
 KOKKOS_INTERNAL_USE_OPENMPTARGET := $(call kokkos_has_string,$(KOKKOS_DEVICES),OpenMPTarget)
+KOKKOS_INTERNAL_USE_OPENACC := $(call kokkos_has_string,$(KOKKOS_DEVICES),OpenACC)
 
 KOKKOS_DEVICELIST =
 ifeq ($(KOKKOS_INTERNAL_USE_SERIAL), 1)
@@ -136,21 +133,14 @@ endif
 ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1)
   KOKKOS_DEVICELIST += HIP
 endif
-KOKKOS_INTERNAL_HAVE_CXX17_OR_NEWER := $(shell expr $(KOKKOS_INTERNAL_ENABLE_CXX17) \
-                                                  + $(KOKKOS_INTERNAL_ENABLE_CXX20) \
-                                                  + $(KOKKOS_INTERNAL_ENABLE_CXX2A))
 ifeq ($(KOKKOS_INTERNAL_USE_SYCL), 1)
   KOKKOS_DEVICELIST += SYCL
-  ifneq ($(KOKKOS_INTERNAL_HAVE_CXX17_OR_NEWER), 1)
-    $(error SYCL backend requires C++17 or newer)
-  endif
-
 endif
 ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1)
   KOKKOS_DEVICELIST += OPENMPTARGET
-  ifneq ($(KOKKOS_INTERNAL_HAVE_CXX17_OR_NEWER), 1)
-    $(error OpenMPTarget backend requires C++17 or newer)
-  endif
+endif
+ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1)
+  KOKKOS_DEVICELIST += OpenACC
 endif
 
 ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1)
@@ -173,10 +163,9 @@ KOKKOS_INTERNAL_OS_DARWIN      := $(call kokkos_has_string,$(KOKKOS_OS),Darwin)
 # Check compiler.
 KOKKOS_CXX_VERSION                   := $(strip $(shell $(CXX) --version       2>&1))
 KOKKOS_INTERNAL_COMPILER_INTEL       := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),Intel Corporation)
-KOKKOS_INTERNAL_COMPILER_PGI         := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),PGI)
-KOKKOS_INTERNAL_COMPILER_XL          := $(strip $(shell $(CXX) -qversion       2>&1 | grep -c XL))
 KOKKOS_INTERNAL_COMPILER_CRAY        := $(strip $(shell $(CXX) -craype-verbose 2>&1 | grep -c "CC-"))
 KOKKOS_INTERNAL_COMPILER_NVCC        := $(strip $(shell echo "$(shell export OMPI_CXX=$(OMPI_CXX); export MPICH_CXX=$(MPICH_CXX); $(CXX) --version 2>&1 | grep -c nvcc)>0" | bc))
+KOKKOS_INTERNAL_COMPILER_NVHPC       := $(strip $(shell $(CXX) --version 2>&1 | grep -c "nvc++"))
 KOKKOS_INTERNAL_COMPILER_CLANG       := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),clang)
 KOKKOS_INTERNAL_COMPILER_CRAY_CLANG  := $(strip $(shell $(CXX) -craype-verbose 2>&1 | grep -c "clang++"))
 KOKKOS_INTERNAL_COMPILER_INTEL_CLANG := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),oneAPI)
@@ -192,7 +181,6 @@ ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC), 1)
   ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC_WRAPPER), 1)
 
     KOKKOS_CXX_HOST_VERSION             := $(strip $(shell $(CXX) $(CXXFLAGS) --host-version       2>&1))
-    KOKKOS_INTERNAL_COMPILER_PGI    := $(call kokkos_has_string,$(KOKKOS_CXX_HOST_VERSION),PGI)
     KOKKOS_INTERNAL_COMPILER_INTEL  := $(call kokkos_has_string,$(KOKKOS_CXX_HOST_VERSION),Intel Corporation)
     KOKKOS_INTERNAL_COMPILER_CLANG  := $(call kokkos_has_string,$(KOKKOS_CXX_HOST_VERSION),clang)
   endif
@@ -201,9 +189,6 @@ endif
 ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 2)
   KOKKOS_INTERNAL_COMPILER_CLANG = 1
 endif
-ifeq ($(KOKKOS_INTERNAL_COMPILER_XL), 2)
-  KOKKOS_INTERNAL_COMPILER_XL = 1
-endif
 
 # Apple Clang passes both clang and apple clang tests, so turn off clang.
 ifeq ($(KOKKOS_INTERNAL_COMPILER_APPLE_CLANG), 1)
@@ -243,113 +228,78 @@ endif
 
 # Set compiler warnings flags.
 ifeq ($(KOKKOS_INTERNAL_ENABLE_COMPILER_WARNINGS), 1)
-  ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1)
-    # TODO check if PGI accepts GNU style warnings
+  ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
+    KOKKOS_INTERNAL_COMPILER_WARNINGS = -Wall -Wunused-parameter -Wshadow -pedantic -Wsign-compare -Wtype-limits -Wuninitialized
+  else ifeq ($(KOKKOS_INTERNAL_COMPILER_APPLE_CLANG), 1)
+    KOKKOS_INTERNAL_COMPILER_WARNINGS = -Wall -Wunused-parameter -Wshadow -pedantic -Wsign-compare -Wtype-limits -Wuninitialized
+  else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
+    # TODO check if cray accepts GNU style warnings
     KOKKOS_INTERNAL_COMPILER_WARNINGS =
   else
-    ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
-      KOKKOS_INTERNAL_COMPILER_WARNINGS = -Wall -Wunused-parameter -Wshadow -pedantic -Wsign-compare -Wtype-limits -Wuninitialized
-    else
-      ifeq ($(KOKKOS_INTERNAL_COMPILER_APPLE_CLANG), 1)
-        KOKKOS_INTERNAL_COMPILER_WARNINGS = -Wall -Wunused-parameter -Wshadow -pedantic -Wsign-compare -Wtype-limits -Wuninitialized
-      else
-        ifeq ($(KOKKOS_INTERNAL_COMPILER_XL), 1)
-          KOKKOS_INTERNAL_COMPILER_WARNINGS = -Wall -Wunused-parameter -Wshadow -pedantic -Wsign-compare -Wtype-limits -Wuninitialized
-        else
-          ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
-            # TODO check if cray accepts GNU style warnings
-            KOKKOS_INTERNAL_COMPILER_WARNINGS =
-          else
-            #gcc
-            KOKKOS_INTERNAL_COMPILER_WARNINGS = -Wall -Wunused-parameter -Wshadow -pedantic -Wsign-compare -Wtype-limits -Wignored-qualifiers -Wempty-body -Wclobbered -Wuninitialized
-          endif
-        endif
-      endif
-    endif
+    #gcc
+    KOKKOS_INTERNAL_COMPILER_WARNINGS = -Wall -Wunused-parameter -Wshadow -pedantic -Wsign-compare -Wtype-limits -Wignored-qualifiers -Wempty-body -Wclobbered -Wuninitialized
   endif
 else
   KOKKOS_INTERNAL_COMPILER_WARNINGS =
 endif
 
 # Set OpenMP flags.
-ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1)
-  KOKKOS_INTERNAL_OPENMP_FLAG := -mp
-else
-  ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
-    ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY_CLANG), 1)
+ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
+  ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY_CLANG), 1)
+    KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp
+  else ifeq ($(KOKKOS_INTERNAL_COMPILER_FUJITSU), 1)
+    # fujitsu (clang mode) fails with `=libomp`
     KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp
-    else
-      ifeq ($(KOKKOS_INTERNAL_COMPILER_FUJITSU), 1)
-      # fujitsu (clang mode) fails with `=libomp`
-      KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp
-      else
-      KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp=libomp
-      endif
-    endif
   else
-    ifeq ($(KOKKOS_INTERNAL_COMPILER_APPLE_CLANG), 1)
-      KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp=libomp
-    else
-      ifeq ($(KOKKOS_INTERNAL_COMPILER_XL), 1)
-        KOKKOS_INTERNAL_OPENMP_FLAG := -qsmp=omp
-      else
-        ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
-          # OpenMP is turned on by default in Cray compiler environment.
-          KOKKOS_INTERNAL_OPENMP_FLAG :=
-        else
-          ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL_CLANG), 1)
-            KOKKOS_INTERNAL_OPENMP_FLAG := -fiopenmp
-          else
-            KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp
-          endif
-        endif
-      endif
-    endif
+    KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp=libomp
+  endif
+else
+  ifeq ($(KOKKOS_INTERNAL_COMPILER_APPLE_CLANG), 1)
+    KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp=libomp
+  else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
+    # OpenMP is turned on by default in Cray compiler environment.
+    KOKKOS_INTERNAL_OPENMP_FLAG :=
+  else ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL_CLANG), 1)
+    KOKKOS_INTERNAL_OPENMP_FLAG := -fiopenmp
+  else
+    KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp
   endif
 endif
-ifeq ($(KOKKOS_INTERNAL_COMPILER_XL), 1)
-  KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -DKOKKOS_IBM_XL_OMP45_WORKAROUND -qsmp=omp -qoffload -qnoeh
+ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
+  #KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -DKOKKOS_BUG_WORKAROUND_IBM_CLANG_OMP45_VIEW_INIT -fopenmp-implicit-declare-target -fopenmp-targets=nvptx64-nvidia-cuda -fopenmp -fopenmp=libomp
+  KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -DKOKKOS_WORKAROUND_OPENMPTARGET_CLANG -fopenmp -fopenmp=libomp -Wno-openmp-mapping
+  KOKKOS_INTERNAL_OPENMPTARGET_LIB := -lomptarget
+else ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL_CLANG), 1)
+  KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -fiopenmp -Wno-openmp-mapping
 else
-  ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
-    #KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -DKOKKOS_BUG_WORKAROUND_IBM_CLANG_OMP45_VIEW_INIT -fopenmp-implicit-declare-target -fopenmp-targets=nvptx64-nvidia-cuda -fopenmp -fopenmp=libomp
-    KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -DKOKKOS_WORKAROUND_OPENMPTARGET_CLANG -fopenmp -fopenmp=libomp -Wno-openmp-mapping
-    KOKKOS_INTERNAL_OPENMPTARGET_LIB := -lomptarget
+  #Assume GCC
+  KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -fopenmp -foffload=nvptx-none
+endif
+
+ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1)
+  # Set OpenACC flags.
+  ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 1)
+    KOKKOS_INTERNAL_OPENACC_FLAG := -acc
   else
-    ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL_CLANG), 1)
-      KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -fiopenmp -Wno-openmp-mapping
-    else
-      #Assume GCC
-      KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -fopenmp -foffload=nvptx-none
-    endif
+    $(error Makefile.kokkos: OpenACC is enabled but the compiler must be NVHPC (got version string $(KOKKOS_CXX_VERSION)))
   endif
 endif
 
 # Set C++ version flags.
-ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1)
-  KOKKOS_INTERNAL_CXX14_FLAG := --c++14
-  KOKKOS_INTERNAL_CXX17_FLAG := --c++17
+ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
+  KOKKOS_INTERNAL_CXX17_FLAG := -hstd=c++17
+  KOKKOS_INTERNAL_CXX1Z_FLAG := -hstd=c++1z
+  KOKKOS_INTERNAL_CXX20_FLAG := -hstd=c++20
+  KOKKOS_INTERNAL_CXX2A_FLAG := -hstd=c++2a
+  KOKKOS_INTERNAL_CXX23_FLAG := -hstd=c++23
+  KOKKOS_INTERNAL_CXX2A_FLAG := -hstd=c++2b
 else
-  ifeq ($(KOKKOS_INTERNAL_COMPILER_XL), 1)
-     KOKKOS_INTERNAL_CXX14_FLAG := -std=c++14
-     KOKKOS_INTERNAL_CXX1Y_FLAG := -std=c++1y
-     #KOKKOS_INTERNAL_CXX17_FLAG := -std=c++17
-     #KOKKOS_INTERNAL_CXX1Z_FLAG := -std=c++1Z
-     #KOKKOS_INTERNAL_CXX2A_FLAG := -std=c++2a
-  else
-    ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
-      KOKKOS_INTERNAL_CXX14_FLAG := -hstd=c++14
-      #KOKKOS_INTERNAL_CXX1Y_FLAG := -hstd=c++1y
-      #KOKKOS_INTERNAL_CXX17_FLAG := -hstd=c++17
-      #KOKKOS_INTERNAL_CXX1Z_FLAG := -hstd=c++1z
-      #KOKKOS_INTERNAL_CXX2A_FLAG := -hstd=c++2a
-    else
-      KOKKOS_INTERNAL_CXX14_FLAG := -std=c++14
-      KOKKOS_INTERNAL_CXX1Y_FLAG := -std=c++1y
-      KOKKOS_INTERNAL_CXX17_FLAG := -std=c++17
-      KOKKOS_INTERNAL_CXX1Z_FLAG := -std=c++1z
-      KOKKOS_INTERNAL_CXX2A_FLAG := -std=c++2a
-    endif
-  endif
+  KOKKOS_INTERNAL_CXX17_FLAG := -std=c++17
+  KOKKOS_INTERNAL_CXX1Z_FLAG := -std=c++1z
+  KOKKOS_INTERNAL_CXX20_FLAG := -std=c++20
+  KOKKOS_INTERNAL_CXX2A_FLAG := -std=c++2a
+  KOKKOS_INTERNAL_CXX23_FLAG := -std=c++23
+  KOKKOS_INTERNAL_CXX2B_FLAG := -std=c++2b
 endif
 
 # Check for Kokkos Architecture settings.
@@ -391,6 +341,8 @@ KOKKOS_INTERNAL_USE_ARCH_VOLTA72 := $(call kokkos_has_string,$(KOKKOS_ARCH),Volt
 KOKKOS_INTERNAL_USE_ARCH_TURING75 := $(call kokkos_has_string,$(KOKKOS_ARCH),Turing75)
 KOKKOS_INTERNAL_USE_ARCH_AMPERE80 := $(call kokkos_has_string,$(KOKKOS_ARCH),Ampere80)
 KOKKOS_INTERNAL_USE_ARCH_AMPERE86 := $(call kokkos_has_string,$(KOKKOS_ARCH),Ampere86)
+KOKKOS_INTERNAL_USE_ARCH_ADA89 := $(call kokkos_has_string,$(KOKKOS_ARCH),Ada89)
+KOKKOS_INTERNAL_USE_ARCH_HOPPER90 := $(call kokkos_has_string,$(KOKKOS_ARCH),Hopper90)
 KOKKOS_INTERNAL_USE_ARCH_NVIDIA := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_KEPLER30)  \
                                               + $(KOKKOS_INTERNAL_USE_ARCH_KEPLER32)  \
                                               + $(KOKKOS_INTERNAL_USE_ARCH_KEPLER35)  \
@@ -404,7 +356,9 @@ KOKKOS_INTERNAL_USE_ARCH_NVIDIA := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_KEPLE
                                               + $(KOKKOS_INTERNAL_USE_ARCH_VOLTA72)   \
                                               + $(KOKKOS_INTERNAL_USE_ARCH_TURING75)  \
                                               + $(KOKKOS_INTERNAL_USE_ARCH_AMPERE80)  \
-                                              + $(KOKKOS_INTERNAL_USE_ARCH_AMPERE86))
+                                              + $(KOKKOS_INTERNAL_USE_ARCH_AMPERE86)  \
+                                              + $(KOKKOS_INTERNAL_USE_ARCH_ADA89)     \
+                                              + $(KOKKOS_INTERNAL_USE_ARCH_HOPPER90))
 
 #SEK: This seems like a bug to me
 ifeq ($(KOKKOS_INTERNAL_USE_ARCH_NVIDIA), 0)
@@ -447,10 +401,10 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ZEN3), 0)
     KOKKOS_INTERNAL_USE_ARCH_ZEN := $(call kokkos_has_string,$(KOKKOS_ARCH),Zen)
   endif
 endif
-KOKKOS_INTERNAL_USE_ARCH_VEGA900 := $(call kokkos_has_string,$(KOKKOS_ARCH),Vega900)
 KOKKOS_INTERNAL_USE_ARCH_VEGA906 := $(call kokkos_has_string,$(KOKKOS_ARCH),Vega906)
 KOKKOS_INTERNAL_USE_ARCH_VEGA908 := $(call kokkos_has_string,$(KOKKOS_ARCH),Vega908)
 KOKKOS_INTERNAL_USE_ARCH_VEGA90A := $(call kokkos_has_string,$(KOKKOS_ARCH),Vega90A)
+KOKKOS_INTERNAL_USE_ARCH_NAVI1030 := $(call kokkos_has_string,$(KOKKOS_ARCH),Navi1030)
 
 # Any AVX?
 KOKKOS_INTERNAL_USE_ARCH_SSE42      := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_WSM))
@@ -518,13 +472,15 @@ tmp := $(call kokkos_append_header,'$H''endif')
 
 tmp := $(call kokkos_append_header,"")
 tmp := $(call kokkos_append_header,"$H""define KOKKOS_VERSION $(KOKKOS_VERSION)")
+tmp := $(call kokkos_append_header,"$H""define KOKKOS_VERSION_MAJOR $(KOKKOS_VERSION_MAJOR)")
+tmp := $(call kokkos_append_header,"$H""define KOKKOS_VERSION_MINOR $(KOKKOS_VERSION_MINOR)")
+tmp := $(call kokkos_append_header,"$H""define KOKKOS_VERSION_PATCH $(KOKKOS_VERSION_PATCH)")
 tmp := $(call kokkos_append_header,"")
 
 tmp := $(call kokkos_append_header,"/* Execution Spaces */")
 
 ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1)
   tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA")
-  tmp := $(call kokkos_append_header,"$H""define KOKKOS_COMPILER_CUDA_VERSION $(KOKKOS_INTERNAL_COMPILER_NVCC_VERSION)")
 endif
 
 ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1)
@@ -543,6 +499,10 @@ ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1)
   endif
 endif
 
+ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1)
+  tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_OPENACC")
+endif
+
 ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1)
   tmp := $(call kokkos_append_header,'$H''define KOKKOS_ENABLE_OPENMP')
 endif
@@ -562,22 +522,11 @@ endif
 #only add the c++ standard flags if this is not CMake
 tmp := $(call kokkos_append_header,"/* General Settings */")
 ifneq ($(KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE), 1)
-  tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_DEPRECATED_CODE_3")
+  tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_DEPRECATED_CODE_4")
 endif
 ifeq ($(KOKKOS_INTERNAL_ENABLE_DEPRECATION_WARNINGS), 1)
   tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_DEPRECATION_WARNINGS")
 endif
-ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX14), 1)
-ifneq ($(KOKKOS_STANDALONE_CMAKE), yes)
-  KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX14_FLAG)
-endif
-  tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX14")
-endif
-ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX1Y), 1)
-  #I cannot make CMake add this in a good way - so add it here
-  KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX1Y_FLAG)
-  tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX14")
-endif
 ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX17), 1)
 ifneq ($(KOKKOS_STANDALONE_CMAKE), yes)
   KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX17_FLAG)
@@ -589,15 +538,25 @@ ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX1Z), 1)
   KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX1Z_FLAG)
   tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX17")
 endif
+ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX20), 1)
+  #I cannot make CMake add this in a good way - so add it here
+  KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX20_FLAG)
+  tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX20")
+endif
 ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX2A), 1)
   #I cannot make CMake add this in a good way - so add it here
   KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX2A_FLAG)
   tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX20")
 endif
-ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX20), 1)
+ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX23), 1)
   #I cannot make CMake add this in a good way - so add it here
-  KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX20_FLAG)
-  tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX20")
+  KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX23_FLAG)
+  tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX23")
+endif
+ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX2B), 1)
+  #I cannot make CMake add this in a good way - so add it here
+  KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX2B_FLAG)
+  tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX23")
 endif
 
 ifeq ($(KOKKOS_INTERNAL_ENABLE_DEBUG), 1)
@@ -678,15 +637,15 @@ endif
 tmp := $(call kokkos_append_header,"/* Cuda Settings */")
 
 ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1)
+  #deprecated
   ifeq ($(KOKKOS_INTERNAL_CUDA_USE_LDG), 1)
     tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_LDG_INTRINSIC")
-  else
-    ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
-      tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_LDG_INTRINSIC")
-    endif
+  else ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
+    tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_LDG_INTRINSIC")
   endif
 
   ifeq ($(KOKKOS_INTERNAL_CUDA_USE_UVM), 1)
+    # deprecated
     tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_UVM")
   endif
 
@@ -711,12 +670,8 @@ ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1)
 
   ifeq ($(KOKKOS_INTERNAL_CUDA_USE_LAMBDA), 1)
     ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC), 1)
-      ifeq ($(shell test $(KOKKOS_INTERNAL_COMPILER_NVCC_VERSION) -gt 70; echo $$?),0)
-        tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_LAMBDA")
-        KOKKOS_CXXFLAGS += -expt-extended-lambda
-      else
-        $(warning Warning: Cuda Lambda support was requested but NVCC version is too low. This requires NVCC for Cuda version 7.5 or higher. Disabling Lambda support now.)
-      endif
+      tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_LAMBDA")
+      KOKKOS_CXXFLAGS += -expt-extended-lambda
     endif
 
     ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
@@ -726,12 +681,8 @@ ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1)
 
   ifeq ($(KOKKOS_INTERNAL_CUDA_USE_CONSTEXPR), 1)
     ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC), 1)
-      ifeq ($(shell test $(KOKKOS_INTERNAL_COMPILER_NVCC_VERSION) -ge 80; echo $$?),0)
-        tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_CONSTEXPR")
-        KOKKOS_CXXFLAGS += -expt-relaxed-constexpr
-      else
-        $(warning Warning: Cuda relaxed constexpr support was requested but NVCC version is too low. This requires NVCC for Cuda version 8.0 or higher. Disabling relaxed constexpr support now.)
-      endif
+      tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_CONSTEXPR")
+      KOKKOS_CXXFLAGS += -expt-relaxed-constexpr
     endif
 
     ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
@@ -759,13 +710,8 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ARMV80), 1)
     KOKKOS_CXXFLAGS +=
     KOKKOS_LDFLAGS +=
   else
-    ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1)
-      KOKKOS_CXXFLAGS +=
-      KOKKOS_LDFLAGS +=
-    else
-      KOKKOS_CXXFLAGS += -march=armv8-a
-      KOKKOS_LDFLAGS += -march=armv8-a
-    endif
+    KOKKOS_CXXFLAGS += -march=armv8-a
+    KOKKOS_LDFLAGS += -march=armv8-a
   endif
 endif
 
@@ -776,13 +722,8 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ARMV81), 1)
     KOKKOS_CXXFLAGS +=
     KOKKOS_LDFLAGS +=
   else
-    ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1)
-      KOKKOS_CXXFLAGS +=
-      KOKKOS_LDFLAGS +=
-    else
-      KOKKOS_CXXFLAGS += -march=armv8.1-a
-      KOKKOS_LDFLAGS += -march=armv8.1-a
-    endif
+    KOKKOS_CXXFLAGS += -march=armv8.1-a
+    KOKKOS_LDFLAGS += -march=armv8.1-a
   endif
 endif
 
@@ -848,13 +789,8 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ARMV8_THUNDERX), 1)
     KOKKOS_CXXFLAGS +=
     KOKKOS_LDFLAGS +=
   else
-    ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1)
-      KOKKOS_CXXFLAGS +=
-      KOKKOS_LDFLAGS +=
-    else
-      KOKKOS_CXXFLAGS += -march=armv8-a -mtune=thunderx
-      KOKKOS_LDFLAGS += -march=armv8-a -mtune=thunderx
-    endif
+    KOKKOS_CXXFLAGS += -march=armv8-a -mtune=thunderx
+    KOKKOS_LDFLAGS += -march=armv8-a -mtune=thunderx
   endif
 endif
 
@@ -866,13 +802,8 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ARMV8_THUNDERX2), 1)
     KOKKOS_CXXFLAGS +=
     KOKKOS_LDFLAGS +=
   else
-    ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1)
-      KOKKOS_CXXFLAGS +=
-      KOKKOS_LDFLAGS +=
-    else
-      KOKKOS_CXXFLAGS += -mtune=thunderx2t99 -mcpu=thunderx2t99
-      KOKKOS_LDFLAGS += -mtune=thunderx2t99 -mcpu=thunderx2t99
-    endif
+    KOKKOS_CXXFLAGS += -mtune=thunderx2t99 -mcpu=thunderx2t99
+    KOKKOS_LDFLAGS += -mtune=thunderx2t99 -mcpu=thunderx2t99
   endif
 endif
 
@@ -882,19 +813,11 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_SSE42), 1)
   ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1)
     KOKKOS_CXXFLAGS += -xSSE4.2
     KOKKOS_LDFLAGS  += -xSSE4.2
+  else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
   else
-    ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
-
-    else
-      ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1)
-        KOKKOS_CXXFLAGS += -tp=nehalem
-        KOKKOS_LDFLAGS  += -tp=nehalem
-      else
-        # Assume that this is a really a GNU compiler.
-        KOKKOS_CXXFLAGS += -msse4.2
-        KOKKOS_LDFLAGS  += -msse4.2
-      endif
-    endif
+    # Assume that this is a really a GNU compiler.
+    KOKKOS_CXXFLAGS += -msse4.2
+    KOKKOS_LDFLAGS  += -msse4.2
   endif
 endif
 
@@ -904,54 +827,34 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AVX), 1)
   ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1)
     KOKKOS_CXXFLAGS += -mavx
     KOKKOS_LDFLAGS  += -mavx
+  else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
   else
-    ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
-
-    else
-      ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1)
-        KOKKOS_CXXFLAGS += -tp=sandybridge
-        KOKKOS_LDFLAGS  += -tp=sandybridge
-      else
-        # Assume that this is a really a GNU compiler.
-        KOKKOS_CXXFLAGS += -mavx
-        KOKKOS_LDFLAGS  += -mavx
-      endif
-    endif
+    # Assume that this is a really a GNU compiler.
+    KOKKOS_CXXFLAGS += -mavx
+    KOKKOS_LDFLAGS  += -mavx
   endif
 endif
 
 ifeq ($(KOKKOS_INTERNAL_USE_ARCH_POWER7), 1)
   tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_POWER7")
 
-  ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1)
-
-  else
-    # Assume that this is a really a GNU compiler or it could be XL on P8.
-    KOKKOS_CXXFLAGS += -mcpu=power7 -mtune=power7
-    KOKKOS_LDFLAGS  += -mcpu=power7 -mtune=power7
-  endif
+  # Assume that this is a really a GNU compiler.
+  KOKKOS_CXXFLAGS += -mcpu=power7 -mtune=power7
+  KOKKOS_LDFLAGS  += -mcpu=power7 -mtune=power7
 endif
 
 ifeq ($(KOKKOS_INTERNAL_USE_ARCH_POWER8), 1)
   tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_POWER8")
 
-  ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1)
-
-  else
-    KOKKOS_CXXFLAGS += -mcpu=power8 -mtune=power8
-    KOKKOS_LDFLAGS  += -mcpu=power8 -mtune=power8
-  endif
+  KOKKOS_CXXFLAGS += -mcpu=power8 -mtune=power8
+  KOKKOS_LDFLAGS  += -mcpu=power8 -mtune=power8
 endif
 
 ifeq ($(KOKKOS_INTERNAL_USE_ARCH_POWER9), 1)
   tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_POWER9")
 
-  ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1)
-
-  else
-    KOKKOS_CXXFLAGS += -mcpu=power9 -mtune=power9
-    KOKKOS_LDFLAGS  += -mcpu=power9 -mtune=power9
-  endif
+  KOKKOS_CXXFLAGS += -mcpu=power9 -mtune=power9
+  KOKKOS_LDFLAGS  += -mcpu=power9 -mtune=power9
 endif
 
 ifeq ($(KOKKOS_INTERNAL_USE_ARCH_HSW), 1)
@@ -960,19 +863,11 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_HSW), 1)
   ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1)
     KOKKOS_CXXFLAGS += -xCORE-AVX2
     KOKKOS_LDFLAGS  += -xCORE-AVX2
+  else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
   else
-    ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
-
-    else
-      ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1)
-        KOKKOS_CXXFLAGS += -tp=haswell
-        KOKKOS_LDFLAGS  += -tp=haswell
-      else
-        # Assume that this is a really a GNU compiler.
-        KOKKOS_CXXFLAGS += -march=core-avx2 -mtune=core-avx2
-        KOKKOS_LDFLAGS  += -march=core-avx2 -mtune=core-avx2
-      endif
-    endif
+    # Assume that this is a really a GNU compiler.
+    KOKKOS_CXXFLAGS += -march=core-avx2 -mtune=core-avx2
+    KOKKOS_LDFLAGS  += -march=core-avx2 -mtune=core-avx2
   endif
 endif
 
@@ -982,19 +877,11 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_BDW), 1)
   ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1)
     KOKKOS_CXXFLAGS += -xCORE-AVX2
     KOKKOS_LDFLAGS  += -xCORE-AVX2
+  else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
   else
-    ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
-
-    else
-      ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1)
-        KOKKOS_CXXFLAGS += -tp=haswell
-        KOKKOS_LDFLAGS  += -tp=haswell
-      else
-        # Assume that this is a really a GNU compiler.
-        KOKKOS_CXXFLAGS += -march=core-avx2 -mtune=core-avx2 -mrtm
-        KOKKOS_LDFLAGS  += -march=core-avx2 -mtune=core-avx2 -mrtm
-      endif
-    endif
+    # Assume that this is a really a GNU compiler.
+    KOKKOS_CXXFLAGS += -march=core-avx2 -mtune=core-avx2 -mrtm
+    KOKKOS_LDFLAGS  += -march=core-avx2 -mtune=core-avx2 -mrtm
   endif
 endif
 
@@ -1004,18 +891,11 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AVX512MIC), 1)
   ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1)
     KOKKOS_CXXFLAGS += -xMIC-AVX512
     KOKKOS_LDFLAGS  += -xMIC-AVX512
+  else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
   else
-    ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
-
-    else
-      ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1)
-
-      else
-        # Asssume that this is really a GNU compiler.
-        KOKKOS_CXXFLAGS += -march=knl -mtune=knl
-        KOKKOS_LDFLAGS  += -march=knl -mtune=knl
-      endif
-    endif
+    # Asssume that this is really a GNU compiler.
+    KOKKOS_CXXFLAGS += -march=knl -mtune=knl
+    KOKKOS_LDFLAGS  += -march=knl -mtune=knl
   endif
 endif
 
@@ -1025,18 +905,11 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_SKL), 1)
   ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1)
     KOKKOS_CXXFLAGS += -xSKYLAKE
     KOKKOS_LDFLAGS  += -xSKYLAKE
+  else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
   else
-    ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
-
-    else
-      ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1)
-
-      else
-        # Nothing here yet.
-	KOKKOS_CXXFLAGS += -march=skylake
-	KOKKOS_LDFLAGS  += -march=skylake
-      endif
-    endif
+    # Nothing here yet.
+    KOKKOS_CXXFLAGS += -march=skylake
+    KOKKOS_LDFLAGS  += -march=skylake
   endif
 endif
 
@@ -1046,18 +919,11 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_SKX), 1)
   ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1)
     KOKKOS_CXXFLAGS += -xCORE-AVX512
     KOKKOS_LDFLAGS  += -xCORE-AVX512
+  else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
   else
-    ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1)
-
-    else
-      ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1)
-
-      else
-        # Nothing here yet.
-        KOKKOS_CXXFLAGS += -march=skylake-avx512 -mtune=skylake-avx512
-        KOKKOS_LDFLAGS  += -march=skylake-avx512 -mtune=skylake-avx512
-      endif
-    endif
+    # Nothing here yet.
+    KOKKOS_CXXFLAGS += -march=skylake-avx512 -mtune=skylake-avx512
+    KOKKOS_LDFLAGS  += -march=skylake-avx512 -mtune=skylake-avx512
   endif
 endif
 
@@ -1184,6 +1050,15 @@ ifeq ($(KOKKOS_INTERNAL_USE_CUDA_ARCH), 1)
     tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMPERE86")
     KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_86
   endif
+  ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ADA89), 1)
+    tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ADA89")
+    KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_89
+  endif
+  ifeq ($(KOKKOS_INTERNAL_USE_ARCH_HOPPER90), 1)
+    tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_HOPPER")
+    tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_HOPPER90")
+    KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_90
+  endif
 
   ifneq ($(KOKKOS_INTERNAL_USE_ARCH_NVIDIA), 0)
     KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)
@@ -1197,20 +1072,12 @@ ifeq ($(KOKKOS_INTERNAL_USE_CUDA_ARCH), 1)
       endif
     endif
   endif
-  ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1)
-    KOKKOS_CXXFLAGS += --expt-extended-lambda
-  endif
 endif
 
 
 # Figure out the architecture flag for ROCm.
 ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1)
   # Lets start with adding architecture defines
-  ifeq ($(KOKKOS_INTERNAL_USE_ARCH_VEGA900), 1)
-    tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VEGA900")
-    tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VEGA")
-    KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx900
-  endif
   ifeq ($(KOKKOS_INTERNAL_USE_ARCH_VEGA906), 1)
     tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VEGA906")
     tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VEGA")
@@ -1226,6 +1093,16 @@ ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1)
     tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VEGA")
     KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx90a
   endif
+  ifeq ($(KOKKOS_INTERNAL_USE_ARCH_NAVI1030), 1)
+    tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_NAVI1030")
+    tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_NAVI")
+    KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx1030
+  endif
+  ifeq ($(KOKKOS_INTERNAL_USE_ARCH_NAVI1100), 1)
+    tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_NAVI1100")
+    tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_NAVI")
+    KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx1100
+  endif
 
 
   KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/core/src/HIP/*.cpp)
@@ -1282,12 +1159,12 @@ endif
 ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_XEHP), 1)
   tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GPU")
   tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_XEHP")
-  KOKKOS_INTERNAL_INTEL_ARCH_FLAG := -f${KOKKOS_INTERNAL_LC_BACKEND}-targets=spir64_gen -X${KOKKOS_INTERNAL_LC_BACKEND}-target-backend "-device xehp"
+  KOKKOS_INTERNAL_INTEL_ARCH_FLAG := -f${KOKKOS_INTERNAL_LC_BACKEND}-targets=spir64_gen -X${KOKKOS_INTERNAL_LC_BACKEND}-target-backend "-device 12.50.4"
 endif
 ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_PVC), 1)
   tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GPU")
   tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_PVC")
-  KOKKOS_INTERNAL_INTEL_ARCH_FLAG := -f${KOKKOS_INTERNAL_LC_BACKEND}-targets=spir64_gen -X${KOKKOS_INTERNAL_LC_BACKEND}-target-backend "-device 12.4.0"
+  KOKKOS_INTERNAL_INTEL_ARCH_FLAG := -f${KOKKOS_INTERNAL_LC_BACKEND}-targets=spir64_gen -X${KOKKOS_INTERNAL_LC_BACKEND}-target-backend "-device 12.60.7"
 endif
 
 ifeq ($(KOKKOS_INTERNAL_USE_SYCL), 1)
@@ -1308,11 +1185,14 @@ endif
 ifeq ($(KOKKOS_INTERNAL_DISABLE_DESUL_ATOMICS), 0)
   tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_IMPL_DESUL_ATOMICS")
   KOKKOS_CPPFLAGS+=-I$(KOKKOS_PATH)/tpls/desul/include
-else
-  ifeq ($(KOKKOS_INTERNAL_ENABLE_DESUL_ATOMICS), 1)
-    $(error Contradictory Desul atomics options: KOKKOS_OPTIONS=$(KOKKOS_OPTIONS) )
-  endif
+else ifeq ($(KOKKOS_INTERNAL_ENABLE_DESUL_ATOMICS), 1)
+  $(error Contradictory Desul atomics options: KOKKOS_OPTIONS=$(KOKKOS_OPTIONS) )
+endif
+
+ifeq ($(KOKKOS_INTERNAL_DISABLE_BUNDLED_MDSPAN), 0)
+  KOKKOS_CPPFLAGS+=-I$(KOKKOS_PATH)/tpls/mdspan/include
 endif
+tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_IMPL_MDSPAN")
 
 KOKKOS_INTERNAL_LS_CONFIG := $(shell ls KokkosCore_config.h 2>&1)
 
@@ -1341,9 +1221,6 @@ ifneq ($(KOKKOS_INTERNAL_NEW_CONFIG), 0)
     tmp := $(call kokkos_append_config_header,"$H""include <fwd/Kokkos_Fwd_CUDA.hpp>","KokkosCore_Config_FwdBackend.hpp")
     tmp := $(call kokkos_append_config_header,"$H""include <decl/Kokkos_Declare_CUDA.hpp>","KokkosCore_Config_DeclareBackend.hpp")
     tmp := $(call kokkos_append_config_header,"$H""include <setup/Kokkos_Setup_Cuda.hpp>","KokkosCore_Config_SetupBackend.hpp")
-    ifeq ($(KOKKOS_INTERNAL_CUDA_USE_UVM), 1)
-    else
-    endif
   endif
   ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1)
     tmp := $(call kokkos_append_config_header,"$H""include <fwd/Kokkos_Fwd_OPENMPTARGET.hpp>","KokkosCore_Config_FwdBackend.hpp")
@@ -1362,6 +1239,10 @@ ifneq ($(KOKKOS_INTERNAL_NEW_CONFIG), 0)
     tmp := $(call kokkos_append_config_header,"$H""include <fwd/Kokkos_Fwd_OPENMP.hpp>","KokkosCore_Config_FwdBackend.hpp")
     tmp := $(call kokkos_append_config_header,"$H""include <decl/Kokkos_Declare_OPENMP.hpp>","KokkosCore_Config_DeclareBackend.hpp")
   endif
+  ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1)
+    tmp := $(call kokkos_append_config_header,"\#include <fwd/Kokkos_Fwd_OPENACC.hpp>","KokkosCore_Config_FwdBackend.hpp")
+    tmp := $(call kokkos_append_config_header,"\#include <decl/Kokkos_Declare_OPENACC.hpp>","KokkosCore_Config_DeclareBackend.hpp")
+  endif
   ifeq ($(KOKKOS_INTERNAL_USE_THREADS), 1)
     tmp := $(call kokkos_append_config_header,"$H""include <fwd/Kokkos_Fwd_THREADS.hpp>","KokkosCore_Config_FwdBackend.hpp")
     tmp := $(call kokkos_append_config_header,"$H""include <decl/Kokkos_Declare_THREADS.hpp>","KokkosCore_Config_DeclareBackend.hpp")
@@ -1429,6 +1310,14 @@ ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1)
   KOKKOS_LIBS += $(KOKKOS_INTERNAL_OPENMPTARGET_LIB)
 endif
 
+ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1)
+  KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/core/src/OpenACC/*.cpp)
+  KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/OpenACC/*.hpp)
+  KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_OPENACC_FLAG)
+  KOKKOS_LDFLAGS += $(KOKKOS_INTERNAL_OPENACC_FLAG)
+  KOKKOS_LIBS += $(KOKKOS_INTERNAL_OPENACC_LIB)
+endif
+
 ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1)
   KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/core/src/OpenMP/*.cpp)
   KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/OpenMP/*.hpp)
@@ -1499,11 +1388,64 @@ endif
 KOKKOS_EXTRA_LIBS := ${KOKKOS_LIBS}
 KOKKOS_LIBS := -lkokkos ${KOKKOS_LIBS}
 
+# Generating the <desul/atomics/Config.hpp> header
+DESUL_INTERNAL_CONFIG_TMP=Desul_Config.tmp
+ifeq ($(KOKKOS_INTERNAL_DISABLE_DESUL_ATOMICS), 0)
+  DESUL_CONFIG_HEADER=desul/atomics/Config.hpp
+else
+  DESUL_CONFIG_HEADER=NothingToSeeHereMoveAlong
+endif
+desul_append_header = $(shell echo $1 >> $(DESUL_INTERNAL_CONFIG_TMP))
+tmp := $(call desul_append_header, "// generated by on-demand build system by crtrott" > $(DESUL_INTERNAL_CONFIG_TMP))
+tmp := $(call desul_append_header, "$H""ifndef DESUL_ATOMICS_CONFIG_HPP_")
+tmp := $(call desul_append_header, "$H""define DESUL_ATOMICS_CONFIG_HPP_")
+tmp := $(call desul_append_header, "")
+ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1)
+  tmp := $(call desul_append_header,"$H""define DESUL_ATOMICS_ENABLE_CUDA")
+else
+  tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_CUDA */")
+endif
+
+ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1)
+  tmp := $(call desul_append_header,"$H""define DESUL_ATOMICS_ENABLE_HIP")
+else
+  tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_HIP */")
+endif
+
+ifeq ($(KOKKOS_INTERNAL_USE_SYCL), 1)
+  tmp := $(call desul_append_header,"$H""define DESUL_ATOMICS_ENABLE_SYCL")
+else
+  tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_SYCL */")
+endif
+
+ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1)
+  tmp := $(call desul_append_header,"$H""define DESUL_ATOMICS_ENABLE_OPENMP")
+else
+  tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_OPENMP */")
+endif
+tmp := $(call desul_append_header, "")
+tmp := $(call desul_append_header, "$H""endif")
+
+DESUL_INTERNAL_LS_CONFIG := $(shell ls $(DESUL_CONFIG_HEADER) 2>&1)
+
+ifeq ($(DESUL_INTERNAL_LS_CONFIG), $(DESUL_CONFIG_HEADER))
+  DESUL_INTERNAL_NEW_CONFIG := $(strip $(shell diff $(DESUL_CONFIG_HEADER) $(DESUL_INTERNAL_CONFIG_TMP) | grep -c define))
+else
+  DESUL_INTERNAL_NEW_CONFIG := 1
+endif
+
+ifneq ($(DESUL_INTERNAL_NEW_CONFIG), 0)
+  tmp := $(shell mkdir -p desul/atomics)
+  tmp := $(shell cp $(DESUL_INTERNAL_CONFIG_TMP) $(DESUL_CONFIG_HEADER))
+endif
+
 # Setting up dependencies.
 
 KokkosCore_config.h:
 
-KOKKOS_CPP_DEPENDS := KokkosCore_config.h $(KOKKOS_HEADERS)
+$(DESUL_CONFIG_HEADER):
+
+KOKKOS_CPP_DEPENDS := $(DESUL_CONFIG_HEADER) KokkosCore_config.h $(KOKKOS_HEADERS)
 
 KOKKOS_OBJ = $(KOKKOS_SRC:.cpp=.o)
 KOKKOS_OBJ_LINK = $(notdir $(KOKKOS_OBJ))
@@ -1511,7 +1453,7 @@ KOKKOS_OBJ_LINK = $(notdir $(KOKKOS_OBJ))
 include $(KOKKOS_PATH)/Makefile.targets
 
 kokkos-clean:
-	rm -f $(KOKKOS_OBJ_LINK) KokkosCore_config.h KokkosCore_config.tmp libkokkos.a KokkosCore_Config_SetupBackend.hpp \
+	rm -f $(KOKKOS_OBJ_LINK) $(DESUL_CONFIG_HEADER) $(DESUL_INTERNAL_CONFIG_TMP) KokkosCore_config.h KokkosCore_config.tmp libkokkos.a KokkosCore_Config_SetupBackend.hpp \
 	KokkosCore_Config_FwdBackend.hpp KokkosCore_Config_DeclareBackend.hpp KokkosCore_Config_DeclareBackend.tmp \
         KokkosCore_Config_FwdBackend.tmp KokkosCore_Config_PostInclude.hpp KokkosCore_Config_PostInclude.tmp KokkosCore_Config_SetupBackend.tmp
 
diff --git a/packages/kokkos/Makefile.targets b/packages/kokkos/Makefile.targets
index 876726e9479966921f0774d4f365d07120d14e97..32b1fab2615dda91ab573de6166a157e3466fd1b 100644
--- a/packages/kokkos/Makefile.targets
+++ b/packages/kokkos/Makefile.targets
@@ -67,6 +67,12 @@ Kokkos_SYCL_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/SYCL/Kokko
 endif
 
 ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1)
+Kokkos_HIP.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP.cpp
+	$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP.cpp
+Kokkos_HIP_SharedAllocationRecord.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.cpp
+	$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.cpp
+Kokkos_HIP_DeepCopy.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_DeepCopy.cpp
+	$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_DeepCopy.cpp
 Kokkos_HIP_Space.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Space.cpp
 	$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Space.cpp
 Kokkos_HIP_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Instance.cpp
@@ -107,5 +113,16 @@ Kokkos_OpenMPTarget_Task.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMP
 	$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.cpp
 endif
 
+ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1)
+Kokkos_OpenACC.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACC.cpp
+	$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACC.cpp
+Kokkos_OpenACCSpace.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACCSpace.cpp
+	$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACCSpace.cpp
+Kokkos_OpenACC_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACC_Instance.cpp
+	$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACC_Instance.cpp
+Kokkos_OpenACC_SharedAllocationRecord.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACC_SharedAllocationRecord.cpp
+	$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACC_SharedAllocationRecord.cpp
+endif
+
 Kokkos_HBWSpace.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_HBWSpace.cpp
 	$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_HBWSpace.cpp
diff --git a/packages/kokkos/algorithms/CMakeLists.txt b/packages/kokkos/algorithms/CMakeLists.txt
index eb54db8a556453f4afed4c95cf20321e8cbe211e..f32363dc9acd5c1a972120f7309ea7745776e71d 100644
--- a/packages/kokkos/algorithms/CMakeLists.txt
+++ b/packages/kokkos/algorithms/CMakeLists.txt
@@ -5,7 +5,8 @@ KOKKOS_SUBPACKAGE(Algorithms)
 IF (NOT Kokkos_INSTALL_TESTING)
   ADD_SUBDIRECTORY(src)
 ENDIF()
-IF(NOT (KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC))
+# FIXME_OPENACC: temporarily disabled due to unimplemented features
+IF(NOT ((KOKKOS_ENABLE_OPENMPTARGET OR KOKKOS_ENABLE_OPENACC) AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC))
   KOKKOS_ADD_TEST_DIRECTORIES(unit_tests)
 ENDIF()
 
diff --git a/packages/kokkos/algorithms/src/CMakeLists.txt b/packages/kokkos/algorithms/src/CMakeLists.txt
index 597626b11115db2d8c78e54c9cb5d24af21c2731..606d83d18b589183cb432ff65e576a674ec9dc6a 100644
--- a/packages/kokkos/algorithms/src/CMakeLists.txt
+++ b/packages/kokkos/algorithms/src/CMakeLists.txt
@@ -25,7 +25,7 @@ INSTALL (
 # These will get ignored for standalone CMake and a true interface library made
 KOKKOS_ADD_INTERFACE_LIBRARY(
   kokkosalgorithms
-  HEADERS ${ALGO_HEADERS}
+  NOINSTALLHEADERS ${ALGO_HEADERS}
   SOURCES ${ALGO_SOURCES}
 )
 KOKKOS_LIB_INCLUDE_DIRECTORIES(kokkosalgorithms
diff --git a/packages/kokkos/algorithms/src/KokkosAlgorithms_dummy.cpp b/packages/kokkos/algorithms/src/KokkosAlgorithms_dummy.cpp
index 9c08a088b0e108f78728fcc00742baaab441d4e2..ddd6374483ec30a3fa39043f7704e6e6f977ef62 100644
--- a/packages/kokkos/algorithms/src/KokkosAlgorithms_dummy.cpp
+++ b/packages/kokkos/algorithms/src/KokkosAlgorithms_dummy.cpp
@@ -1 +1,17 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 void KOKKOS_ALGORITHMS_SRC_DUMMY_PREVENT_LINK_ERROR() {}
diff --git a/packages/kokkos/algorithms/src/Kokkos_NestedSort.hpp b/packages/kokkos/algorithms/src/Kokkos_NestedSort.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..4c8be792d816a8032d3e2e3abbc0458b327ec26c
--- /dev/null
+++ b/packages/kokkos/algorithms/src/Kokkos_NestedSort.hpp
@@ -0,0 +1,188 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_NESTEDSORT_HPP_
+#define KOKKOS_NESTEDSORT_HPP_
+
+#include <Kokkos_Core.hpp>
+#include <std_algorithms/impl/Kokkos_HelperPredicates.hpp>
+#include <std_algorithms/Kokkos_Swap.hpp>
+
+namespace Kokkos {
+namespace Experimental {
+namespace Impl {
+
+// true for TeamVectorRange, false for ThreadVectorRange
+template <bool teamLevel>
+struct NestedRange {};
+
+// Specialization for team-level
+template <>
+struct NestedRange<true> {
+  template <typename TeamMember, typename SizeType>
+  KOKKOS_FUNCTION static auto create(const TeamMember& t, SizeType len) {
+    return Kokkos::TeamVectorRange(t, len);
+  }
+  template <typename TeamMember>
+  KOKKOS_FUNCTION static void barrier(const TeamMember& t) {
+    t.team_barrier();
+  }
+};
+
+// Specialization for thread-level
+template <>
+struct NestedRange<false> {
+  template <typename TeamMember, typename SizeType>
+  KOKKOS_FUNCTION static auto create(const TeamMember& t, SizeType len) {
+    return Kokkos::ThreadVectorRange(t, len);
+  }
+  // Barrier is no-op, as vector lanes of a thread are implicitly synchronized
+  // after parallel region
+  template <typename TeamMember>
+  KOKKOS_FUNCTION static void barrier(const TeamMember&) {}
+};
+
+// When just doing sort (not sort_by_key), use nullptr_t for ValueViewType.
+// This only takes the NestedRange instance for template arg deduction.
+template <class TeamMember, class KeyViewType, class ValueViewType,
+          class Comparator, bool useTeamLevel>
+KOKKOS_INLINE_FUNCTION void sort_nested_impl(
+    const TeamMember& t, const KeyViewType& keyView,
+    [[maybe_unused]] const ValueViewType& valueView, const Comparator& comp,
+    const NestedRange<useTeamLevel>) {
+  using SizeType  = typename KeyViewType::size_type;
+  using KeyType   = typename KeyViewType::non_const_value_type;
+  using Range     = NestedRange<useTeamLevel>;
+  SizeType n      = keyView.extent(0);
+  SizeType npot   = 1;
+  SizeType levels = 0;
+  // FIXME: ceiling power-of-two is a common thing to need - make it a utility
+  while (npot < n) {
+    levels++;
+    npot <<= 1;
+  }
+  for (SizeType i = 0; i < levels; i++) {
+    for (SizeType j = 0; j <= i; j++) {
+      // n/2 pairs of items are compared in parallel
+      Kokkos::parallel_for(Range::create(t, npot / 2), [=](const SizeType k) {
+        // How big are the brown/pink boxes?
+        // (Terminology comes from Wikipedia diagram)
+        // https://commons.wikimedia.org/wiki/File:BitonicSort.svg#/media/File:BitonicSort.svg
+        SizeType boxSize = SizeType(2) << (i - j);
+        // Which box contains this thread?
+        SizeType boxID     = k >> (i - j);          // k * 2 / boxSize;
+        SizeType boxStart  = boxID << (1 + i - j);  // boxID * boxSize
+        SizeType boxOffset = k - (boxStart >> 1);   // k - boxID * boxSize / 2;
+        SizeType elem1     = boxStart + boxOffset;
+        // In first phase (j == 0, brown box): within a box, compare with the
+        // opposite value in the box.
+        // In later phases (j > 0, pink box): within a box, compare with fixed
+        // distance (boxSize / 2) apart.
+        SizeType elem2 = (j == 0) ? (boxStart + boxSize - 1 - boxOffset)
+                                  : (elem1 + boxSize / 2);
+        if (elem2 < n) {
+          KeyType key1 = keyView(elem1);
+          KeyType key2 = keyView(elem2);
+          if (comp(key2, key1)) {
+            keyView(elem1) = key2;
+            keyView(elem2) = key1;
+            if constexpr (!std::is_same_v<ValueViewType, std::nullptr_t>) {
+              Kokkos::Experimental::swap(valueView(elem1), valueView(elem2));
+            }
+          }
+        }
+      });
+      Range::barrier(t);
+    }
+  }
+}
+
+}  // namespace Impl
+
+template <class TeamMember, class ViewType>
+KOKKOS_INLINE_FUNCTION void sort_team(const TeamMember& t,
+                                      const ViewType& view) {
+  Impl::sort_nested_impl(t, view, nullptr,
+                         Experimental::Impl::StdAlgoLessThanBinaryPredicate<
+                             typename ViewType::non_const_value_type>(),
+                         Impl::NestedRange<true>());
+}
+
+template <class TeamMember, class ViewType, class Comparator>
+KOKKOS_INLINE_FUNCTION void sort_team(const TeamMember& t, const ViewType& view,
+                                      const Comparator& comp) {
+  Impl::sort_nested_impl(t, view, nullptr, comp, Impl::NestedRange<true>());
+}
+
+template <class TeamMember, class KeyViewType, class ValueViewType>
+KOKKOS_INLINE_FUNCTION void sort_by_key_team(const TeamMember& t,
+                                             const KeyViewType& keyView,
+                                             const ValueViewType& valueView) {
+  Impl::sort_nested_impl(t, keyView, valueView,
+                         Experimental::Impl::StdAlgoLessThanBinaryPredicate<
+                             typename KeyViewType::non_const_value_type>(),
+                         Impl::NestedRange<true>());
+}
+
+template <class TeamMember, class KeyViewType, class ValueViewType,
+          class Comparator>
+KOKKOS_INLINE_FUNCTION void sort_by_key_team(const TeamMember& t,
+                                             const KeyViewType& keyView,
+                                             const ValueViewType& valueView,
+                                             const Comparator& comp) {
+  Impl::sort_nested_impl(t, keyView, valueView, comp,
+                         Impl::NestedRange<true>());
+}
+
+template <class TeamMember, class ViewType>
+KOKKOS_INLINE_FUNCTION void sort_thread(const TeamMember& t,
+                                        const ViewType& view) {
+  Impl::sort_nested_impl(t, view, nullptr,
+                         Experimental::Impl::StdAlgoLessThanBinaryPredicate<
+                             typename ViewType::non_const_value_type>(),
+                         Impl::NestedRange<false>());
+}
+
+template <class TeamMember, class ViewType, class Comparator>
+KOKKOS_INLINE_FUNCTION void sort_thread(const TeamMember& t,
+                                        const ViewType& view,
+                                        const Comparator& comp) {
+  Impl::sort_nested_impl(t, view, nullptr, comp, Impl::NestedRange<false>());
+}
+
+template <class TeamMember, class KeyViewType, class ValueViewType>
+KOKKOS_INLINE_FUNCTION void sort_by_key_thread(const TeamMember& t,
+                                               const KeyViewType& keyView,
+                                               const ValueViewType& valueView) {
+  Impl::sort_nested_impl(t, keyView, valueView,
+                         Experimental::Impl::StdAlgoLessThanBinaryPredicate<
+                             typename KeyViewType::non_const_value_type>(),
+                         Impl::NestedRange<false>());
+}
+
+template <class TeamMember, class KeyViewType, class ValueViewType,
+          class Comparator>
+KOKKOS_INLINE_FUNCTION void sort_by_key_thread(const TeamMember& t,
+                                               const KeyViewType& keyView,
+                                               const ValueViewType& valueView,
+                                               const Comparator& comp) {
+  Impl::sort_nested_impl(t, keyView, valueView, comp,
+                         Impl::NestedRange<false>());
+}
+
+}  // namespace Experimental
+}  // namespace Kokkos
+#endif
diff --git a/packages/kokkos/algorithms/src/Kokkos_Random.hpp b/packages/kokkos/algorithms/src/Kokkos_Random.hpp
index 1d85ffdfb911f7dd4981ab1b2f98c903270e4628..91e9ce6fc84bcdeccfb9c40e4fca104d885f4b46 100644
--- a/packages/kokkos/algorithms/src/Kokkos_Random.hpp
+++ b/packages/kokkos/algorithms/src/Kokkos_Random.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_RANDOM_HPP
 #define KOKKOS_RANDOM_HPP
@@ -631,8 +603,7 @@ struct Random_XorShift1024_UseCArrayState<Kokkos::Cuda> : std::false_type {};
 #endif
 #ifdef KOKKOS_ENABLE_HIP
 template <>
-struct Random_XorShift1024_UseCArrayState<Kokkos::Experimental::HIP>
-    : std::false_type {};
+struct Random_XorShift1024_UseCArrayState<Kokkos::HIP> : std::false_type {};
 #endif
 #ifdef KOKKOS_ENABLE_OPENMPTARGET
 template <>
@@ -657,7 +628,7 @@ struct Random_UniqueIndex {
 #if defined(KOKKOS_ENABLE_CUDA)
 #define KOKKOS_IMPL_EXECUTION_SPACE_CUDA_OR_HIP Kokkos::Cuda
 #elif defined(KOKKOS_ENABLE_HIP)
-#define KOKKOS_IMPL_EXECUTION_SPACE_CUDA_OR_HIP Kokkos::Experimental::HIP
+#define KOKKOS_IMPL_EXECUTION_SPACE_CUDA_OR_HIP Kokkos::HIP
 #endif
 
 template <class MemorySpace>
@@ -907,38 +878,32 @@ class Random_XorShift64_Pool {
   using execution_space = typename device_type::execution_space;
   using locks_type      = View<int**, device_type>;
   using state_data_type = View<uint64_t**, device_type>;
-  locks_type locks_;
-  state_data_type state_;
-  int num_states_;
-  int padding_;
+
+  locks_type locks_      = {};
+  state_data_type state_ = {};
+  int num_states_        = {};
+  int padding_           = {};
 
  public:
   using generator_type = Random_XorShift64<DeviceType>;
 
-  KOKKOS_INLINE_FUNCTION
-  Random_XorShift64_Pool() {
-    num_states_ = 0;
-    padding_    = 0;
-  }
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
+  KOKKOS_DEFAULTED_FUNCTION Random_XorShift64_Pool() = default;
+
+  KOKKOS_DEFAULTED_FUNCTION Random_XorShift64_Pool(
+      Random_XorShift64_Pool const&) = default;
+
+  KOKKOS_DEFAULTED_FUNCTION Random_XorShift64_Pool& operator=(
+      Random_XorShift64_Pool const&) = default;
+#else
+  Random_XorShift64_Pool()   = default;
+#endif
   Random_XorShift64_Pool(uint64_t seed) {
     num_states_ = 0;
 
     init(seed, execution_space().concurrency());
   }
 
-  KOKKOS_INLINE_FUNCTION
-  Random_XorShift64_Pool(const Random_XorShift64_Pool& src)
-      : locks_(src.locks_), state_(src.state_), num_states_(src.num_states_) {}
-
-  KOKKOS_INLINE_FUNCTION
-  Random_XorShift64_Pool operator=(const Random_XorShift64_Pool& src) {
-    locks_      = src.locks_;
-    state_      = src.state_;
-    num_states_ = src.num_states_;
-    padding_    = src.padding_;
-    return *this;
-  }
-
   void init(uint64_t seed, int num_states) {
     if (seed == 0) seed = uint64_t(1318319);
     // I only want to pad on CPU like archs (less than 1000 threads). 64 is a
@@ -976,8 +941,8 @@ class Random_XorShift64_Pool {
     deep_copy(locks_, h_lock);
   }
 
-  KOKKOS_INLINE_FUNCTION
-  Random_XorShift64<DeviceType> get_state() const {
+  KOKKOS_INLINE_FUNCTION Random_XorShift64<DeviceType> get_state() const {
+    KOKKOS_EXPECTS(num_states_ > 0);
     const int i = Impl::Random_UniqueIndex<device_type>::get_state_idx(locks_);
     return Random_XorShift64<DeviceType>(state_(i, 0), i);
   }
@@ -1158,43 +1123,35 @@ class Random_XorShift1024_Pool {
   using int_view_type   = View<int**, device_type>;
   using state_data_type = View<uint64_t * [16], device_type>;
 
-  locks_type locks_;
-  state_data_type state_;
-  int_view_type p_;
-  int num_states_;
-  int padding_;
+  locks_type locks_      = {};
+  state_data_type state_ = {};
+  int_view_type p_       = {};
+  int num_states_        = {};
+  int padding_           = {};
   friend class Random_XorShift1024<DeviceType>;
 
  public:
   using generator_type = Random_XorShift1024<DeviceType>;
 
-  KOKKOS_INLINE_FUNCTION
-  Random_XorShift1024_Pool() { num_states_ = 0; }
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
+  KOKKOS_DEFAULTED_FUNCTION Random_XorShift1024_Pool() = default;
 
-  inline Random_XorShift1024_Pool(uint64_t seed) {
-    num_states_ = 0;
+  KOKKOS_DEFAULTED_FUNCTION Random_XorShift1024_Pool(
+      Random_XorShift1024_Pool const&) = default;
 
-    init(seed, execution_space().concurrency());
-  }
+  KOKKOS_DEFAULTED_FUNCTION Random_XorShift1024_Pool& operator=(
+      Random_XorShift1024_Pool const&) = default;
+#else
+  Random_XorShift1024_Pool() = default;
+#endif
 
-  KOKKOS_INLINE_FUNCTION
-  Random_XorShift1024_Pool(const Random_XorShift1024_Pool& src)
-      : locks_(src.locks_),
-        state_(src.state_),
-        p_(src.p_),
-        num_states_(src.num_states_) {}
+  Random_XorShift1024_Pool(uint64_t seed) {
+    num_states_ = 0;
 
-  KOKKOS_INLINE_FUNCTION
-  Random_XorShift1024_Pool operator=(const Random_XorShift1024_Pool& src) {
-    locks_      = src.locks_;
-    state_      = src.state_;
-    p_          = src.p_;
-    num_states_ = src.num_states_;
-    padding_    = src.padding_;
-    return *this;
+    init(seed, execution_space().concurrency());
   }
 
-  inline void init(uint64_t seed, int num_states) {
+  void init(uint64_t seed, int num_states) {
     if (seed == 0) seed = uint64_t(1318319);
     // I only want to pad on CPU like archs (less than 1000 threads). 64 is a
     // magic number, or random number I just wanted something not too large and
@@ -1237,6 +1194,7 @@ class Random_XorShift1024_Pool {
 
   KOKKOS_INLINE_FUNCTION
   Random_XorShift1024<DeviceType> get_state() const {
+    KOKKOS_EXPECTS(num_states_ > 0);
     const int i = Impl::Random_UniqueIndex<device_type>::get_state_idx(locks_);
     return Random_XorShift1024<DeviceType>(state_, p_(i, 0), i);
   };
diff --git a/packages/kokkos/algorithms/src/Kokkos_Sort.hpp b/packages/kokkos/algorithms/src/Kokkos_Sort.hpp
index c7be70e09a48eff3fb2bf3a7cb89be1cf1fe6664..033de221649659353e61c61313233a1805e8fd30 100644
--- a/packages/kokkos/algorithms/src/Kokkos_Sort.hpp
+++ b/packages/kokkos/algorithms/src/Kokkos_Sort.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SORT_HPP_
 #define KOKKOS_SORT_HPP_
@@ -50,9 +22,50 @@
 #endif
 
 #include <Kokkos_Core.hpp>
-
+#include <Kokkos_NestedSort.hpp>
+#include <std_algorithms/Kokkos_BeginEnd.hpp>
 #include <algorithm>
 
+#if defined(KOKKOS_ENABLE_CUDA)
+
+// Workaround for `Instruction 'shfl' without '.sync' is not supported on
+// .target sm_70 and higher from PTX ISA version 6.4`.
+// Also see https://github.com/NVIDIA/cub/pull/170.
+#if !defined(CUB_USE_COOPERATIVE_GROUPS)
+#define CUB_USE_COOPERATIVE_GROUPS
+#endif
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+
+#if defined(KOKKOS_COMPILER_CLANG)
+// Some versions of Clang fail to compile Thrust, failing with errors like
+// this:
+//    <snip>/thrust/system/cuda/detail/core/agent_launcher.h:557:11:
+//    error: use of undeclared identifier 'va_printf'
+// The exact combination of versions for Clang and Thrust (or CUDA) for this
+// failure was not investigated, however even very recent version combination
+// (Clang 10.0.0 and Cuda 10.0) demonstrated failure.
+//
+// Defining _CubLog here locally allows us to avoid that code path, however
+// disabling some debugging diagnostics
+#pragma push_macro("_CubLog")
+#ifdef _CubLog
+#undef _CubLog
+#endif
+#define _CubLog
+#include <thrust/device_ptr.h>
+#include <thrust/sort.h>
+#pragma pop_macro("_CubLog")
+#else
+#include <thrust/device_ptr.h>
+#include <thrust/sort.h>
+#endif
+
+#pragma GCC diagnostic pop
+
+#endif
+
 namespace Kokkos {
 
 namespace Impl {
@@ -559,24 +572,6 @@ struct BinOp3D {
 
 namespace Impl {
 
-template <class ViewType, class ExecutionSpace>
-bool try_std_sort(ViewType view, const ExecutionSpace& exec) {
-  bool possible    = true;
-  size_t stride[8] = {view.stride_0(), view.stride_1(), view.stride_2(),
-                      view.stride_3(), view.stride_4(), view.stride_5(),
-                      view.stride_6(), view.stride_7()};
-  possible         = possible &&
-             SpaceAccessibility<HostSpace,
-                                typename ViewType::memory_space>::accessible;
-  possible = possible && (ViewType::Rank == 1);
-  possible = possible && (stride[0] == 1);
-  if (possible) {
-    exec.fence("Kokkos::sort: Fence before sorting on the host");
-    std::sort(view.data(), view.data() + view.extent(0));
-  }
-  return possible;
-}
-
 template <class ViewType>
 struct min_max_functor {
   using minmax_scalar =
@@ -594,9 +589,14 @@ struct min_max_functor {
 
 }  // namespace Impl
 
-template <class ExecutionSpace, class ViewType>
-std::enable_if_t<Kokkos::is_execution_space<ExecutionSpace>::value> sort(
-    const ExecutionSpace& exec, ViewType const& view) {
+template <class ExecutionSpace, class DataType, class... Properties>
+std::enable_if_t<(Kokkos::is_execution_space<ExecutionSpace>::value) &&
+                 (!SpaceAccessibility<
+                     HostSpace, typename Kokkos::View<DataType, Properties...>::
+                                    memory_space>::accessible)>
+sort(const ExecutionSpace& exec,
+     const Kokkos::View<DataType, Properties...>& view) {
+  using ViewType = Kokkos::View<DataType, Properties...>;
   using CompType = BinOp1D<ViewType>;
 
   Kokkos::MinMaxScalar<typename ViewType::non_const_value_type> result;
@@ -634,18 +634,25 @@ std::enable_if_t<Kokkos::is_execution_space<ExecutionSpace>::value> sort(
   bin_sort.sort(exec, view);
 }
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-template <class ExecutionSpace, class ViewType>
-KOKKOS_DEPRECATED_WITH_COMMENT(
-    "Use the overload not taking bool always_use_kokkos_sort")
-std::enable_if_t<Kokkos::is_execution_space<ExecutionSpace>::value> sort(
-    const ExecutionSpace& exec, ViewType const& view,
-    bool const always_use_kokkos_sort) {
-  if (!always_use_kokkos_sort && Impl::try_std_sort(view, exec)) {
-    return;
-  } else {
-    sort(exec, view);
-  }
+template <class ExecutionSpace, class DataType, class... Properties>
+std::enable_if_t<(Kokkos::is_execution_space<ExecutionSpace>::value) &&
+                 (SpaceAccessibility<
+                     HostSpace, typename Kokkos::View<DataType, Properties...>::
+                                    memory_space>::accessible)>
+sort(const ExecutionSpace&, const Kokkos::View<DataType, Properties...>& view) {
+  auto first = Experimental::begin(view);
+  auto last  = Experimental::end(view);
+  std::sort(first, last);
+}
+
+#if defined(KOKKOS_ENABLE_CUDA)
+template <class DataType, class... Properties>
+void sort(const Cuda& space,
+          const Kokkos::View<DataType, Properties...>& view) {
+  const auto exec = thrust::cuda::par.on(space.cuda_stream());
+  auto first      = Experimental::begin(view);
+  auto last       = Experimental::end(view);
+  thrust::sort(exec, first, last);
 }
 #endif
 
@@ -657,17 +664,6 @@ void sort(ViewType const& view) {
   exec.fence("Kokkos::sort: fence after sorting");
 }
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-template <class ViewType>
-KOKKOS_DEPRECATED_WITH_COMMENT(
-    "Use the overload not taking bool always_use_kokkos_sort")
-void sort(ViewType const& view, bool const always_use_kokkos_sort) {
-  typename ViewType::execution_space exec;
-  sort(exec, view, always_use_kokkos_sort);
-  exec.fence("Kokkos::Sort: fence after sorting");
-}
-#endif
-
 template <class ExecutionSpace, class ViewType>
 std::enable_if_t<Kokkos::is_execution_space<ExecutionSpace>::value> sort(
     const ExecutionSpace& exec, ViewType view, size_t const begin,
diff --git a/packages/kokkos/algorithms/src/Kokkos_StdAlgorithms.hpp b/packages/kokkos/algorithms/src/Kokkos_StdAlgorithms.hpp
index 3e0f731cf0528a7145703a04004e0c1095003422..436ae0d10bf88bcd4643cf0255bb442fe1d1bec4 100644
--- a/packages/kokkos/algorithms/src/Kokkos_StdAlgorithms.hpp
+++ b/packages/kokkos/algorithms/src/Kokkos_StdAlgorithms.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_HPP
 #define KOKKOS_STD_ALGORITHMS_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp
index 0a7cf06f5bdb166a566a1dd8ef517bbea47b6976..38dcd1a6743610fcd6859164133a04ebc56add4a 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_ADJACENT_DIFFERENCE_HPP
 #define KOKKOS_STD_ALGORITHMS_ADJACENT_DIFFERENCE_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp
index 332f9dd3693c6d14a77cc72700708d55681d8f5e..43c2b660107b6d27223f7004fb5d7c52babc3592 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_ADJACENT_FIND_HPP
 #define KOKKOS_STD_ALGORITHMS_ADJACENT_FIND_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AllOf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AllOf.hpp
index 66a49541f333b5f5048067898863c2aedb103b57..2ffec7e144a0c504e666757778b1e2960dd988ad 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AllOf.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AllOf.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_ALL_OF_HPP
 #define KOKKOS_STD_ALGORITHMS_ALL_OF_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp
index e50e90f6da3d480610af10d1cc421edfe322c995..019c466c6d2f3701b827e1a566e1ef1daaf71a2f 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_ANY_OF_HPP
 #define KOKKOS_STD_ALGORITHMS_ANY_OF_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp
index 544919619204837921e6cac925c5f52b3c9c73fd..3836d4bf62c11ece3fdf2b86b8ca6a24245a0553 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_BEGIN_END_HPP
 #define KOKKOS_BEGIN_END_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Copy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Copy.hpp
index b3237041b7f3c64b1b74c66f63329c3169f1eb1a..028f3b66b2dce3fd61a823361eb60c899718cc57 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Copy.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Copy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_COPY_HPP
 #define KOKKOS_STD_ALGORITHMS_COPY_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp
index 83efd96672b32b842f5296a22e8c156295ebccfc..deff6baf9a523dcdd880796483d94a5a5e506416 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_COPY_BACKWARD_HPP
 #define KOKKOS_STD_ALGORITHMS_COPY_BACKWARD_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp
index c83cc29886ca9889697b4f76675f0071f92db1f3..3db2fc074f73bc5173cae7583717be9e96eb0152 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_COPY_IF_HPP
 #define KOKKOS_STD_ALGORITHMS_COPY_IF_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyN.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyN.hpp
index 7f3b9374c74d436670740609afd1490b04ab7d10..a64f99b5c01d2001f8c0151e842831ac7749e739 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyN.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyN.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_COPY_N_HPP
 #define KOKKOS_STD_ALGORITHMS_COPY_N_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Count.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Count.hpp
index a885ee4ad2f1546122a65eebe329ff523eaa7893..3ac63467ec9a0d1e50382952f093b4cf18289480 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Count.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Count.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_COUNT_HPP
 #define KOKKOS_STD_ALGORITHMS_COUNT_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CountIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CountIf.hpp
index 98b9d74c4c4e0fa369380d8533f53cd3a7790320..b9731d378a594a6177f83dbae51585dd59c053db 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CountIf.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CountIf.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_COUNT_IF_HPP
 #define KOKKOS_STD_ALGORITHMS_COUNT_IF_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Distance.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Distance.hpp
index 4e148642b10e3e6d2bd68d6cca04fb58caf07839..8605606307ead6b579551c67ed21268994659a87 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Distance.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Distance.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_DISTANCE_HPP
 #define KOKKOS_STD_ALGORITHMS_DISTANCE_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Equal.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Equal.hpp
index 8634019fad23a7eaecc9faf13bcb951ff21bb372..37c0d75ef5bfb751883b8e3d0c086b4e732ea8b8 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Equal.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Equal.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_EQUAL_HPP
 #define KOKKOS_STD_ALGORITHMS_EQUAL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp
index b97710f24f2122c637f294b10fe79080266d80c8..4e05676c2c1971832de2ad55de6f66c6fe582642 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_EXCLUSIVE_SCAN_HPP
 #define KOKKOS_STD_ALGORITHMS_EXCLUSIVE_SCAN_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Fill.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Fill.hpp
index 200e03b9dcd2a6ea7d871820f8f6fb746e87a82c..1e300a4c2081694786ae021e04958a9d2e757c88 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Fill.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Fill.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_FILL_HPP
 #define KOKKOS_STD_ALGORITHMS_FILL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FillN.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FillN.hpp
index 2e814dc55f781c67ed8c6960a97605265c50ff94..02503dfd14324ea0d7b1043e453bbdc0f35f5672 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FillN.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FillN.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_FILL_N_HPP
 #define KOKKOS_STD_ALGORITHMS_FILL_N_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Find.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Find.hpp
index 6758f00ce4e6572d8366acac028656b6f0831427..65b68cf931d28934d00560964586967d8264e93e 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Find.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Find.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_FIND_HPP
 #define KOKKOS_STD_ALGORITHMS_FIND_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp
index 61b54c822550a9e6d1043a9eaabac5bcb89bb1c6..f6a38855ebbcfb5c8db06ce961b5e5c1001f4060 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_FIND_END_HPP
 #define KOKKOS_STD_ALGORITHMS_FIND_END_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp
index b8c27cb272ea0d102714fb6c38c4b0087e194cfd..6b0e4993ee2461179f6ca467fbda060934dd32ae 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_FIND_FIRST_OF_HPP
 #define KOKKOS_STD_ALGORITHMS_FIND_FIRST_OF_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIf.hpp
index 54896da1176155579a912220a739d22764fba113..911316a668dd33f52da9ccc105b7a77923e709e8 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIf.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIf.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_FIND_IF_HPP
 #define KOKKOS_STD_ALGORITHMS_FIND_IF_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp
index cfe6bb84d8f50e18535e7ce07e8acac996b782e8..18294d7b7df963b96eb122fb09544905d6203741 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_FIND_IF_NOT_HPP
 #define KOKKOS_STD_ALGORITHMS_FIND_IF_NOT_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEach.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEach.hpp
index 8a2f90e82bf3faedef85cc21610259b98b80a3d2..d7b08e4842658cab72a73ed835ff3bba50780768 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEach.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEach.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_FOR_EACH_HPP
 #define KOKKOS_STD_ALGORITHMS_FOR_EACH_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp
index dd917a33e89790fa70384d4cc0b16905d37c6a32..f1769da05bd6aa90641433fd708c4910d59c325f 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_FOR_EACH_N_HPP
 #define KOKKOS_STD_ALGORITHMS_FOR_EACH_N_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Generate.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Generate.hpp
index 955cb42d4b18c4818316d995492f6d99b922a219..13e12783e0999ca5ff2fea384697989a6a21a56f 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Generate.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Generate.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_GENERATE_HPP
 #define KOKKOS_STD_ALGORITHMS_GENERATE_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp
index 470edb15966fb08adbc131df3347d7aac82a087d..4d17512228590195c74f9993bd52952943f4bb35 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_GENERATE_N_HPP
 #define KOKKOS_STD_ALGORITHMS_GENERATE_N_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp
index c34b5f43c9d426b91be882b315e3675b2b6872ca..bcd731b850aa0d510ea2b2b4b2fece15f9a08970 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_INCLUSIVE_SCAN_HPP
 #define KOKKOS_STD_ALGORITHMS_INCLUSIVE_SCAN_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp
index 8a2ca207ae6d01756498f24e8daa14fbed838a63..29d6be9e8b769e0982f06645b48f77ee27713a3c 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_IS_PARTITIONED_HPP
 #define KOKKOS_STD_ALGORITHMS_IS_PARTITIONED_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp
index 0ab466f3389564aeddd1b4f8482458c1baf644da..f036254a02cf5280b22493869efa81e2dd4033dc 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_IS_SORTED_HPP
 #define KOKKOS_STD_ALGORITHMS_IS_SORTED_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp
index c480d9ee5a2e4335add84889862617c98cc5b9cf..276b3bb884269d43c87e38ef79aa38fae94b704c 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_IS_SORTED_UNTIL_HPP
 #define KOKKOS_STD_ALGORITHMS_IS_SORTED_UNTIL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp
index 1174740a5b1ac1dca656a3663ce889bf773305fc..a796a306dda0af270977550a4095cd63be5e86b4 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_ITER_SWAP_HPP
 #define KOKKOS_STD_ALGORITHMS_ITER_SWAP_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp
index 4704a9ec5664e3bc7d18559e65ee5d5f90157c71..0a77ef629f7baf3c25a35789fdf345c31ef939e5 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_LEXICOGRAPHICAL_COMPARE_HPP
 #define KOKKOS_STD_ALGORITHMS_LEXICOGRAPHICAL_COMPARE_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp
index 5f6e5cbf62e28bae181663f14e44bcf2ee16bdab..2c1374f700764c7761bc3c81da45534b9bd24b8c 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_MAX_ELEMENT_HPP
 #define KOKKOS_STD_ALGORITHMS_MAX_ELEMENT_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinElement.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinElement.hpp
index 63cc5489607a6f5b5f525ee9aa61dfe1ec8a1962..1d03b7c962f21df9f7523dcf7c7222ddb88dbb74 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinElement.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinElement.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_MIN_ELEMENT_HPP
 #define KOKKOS_STD_ALGORITHMS_MIN_ELEMENT_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp
index 07cdefcc05658ab5bd4edc8d47d592308a56aede..d481b499cc9932cd55a8f7eeb4d8487cbb9e2401 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_MINMAX_ELEMENT_HPP
 #define KOKKOS_STD_ALGORITHMS_MINMAX_ELEMENT_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Mismatch.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Mismatch.hpp
index 3418e048a94f15a6ff01c5497f3281660049812e..13c994ca90b19a21956251f5748bb65cc1598080 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Mismatch.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Mismatch.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_MISMATCH_HPP
 #define KOKKOS_STD_ALGORITHMS_MISMATCH_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Move.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Move.hpp
index c2ce4655faa4631d48eaaafaec016c6e0fa65c4b..d49acd9f702d05897576f532b290dc6b965b220c 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Move.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Move.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_MOVE_HPP
 #define KOKKOS_STD_ALGORITHMS_MOVE_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MoveBackward.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MoveBackward.hpp
index f7462d52d8a8cbb520b0985085b23c8e56c01879..60d50fa881a812cd68111f1b7f8b69607a57e0a5 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MoveBackward.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MoveBackward.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_MOVE_BACKWARD_HPP
 #define KOKKOS_STD_ALGORITHMS_MOVE_BACKWARD_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_NoneOf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_NoneOf.hpp
index 30ffb52442e39f1fe33c3258194ebae5f249f060..cf5de3b72b961f306c7d670ce92b5f9c88395724 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_NoneOf.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_NoneOf.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_NONE_OF_HPP
 #define KOKKOS_STD_ALGORITHMS_NONE_OF_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionCopy.hpp
index 5b00669fd1bcc90cbcfeaf2dcaf609514cc566d8..38c0a35b6208e43b9bc78f0cba4cb05d1a3766bf 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionCopy.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionCopy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_PARTITION_COPY_HPP
 #define KOKKOS_STD_ALGORITHMS_PARTITION_COPY_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionPoint.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionPoint.hpp
index b714d5a27163ff1d7fecbe6f2ad973cfd2d33da0..24798e377ef194c397f09b933e20988234ae0ea9 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionPoint.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionPoint.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_PARTITION_POINT_HPP
 #define KOKKOS_STD_ALGORITHMS_PARTITION_POINT_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reduce.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reduce.hpp
index 3cf9153202a3339c9b96bd054c5fcf6ceeb79d3d..a31fa1497ab1690b14fb8d89c81b6ece3b939ec4 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reduce.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reduce.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REDUCE_HPP
 #define KOKKOS_STD_ALGORITHMS_REDUCE_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Remove.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Remove.hpp
index d8d7c999b6edc70d9e4d6bf702cc92c6fadfa358..c8602d2f53cf5b8c4e9f56de09f2254d0cd67aad 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Remove.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Remove.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REMOVE_HPP
 #define KOKKOS_STD_ALGORITHMS_REMOVE_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopy.hpp
index 7d5c163af95c0b8f804a064af4b13d1dd1940a97..c2c06f6202804f47760ebd8d07b2cd4ba9384cf5 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopy.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REMOVE_COPY_HPP
 #define KOKKOS_STD_ALGORITHMS_REMOVE_COPY_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopyIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopyIf.hpp
index 8a9a3e4c14cc441c3aa5d92843ad5e939b585aa3..6d642ed6f09b0ad82275fcc3c9dd7e1c842d54a8 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopyIf.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopyIf.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REMOVE_COPY_IF_HPP
 #define KOKKOS_STD_ALGORITHMS_REMOVE_COPY_IF_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveIf.hpp
index e4171ca917855b3b45d35c9896035d0994a428af..4062e8d373e2be30681351ce86c30d55391c58c4 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveIf.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveIf.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REMOVE_IF_HPP
 #define KOKKOS_STD_ALGORITHMS_REMOVE_IF_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Replace.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Replace.hpp
index 10ca46af255d1f0e59347188e1901c11d54133d9..4d1490ded0c8ebe05fdba27f27cfe80b140fdd47 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Replace.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Replace.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_HPP
 #define KOKKOS_STD_ALGORITHMS_REPLACE_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopy.hpp
index f5136eb438f4dc2b65aaa1f6fd8791f58ad6a6b3..e7f464e4bd7b7102839dcf38547a51ebd437f1da 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopy.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_COPY_HPP
 #define KOKKOS_STD_ALGORITHMS_REPLACE_COPY_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopyIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopyIf.hpp
index a3f3fe69abaf7cce17b72f69ca0ffdada733de6a..71ae8f845280d554f625815a80b3b0f0db9b00b3 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopyIf.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopyIf.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IF_HPP
 #define KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IF_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceIf.hpp
index bdb59f28af1cee6be97d822f7d4b41ae47321f44..7f06540e068b76b38052adf94767b6603c9e4298 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceIf.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceIf.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_IF_HPP
 #define KOKKOS_STD_ALGORITHMS_REPLACE_IF_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reverse.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reverse.hpp
index 4848b20f66973f22292da27ce97a68f886430870..9f2fc5f3ccffa493575d2d7bd745fb83094a4dad 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reverse.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reverse.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REVERSE_HPP
 #define KOKKOS_STD_ALGORITHMS_REVERSE_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReverseCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReverseCopy.hpp
index bb4462bf41d55a43fe5358e6c0ea3538c0fb35ab..279bb220869940f55a2689d519b4708838572d88 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReverseCopy.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReverseCopy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REVERSE_COPY_HPP
 #define KOKKOS_STD_ALGORITHMS_REVERSE_COPY_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Rotate.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Rotate.hpp
index 39975811a47c1b3124084e3f12ddb678b92d848f..738e9bf1374388dfc5be8600c2fb27cbb95edde0 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Rotate.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Rotate.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_ROTATE_HPP
 #define KOKKOS_STD_ALGORITHMS_ROTATE_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RotateCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RotateCopy.hpp
index f98686ab631ba031ab121cd0f7e224557c5d265c..f5d826c4bb4f32b1a3d0f66700cb22af5ae33134 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RotateCopy.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RotateCopy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_ROTATE_COPY_HPP
 #define KOKKOS_STD_ALGORITHMS_ROTATE_COPY_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Search.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Search.hpp
index ce656da31c8610fca42f4ec3c8e6405c1ea1c0d6..b1154b297edf01c76a3b791c8f1c50314d3f266b 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Search.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Search.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_SEARCH_HPP
 #define KOKKOS_STD_ALGORITHMS_SEARCH_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SearchN.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SearchN.hpp
index 854d911e7602c4917133582d197b2a9d6fb18bdc..a649c8f2053a0817bc6683900ff5825f3e4c1af4 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SearchN.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SearchN.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_SEARCH_N_HPP
 #define KOKKOS_STD_ALGORITHMS_SEARCH_N_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftLeft.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftLeft.hpp
index cee111af98a0d3e759b29feeb55db278b7ed20d3..4b91a17ab838e5d5fedc16570100614e1e8e0eef 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftLeft.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftLeft.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_SHIFT_LEFT_HPP
 #define KOKKOS_STD_ALGORITHMS_SHIFT_LEFT_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftRight.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftRight.hpp
index f104d2bd7a67836ee826c7f0e44b0107c0443ee2..2ea50fd74e5c1910c77040af07dd5e56661ea716 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftRight.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftRight.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_SHIFT_RIGHT_HPP
 #define KOKKOS_STD_ALGORITHMS_SHIFT_RIGHT_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Swap.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Swap.hpp
index 9006aa9167dd326d312b8c31cc0790d511245918..acd2a572c8c216fe1f953e2651533ecc08d99ddb 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Swap.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Swap.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_SWAP_HPP
 #define KOKKOS_STD_ALGORITHMS_SWAP_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SwapRanges.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SwapRanges.hpp
index 2997cdab4b5fa58c47bc65eb4ed3d4804868a492..5fbf04531885c22887d3d4cf0998f6e07da1a773 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SwapRanges.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SwapRanges.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_SWAP_RANGES_HPP
 #define KOKKOS_STD_ALGORITHMS_SWAP_RANGES_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Transform.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Transform.hpp
index 6dfb83a8c0ea531f76f9ce4460d1ee37ae0cc37b..27dee304261d14ebad1dd066d3cfe7655715bd2f 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Transform.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Transform.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_HPP
 #define KOKKOS_STD_ALGORITHMS_TRANSFORM_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformExclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformExclusiveScan.hpp
index d0073599b02eef5ed289a7afe3afbb46313297c5..9d85aee06f8e5fc2dbfb46792e3b4c9ab9643a1a 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformExclusiveScan.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformExclusiveScan.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_TRASFORM_EXCLUSIVE_SCAN_HPP
 #define KOKKOS_STD_ALGORITHMS_TRASFORM_EXCLUSIVE_SCAN_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformInclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformInclusiveScan.hpp
index 088e162adba77d514d157099f1f06663d515db4f..7489af7e379b576bc38e555d425c65cd33c675a7 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformInclusiveScan.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformInclusiveScan.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_INCLUSIVE_SCAN_HPP
 #define KOKKOS_STD_ALGORITHMS_TRANSFORM_INCLUSIVE_SCAN_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformReduce.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformReduce.hpp
index 5caced59172b47fa69686ca93d65171addf41d94..b5ec9066d2e25709575e1dcd6e27795de9d00de8 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformReduce.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformReduce.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_REDUCE_HPP
 #define KOKKOS_STD_ALGORITHMS_TRANSFORM_REDUCE_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Unique.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Unique.hpp
index aeb54a6ffe6fceaa7e8787e73527491e536b0686..b47ecffb20737ee439c0427c47510855d1f5d7af 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Unique.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Unique.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_UNIQUE_HPP
 #define KOKKOS_STD_ALGORITHMS_UNIQUE_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_UniqueCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_UniqueCopy.hpp
index 632b560fa8e2da17acf3eda9b16fc74b416f2362..bd2451c220dd06bdcaee1d8c4693af745e3771bb 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_UniqueCopy.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_UniqueCopy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_UNIQUE_COPY_HPP
 #define KOKKOS_STD_ALGORITHMS_UNIQUE_COPY_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentDifference.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentDifference.hpp
index 35c78b86bf257255bf239552f9b41b7c34592532..8a474508d73edfe06b14c7360cf513f4c2c988bd 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentDifference.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentDifference.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_ADJACENT_DIFFERENCE_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_ADJACENT_DIFFERENCE_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentFind.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentFind.hpp
index 155f6c7bb80c6879eb9bbf1d86fad4e222b69ee5..cc6b63f028760d02da7a0b46e250b1bd1ee8439a 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentFind.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentFind.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_ADJACENT_FIND_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_ADJACENT_FIND_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AllOfAnyOfNoneOf.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AllOfAnyOfNoneOf.hpp
index dd8ae4f5b4d992f3b2d4b9894fd113889dd68df0..ad562070a044f337970129f9e9a1c241cfaf4944 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AllOfAnyOfNoneOf.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AllOfAnyOfNoneOf.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_ALL_OF_ANY_OF_NONE_OF_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_ALL_OF_ANY_OF_NONE_OF_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Constraints.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Constraints.hpp
index ec54cd1900d4edc2c347035dc7feeb1568df32f7..52e7625e4d2f0e55c89d8e42634a3083c8d2088a 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Constraints.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Constraints.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_CONSTRAINTS_HPP_
 #define KOKKOS_STD_ALGORITHMS_CONSTRAINTS_HPP_
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyBackward.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyBackward.hpp
index 18f614094cff0588ee045e8d61c27aade705f374..b3adbc5e2dcf5f970bf3509944fc34c71131117d 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyBackward.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyBackward.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_COPY_BACKWARD_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_COPY_BACKWARD_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyCopyN.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyCopyN.hpp
index 03b6fc6ecacc0fca8d9d457f4e6b2193a2fc9c81..1b120c46d0844da292652683b5234cfc7c8417d4 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyCopyN.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyCopyN.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_COPY_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_COPY_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyIf.hpp
index aebb5a9a46111a3012e6d304d312ad77f14f42a3..3c0c4f7e9bce2f0ce3d11303566204db612739ec 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyIf.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyIf.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_COPY_IF_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_COPY_IF_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CountCountIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CountCountIf.hpp
index 982ac4046426ceb20de1899e6c0fe700aa8382e0..18b8c463594f2c3da1268db5ac57c59b0f40fbef 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CountCountIf.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CountCountIf.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_COUNT_IF_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_COUNT_IF_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Equal.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Equal.hpp
index 9482917abb996498af8161b2ac3feb8300f3f5e2..e045080d4a6a3d8bf6a78f3041a31681c0491027 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Equal.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Equal.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_EQUAL_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_EQUAL_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ExclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ExclusiveScan.hpp
index 0ae4651c6afa9beec90cf09b7cd7ccbc1b0c71ab..f2bfa23ccdcc1489d07ccb4af9db249dd19180cc 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ExclusiveScan.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ExclusiveScan.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_EXCLUSIVE_SCAN_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_EXCLUSIVE_SCAN_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FillFillN.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FillFillN.hpp
index 843771b6b13c481b2859e8981a5b21e11ce6b229..316d865f316225528987b038a4b623816ffdfd76 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FillFillN.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FillFillN.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_FILL_AND_FILL_N_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_FILL_AND_FILL_N_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindEnd.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindEnd.hpp
index 35a6c4b4ac9b650655333e21579be707f72774f0..3fa41af8ea3271eddbe322a93f49395462463e2c 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindEnd.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindEnd.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_FIND_END_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_FIND_END_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindFirstOf.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindFirstOf.hpp
index 6907bbdbc37c77182c86382b37a8d346c8174988..df10da2fd55e513112f9a2cf3ca0c710556e1adb 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindFirstOf.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindFirstOf.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_FIND_FIRST_OF_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_FIND_FIRST_OF_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindIfOrNot.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindIfOrNot.hpp
index c79c4b5216bed0d8b386ec4c0630834537d1c0e8..f7ec4b1110c48a616cc451b04edad2f69616bfe0 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindIfOrNot.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindIfOrNot.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_FIND_IF_AND_FIND_IF_NOT_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_FIND_IF_AND_FIND_IF_NOT_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ForEachForEachN.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ForEachForEachN.hpp
index 8bd37b13bc9a19f0b8cbe457913b3a34d0320c6b..f9a6ff2e99e6229cfa154585e9ae298c9622ad91 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ForEachForEachN.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ForEachForEachN.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_FOR_EACH_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_FOR_EACH_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_GenerateGenerateN.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_GenerateGenerateN.hpp
index f01d9bfb55ebf3f2dd9fdd795e34b57ff8057a24..228390bdfff0f6dcbd20cd17912f6babc736daa0 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_GenerateGenerateN.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_GenerateGenerateN.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_GENERATE_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_GENERATE_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_HelperPredicates.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_HelperPredicates.hpp
index 244bce48e436b3c8af3a7d70823baa436d9f9958..db0def6f227b0182bbbbc0c3c05a8eb762a4b160 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_HelperPredicates.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_HelperPredicates.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_HELPER_PREDICATES_HPP
 #define KOKKOS_STD_ALGORITHMS_HELPER_PREDICATES_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IdentityReferenceUnaryFunctor.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IdentityReferenceUnaryFunctor.hpp
index f41e567c9b09d43550fd1dd4d1f12da9b6589597..252511c5d0cfd22fb15fd3648408c7c91bcb75a4 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IdentityReferenceUnaryFunctor.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IdentityReferenceUnaryFunctor.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_NUMERIC_IDENTITY_REFERENCE_UNARY_FUNCTOR_HPP
 #define KOKKOS_STD_ALGORITHMS_NUMERIC_IDENTITY_REFERENCE_UNARY_FUNCTOR_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_InclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_InclusiveScan.hpp
index 2088ebd439325bff2273c0a5b5ee635590f40532..55e1a78695d0f39e7a9c3ea84eb785c92cb63a36 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_InclusiveScan.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_InclusiveScan.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_INCLUSIVE_SCAN_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_INCLUSIVE_SCAN_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsPartitioned.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsPartitioned.hpp
index 0f00bebb6ddd148b23bf266c7a12dddbc9abda19..92a22f3c3a82770491eaa8d08912d64f2e8c3ed6 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsPartitioned.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsPartitioned.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_IS_PARTITIONED_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_IS_PARTITIONED_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSorted.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSorted.hpp
index 4e36ae3890f578533465eca0bc224cea439d4f52..469682158641f61793821c22f9735b4243dd135d 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSorted.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSorted.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_IS_SORTED_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_IS_SORTED_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSortedUntil.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSortedUntil.hpp
index 4e99c301b26e2d8b238300945412de7038975d4b..fe52e18a33d070ce3406418c242357d2de785a5a 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSortedUntil.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSortedUntil.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_IS_SORTED_UNTIL_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_IS_SORTED_UNTIL_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_LexicographicalCompare.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_LexicographicalCompare.hpp
index c3dd13e6b5a15c54fef30c976135437fe400d0e0..170ec9f2911d6ad303f1262998dac1912b733c29 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_LexicographicalCompare.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_LexicographicalCompare.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_LEXICOGRAPHICAL_COMPARE_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_LEXICOGRAPHICAL_COMPARE_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MinMaxMinmaxElement.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MinMaxMinmaxElement.hpp
index 0a9d41b9bb62e3f4c22eb6ece4745b1033bc00d7..048420f7a83dbc554cd491242021d933acc49f35 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MinMaxMinmaxElement.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MinMaxMinmaxElement.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_MIN_MAX_MINMAX_ELEMENT_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_MIN_MAX_MINMAX_ELEMENT_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Mismatch.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Mismatch.hpp
index 180afe925c1158760d37cfb7db4ace25a8858ef5..9d2e31f63fcf782284a60d3e5c0d23c7de987f04 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Mismatch.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Mismatch.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_MISMATCH_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_MISMATCH_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Move.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Move.hpp
index 6b1ed1da4c17804c811e746c8d4889f7b1ed3c5b..01086d1772aaa3c722c84e238f8d97a82812b4ec 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Move.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Move.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_MOVE_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_MOVE_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MoveBackward.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MoveBackward.hpp
index c34ab679dbc927fcf42dfed420cc00add06dce58..9a28c3fb4a4df5f01b0e8cc7959297f2c4f46f2a 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MoveBackward.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MoveBackward.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_MOVE_BACKWARD_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_MOVE_BACKWARD_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionCopy.hpp
index 508e4baedf60f1fb46c69bdb3ee05d725ea716ab..5457ae25084867af6c2b07a15b1d5e7b4c333ab8 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionCopy.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionCopy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_PARTITION_COPY_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_PARTITION_COPY_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionPoint.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionPoint.hpp
index 671e8d70f01d83f65d6c3173fe3753527b09c278..2d0ae2aac615ae6953bd5a3c8ea6c47810f598f7 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionPoint.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionPoint.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_PARTITION_POINT_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_PARTITION_POINT_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RandomAccessIterator.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RandomAccessIterator.hpp
index 2457d9400a24bc962bae1726d4dc238ab7d4a637..5c9854b87d7044c1ed252ff09438fb91be33168c 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RandomAccessIterator.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RandomAccessIterator.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_RANDOM_ACCESS_ITERATOR_IMPL_HPP
 #define KOKKOS_RANDOM_ACCESS_ITERATOR_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reduce.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reduce.hpp
index 26e0795d8b1c1214b7bcf1a3dfe30d26aaf5aa0b..45a0de3727d8407e12d465d0bdd59943ea117490 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reduce.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reduce.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REDUCE_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_REDUCE_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReducerWithArbitraryJoinerNoNeutralElement.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReducerWithArbitraryJoinerNoNeutralElement.hpp
index d8e383b859218bd33b67efdd9f11c374372b8fb5..b460982d33484933e86b2dce33832105c9bbb9c2 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReducerWithArbitraryJoinerNoNeutralElement.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReducerWithArbitraryJoinerNoNeutralElement.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REDUCER_WITH_ARBITRARY_JOINER_NONEUTRAL_ELEMENT_HPP
 #define KOKKOS_STD_ALGORITHMS_REDUCER_WITH_ARBITRARY_JOINER_NONEUTRAL_ELEMENT_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RemoveAllVariants.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RemoveAllVariants.hpp
index 742d4d776a8c755a76393ae38a375b8dd0d61ed6..bda647019959c519ab29b1aeb89058d777b2f2b1 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RemoveAllVariants.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RemoveAllVariants.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REMOVE_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_REMOVE_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Replace.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Replace.hpp
index 877ffa276faebd4b6368dc23f63946587751de05..e3a6b538f4b6810f1b758b79c6df8bc727c63b38 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Replace.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Replace.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_REPLACE_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopy.hpp
index b75dde9cd804836e9fb39ee41393c84f0cb1fded..729cf8931155daf8ce2a130de6e97f123ac1b7bd 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopy.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopyIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopyIf.hpp
index 8f7c8140e6b9bb1099876171e4ecd07eed5530a2..dca7e7f6a5173d042d15930926f37ae0b52f32d6 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopyIf.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopyIf.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IF_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IF_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceIf.hpp
index 6fe33019c0b6703713c4b17e5c71cbe21cc444c2..54b6e1c5287d863eb58ad2aaf371397db806c328 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceIf.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceIf.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_IF_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_REPLACE_IF_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reverse.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reverse.hpp
index f84eb2c81ad4fbf218ecc8c67de8f1f9eabc39f9..a4aaba26b9866780fc127924c040954b13c3459a 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reverse.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reverse.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REVERSE_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_REVERSE_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReverseCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReverseCopy.hpp
index 88b6ed16b5ee326f9551aa2168884c4f52641992..6dd52813e050f717f6a2ce8cb03ef99fb9ee9530 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReverseCopy.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReverseCopy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_REVERSE_COPY_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_REVERSE_COPY_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Rotate.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Rotate.hpp
index c08cf1aecbf25f6532810ab0ff4fe138309b5eff..3aa1ab5d405125bb13a820cc3ab17e3c552c52e1 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Rotate.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Rotate.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_ROTATE_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_ROTATE_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RotateCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RotateCopy.hpp
index a8111a511f10512f31bcf201a7e5eddb47f26ced..28023cc4dfa4cd70b2dc71edac90605c97d560a5 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RotateCopy.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RotateCopy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_ROTATE_COPY_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_ROTATE_COPY_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Search.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Search.hpp
index 2afb0a74f013574f852b178b0a7f505462a80feb..a612a57231f561b5556c8e4fcac315bb504ff099 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Search.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Search.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_SEARCH_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_SEARCH_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SearchN.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SearchN.hpp
index cd8b394386c1432ee532ab15dd8b599342ff02e0..0d3b6bc7060f15bd6646479465687e4f618d6cf6 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SearchN.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SearchN.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_SEARCH_N_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_SEARCH_N_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftLeft.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftLeft.hpp
index 796864461f0824e43efe16632432e00d6144ac6a..7a33762f176062bbee756fafebeef0df5219541f 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftLeft.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftLeft.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_SHIFT_LEFT_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_SHIFT_LEFT_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftRight.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftRight.hpp
index 0ffde42ab29abf13ab8ff113c94b8de9ca8bc9fd..2b0a4bb524ebea2f528001c0986b361a541d05c1 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftRight.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftRight.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_SHIFT_RIGHT_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_SHIFT_RIGHT_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SwapRanges.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SwapRanges.hpp
index 3e6ca14697647d6eec2c5b2300a3d4c1ab7dbac1..438acb989f9fc924ebb7bf2308b43fa440c1e115 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SwapRanges.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SwapRanges.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_SWAP_RANGES_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_SWAP_RANGES_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Transform.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Transform.hpp
index 5d2c0cc98240569a03646382967b19963401d0fa..840e9d205441a5d20692c347f5a3e6b1bddc2eaa 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Transform.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Transform.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_TRANSFORM_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformExclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformExclusiveScan.hpp
index 9fb8cbcc3035c33b73197c7005e0a3d8c502dbe5..773e8c2f883556b53d85ed0750cc675422774d76 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformExclusiveScan.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformExclusiveScan.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_EXCLUSIVE_SCAN_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_TRANSFORM_EXCLUSIVE_SCAN_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformInclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformInclusiveScan.hpp
index 281eb6f8a14f6a878c929b06f409515562d800cc..9dde2b0fb125d3f88806e3bf4437d1bedc947617 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformInclusiveScan.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformInclusiveScan.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_INCLUSIVE_SCAN_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_TRANSFORM_INCLUSIVE_SCAN_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformReduce.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformReduce.hpp
index e3a780f4856c34cf15a6c5fa72f33f2d69c25607..03771056a27b0b82ff138d8f356ff9dd601a326c 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformReduce.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformReduce.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_REDUCE_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_TRANSFORM_REDUCE_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Unique.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Unique.hpp
index 5e4ea7d792a03551914f7c6e2cde8fa13a8a4fbf..4bab551563f17e863d8289695fabe56d2d3156e7 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Unique.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Unique.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_UNIQUE_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_UNIQUE_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_UniqueCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_UniqueCopy.hpp
index e4fd6f3ed8c5e36aa85c2305c89b540aa79c38b4..d0aa1ed1d0e0dcac7ddcc3454b9f7f72a96b54b9 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_UniqueCopy.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_UniqueCopy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_UNIQUE_COPY_IMPL_HPP
 #define KOKKOS_STD_ALGORITHMS_UNIQUE_COPY_IMPL_HPP
diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ValueWrapperForNoNeutralElement.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ValueWrapperForNoNeutralElement.hpp
index da9b6ef9a9ed0ec9c2c79f93eb55ac535be7c5ac..9b0d4d8244f28f5588274f870d7eed7b52eefc7f 100644
--- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ValueWrapperForNoNeutralElement.hpp
+++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ValueWrapperForNoNeutralElement.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STD_ALGORITHMS_VALUE_WRAPPER_FOR_NO_NEUTRAL_ELEMENT_HPP
 #define KOKKOS_STD_ALGORITHMS_VALUE_WRAPPER_FOR_NO_NEUTRAL_ELEMENT_HPP
diff --git a/packages/kokkos/algorithms/unit_tests/CMakeLists.txt b/packages/kokkos/algorithms/unit_tests/CMakeLists.txt
index 0c50ff7a0805d63319f5d9857f313ff87ebafdb8..0fe9c2006ee2e526fac1e2018e82165e256215e7 100644
--- a/packages/kokkos/algorithms/unit_tests/CMakeLists.txt
+++ b/packages/kokkos/algorithms/unit_tests/CMakeLists.txt
@@ -28,16 +28,24 @@ foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;HIP;SYCL;OpenMPTarget)
 	)
     endif()
 
-    set(file ${dir}/TestRandomAndSort.cpp)
-    # Write to a temporary intermediate file and call configure_file to avoid
-    # updating timestamps triggering unnecessary rebuilds on subsequent cmake runs.
-    file(WRITE ${dir}/dummy.cpp
-      "#include <Test${Tag}_Category.hpp>\n"
-      "#include <TestRandomCommon.hpp>\n"
-      "#include <TestSortCommon.hpp>\n"
-      )
-    configure_file(${dir}/dummy.cpp ${file})
-    list(APPEND SOURCES_A ${file})
+    # Each of these inputs is an .hpp file.
+    # Generate a .cpp file for each one that runs it on the current backend (Tag),
+    # and add this .cpp file to the sources for UnitTest_RandomAndSort.
+    foreach(SOURCES_A_Input
+        TestRandomCommon
+        TestSortCommon
+        TestNestedSort
+    )
+      set(file ${dir}/${SOURCES_A_Input}.cpp)
+      # Write to a temporary intermediate file and call configure_file to avoid
+      # updating timestamps triggering unnecessary rebuilds on subsequent cmake runs.
+      file(WRITE ${dir}/dummy.cpp
+        "#include <Test${Tag}_Category.hpp>\n"
+        "#include <${SOURCES_A_Input}.hpp>\n"
+        )
+      configure_file(${dir}/dummy.cpp ${file})
+      list(APPEND SOURCES_A ${file})
+    endforeach()
 
     # ------------------------------------------
     # std set A
@@ -137,12 +145,31 @@ foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;HIP;SYCL;OpenMPTarget)
   endif()
 endforeach()
 
-KOKKOS_ADD_EXECUTABLE_AND_TEST(
-  UnitTest_RandomAndSort
-  SOURCES
-    UnitTestMain.cpp
-    ${SOURCES_A}
-)
+# FIXME_OPENMPTARGET These tests cause internal compiler errors as of 09/01/22
+# when compiling for Intel's Xe-HP GPUs.
+if(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM)
+  list(REMOVE_ITEM STDALGO_SOURCES_D
+    TestStdAlgorithmsCopyIf.cpp
+    TestStdAlgorithmsRemoveCopy.cpp
+    TestStdAlgorithmsUnique.cpp
+    TestStdAlgorithmsUniqueCopy.cpp
+  )
+  list(REMOVE_ITEM STDALGO_SOURCES_E
+    TestStdAlgorithmsExclusiveScan.cpp
+    TestStdAlgorithmsInclusiveScan.cpp
+  )
+endif()
+
+# FIXME_OPENMPTARGET This test causes internal compiler errors as of 09/01/22
+# when compiling for Intel's Xe-HP GPUs.
+if(NOT (KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM))
+  KOKKOS_ADD_EXECUTABLE_AND_TEST(
+    UnitTest_RandomAndSort
+    SOURCES
+      UnitTestMain.cpp
+      ${SOURCES_A}
+  )
+endif()
 
 foreach(ID A;B;C;D;E)
   KOKKOS_ADD_EXECUTABLE_AND_TEST(
@@ -153,7 +180,11 @@ foreach(ID A;B;C;D;E)
     )
 endforeach()
 
-KOKKOS_ADD_EXECUTABLE(
-  UnitTest_StdAlgoCompileOnly
-  SOURCES TestStdAlgorithmsCompileOnly.cpp
-)
+# FIXME_OPENMPTARGET This test causes internal compiler errors as of 09/01/22
+# when compiling for Intel's Xe-HP GPUs.
+if(NOT (KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM))
+  KOKKOS_ADD_EXECUTABLE(
+    UnitTest_StdAlgoCompileOnly
+    SOURCES TestStdAlgorithmsCompileOnly.cpp
+  )
+endif()
diff --git a/packages/kokkos/algorithms/unit_tests/TestNestedSort.hpp b/packages/kokkos/algorithms/unit_tests/TestNestedSort.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..37ee211b42a7681967ba17c40935e8a9d8699ba4
--- /dev/null
+++ b/packages/kokkos/algorithms/unit_tests/TestNestedSort.hpp
@@ -0,0 +1,408 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_ALGORITHMS_UNITTESTS_TEST_NESTED_SORT_HPP
+#define KOKKOS_ALGORITHMS_UNITTESTS_TEST_NESTED_SORT_HPP
+
+#include <unordered_set>
+#include <random>
+#include <Kokkos_Random.hpp>
+#include <Kokkos_NestedSort.hpp>
+
+namespace Test {
+
+namespace Impl {
+
+// Comparator for sorting in descending order
+template <typename Key>
+struct GreaterThan {
+  KOKKOS_FUNCTION constexpr bool operator()(const Key& lhs,
+                                            const Key& rhs) const {
+    return lhs > rhs;
+  }
+};
+
+// Functor to test sort_team: each team responsible for sorting one array
+template <typename ExecSpace, typename KeyViewType, typename OffsetViewType>
+struct TeamSortFunctor {
+  using TeamMem  = typename Kokkos::TeamPolicy<ExecSpace>::member_type;
+  using SizeType = typename KeyViewType::size_type;
+  using KeyType  = typename KeyViewType::non_const_value_type;
+  TeamSortFunctor(const KeyViewType& keys_, const OffsetViewType& offsets_,
+                  bool sortDescending_)
+      : keys(keys_), offsets(offsets_), sortDescending(sortDescending_) {}
+  KOKKOS_INLINE_FUNCTION void operator()(const TeamMem& t) const {
+    int i          = t.league_rank();
+    SizeType begin = offsets(i);
+    SizeType end   = offsets(i + 1);
+    if (sortDescending)
+      Kokkos::Experimental::sort_team(
+          t, Kokkos::subview(keys, Kokkos::make_pair(begin, end)),
+          GreaterThan<KeyType>());
+    else
+      Kokkos::Experimental::sort_team(
+          t, Kokkos::subview(keys, Kokkos::make_pair(begin, end)));
+  }
+  KeyViewType keys;
+  OffsetViewType offsets;
+  bool sortDescending;
+};
+
+// Functor to test sort_by_key_team: each team responsible for sorting one array
+template <typename ExecSpace, typename KeyViewType, typename ValueViewType,
+          typename OffsetViewType>
+struct TeamSortByKeyFunctor {
+  using TeamMem  = typename Kokkos::TeamPolicy<ExecSpace>::member_type;
+  using SizeType = typename KeyViewType::size_type;
+  using KeyType  = typename KeyViewType::non_const_value_type;
+  TeamSortByKeyFunctor(const KeyViewType& keys_, const ValueViewType& values_,
+                       const OffsetViewType& offsets_, bool sortDescending_)
+      : keys(keys_),
+        values(values_),
+        offsets(offsets_),
+        sortDescending(sortDescending_) {}
+  KOKKOS_INLINE_FUNCTION void operator()(const TeamMem& t) const {
+    int i          = t.league_rank();
+    SizeType begin = offsets(i);
+    SizeType end   = offsets(i + 1);
+    if (sortDescending) {
+      Kokkos::Experimental::sort_by_key_team(
+          t, Kokkos::subview(keys, Kokkos::make_pair(begin, end)),
+          Kokkos::subview(values, Kokkos::make_pair(begin, end)),
+          GreaterThan<KeyType>());
+    } else {
+      Kokkos::Experimental::sort_by_key_team(
+          t, Kokkos::subview(keys, Kokkos::make_pair(begin, end)),
+          Kokkos::subview(values, Kokkos::make_pair(begin, end)));
+    }
+  }
+  KeyViewType keys;
+  ValueViewType values;
+  OffsetViewType offsets;
+  bool sortDescending;
+};
+
+// Functor to test sort_thread: each thread (multiple vector lanes) responsible
+// for sorting one array
+template <typename ExecSpace, typename KeyViewType, typename OffsetViewType>
+struct ThreadSortFunctor {
+  using TeamMem  = typename Kokkos::TeamPolicy<ExecSpace>::member_type;
+  using SizeType = typename KeyViewType::size_type;
+  using KeyType  = typename KeyViewType::non_const_value_type;
+  ThreadSortFunctor(const KeyViewType& keys_, const OffsetViewType& offsets_,
+                    bool sortDescending_)
+      : keys(keys_), offsets(offsets_), sortDescending(sortDescending_) {}
+  KOKKOS_INLINE_FUNCTION void operator()(const TeamMem& t) const {
+    int i = t.league_rank() * t.team_size() + t.team_rank();
+    // Number of arrays to sort doesn't have to be divisible by team size, so
+    // some threads may be idle.
+    if (i < offsets.extent_int(0) - 1) {
+      SizeType begin = offsets(i);
+      SizeType end   = offsets(i + 1);
+      if (sortDescending)
+        Kokkos::Experimental::sort_thread(
+            t, Kokkos::subview(keys, Kokkos::make_pair(begin, end)),
+            GreaterThan<KeyType>());
+      else
+        Kokkos::Experimental::sort_thread(
+            t, Kokkos::subview(keys, Kokkos::make_pair(begin, end)));
+    }
+  }
+  KeyViewType keys;
+  OffsetViewType offsets;
+  bool sortDescending;
+};
+
+// Functor to test sort_by_key_thread
+template <typename ExecSpace, typename KeyViewType, typename ValueViewType,
+          typename OffsetViewType>
+struct ThreadSortByKeyFunctor {
+  using TeamMem  = typename Kokkos::TeamPolicy<ExecSpace>::member_type;
+  using SizeType = typename KeyViewType::size_type;
+  using KeyType  = typename KeyViewType::non_const_value_type;
+  ThreadSortByKeyFunctor(const KeyViewType& keys_, const ValueViewType& values_,
+                         const OffsetViewType& offsets_, bool sortDescending_)
+      : keys(keys_),
+        values(values_),
+        offsets(offsets_),
+        sortDescending(sortDescending_) {}
+  KOKKOS_INLINE_FUNCTION void operator()(const TeamMem& t) const {
+    int i = t.league_rank() * t.team_size() + t.team_rank();
+    // Number of arrays to sort doesn't have to be divisible by team size, so
+    // some threads may be idle.
+    if (i < offsets.extent_int(0) - 1) {
+      SizeType begin = offsets(i);
+      SizeType end   = offsets(i + 1);
+      if (sortDescending) {
+        Kokkos::Experimental::sort_by_key_thread(
+            t, Kokkos::subview(keys, Kokkos::make_pair(begin, end)),
+            Kokkos::subview(values, Kokkos::make_pair(begin, end)),
+            GreaterThan<KeyType>());
+      } else {
+        Kokkos::Experimental::sort_by_key_thread(
+            t, Kokkos::subview(keys, Kokkos::make_pair(begin, end)),
+            Kokkos::subview(values, Kokkos::make_pair(begin, end)));
+      }
+    }
+  }
+  KeyViewType keys;
+  ValueViewType values;
+  OffsetViewType offsets;
+  bool sortDescending;
+};
+
+// Generate the offsets view for a set of n packed arrays, each with uniform
+// random length in [0,k]. Array i will occupy the indices [offsets(i),
+// offsets(i+1)), like a row in a CRS graph. Returns the total length of all the
+// arrays.
+template <typename OffsetViewType>
+size_t randomPackedArrayOffsets(unsigned n, unsigned k,
+                                OffsetViewType& offsets) {
+  offsets          = OffsetViewType("Offsets", n + 1);
+  auto offsetsHost = Kokkos::create_mirror_view(Kokkos::HostSpace(), offsets);
+  std::mt19937 gen;
+  std::uniform_int_distribution<> distrib(0, k);
+  // This will leave offsetsHost(n) == 0.
+  std::generate(offsetsHost.data(), offsetsHost.data() + n,
+                [&]() { return distrib(gen); });
+  // Exclusive prefix-sum to get offsets
+  size_t accum = 0;
+  for (unsigned i = 0; i <= n; i++) {
+    size_t num     = offsetsHost(i);
+    offsetsHost(i) = accum;
+    accum += num;
+  }
+  Kokkos::deep_copy(offsets, offsetsHost);
+  return offsetsHost(n);
+}
+
+template <typename ValueViewType>
+ValueViewType uniformRandomViewFill(size_t totalLength,
+                                    typename ValueViewType::value_type minVal,
+                                    typename ValueViewType::value_type maxVal) {
+  ValueViewType vals("vals", totalLength);
+  Kokkos::Random_XorShift64_Pool<typename ValueViewType::execution_space> g(
+      1931);
+  Kokkos::fill_random(vals, g, minVal, maxVal);
+  return vals;
+}
+
+template <class ExecutionSpace, typename KeyType>
+void test_nested_sort_impl(unsigned narray, unsigned n, bool useTeams,
+                           bool customCompare, KeyType minKey, KeyType maxKey) {
+  using KeyViewType    = Kokkos::View<KeyType*, ExecutionSpace>;
+  using OffsetViewType = Kokkos::View<unsigned*, ExecutionSpace>;
+  using TeamPol        = Kokkos::TeamPolicy<ExecutionSpace>;
+  OffsetViewType offsets;
+  size_t totalLength = randomPackedArrayOffsets(narray, n, offsets);
+  KeyViewType keys =
+      uniformRandomViewFill<KeyViewType>(totalLength, minKey, maxKey);
+  // note: doing create_mirror because we always want this to be a separate
+  // copy, even if keys is already host-accessible. keysHost becomes the correct
+  // result to compare against.
+  auto keysHost = Kokkos::create_mirror(Kokkos::HostSpace(), keys);
+  Kokkos::deep_copy(keysHost, keys);
+  auto offsetsHost =
+      Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), offsets);
+  // Sort the same arrays on host to compare against
+  for (unsigned i = 0; i < narray; i++) {
+    KeyType* begin = keysHost.data() + offsetsHost(i);
+    KeyType* end   = keysHost.data() + offsetsHost(i + 1);
+    if (customCompare)
+      std::sort(begin, end,
+                [](const KeyType& a, const KeyType& b) { return a > b; });
+    else
+      std::sort(begin, end);
+  }
+  if (useTeams) {
+    int vectorLen = std::min<int>(4, TeamPol::vector_length_max());
+    TeamPol policy(narray, Kokkos::AUTO(), vectorLen);
+    Kokkos::parallel_for(
+        policy, TeamSortFunctor<ExecutionSpace, KeyViewType, OffsetViewType>(
+                    keys, offsets, customCompare));
+  } else {
+    ThreadSortFunctor<ExecutionSpace, KeyViewType, OffsetViewType> functor(
+        keys, offsets, customCompare);
+    int vectorLen = std::min<int>(4, TeamPol::vector_length_max());
+    TeamPol dummy(1, Kokkos::AUTO(), vectorLen);
+    int teamSize =
+        dummy.team_size_recommended(functor, Kokkos::ParallelForTag());
+    int numTeams = (narray + teamSize - 1) / teamSize;
+    Kokkos::parallel_for(TeamPol(numTeams, teamSize, vectorLen), functor);
+  }
+  auto keysOut = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), keys);
+  std::string testLabel = useTeams ? "sort_team" : "sort_thread";
+  for (unsigned i = 0; i < keys.extent(0); i++) {
+    EXPECT_EQ(keysOut(i), keysHost(i))
+        << testLabel << ": after sorting, key at index " << i
+        << " is incorrect.";
+  }
+}
+
+template <class ExecutionSpace, typename KeyType, typename ValueType>
+void test_nested_sort_by_key_impl(unsigned narray, unsigned n, bool useTeams,
+                                  bool customCompare, KeyType minKey,
+                                  KeyType maxKey, ValueType minVal,
+                                  ValueType maxVal) {
+  using KeyViewType    = Kokkos::View<KeyType*, ExecutionSpace>;
+  using ValueViewType  = Kokkos::View<ValueType*, ExecutionSpace>;
+  using OffsetViewType = Kokkos::View<unsigned*, ExecutionSpace>;
+  using TeamPol        = Kokkos::TeamPolicy<ExecutionSpace>;
+  OffsetViewType offsets;
+  size_t totalLength = randomPackedArrayOffsets(narray, n, offsets);
+  KeyViewType keys =
+      uniformRandomViewFill<KeyViewType>(totalLength, minKey, maxKey);
+  ValueViewType values =
+      uniformRandomViewFill<ValueViewType>(totalLength, minVal, maxVal);
+  // note: doing create_mirror because we always want this to be a separate
+  // copy, even if keys/vals are already host-accessible. keysHost and valsHost
+  // becomes the correct result to compare against.
+  auto keysHost   = Kokkos::create_mirror(Kokkos::HostSpace(), keys);
+  auto valuesHost = Kokkos::create_mirror(Kokkos::HostSpace(), values);
+  Kokkos::deep_copy(keysHost, keys);
+  Kokkos::deep_copy(valuesHost, values);
+  auto offsetsHost =
+      Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), offsets);
+  // Sort the same arrays on host to compare against
+  for (unsigned i = 0; i < narray; i++) {
+    // std:: doesn't have a sort_by_key, so sort a vector of key-value pairs
+    // instead
+    using KV = std::pair<KeyType, ValueType>;
+    std::vector<KV> keysAndValues(offsetsHost(i + 1) - offsetsHost(i));
+    for (unsigned j = 0; j < keysAndValues.size(); j++) {
+      keysAndValues[j].first  = keysHost(offsetsHost(i) + j);
+      keysAndValues[j].second = valuesHost(offsetsHost(i) + j);
+    }
+    if (customCompare) {
+      std::sort(keysAndValues.begin(), keysAndValues.end(),
+                [](const KV& a, const KV& b) { return a.first > b.first; });
+    } else {
+      std::sort(keysAndValues.begin(), keysAndValues.end(),
+                [](const KV& a, const KV& b) { return a.first < b.first; });
+    }
+    // Copy back from pairs to views
+    for (unsigned j = 0; j < keysAndValues.size(); j++) {
+      keysHost(offsetsHost(i) + j)   = keysAndValues[j].first;
+      valuesHost(offsetsHost(i) + j) = keysAndValues[j].second;
+    }
+  }
+  if (useTeams) {
+    int vectorLen = std::min<int>(4, TeamPol::vector_length_max());
+    TeamPol policy(narray, Kokkos::AUTO(), vectorLen);
+    Kokkos::parallel_for(
+        policy, TeamSortByKeyFunctor<ExecutionSpace, KeyViewType, ValueViewType,
+                                     OffsetViewType>(keys, values, offsets,
+                                                     customCompare));
+  } else {
+    ThreadSortByKeyFunctor<ExecutionSpace, KeyViewType, ValueViewType,
+                           OffsetViewType>
+        functor(keys, values, offsets, customCompare);
+    int vectorLen = std::min<int>(4, TeamPol::vector_length_max());
+    TeamPol dummy(1, Kokkos::AUTO(), vectorLen);
+    int teamSize =
+        dummy.team_size_recommended(functor, Kokkos::ParallelForTag());
+    int numTeams = (narray + teamSize - 1) / teamSize;
+    Kokkos::parallel_for(TeamPol(numTeams, teamSize, vectorLen), functor);
+  }
+  auto keysOut = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), keys);
+  auto valuesOut =
+      Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), values);
+  std::string testLabel = useTeams ? "sort_by_key_team" : "sort_by_key_thread";
+  // First, compare keys since they will always match exactly
+  for (unsigned i = 0; i < keys.extent(0); i++) {
+    EXPECT_EQ(keysOut(i), keysHost(i))
+        << testLabel << ": after sorting, key at index " << i
+        << " is incorrect.";
+  }
+  // Kokkos::sort_by_key_X is not stable, so if a key happens to
+  // appear more than once, the order of the values may not match exactly.
+  // But the set of values for a given key should be identical.
+  unsigned keyStart = 0;
+  while (keyStart < keys.extent(0)) {
+    KeyType key     = keysHost(keyStart);
+    unsigned keyEnd = keyStart + 1;
+    while (keyEnd < keys.extent(0) && keysHost(keyEnd) == key) keyEnd++;
+    std::unordered_multiset<ValueType> correctVals;
+    std::unordered_multiset<ValueType> outputVals;
+    for (unsigned i = keyStart; i < keyEnd; i++) {
+      correctVals.insert(valuesHost(i));
+      outputVals.insert(valuesOut(i));
+    }
+    // Check one value at a time that they match
+    for (auto it = correctVals.begin(); it != correctVals.end(); it++) {
+      ValueType val = *it;
+      EXPECT_TRUE(outputVals.find(val) != outputVals.end())
+          << testLabel << ": after sorting, value " << val
+          << " corresponding to key " << key << " is missing.";
+      EXPECT_EQ(correctVals.count(val), outputVals.count(val))
+          << testLabel << ": after sorting, the number of occurences of value "
+          << val << " corresponding to key " << key << " changed.";
+    }
+    keyStart = keyEnd;
+  }
+}
+
+template <class ExecutionSpace, typename KeyType>
+void test_nested_sort(unsigned int N, KeyType minKey, KeyType maxKey) {
+  // 2nd arg: true = team-level, false = thread-level.
+  // 3rd arg: true = custom comparator, false = default comparator.
+  test_nested_sort_impl<ExecutionSpace, KeyType>(N, N, true, false, minKey,
+                                                 maxKey);
+  test_nested_sort_impl<ExecutionSpace, KeyType>(N, N, true, true, minKey,
+                                                 maxKey);
+  test_nested_sort_impl<ExecutionSpace, KeyType>(N, N, false, false, minKey,
+                                                 maxKey);
+  test_nested_sort_impl<ExecutionSpace, KeyType>(N, N, false, true, minKey,
+                                                 maxKey);
+}
+
+template <class ExecutionSpace, typename KeyType, typename ValueType>
+void test_nested_sort_by_key(unsigned int N, KeyType minKey, KeyType maxKey,
+                             ValueType minVal, ValueType maxVal) {
+  // 2nd arg: true = team-level, false = thread-level.
+  // 3rd arg: true = custom comparator, false = default comparator.
+  test_nested_sort_by_key_impl<ExecutionSpace, KeyType, ValueType>(
+      N, N, true, false, minKey, maxKey, minVal, maxVal);
+  test_nested_sort_by_key_impl<ExecutionSpace, KeyType, ValueType>(
+      N, N, true, true, minKey, maxKey, minVal, maxVal);
+  test_nested_sort_by_key_impl<ExecutionSpace, KeyType, ValueType>(
+      N, N, false, false, minKey, maxKey, minVal, maxVal);
+  test_nested_sort_by_key_impl<ExecutionSpace, KeyType, ValueType>(
+      N, N, false, true, minKey, maxKey, minVal, maxVal);
+}
+}  // namespace Impl
+
+TEST(TEST_CATEGORY, NestedSort) {
+  Impl::test_nested_sort<TEST_EXECSPACE, unsigned>(171, 0U, UINT_MAX);
+  Impl::test_nested_sort<TEST_EXECSPACE, float>(42, -1e6f, 1e6f);
+  Impl::test_nested_sort<TEST_EXECSPACE, char>(67, CHAR_MIN, CHAR_MAX);
+}
+
+TEST(TEST_CATEGORY, NestedSortByKey) {
+  // Second/third template arguments are key and value respectively.
+  // In sort_by_key_X functions, a key view and a value view are both permuted
+  // to make the keys sorted. This means that the value type doesn't need to be
+  // ordered, unlike key
+  Impl::test_nested_sort_by_key<TEST_EXECSPACE, unsigned, unsigned>(
+      161, 0U, UINT_MAX, 0U, UINT_MAX);
+  Impl::test_nested_sort_by_key<TEST_EXECSPACE, float, char>(
+      267, -1e6f, 1e6f, CHAR_MIN, CHAR_MAX);
+  Impl::test_nested_sort_by_key<TEST_EXECSPACE, char, double>(
+      11, CHAR_MIN, CHAR_MAX, 2.718, 3.14);
+}
+
+}  // namespace Test
+#endif
diff --git a/packages/kokkos/algorithms/unit_tests/TestOpenMP_Sort1D.cpp b/packages/kokkos/algorithms/unit_tests/TestOpenMP_Sort1D.cpp
index 4a5839f0c80a5298c14ff91422d74664b9dd95bd..e06486618f38e13a709da4e6225f241cd323a494 100644
--- a/packages/kokkos/algorithms/unit_tests/TestOpenMP_Sort1D.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestOpenMP_Sort1D.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Macros.hpp>
 #ifdef KOKKOS_ENABLE_OPENMP
diff --git a/packages/kokkos/algorithms/unit_tests/TestOpenMP_Sort3D.cpp b/packages/kokkos/algorithms/unit_tests/TestOpenMP_Sort3D.cpp
index 127d911d7ca3856957646698b431089b5deb2caa..cd6e8e8cbf337eac3158eaa14f80dc5cd5e08a8a 100644
--- a/packages/kokkos/algorithms/unit_tests/TestOpenMP_Sort3D.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestOpenMP_Sort3D.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Macros.hpp>
 #ifdef KOKKOS_ENABLE_OPENMP
diff --git a/packages/kokkos/algorithms/unit_tests/TestOpenMP_SortDynamicView.cpp b/packages/kokkos/algorithms/unit_tests/TestOpenMP_SortDynamicView.cpp
index 3dc88540443f7af219b18b85425408afbc1fda6e..549d09f1f247e24faf59944b6a2a0de9127d8bce 100644
--- a/packages/kokkos/algorithms/unit_tests/TestOpenMP_SortDynamicView.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestOpenMP_SortDynamicView.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Macros.hpp>
 #ifdef KOKKOS_ENABLE_OPENMP
diff --git a/packages/kokkos/algorithms/unit_tests/TestRandom.hpp b/packages/kokkos/algorithms/unit_tests/TestRandom.hpp
index 19c82003cf3429714a17a262fe55d59907ec5ecf..607e94c7845ed9529a1b561cdbda13ea0d277f39 100644
--- a/packages/kokkos/algorithms/unit_tests/TestRandom.hpp
+++ b/packages/kokkos/algorithms/unit_tests/TestRandom.hpp
@@ -1,43 +1,17 @@
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
 
 #ifndef KOKKOS_TEST_DUALVIEW_HPP
@@ -189,50 +163,10 @@ struct test_random_functor {
           static_cast<uint64_t>(1.0 * HIST_DIM3D * tmp2 / theMax);
       const uint64_t ind3_3d =
           static_cast<uint64_t>(1.0 * HIST_DIM3D * tmp3 / theMax);
-// Workaround Intel 17 compiler bug which sometimes add random
-// instruction alignment which makes the lock instruction
-// illegal. Seems to be mostly just for unsigned int atomics.
-// Looking at the assembly the compiler
-// appears to insert cache line alignment for the instruction.
-// Isn't restricted to specific archs. Seen it on SNB and SKX, but for
-// different code. Another occurrence was with Desul atomics in
-// a different unit test. This one here happens without desul atomics.
-// Inserting an assembly nop instruction changes the alignment and
-// works round this.
-//
-// 17.0.4 for 64bit Random works with 1/1/1/2/1
-// 17.0.4 for 1024bit Random works with 1/1/1/1/1
-#ifdef KOKKOS_COMPILER_INTEL
-#if (KOKKOS_COMPILER_INTEL < 1800)
-      asm volatile("nop\n");
-#endif
-#endif
       atomic_fetch_add(&density_1d(ind1_1d), 1);
-#ifdef KOKKOS_COMPILER_INTEL
-#if (KOKKOS_COMPILER_INTEL < 1800)
-      asm volatile("nop\n");
-#endif
-#endif
       atomic_fetch_add(&density_1d(ind2_1d), 1);
-#ifdef KOKKOS_COMPILER_INTEL
-#if (KOKKOS_COMPILER_INTEL < 1800)
-      asm volatile("nop\n");
-#endif
-#endif
       atomic_fetch_add(&density_1d(ind3_1d), 1);
-#ifdef KOKKOS_COMPILER_INTEL
-#if (KOKKOS_COMPILER_INTEL < 1800)
-      if (std::is_same<rnd_type, Kokkos::Random_XorShift64<device_type>>::value)
-        asm volatile("nop\n");
-      asm volatile("nop\n");
-#endif
-#endif
       atomic_fetch_add(&density_3d(ind1_3d, ind2_3d, ind3_3d), 1);
-#ifdef KOKKOS_COMPILER_INTEL
-#if (KOKKOS_COMPILER_INTEL < 1800)
-      asm volatile("nop\n");
-#endif
-#endif
     }
     rand_pool.free_state(rand_gen);
   }
diff --git a/packages/kokkos/algorithms/unit_tests/TestRandomAccessIterator.cpp b/packages/kokkos/algorithms/unit_tests/TestRandomAccessIterator.cpp
index 5136ad434ba42b17292deeeb792a7d416fcc2ea6..439d171c8aec4a2ca6146e6e0963d515dd74b725 100644
--- a/packages/kokkos/algorithms/unit_tests/TestRandomAccessIterator.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestRandomAccessIterator.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 
diff --git a/packages/kokkos/algorithms/unit_tests/TestRandomCommon.hpp b/packages/kokkos/algorithms/unit_tests/TestRandomCommon.hpp
index c6d3b59ae1f12422c448a13f5f91f2ed74cc58ff..c53d66f4d02cc2b3cbaf2ee3056615022eaa2446 100644
--- a/packages/kokkos/algorithms/unit_tests/TestRandomCommon.hpp
+++ b/packages/kokkos/algorithms/unit_tests/TestRandomCommon.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TESTRANDOM_COMMON_HPP
 #define KOKKOS_ALGORITHMS_UNITTESTS_TESTRANDOM_COMMON_HPP
diff --git a/packages/kokkos/algorithms/unit_tests/TestSort.hpp b/packages/kokkos/algorithms/unit_tests/TestSort.hpp
index 120a04bdb535a55b31516b047a0da4c347c581b9..d903888878c93af5a00dd2f2a864cc1f017ebf2f 100644
--- a/packages/kokkos/algorithms/unit_tests/TestSort.hpp
+++ b/packages/kokkos/algorithms/unit_tests/TestSort.hpp
@@ -1,43 +1,17 @@
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
 
 #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TESTSORT_HPP
@@ -130,19 +104,14 @@ struct sum3D {
 };
 
 template <class ExecutionSpace, typename KeyType>
-void test_1D_sort_impl(unsigned int n, bool force_kokkos) {
+void test_1D_sort_impl(unsigned int n) {
   using KeyViewType = Kokkos::View<KeyType*, ExecutionSpace>;
   KeyViewType keys("Keys", n);
 
   // Test sorting array with all numbers equal
   ExecutionSpace exec;
   Kokkos::deep_copy(exec, keys, KeyType(1));
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  Kokkos::sort(exec, keys, force_kokkos);
-#else
-  (void)force_kokkos;  // suppress warnings about unused variable
   Kokkos::sort(exec, keys);
-#endif
 
   Kokkos::Random_XorShift64_Pool<ExecutionSpace> g(1931);
   Kokkos::fill_random(keys, g,
@@ -156,11 +125,7 @@ void test_1D_sort_impl(unsigned int n, bool force_kokkos) {
   Kokkos::parallel_reduce(Kokkos::RangePolicy<ExecutionSpace>(exec, 0, n),
                           sum<ExecutionSpace, KeyType>(keys), sum_before);
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  Kokkos::sort(exec, keys, force_kokkos);
-#else
   Kokkos::sort(exec, keys);
-#endif
 
   Kokkos::parallel_reduce(Kokkos::RangePolicy<ExecutionSpace>(exec, 0, n),
                           sum<ExecutionSpace, KeyType>(keys), sum_after);
@@ -415,10 +380,7 @@ void test_sort_integer_overflow() {
 
 template <class ExecutionSpace, typename KeyType>
 void test_1D_sort(unsigned int N) {
-  test_1D_sort_impl<ExecutionSpace, KeyType>(N * N * N, true);
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  test_1D_sort_impl<ExecutionSpace, KeyType>(N * N * N, false);
-#endif
+  test_1D_sort_impl<ExecutionSpace, KeyType>(N * N * N);
 }
 
 template <class ExecutionSpace, typename KeyType>
@@ -444,12 +406,20 @@ void test_issue_4978_sort() {
 template <class ExecutionSpace, typename KeyType>
 void test_sort(unsigned int N) {
   test_1D_sort<ExecutionSpace, KeyType>(N);
-  test_3D_sort<ExecutionSpace, KeyType>(N);
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if (!std::is_same_v<ExecutionSpace, Kokkos::Cuda>)
+#endif
+    test_3D_sort<ExecutionSpace, KeyType>(N);
 // FIXME_OPENMPTARGET: OpenMPTarget doesn't support DynamicView yet.
 #ifndef KOKKOS_ENABLE_OPENMPTARGET
   test_dynamic_view_sort<ExecutionSpace, KeyType>(N);
 #endif
-  test_issue_1160_sort<ExecutionSpace>();
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if (!std::is_same_v<ExecutionSpace, Kokkos::Cuda>)
+#endif
+    test_issue_1160_sort<ExecutionSpace>();
   test_issue_4978_sort<ExecutionSpace>();
   test_sort_integer_overflow<ExecutionSpace, long long>();
   test_sort_integer_overflow<ExecutionSpace, unsigned long long>();
diff --git a/packages/kokkos/algorithms/unit_tests/TestSortCommon.hpp b/packages/kokkos/algorithms/unit_tests/TestSortCommon.hpp
index 56657b6574b865419a1f93e01a49aa2a3e648736..b8e2e17e4f353994a013d3cd9b8305135d2b84ca 100644
--- a/packages/kokkos/algorithms/unit_tests/TestSortCommon.hpp
+++ b/packages/kokkos/algorithms/unit_tests/TestSortCommon.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TESTSORT_COMMON_HPP
 #define KOKKOS_ALGORITHMS_UNITTESTS_TESTSORT_COMMON_HPP
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentDifference.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentDifference.cpp
index d37f657f57599e1029cf32e59f6bb9775b57a224..d414d524b61d21828808e3cf7e540ea377df85ec 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentDifference.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentDifference.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <std_algorithms/Kokkos_BeginEnd.hpp>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentFind.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentFind.cpp
index 874748193e366b1921a870100c4baadb16fe2a82..ee34761265021e404b3848d00e3a2871e752be14 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentFind.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentFind.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <std_algorithms/Kokkos_BeginEnd.hpp>
@@ -315,6 +287,12 @@ void run_all_scenarios() {
 }
 
 TEST(std_algorithms_nonmod_seq_ops, adjacent_find) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) {
+    GTEST_SKIP() << "FIXME wrong result";
+  }
+#endif
   run_all_scenarios<DynamicTag, int>();
   run_all_scenarios<DynamicTag, double>();
   run_all_scenarios<StridedThreeTag, int>();
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAllAnyNoneOf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAllAnyNoneOf.cpp
index a1307d4c23cb0dabd093155841a4589a64d0f3f3..1c39a4735e62576fe9ebfb8a3a702f6e9436ed5c 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAllAnyNoneOf.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAllAnyNoneOf.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <std_algorithms/Kokkos_BeginEnd.hpp>
@@ -175,6 +147,12 @@ void run_all_scenarios() {
 }
 
 TEST(std_algorithms_all_any_none_of_test, test) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) {
+    GTEST_SKIP() << "FIXME wrong result";
+  }
+#endif
   run_all_scenarios<DynamicTag, double>();
   run_all_scenarios<StridedTwoTag, int>();
   run_all_scenarios<StridedThreeTag, unsigned>();
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.cpp
index 871cce155b4d43239a1306f051f439359ad3b99b..39a508bb8feacfdf872bd7f0614b74970524d441 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.hpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.hpp
index a06f9c61c03adef2950c3074a38b07757cfaa120..694676a878a2a9c601b5fcc70febe6207903f742 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.hpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TEST_STD_ALGOS_COMMON_HPP
 #define KOKKOS_ALGORITHMS_UNITTESTS_TEST_STD_ALGOS_COMMON_HPP
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCompileOnly.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCompileOnly.cpp
index 037dac36ed9de12a37b36d060a42c37c91cc40f6..9324db12f2874a6445f0e4581fd2bc0a68698620 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCompileOnly.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCompileOnly.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_StdAlgorithms.hpp>
 
@@ -123,18 +95,20 @@ struct TrivialTransformReduceBinaryTransformer {
   }
 };
 
-// put all code here and don't call from main
-// so that even if one runs the executable,
-// nothing is run anyway
+namespace KE = Kokkos::Experimental;
+
+struct TestStruct {
+  // put all code here and don't call from main
+  // so that even if one runs the executable,
+  // nothing is run anyway
 
-namespace KE     = Kokkos::Experimental;
-using count_type = std::size_t;
-using T          = double;
-Kokkos::View<T *> in1("in1", 10);
-Kokkos::View<T *> in2("in2", 10);
-Kokkos::View<T *> in3("in3", 10);
-Kokkos::DefaultExecutionSpace exe_space;
-std::string const label = "trivial";
+  using count_type      = std::size_t;
+  using T               = double;
+  Kokkos::View<T *> in1 = Kokkos::View<T *>("in1", 10);
+  Kokkos::View<T *> in2 = Kokkos::View<T *>("in2", 10);
+  Kokkos::View<T *> in3 = Kokkos::View<T *>("in3", 10);
+  Kokkos::DefaultExecutionSpace exe_space;
+  std::string const label = "trivial";
 
 //
 // just iterators
@@ -239,293 +213,299 @@ std::string const label = "trivial";
   (void)KE::ALGO(exe_space, /*--*/ in1, ARG, in2); \
   (void)KE::ALGO(label, exe_space, in1, ARG, in2);
 
-void non_modifying_seq_ops() {
-  TEST_ALGO_MACRO_B1E1_VARIAD(find, T{});
-  TEST_ALGO_MACRO_V1_VARIAD(find, T{});
+  void non_modifying_seq_ops() {
+    TEST_ALGO_MACRO_B1E1_VARIAD(find, T{});
+    TEST_ALGO_MACRO_V1_VARIAD(find, T{});
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(find_if, TrivialUnaryPredicate<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(find_if, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_B1E1_VARIAD(find_if, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(find_if, TrivialUnaryPredicate<T>());
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(find_if_not, TrivialUnaryPredicate<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(find_if_not, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_B1E1_VARIAD(find_if_not, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(find_if_not, TrivialUnaryPredicate<T>());
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(for_each, TimesTwoFunctor<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(for_each, TimesTwoFunctor<T>());
+    TEST_ALGO_MACRO_B1E1_VARIAD(for_each, TimesTwoFunctor<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(for_each, TimesTwoFunctor<T>());
 
-  TEST_ALGO_MACRO_B1_VARIAD(for_each_n, count_type{}, TimesTwoFunctor<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(for_each_n, count_type{}, TimesTwoFunctor<T>());
+    TEST_ALGO_MACRO_B1_VARIAD(for_each_n, count_type{}, TimesTwoFunctor<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(for_each_n, count_type{}, TimesTwoFunctor<T>());
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(count_if, TrivialUnaryPredicate<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(count_if, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_B1E1_VARIAD(count_if, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(count_if, TrivialUnaryPredicate<T>());
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(count, T{});
-  TEST_ALGO_MACRO_V1_VARIAD(count, T{});
+    TEST_ALGO_MACRO_B1E1_VARIAD(count, T{});
+    TEST_ALGO_MACRO_V1_VARIAD(count, T{});
 
-  TEST_ALGO_MACRO_B1E1B2E2(mismatch);
-  TEST_ALGO_MACRO_B1E1B2E2_VARIAD(mismatch, TrivialBinaryPredicate<T>());
-  TEST_ALGO_MACRO_V1V2(mismatch);
-  TEST_ALGO_MACRO_V1V2_VARIAD(mismatch, TrivialBinaryPredicate<T>());
+    TEST_ALGO_MACRO_B1E1B2E2(mismatch);
+    TEST_ALGO_MACRO_B1E1B2E2_VARIAD(mismatch, TrivialBinaryPredicate<T>());
+    TEST_ALGO_MACRO_V1V2(mismatch);
+    TEST_ALGO_MACRO_V1V2_VARIAD(mismatch, TrivialBinaryPredicate<T>());
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(all_of, TrivialUnaryPredicate<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(all_of, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_B1E1_VARIAD(all_of, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(all_of, TrivialUnaryPredicate<T>());
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(any_of, TrivialUnaryPredicate<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(any_of, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_B1E1_VARIAD(any_of, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(any_of, TrivialUnaryPredicate<T>());
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(none_of, TrivialUnaryPredicate<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(none_of, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_B1E1_VARIAD(none_of, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(none_of, TrivialUnaryPredicate<T>());
 
-  TEST_ALGO_MACRO_B1E1B2(equal);
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(equal, TrivialBinaryPredicate<T>());
-  TEST_ALGO_MACRO_V1V2(equal);
-  TEST_ALGO_MACRO_V1V2_VARIAD(equal, TrivialBinaryPredicate<T>());
-  TEST_ALGO_MACRO_B1E1B2E2(equal);
-  TEST_ALGO_MACRO_B1E1B2E2_VARIAD(equal, TrivialBinaryPredicate<T>());
+    TEST_ALGO_MACRO_B1E1B2(equal);
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(equal, TrivialBinaryPredicate<T>());
+    TEST_ALGO_MACRO_V1V2(equal);
+    TEST_ALGO_MACRO_V1V2_VARIAD(equal, TrivialBinaryPredicate<T>());
+    TEST_ALGO_MACRO_B1E1B2E2(equal);
+    TEST_ALGO_MACRO_B1E1B2E2_VARIAD(equal, TrivialBinaryPredicate<T>());
 
-  TEST_ALGO_MACRO_B1E1B2E2(lexicographical_compare);
-  TEST_ALGO_MACRO_B1E1B2E2_VARIAD(lexicographical_compare,
-                                  TrivialComparator<T>());
-  TEST_ALGO_MACRO_V1V2(lexicographical_compare);
-  TEST_ALGO_MACRO_V1V2_VARIAD(lexicographical_compare, TrivialComparator<T>());
+    TEST_ALGO_MACRO_B1E1B2E2(lexicographical_compare);
+    TEST_ALGO_MACRO_B1E1B2E2_VARIAD(lexicographical_compare,
+                                    TrivialComparator<T>());
+    TEST_ALGO_MACRO_V1V2(lexicographical_compare);
+    TEST_ALGO_MACRO_V1V2_VARIAD(lexicographical_compare,
+                                TrivialComparator<T>());
 
-  TEST_ALGO_MACRO_B1E1(adjacent_find);
-  TEST_ALGO_MACRO_V1(adjacent_find);
-  TEST_ALGO_MACRO_B1E1_VARIAD(adjacent_find, TrivialBinaryFunctor<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(adjacent_find, TrivialBinaryFunctor<T>());
+    TEST_ALGO_MACRO_B1E1(adjacent_find);
+    TEST_ALGO_MACRO_V1(adjacent_find);
+    TEST_ALGO_MACRO_B1E1_VARIAD(adjacent_find, TrivialBinaryFunctor<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(adjacent_find, TrivialBinaryFunctor<T>());
 
-  TEST_ALGO_MACRO_B1E1B2E2(search);
-  TEST_ALGO_MACRO_V1V2(search);
-  TEST_ALGO_MACRO_B1E1B2E2_VARIAD(search, TrivialBinaryFunctor<T>());
-  TEST_ALGO_MACRO_V1V2_VARIAD(search, TrivialBinaryFunctor<T>());
+    TEST_ALGO_MACRO_B1E1B2E2(search);
+    TEST_ALGO_MACRO_V1V2(search);
+    TEST_ALGO_MACRO_B1E1B2E2_VARIAD(search, TrivialBinaryFunctor<T>());
+    TEST_ALGO_MACRO_V1V2_VARIAD(search, TrivialBinaryFunctor<T>());
 
-  TEST_ALGO_MACRO_B1E1B2E2(find_first_of);
-  TEST_ALGO_MACRO_V1V2(find_first_of);
-  TEST_ALGO_MACRO_B1E1B2E2_VARIAD(find_first_of, TrivialBinaryFunctor<T>());
-  TEST_ALGO_MACRO_V1V2_VARIAD(find_first_of, TrivialBinaryFunctor<T>());
+    TEST_ALGO_MACRO_B1E1B2E2(find_first_of);
+    TEST_ALGO_MACRO_V1V2(find_first_of);
+    TEST_ALGO_MACRO_B1E1B2E2_VARIAD(find_first_of, TrivialBinaryFunctor<T>());
+    TEST_ALGO_MACRO_V1V2_VARIAD(find_first_of, TrivialBinaryFunctor<T>());
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(search_n, count_type{}, T{});
-  TEST_ALGO_MACRO_V1_VARIAD(search_n, count_type{}, T{});
-  TEST_ALGO_MACRO_B1E1_VARIAD(search_n, count_type{}, T{},
+    TEST_ALGO_MACRO_B1E1_VARIAD(search_n, count_type{}, T{});
+    TEST_ALGO_MACRO_V1_VARIAD(search_n, count_type{}, T{});
+    TEST_ALGO_MACRO_B1E1_VARIAD(search_n, count_type{}, T{},
+                                TrivialBinaryPredicate<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(search_n, count_type{}, T{},
                               TrivialBinaryPredicate<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(search_n, count_type{}, T{},
-                            TrivialBinaryPredicate<T>());
 
-  TEST_ALGO_MACRO_B1E1B2E2(find_end);
-  TEST_ALGO_MACRO_V1V2(find_end);
-  TEST_ALGO_MACRO_B1E1B2E2_VARIAD(find_end, TrivialBinaryFunctor<T>());
-  TEST_ALGO_MACRO_V1V2_VARIAD(find_end, TrivialBinaryFunctor<T>());
-}
+    TEST_ALGO_MACRO_B1E1B2E2(find_end);
+    TEST_ALGO_MACRO_V1V2(find_end);
+    TEST_ALGO_MACRO_B1E1B2E2_VARIAD(find_end, TrivialBinaryFunctor<T>());
+    TEST_ALGO_MACRO_V1V2_VARIAD(find_end, TrivialBinaryFunctor<T>());
+  }
 
-void modifying_seq_ops() {
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(replace_copy, T{}, T{});
-  TEST_ALGO_MACRO_V1V2_VARIAD(replace_copy, T{}, T{});
+  void modifying_seq_ops() {
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(replace_copy, T{}, T{});
+    TEST_ALGO_MACRO_V1V2_VARIAD(replace_copy, T{}, T{});
 
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(replace_copy_if, TrivialUnaryPredicate<T>(),
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(replace_copy_if, TrivialUnaryPredicate<T>(),
+                                  T{});
+    TEST_ALGO_MACRO_V1V2_VARIAD(replace_copy_if, TrivialUnaryPredicate<T>(),
                                 T{});
-  TEST_ALGO_MACRO_V1V2_VARIAD(replace_copy_if, TrivialUnaryPredicate<T>(), T{});
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(replace, T{}, T{});
-  TEST_ALGO_MACRO_V1_VARIAD(replace, T{}, T{});
+    TEST_ALGO_MACRO_B1E1_VARIAD(replace, T{}, T{});
+    TEST_ALGO_MACRO_V1_VARIAD(replace, T{}, T{});
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(replace_if, TrivialUnaryPredicate<T>(), T{});
-  TEST_ALGO_MACRO_V1_VARIAD(replace_if, TrivialUnaryPredicate<T>(), T{});
+    TEST_ALGO_MACRO_B1E1_VARIAD(replace_if, TrivialUnaryPredicate<T>(), T{});
+    TEST_ALGO_MACRO_V1_VARIAD(replace_if, TrivialUnaryPredicate<T>(), T{});
 
-  TEST_ALGO_MACRO_B1E1B2(copy);
-  TEST_ALGO_MACRO_V1V2(copy);
+    TEST_ALGO_MACRO_B1E1B2(copy);
+    TEST_ALGO_MACRO_V1V2(copy);
 
-  TEST_ALGO_MACRO_B1_ARG_B2(copy_n, count_type{});
-  TEST_ALGO_MACRO_V1_ARG_V2(copy_n, count_type{});
+    TEST_ALGO_MACRO_B1_ARG_B2(copy_n, count_type{});
+    TEST_ALGO_MACRO_V1_ARG_V2(copy_n, count_type{});
 
-  TEST_ALGO_MACRO_B1E1B2(copy_backward);
-  TEST_ALGO_MACRO_V1V2(copy_backward);
+    TEST_ALGO_MACRO_B1E1B2(copy_backward);
+    TEST_ALGO_MACRO_V1V2(copy_backward);
 
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(copy_if, TrivialUnaryPredicate<T>());
-  TEST_ALGO_MACRO_V1V2_VARIAD(copy_if, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(copy_if, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_V1V2_VARIAD(copy_if, TrivialUnaryPredicate<T>());
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(fill, T{});
-  TEST_ALGO_MACRO_V1_VARIAD(fill, T{});
+    TEST_ALGO_MACRO_B1E1_VARIAD(fill, T{});
+    TEST_ALGO_MACRO_V1_VARIAD(fill, T{});
 
-  TEST_ALGO_MACRO_B1_VARIAD(fill_n, count_type{}, T{});
-  TEST_ALGO_MACRO_V1_VARIAD(fill_n, count_type{}, T{});
+    TEST_ALGO_MACRO_B1_VARIAD(fill_n, count_type{}, T{});
+    TEST_ALGO_MACRO_V1_VARIAD(fill_n, count_type{}, T{});
 
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(transform, TrivialUnaryFunctor<T>{});
-  TEST_ALGO_MACRO_V1V2_VARIAD(transform, TrivialUnaryFunctor<T>{});
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(transform, TrivialUnaryFunctor<T>{});
+    TEST_ALGO_MACRO_V1V2_VARIAD(transform, TrivialUnaryFunctor<T>{});
 
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(transform, TrivialUnaryFunctor<T>{});
-  TEST_ALGO_MACRO_B1E1B2B3_VARIAD(transform, TrivialBinaryFunctor<T>{});
-  TEST_ALGO_MACRO_V1V2_VARIAD(transform, TrivialUnaryFunctor<T>{});
-  TEST_ALGO_MACRO_V1V2V3_VARIAD(transform, TrivialBinaryFunctor<T>{});
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(transform, TrivialUnaryFunctor<T>{});
+    TEST_ALGO_MACRO_B1E1B2B3_VARIAD(transform, TrivialBinaryFunctor<T>{});
+    TEST_ALGO_MACRO_V1V2_VARIAD(transform, TrivialUnaryFunctor<T>{});
+    TEST_ALGO_MACRO_V1V2V3_VARIAD(transform, TrivialBinaryFunctor<T>{});
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(generate, TrivialGenerator<T>{});
-  TEST_ALGO_MACRO_V1_VARIAD(generate, TrivialGenerator<T>{});
+    TEST_ALGO_MACRO_B1E1_VARIAD(generate, TrivialGenerator<T>{});
+    TEST_ALGO_MACRO_V1_VARIAD(generate, TrivialGenerator<T>{});
 
-  TEST_ALGO_MACRO_B1_VARIAD(generate_n, count_type{}, TrivialGenerator<T>{});
-  TEST_ALGO_MACRO_V1_VARIAD(generate_n, count_type{}, TrivialGenerator<T>{});
+    TEST_ALGO_MACRO_B1_VARIAD(generate_n, count_type{}, TrivialGenerator<T>{});
+    TEST_ALGO_MACRO_V1_VARIAD(generate_n, count_type{}, TrivialGenerator<T>{});
 
-  TEST_ALGO_MACRO_B1E1B2(reverse_copy);
-  TEST_ALGO_MACRO_V1V2(reverse_copy);
+    TEST_ALGO_MACRO_B1E1B2(reverse_copy);
+    TEST_ALGO_MACRO_V1V2(reverse_copy);
 
-  TEST_ALGO_MACRO_B1E1(reverse);
-  TEST_ALGO_MACRO_V1(reverse);
+    TEST_ALGO_MACRO_B1E1(reverse);
+    TEST_ALGO_MACRO_V1(reverse);
 
-  TEST_ALGO_MACRO_B1E1B2(move);
-  TEST_ALGO_MACRO_V1V2(move);
+    TEST_ALGO_MACRO_B1E1B2(move);
+    TEST_ALGO_MACRO_V1V2(move);
 
-  TEST_ALGO_MACRO_B1E1E2(move_backward);
-  TEST_ALGO_MACRO_V1V2(move_backward);
+    TEST_ALGO_MACRO_B1E1E2(move_backward);
+    TEST_ALGO_MACRO_V1V2(move_backward);
 
-  TEST_ALGO_MACRO_B1E1B2(swap_ranges);
-  TEST_ALGO_MACRO_V1V2(swap_ranges);
+    TEST_ALGO_MACRO_B1E1B2(swap_ranges);
+    TEST_ALGO_MACRO_V1V2(swap_ranges);
 
-  TEST_ALGO_MACRO_B1E1(unique);
-  TEST_ALGO_MACRO_V1(unique);
-  TEST_ALGO_MACRO_B1E1_VARIAD(unique, TrivialBinaryPredicate<T>{});
-  TEST_ALGO_MACRO_V1_VARIAD(unique, TrivialBinaryPredicate<T>{});
+    TEST_ALGO_MACRO_B1E1(unique);
+    TEST_ALGO_MACRO_V1(unique);
+    TEST_ALGO_MACRO_B1E1_VARIAD(unique, TrivialBinaryPredicate<T>{});
+    TEST_ALGO_MACRO_V1_VARIAD(unique, TrivialBinaryPredicate<T>{});
 
-  TEST_ALGO_MACRO_B1E1B2(unique_copy);
-  TEST_ALGO_MACRO_V1V2(unique_copy);
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(unique_copy, TrivialBinaryPredicate<T>{});
-  TEST_ALGO_MACRO_V1V2_VARIAD(unique_copy, TrivialBinaryPredicate<T>{});
+    TEST_ALGO_MACRO_B1E1B2(unique_copy);
+    TEST_ALGO_MACRO_V1V2(unique_copy);
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(unique_copy, TrivialBinaryPredicate<T>{});
+    TEST_ALGO_MACRO_V1V2_VARIAD(unique_copy, TrivialBinaryPredicate<T>{});
 
-  TEST_ALGO_MACRO_B1E1E2(rotate);
-  TEST_ALGO_MACRO_V1_VARIAD(rotate, count_type{});
+    TEST_ALGO_MACRO_B1E1E2(rotate);
+    TEST_ALGO_MACRO_V1_VARIAD(rotate, count_type{});
 
-  TEST_ALGO_MACRO_B1E1E1B2(rotate_copy);
-  TEST_ALGO_MACRO_V1_ARG_V2(rotate_copy, count_type{});
+    TEST_ALGO_MACRO_B1E1E1B2(rotate_copy);
+    TEST_ALGO_MACRO_V1_ARG_V2(rotate_copy, count_type{});
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(remove_if, TrivialUnaryPredicate<T>{});
-  TEST_ALGO_MACRO_V1_VARIAD(remove_if, TrivialUnaryPredicate<T>{});
+    TEST_ALGO_MACRO_B1E1_VARIAD(remove_if, TrivialUnaryPredicate<T>{});
+    TEST_ALGO_MACRO_V1_VARIAD(remove_if, TrivialUnaryPredicate<T>{});
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(remove, T{});
-  TEST_ALGO_MACRO_V1_VARIAD(remove, T{});
+    TEST_ALGO_MACRO_B1E1_VARIAD(remove, T{});
+    TEST_ALGO_MACRO_V1_VARIAD(remove, T{});
 
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(remove_copy, T{});
-  TEST_ALGO_MACRO_V1V2_VARIAD(remove_copy, T{});
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(remove_copy, T{});
+    TEST_ALGO_MACRO_V1V2_VARIAD(remove_copy, T{});
 
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(remove_copy_if, TrivialUnaryPredicate<T>());
-  TEST_ALGO_MACRO_V1V2_VARIAD(remove_copy_if, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(remove_copy_if, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_V1V2_VARIAD(remove_copy_if, TrivialUnaryPredicate<T>());
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(shift_left, count_type{});
-  TEST_ALGO_MACRO_V1_VARIAD(shift_left, count_type{});
+    TEST_ALGO_MACRO_B1E1_VARIAD(shift_left, count_type{});
+    TEST_ALGO_MACRO_V1_VARIAD(shift_left, count_type{});
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(shift_right, count_type{});
-  TEST_ALGO_MACRO_V1_VARIAD(shift_right, count_type{});
-}
+    TEST_ALGO_MACRO_B1E1_VARIAD(shift_right, count_type{});
+    TEST_ALGO_MACRO_V1_VARIAD(shift_right, count_type{});
+  }
 
-void sorting_ops() {
-  TEST_ALGO_MACRO_B1E1(is_sorted_until);
-  TEST_ALGO_MACRO_V1(is_sorted_until);
+  void sorting_ops() {
+    TEST_ALGO_MACRO_B1E1(is_sorted_until);
+    TEST_ALGO_MACRO_V1(is_sorted_until);
 
 #ifndef KOKKOS_ENABLE_OPENMPTARGET
-  TEST_ALGO_MACRO_B1E1_VARIAD(is_sorted_until, TrivialComparator<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(is_sorted_until, TrivialComparator<T>());
+    TEST_ALGO_MACRO_B1E1_VARIAD(is_sorted_until, TrivialComparator<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(is_sorted_until, TrivialComparator<T>());
 #endif
 
-  TEST_ALGO_MACRO_B1E1(is_sorted);
-  TEST_ALGO_MACRO_V1(is_sorted);
+    TEST_ALGO_MACRO_B1E1(is_sorted);
+    TEST_ALGO_MACRO_V1(is_sorted);
 
 #ifndef KOKKOS_ENABLE_OPENMPTARGET
-  TEST_ALGO_MACRO_B1E1_VARIAD(is_sorted, TrivialComparator<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(is_sorted, TrivialComparator<T>());
+    TEST_ALGO_MACRO_B1E1_VARIAD(is_sorted, TrivialComparator<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(is_sorted, TrivialComparator<T>());
 #endif
-}
+  }
 
-void minmax_ops() {
-  TEST_ALGO_MACRO_B1E1(min_element);
-  TEST_ALGO_MACRO_V1(min_element);
-  TEST_ALGO_MACRO_B1E1(max_element);
-  TEST_ALGO_MACRO_V1(max_element);
-  TEST_ALGO_MACRO_B1E1(minmax_element);
-  TEST_ALGO_MACRO_V1(minmax_element);
+  void minmax_ops() {
+    TEST_ALGO_MACRO_B1E1(min_element);
+    TEST_ALGO_MACRO_V1(min_element);
+    TEST_ALGO_MACRO_B1E1(max_element);
+    TEST_ALGO_MACRO_V1(max_element);
+    TEST_ALGO_MACRO_B1E1(minmax_element);
+    TEST_ALGO_MACRO_V1(minmax_element);
 
 #ifndef KOKKOS_ENABLE_OPENMPTARGET
-  TEST_ALGO_MACRO_B1E1_VARIAD(min_element, TrivialComparator<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(min_element, TrivialComparator<T>());
-  TEST_ALGO_MACRO_B1E1_VARIAD(max_element, TrivialComparator<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(max_element, TrivialComparator<T>());
-  TEST_ALGO_MACRO_B1E1_VARIAD(minmax_element, TrivialComparator<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(minmax_element, TrivialComparator<T>());
+    TEST_ALGO_MACRO_B1E1_VARIAD(min_element, TrivialComparator<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(min_element, TrivialComparator<T>());
+    TEST_ALGO_MACRO_B1E1_VARIAD(max_element, TrivialComparator<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(max_element, TrivialComparator<T>());
+    TEST_ALGO_MACRO_B1E1_VARIAD(minmax_element, TrivialComparator<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(minmax_element, TrivialComparator<T>());
 #endif
-}
+  }
 
-void partitionig_ops() {
-  TEST_ALGO_MACRO_B1E1_VARIAD(is_partitioned, TrivialUnaryPredicate<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(is_partitioned, TrivialUnaryPredicate<T>());
+  void partitionig_ops() {
+    TEST_ALGO_MACRO_B1E1_VARIAD(is_partitioned, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(is_partitioned, TrivialUnaryPredicate<T>());
 
-  TEST_ALGO_MACRO_B1E1B2B3_VARIAD(partition_copy, TrivialUnaryPredicate<T>());
-  TEST_ALGO_MACRO_V1V2V3_VARIAD(partition_copy, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_B1E1B2B3_VARIAD(partition_copy, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_V1V2V3_VARIAD(partition_copy, TrivialUnaryPredicate<T>());
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(partition_point, TrivialUnaryPredicate<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(partition_point, TrivialUnaryPredicate<T>());
-}
+    TEST_ALGO_MACRO_B1E1_VARIAD(partition_point, TrivialUnaryPredicate<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(partition_point, TrivialUnaryPredicate<T>());
+  }
 
-void numeric() {
-  TEST_ALGO_MACRO_B1E1B2(adjacent_difference);
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(adjacent_difference, TrivialBinaryFunctor<T>());
-  TEST_ALGO_MACRO_V1V2(adjacent_difference);
-  TEST_ALGO_MACRO_V1V2_VARIAD(adjacent_difference, TrivialBinaryFunctor<T>());
+  void numeric() {
+    TEST_ALGO_MACRO_B1E1B2(adjacent_difference);
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(adjacent_difference,
+                                  TrivialBinaryFunctor<T>());
+    TEST_ALGO_MACRO_V1V2(adjacent_difference);
+    TEST_ALGO_MACRO_V1V2_VARIAD(adjacent_difference, TrivialBinaryFunctor<T>());
 
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(exclusive_scan, T{});
-  TEST_ALGO_MACRO_V1V2_VARIAD(exclusive_scan, T{});
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(exclusive_scan, T{});
+    TEST_ALGO_MACRO_V1V2_VARIAD(exclusive_scan, T{});
 #ifndef KOKKOS_ENABLE_OPENMPTARGET
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(exclusive_scan, T{}, TrivialBinaryFunctor<T>());
-  TEST_ALGO_MACRO_V1V2_VARIAD(exclusive_scan, T{}, TrivialBinaryFunctor<T>());
-
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_exclusive_scan, T{},
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(exclusive_scan, T{},
+                                  TrivialBinaryFunctor<T>());
+    TEST_ALGO_MACRO_V1V2_VARIAD(exclusive_scan, T{}, TrivialBinaryFunctor<T>());
+
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_exclusive_scan, T{},
+                                  TrivialBinaryFunctor<T>(),
+                                  TrivialUnaryFunctor<T>());
+    TEST_ALGO_MACRO_V1V2_VARIAD(transform_exclusive_scan, T{},
                                 TrivialBinaryFunctor<T>(),
                                 TrivialUnaryFunctor<T>());
-  TEST_ALGO_MACRO_V1V2_VARIAD(transform_exclusive_scan, T{},
-                              TrivialBinaryFunctor<T>(),
-                              TrivialUnaryFunctor<T>());
 #endif
 
-  TEST_ALGO_MACRO_B1E1B2(inclusive_scan);
-  TEST_ALGO_MACRO_V1V2(inclusive_scan);
+    TEST_ALGO_MACRO_B1E1B2(inclusive_scan);
+    TEST_ALGO_MACRO_V1V2(inclusive_scan);
 #ifndef KOKKOS_ENABLE_OPENMPTARGET
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(inclusive_scan, TrivialBinaryFunctor<T>());
-  TEST_ALGO_MACRO_V1V2_VARIAD(inclusive_scan, TrivialBinaryFunctor<T>());
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(inclusive_scan, TrivialBinaryFunctor<T>(), T{});
-  TEST_ALGO_MACRO_V1V2_VARIAD(inclusive_scan, TrivialBinaryFunctor<T>(), T{});
-
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_inclusive_scan,
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(inclusive_scan, TrivialBinaryFunctor<T>());
+    TEST_ALGO_MACRO_V1V2_VARIAD(inclusive_scan, TrivialBinaryFunctor<T>());
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(inclusive_scan, TrivialBinaryFunctor<T>(),
+                                  T{});
+    TEST_ALGO_MACRO_V1V2_VARIAD(inclusive_scan, TrivialBinaryFunctor<T>(), T{});
+
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_inclusive_scan,
+                                  TrivialBinaryFunctor<T>(),
+                                  TrivialUnaryFunctor<T>());
+    TEST_ALGO_MACRO_V1V2_VARIAD(transform_inclusive_scan,
                                 TrivialBinaryFunctor<T>(),
                                 TrivialUnaryFunctor<T>());
-  TEST_ALGO_MACRO_V1V2_VARIAD(transform_inclusive_scan,
-                              TrivialBinaryFunctor<T>(),
-                              TrivialUnaryFunctor<T>());
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_inclusive_scan,
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_inclusive_scan,
+                                  TrivialBinaryFunctor<T>(),
+                                  TrivialUnaryFunctor<T>(), T{});
+    TEST_ALGO_MACRO_V1V2_VARIAD(transform_inclusive_scan,
                                 TrivialBinaryFunctor<T>(),
                                 TrivialUnaryFunctor<T>(), T{});
-  TEST_ALGO_MACRO_V1V2_VARIAD(transform_inclusive_scan,
-                              TrivialBinaryFunctor<T>(),
-                              TrivialUnaryFunctor<T>(), T{});
 #endif
 
 #ifndef KOKKOS_ENABLE_OPENMPTARGET
-  TEST_ALGO_MACRO_B1E1(reduce);
-  TEST_ALGO_MACRO_V1(reduce);
-  TEST_ALGO_MACRO_B1E1_VARIAD(reduce, T{});
-  TEST_ALGO_MACRO_V1_VARIAD(reduce, T{});
-  TEST_ALGO_MACRO_B1E1_VARIAD(reduce, T{}, TrivialReduceJoinFunctor<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(reduce, T{}, TrivialReduceJoinFunctor<T>());
-
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_reduce, T{});
-  TEST_ALGO_MACRO_V1V2_VARIAD(transform_reduce, T{});
-  TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_reduce, T{},
+    TEST_ALGO_MACRO_B1E1(reduce);
+    TEST_ALGO_MACRO_V1(reduce);
+    TEST_ALGO_MACRO_B1E1_VARIAD(reduce, T{});
+    TEST_ALGO_MACRO_V1_VARIAD(reduce, T{});
+    TEST_ALGO_MACRO_B1E1_VARIAD(reduce, T{}, TrivialReduceJoinFunctor<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(reduce, T{}, TrivialReduceJoinFunctor<T>());
+
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_reduce, T{});
+    TEST_ALGO_MACRO_V1V2_VARIAD(transform_reduce, T{});
+    TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_reduce, T{},
+                                  TrivialReduceJoinFunctor<T>(),
+                                  TrivialTransformReduceBinaryTransformer<T>());
+    TEST_ALGO_MACRO_V1V2_VARIAD(transform_reduce, T{},
                                 TrivialReduceJoinFunctor<T>(),
                                 TrivialTransformReduceBinaryTransformer<T>());
-  TEST_ALGO_MACRO_V1V2_VARIAD(transform_reduce, T{},
-                              TrivialReduceJoinFunctor<T>(),
-                              TrivialTransformReduceBinaryTransformer<T>());
 
-  TEST_ALGO_MACRO_B1E1_VARIAD(transform_reduce, T{},
+    TEST_ALGO_MACRO_B1E1_VARIAD(transform_reduce, T{},
+                                TrivialReduceJoinFunctor<T>(),
+                                TrivialTransformReduceUnaryTransformer<T>());
+    TEST_ALGO_MACRO_V1_VARIAD(transform_reduce, T{},
                               TrivialReduceJoinFunctor<T>(),
                               TrivialTransformReduceUnaryTransformer<T>());
-  TEST_ALGO_MACRO_V1_VARIAD(transform_reduce, T{},
-                            TrivialReduceJoinFunctor<T>(),
-                            TrivialTransformReduceUnaryTransformer<T>());
 #endif
-}
+  }
+};
 
 }  // namespace compileonly
 }  // namespace stdalgos
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsConstraints.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsConstraints.cpp
index 3eb13c98c4577c315ac2d7232b9b69969f541c1a..5d55199801217f0a43ce8d53e94e90d11c8ff445 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsConstraints.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsConstraints.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 #include <Kokkos_Core.hpp>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCopyIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCopyIf.cpp
index d5758e2438bac69d146068b36b110be72b5d263a..e21d50f69b9e001685aa62e45f023e6b2ac62782 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCopyIf.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCopyIf.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCount.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCount.cpp
index 4c92a990595bb6a4ef5dced69531fa4f22da49d2..9423d2e15a46fe550282bf2b2106037610c18b6c 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCount.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCount.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <algorithm>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsEqual.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsEqual.cpp
index e5b1e8514db8b175fa7b1c4ff078c5516099680c..ef0209b345920121c2c94c5f43aa715f07b22d4c 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsEqual.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsEqual.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <algorithm>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsExclusiveScan.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsExclusiveScan.cpp
index e470ee86204bde1098d1064dd0713090dbc7a907..4969541a023bed06076120ff09e6187048041bdb 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsExclusiveScan.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsExclusiveScan.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFind.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFind.cpp
index 35b232e94fb9baf6ce832c26e5815cf0b8fd40e9..3b8b5e85af408a023e1ad0033288270496646d3f 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFind.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFind.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <iterator>
@@ -179,6 +151,12 @@ void run_all_scenarios() {
 }
 
 TEST(std_algorithms_find_test, test) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) {
+    GTEST_SKIP() << "FIXME wrong result";
+  }
+#endif
   run_all_scenarios<DynamicTag, double>();
   run_all_scenarios<StridedTwoTag, int>();
   run_all_scenarios<StridedThreeTag, unsigned>();
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindEnd.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindEnd.cpp
index 2a6d271856a978366aa8c052583219fe3b22fac3..ddc4bc1ba676e62b6fc04b07b092b1a39a4a9d49 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindEnd.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindEnd.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
@@ -376,6 +348,12 @@ void run_all_scenarios() {
 }
 
 TEST(std_algorithms_non_mod_seq_ops, find_end) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) {
+    GTEST_SKIP() << "FIXME wrong result";
+  }
+#endif
   run_all_scenarios<DynamicTag, int>();
   run_all_scenarios<StridedThreeTag, int>();
 }
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindFirstOf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindFirstOf.cpp
index 84892bc37645407a4e0c9895782f3a51c65354f0..c2f7a2fdb8f8287040013a375d7ec52fe9202e1b 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindFirstOf.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindFirstOf.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
@@ -292,6 +264,12 @@ void run_all_scenarios() {
 }
 
 TEST(std_algorithms_non_mod_seq_ops, find_first_of) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) {
+    GTEST_SKIP() << "FIXME wrong result";
+  }
+#endif
   run_all_scenarios<DynamicTag, int>();
   run_all_scenarios<StridedThreeTag, int>();
 }
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsForEach.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsForEach.cpp
index 79badc7c4f75b1dcd3f52f3abf87e6615ee198e3..83b44f01aa7d825acc1ec72c0945cbedd32a91a8 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsForEach.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsForEach.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <algorithm>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsHelperFunctors.hpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsHelperFunctors.hpp
index 882a6012ebb27afd9bf2e81991e33ae3776168cb..a2a31f1f65a11b78f41adfc491359c034c183cff 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsHelperFunctors.hpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsHelperFunctors.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TEST_STD_ALGOS_HELPERS_FUNCTORS_HPP
 #define KOKKOS_ALGORITHMS_UNITTESTS_TEST_STD_ALGOS_HELPERS_FUNCTORS_HPP
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsInclusiveScan.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsInclusiveScan.cpp
index 173fbed660f4b50d8ef8f7968fb3e20ef9f1f560..510f1d195a19b412abfb4baa522f416e5ca6f796 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsInclusiveScan.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsInclusiveScan.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSorted.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSorted.cpp
index b0df935392f8bd39ea49fb7d2614fc3f75cae10d..f31d49e06b4ad297d2de370b08bb6967a292d90d 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSorted.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSorted.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSortedUntil.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSortedUntil.cpp
index 7f0071e248b952db0e3f8630a45cb8bf7d16a640..ce8669a84f237ec519a310c657e5d14128ca1ab4 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSortedUntil.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSortedUntil.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
@@ -213,6 +185,12 @@ void run_is_sorted_until_all_scenarios() {
 }
 
 TEST(std_algorithms_sorting_ops_test, is_sorted_until) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) {
+    GTEST_SKIP() << "FIXME wrong result";
+  }
+#endif
   run_is_sorted_until_all_scenarios<DynamicTag, double>();
   run_is_sorted_until_all_scenarios<StridedTwoTag, double>();
   run_is_sorted_until_all_scenarios<StridedThreeTag, double>();
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsLexicographicalCompare.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsLexicographicalCompare.cpp
index 8bfa51b4f54b6413855e3bac527ec0d90e9e4032..2acd4934accf621a01e820c9b7c398dee91faf13 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsLexicographicalCompare.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsLexicographicalCompare.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <algorithm>
@@ -168,6 +140,12 @@ void run_all_scenarios() {
 }
 
 TEST(std_algorithms_lexicographical_compare_test, test) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) {
+    GTEST_SKIP() << "FIXME wrong result";
+  }
+#endif
 // FIXME: should this disable only custom comparator tests?
 #if !defined KOKKOS_ENABLE_OPENMPTARGET
   run_all_scenarios<DynamicTag, double>();
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMinMaxElementOps.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMinMaxElementOps.cpp
index 56819de8c100f88958d9aafaa43b24017801fffb..f8634ffafe2818b4138927e812e326c5cd9e172f 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMinMaxElementOps.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMinMaxElementOps.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMismatch.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMismatch.cpp
index 4bc4e018b498eaffa9d9db88db8a84e82e9f254f..bb4b6fb2a2ac1ecbb078962012d17295c3a421c4 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMismatch.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMismatch.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <iterator>
@@ -217,6 +189,12 @@ void run_all_scenarios() {
 }
 
 TEST(std_algorithms_mismatch_test, test) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) {
+    GTEST_SKIP() << "FIXME wrong result";
+  }
+#endif
   run_all_scenarios<DynamicTag, double>();
   run_all_scenarios<StridedThreeTag, int>();
 }
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModOps.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModOps.cpp
index 8d4f604037d302327961c82b2020ef99bacef24e..4fce044bcf76a4cbe380196f00f50e50ac55f87d 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModOps.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModOps.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModSeqOps.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModSeqOps.cpp
index 1e3960c5e690dd7b7b13cb1b7946d847d0912438..6b806d7bc5c05bc4250389ee43f4a6cb81e06c3c 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModSeqOps.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModSeqOps.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMoveBackward.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMoveBackward.cpp
index 002d35466127470ff78616de34497da2e1ac3c98..635714eb5451f52bbbcfbe5867b555ee826a4db3 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMoveBackward.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMoveBackward.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsNumerics.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsNumerics.cpp
index 0ea5fcc99ad319eb337cc992c75a829660801c37..288a67c36956d7c939210bd70d6fb30bf1d9d46b 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsNumerics.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsNumerics.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitionCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitionCopy.cpp
index a461f275154e06b4f39c414787309f464a3a4529..0399e9eee4d42290299e254a0cbd40ba941efc1e 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitionCopy.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitionCopy.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitioningOps.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitioningOps.cpp
index 0d46151559031937fac59bf9e18effac9a4c6604..1bfb536c2c750d582116e840d9a663bfbee8fff3 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitioningOps.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitioningOps.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 
@@ -176,6 +148,12 @@ struct std_algorithms_partitioning_test : public std_algorithms_test {
 };
 
 TEST_F(std_algorithms_partitioning_test, is_partitioned_trivial) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) {
+    GTEST_SKIP() << "FIXME wrong result";
+  }
+#endif
   IsNegativeFunctor<value_type> p;
   const auto result1 = KE::is_partitioned(exespace(), KE::cbegin(m_static_view),
                                           KE::cbegin(m_static_view), p);
@@ -191,6 +169,12 @@ TEST_F(std_algorithms_partitioning_test, is_partitioned_trivial) {
 }
 
 TEST_F(std_algorithms_partitioning_test, is_partitioned_accepting_iterators) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) {
+    GTEST_SKIP() << "FIXME wrong result";
+  }
+#endif
   const IsNegativeFunctor<value_type> p;
 
   for (int id = 0; id < FixtureViews::Count; ++id) {
@@ -212,6 +196,12 @@ TEST_F(std_algorithms_partitioning_test, is_partitioned_accepting_iterators) {
 }
 
 TEST_F(std_algorithms_partitioning_test, is_partitioned_accepting_view) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) {
+    GTEST_SKIP() << "FIXME wrong result";
+  }
+#endif
   const IsNegativeFunctor<value_type> p;
 
   for (int id = 0; id < FixtureViews::Count; ++id) {
@@ -230,6 +220,12 @@ TEST_F(std_algorithms_partitioning_test, is_partitioned_accepting_view) {
 }
 
 TEST_F(std_algorithms_partitioning_test, partition_point) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) {
+    GTEST_SKIP() << "FIXME wrong result";
+  }
+#endif
   const IsNegativeFunctor<value_type> p;
 
   for (int id = 0; id < FixtureViews::Count; ++id) {
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemove.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemove.cpp
index 8f345f044e437ca65ab9938f7da58423fe9e0ab4..8832d71f9537163d4bb5697888202ee98f5504e3 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemove.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemove.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopy.cpp
index bb7d0b52bd387d4d3e3237a63536f77ecde1f153..949f8f60c938cfe315ea32ea4f04941551a2ac77 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopy.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopy.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopyIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopyIf.cpp
index b209b88ea968cb672f76f1827742aa9bac22f415..9dc1e4a7e164299693f83407b0736cdcd4e2909d 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopyIf.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopyIf.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveIf.cpp
index f1f232369b87f8757292d3d8c54fa55a700eb92d..e9d15f29d88415c03c9d66866375fa781e371ecb 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveIf.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveIf.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplace.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplace.cpp
index f044d975a7ce47402b6a4bb92f94158e4a86d4e9..b226de5535fee97c9f1679407a27c02fc06f5f52 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplace.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplace.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopy.cpp
index 682622cc13cd97e53e4a710c17d1cde89cc695ea..16b181fdd220a026ad5e62646e2e6af7e9e6cab5 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopy.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopy.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopyIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopyIf.cpp
index c2ba66e920da8dd61a091fe3d842427c352a2ce7..a402e30ad9c02066ef2a7f7e263bc430fc709512 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopyIf.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopyIf.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceIf.cpp
index 7237e29555afbda7e595cdfbb7f8750428942c5d..f481144e1ce36a4884a0b83f295681c8ed27b29b 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceIf.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceIf.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReverse.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReverse.cpp
index f8c81dc105a8986791e79316f3b36fc5bca92c35..7d16e54029d35885bec3e71108d463812aee57e7 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReverse.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReverse.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotate.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotate.cpp
index bbf273970efe23d61f960c963369740ba91e5890..a5a6f99bac36f2f1e30f44831bbfab47a1a61a5c 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotate.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotate.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotateCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotateCopy.cpp
index 2012fde00860636d084cf096471589eae8a25751..27451a1d04953384b488b06ea0086db343f088a5 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotateCopy.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotateCopy.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch.cpp
index e57385a8be6d17db10178f343bfe7026d199633b..ab4bf50713633a81b98d5745f054225644200cc6 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
@@ -353,6 +325,12 @@ void run_all_scenarios() {
 }
 
 TEST(std_algorithms_non_mod_seq_ops, search) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) {
+    GTEST_SKIP() << "FIXME wrong result";
+  }
+#endif
   run_all_scenarios<DynamicTag, int>();
   run_all_scenarios<StridedThreeTag, int>();
 }
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch_n.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch_n.cpp
index 31446046a597d2593fa20e106975ca06d141abd2..a6fe9c1e896c5f92055dfed6230dea00999c3dd7 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch_n.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch_n.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
@@ -325,6 +297,12 @@ void run_all_scenarios() {
 }
 
 TEST(std_algorithms_non_mod_seq_ops, search_n) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) {
+    GTEST_SKIP() << "FIXME wrong result";
+  }
+#endif
   run_all_scenarios<DynamicTag, int>();
   run_all_scenarios<StridedThreeTag, int>();
 }
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftLeft.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftLeft.cpp
index 0c97f255e9cc8552757652e2d40e5f45f921aaeb..8e4ced963584b1afc7650bcbd0a5241902f3f212 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftLeft.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftLeft.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftRight.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftRight.cpp
index d8aa350f1dd822cf8cd7a6de7ee5d879757ca270..a1614be027b474537199975052965929ab3016af 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftRight.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftRight.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformExclusiveScan.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformExclusiveScan.cpp
index e415eff06cff08a3bacf3e5c02e3f0564b83f4cb..70c04dbafa2979938091dd8a8268715c9601d1c1 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformExclusiveScan.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformExclusiveScan.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformInclusiveScan.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformInclusiveScan.cpp
index 21ce01fb10428cf16af5c7576c7503fba6e699a1..80ff8132519b22b56b24f8e26b96a525f6495364 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformInclusiveScan.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformInclusiveScan.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformUnaryOp.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformUnaryOp.cpp
index 35c293adcfff0947910ef09b633c15fbb9bb1bc3..dab81b8f1e3bb536a3635bde98b072909a1e31cc 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformUnaryOp.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformUnaryOp.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUnique.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUnique.cpp
index 88dd4d259926c5f078188d2974c920c57249f508..a810d31d820266294a9cdf57121d7606c9588d07 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUnique.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUnique.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUniqueCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUniqueCopy.cpp
index fdede951701de39c0e55635667b90688e8fb867a..f609d8517e642fa5b1a2cff420475468e0a1099f 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUniqueCopy.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUniqueCopy.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestStdAlgorithmsCommon.hpp>
 #include <utility>
diff --git a/packages/kokkos/algorithms/unit_tests/TestStdReducers.cpp b/packages/kokkos/algorithms/unit_tests/TestStdReducers.cpp
index a88860749c8a8b8ff41a2b62b09ca596ef96aabb..3847e1e6a3663c0aca1418638dd111e3e787fea3 100644
--- a/packages/kokkos/algorithms/unit_tests/TestStdReducers.cpp
+++ b/packages/kokkos/algorithms/unit_tests/TestStdReducers.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <gtest/gtest.h>
diff --git a/packages/kokkos/algorithms/unit_tests/UnitTestMain.cpp b/packages/kokkos/algorithms/unit_tests/UnitTestMain.cpp
index e245aad35fc33a595a16f711dbd4a63a0c7f8948..11a1cb717a3414b42aec8cda20e13be5ab99ce09 100644
--- a/packages/kokkos/algorithms/unit_tests/UnitTestMain.cpp
+++ b/packages/kokkos/algorithms/unit_tests/UnitTestMain.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 #include <Kokkos_Core.hpp>
diff --git a/packages/kokkos/appveyor.yml b/packages/kokkos/appveyor.yml
index e63fec718ae74e3c935de791e2ce099ab12ccca8..ceb33bf4410f44fcb4be98d9c029122a7168df5a 100644
--- a/packages/kokkos/appveyor.yml
+++ b/packages/kokkos/appveyor.yml
@@ -5,6 +5,6 @@ build_script:
 - cmd: >-
     mkdir build &&
     cd build &&
-    cmake c:\projects\source -DKokkos_ENABLE_TESTS=ON -DCMAKE_CXX_FLAGS="/W0 /EHsc" -DKokkos_ENABLE_DEPRECATED_CODE_3=ON -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF -DKokkos_ARCH_NATIVE=ON &&
+    cmake c:\projects\source -DKokkos_ENABLE_TESTS=ON -DKokkos_ENABLE_BENCHMARKS=ON -DCMAKE_CXX_FLAGS="/W0 /EHsc" -DKokkos_ENABLE_DEPRECATED_CODE_4=ON -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF &&
     cmake --build . --target install &&
     ctest -C Debug --output-on-failure
diff --git a/packages/kokkos/benchmarks/atomic/main.cpp b/packages/kokkos/benchmarks/atomic/main.cpp
index 6e32c6fe641a1c6f2c78c3bc6a5755149aa3ade2..af1b96f27dd169f6615178a3b92591995952d8a8 100644
--- a/packages/kokkos/benchmarks/atomic/main.cpp
+++ b/packages/kokkos/benchmarks/atomic/main.cpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #include <Kokkos_Core.hpp>
 #include <Kokkos_Timer.hpp>
 #include <Kokkos_Random.hpp>
diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench.hpp b/packages/kokkos/benchmarks/bytes_and_flops/bench.hpp
index be190e868ea06ac60f57a30ca29cb9aa71e6f97f..2589fd7309b29244c764b61b0335f3a0f2d756f9 100644
--- a/packages/kokkos/benchmarks/bytes_and_flops/bench.hpp
+++ b/packages/kokkos/benchmarks/bytes_and_flops/bench.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <Kokkos_Timer.hpp>
diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench_double.cpp b/packages/kokkos/benchmarks/bytes_and_flops/bench_double.cpp
index 73ad21b05cee90d8e55a0a1aa8af4cf5ef42812f..f955c996660a9ccefa3b0084f12ff140d3bfcebd 100644
--- a/packages/kokkos/benchmarks/bytes_and_flops/bench_double.cpp
+++ b/packages/kokkos/benchmarks/bytes_and_flops/bench_double.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <bench.hpp>
 
diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench_float.cpp b/packages/kokkos/benchmarks/bytes_and_flops/bench_float.cpp
index 3964df3fa8e15fd9274b208de40dfc085632a3b2..137ff67d40408f0ff19ef7ed174adf1b7cbd0194 100644
--- a/packages/kokkos/benchmarks/bytes_and_flops/bench_float.cpp
+++ b/packages/kokkos/benchmarks/bytes_and_flops/bench_float.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <bench.hpp>
 
diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench_int32_t.cpp b/packages/kokkos/benchmarks/bytes_and_flops/bench_int32_t.cpp
index d63c3080775c5c9d5bc39e3416fc783a3270749d..29ccec014149592652247e33bf9e864a50f67bb3 100644
--- a/packages/kokkos/benchmarks/bytes_and_flops/bench_int32_t.cpp
+++ b/packages/kokkos/benchmarks/bytes_and_flops/bench_int32_t.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <bench.hpp>
 
diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench_int64_t.cpp b/packages/kokkos/benchmarks/bytes_and_flops/bench_int64_t.cpp
index 51a31b16f0a88187e725fced27ff05baa367d318..c153d5eff3974fb63b84121346ea20ff96ae9361 100644
--- a/packages/kokkos/benchmarks/bytes_and_flops/bench_int64_t.cpp
+++ b/packages/kokkos/benchmarks/bytes_and_flops/bench_int64_t.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <bench.hpp>
 
diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench_stride.hpp b/packages/kokkos/benchmarks/bytes_and_flops/bench_stride.hpp
index c29f2a18c34bfc66ae04762e123fcb0f0b6d0931..b63d486fc9e40a9b327be6316cf0e44387adee64 100644
--- a/packages/kokkos/benchmarks/bytes_and_flops/bench_stride.hpp
+++ b/packages/kokkos/benchmarks/bytes_and_flops/bench_stride.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #define UNROLL 1
 #include <bench_unroll_stride.hpp>
diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench_unroll_stride.hpp b/packages/kokkos/benchmarks/bytes_and_flops/bench_unroll_stride.hpp
index 58bf17b0bb8dc0f5a71b469d5c40aa82f4195c31..0f7a298c1bb66758e991727b1f021247a7b133ec 100644
--- a/packages/kokkos/benchmarks/bytes_and_flops/bench_unroll_stride.hpp
+++ b/packages/kokkos/benchmarks/bytes_and_flops/bench_unroll_stride.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 template <class Scalar>
 struct Run<Scalar, UNROLL, STRIDE> {
@@ -66,25 +38,25 @@ struct Run<Scalar, UNROLL, STRIDE> {
                     Scalar a1      = A(n, i, 0);
                     const Scalar b = B(n, i, 0);
 #if (UNROLL > 1)
-                    Scalar a2 = a1 * 1.3;
+                    Scalar a2 = a1 * static_cast<Scalar>(1.3);
 #endif
 #if (UNROLL > 2)
-                    Scalar a3 = a2 * 1.1;
+                    Scalar a3 = a2 * static_cast<Scalar>(1.1);
 #endif
 #if (UNROLL > 3)
-                    Scalar a4 = a3 * 1.1;
+                    Scalar a4 = a3 * static_cast<Scalar>(1.1);
 #endif
 #if (UNROLL > 4)
-                    Scalar a5 = a4 * 1.3;
+                    Scalar a5 = a4 * static_cast<Scalar>(1.3);
 #endif
 #if (UNROLL > 5)
-                    Scalar a6 = a5 * 1.1;
+                    Scalar a6 = a5 * static_cast<Scalar>(1.1);
 #endif
 #if (UNROLL > 6)
-                    Scalar a7 = a6 * 1.1;
+                    Scalar a7 = a6 * static_cast<Scalar>(1.1);
 #endif
 #if (UNROLL > 7)
-                    Scalar a8 = a7 * 1.1;
+                    Scalar a8 = a7 * static_cast<Scalar>(1.1);
 #endif
 
                     for (int f = 0; f < F; f++) {
diff --git a/packages/kokkos/benchmarks/bytes_and_flops/main.cpp b/packages/kokkos/benchmarks/bytes_and_flops/main.cpp
index b26b8ef5ed83fa4a8fae302a7664013e049e69bc..20077757d1ffa4557bf404ee8be4976edcf79cf8 100644
--- a/packages/kokkos/benchmarks/bytes_and_flops/main.cpp
+++ b/packages/kokkos/benchmarks/bytes_and_flops/main.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <Kokkos_Timer.hpp>
diff --git a/packages/kokkos/benchmarks/gather/gather.hpp b/packages/kokkos/benchmarks/gather/gather.hpp
index 239614184ba13aad35fe54190ce5eaf507c61fde..d83461702c7863130803be76276a3d15abab571d 100644
--- a/packages/kokkos/benchmarks/gather/gather.hpp
+++ b/packages/kokkos/benchmarks/gather/gather.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 template <class Scalar, int UNROLL>
 struct RunGather {
diff --git a/packages/kokkos/benchmarks/gather/gather_unroll.hpp b/packages/kokkos/benchmarks/gather/gather_unroll.hpp
index 4dc046f99c33125f86d7674f61b38b77caff99c2..5ee5742a3f72f7baa76936ace5e863275700c104 100644
--- a/packages/kokkos/benchmarks/gather/gather_unroll.hpp
+++ b/packages/kokkos/benchmarks/gather/gather_unroll.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <Kokkos_Random.hpp>
diff --git a/packages/kokkos/benchmarks/gather/main.cpp b/packages/kokkos/benchmarks/gather/main.cpp
index dd502faaa480c1c7ab9936e4f032095094e714bb..7f4fc9ede6ce1c1c7b2dced824a19b984a4bc421 100644
--- a/packages/kokkos/benchmarks/gather/main.cpp
+++ b/packages/kokkos/benchmarks/gather/main.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <Kokkos_Timer.hpp>
diff --git a/packages/kokkos/benchmarks/gups/gups-kokkos.cpp b/packages/kokkos/benchmarks/gups/gups-kokkos.cpp
index 5a3ad23800f8f20d7a66eaad4c509938fc23c778..97c339d09d8bb052251919d15b8690c040e14924 100644
--- a/packages/kokkos/benchmarks/gups/gups-kokkos.cpp
+++ b/packages/kokkos/benchmarks/gups/gups-kokkos.cpp
@@ -1,44 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include "Kokkos_Core.hpp"
 #include <cstdio>
diff --git a/packages/kokkos/benchmarks/policy_performance/main.cpp b/packages/kokkos/benchmarks/policy_performance/main.cpp
index da49cdb019a86eeb193555fdc383df800b31bcfe..28cfde552a59c987efe83d140de379dd893b2891 100644
--- a/packages/kokkos/benchmarks/policy_performance/main.cpp
+++ b/packages/kokkos/benchmarks/policy_performance/main.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include "policy_perf_test.hpp"
diff --git a/packages/kokkos/benchmarks/policy_performance/policy_perf_test.hpp b/packages/kokkos/benchmarks/policy_performance/policy_perf_test.hpp
index 8e6cd7447dbbdde87911d88cf4b0d0c6f9ca3a75..cc2cc40257b86cf0813b8dca6d64733b14ae2ba8 100644
--- a/packages/kokkos/benchmarks/policy_performance/policy_perf_test.hpp
+++ b/packages/kokkos/benchmarks/policy_performance/policy_perf_test.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 
diff --git a/packages/kokkos/benchmarks/stream/stream-kokkos.cpp b/packages/kokkos/benchmarks/stream/stream-kokkos.cpp
index 311947c197cba64e8354dc63743baa99b0bfa782..24c598ffad83afd155bfaf6caf407c139c850da9 100644
--- a/packages/kokkos/benchmarks/stream/stream-kokkos.cpp
+++ b/packages/kokkos/benchmarks/stream/stream-kokkos.cpp
@@ -1,44 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include "Kokkos_Core.hpp"
 #include <cstdio>
diff --git a/packages/kokkos/bin/hpcbind b/packages/kokkos/bin/hpcbind
index 9da3d994698ebe6554cc21222e153098a8d39d83..cb2af2c4b51ef1f25f8fd9c615b8c7f065d49457 100755
--- a/packages/kokkos/bin/hpcbind
+++ b/packages/kokkos/bin/hpcbind
@@ -586,8 +586,6 @@ if [[ ${HPCBIND_TEE} -eq 0 || ${HPCBIND_VERBOSE} -eq 0 ]]; then
   echo "${TMP_ENV}" | grep -E "^GOMP_" >> ${HPCBIND_LOG}
   echo "[KMP] (icc, icpc, and ifort)" >> ${HPCBIND_LOG}
   echo "${TMP_ENV}" | grep -E "^KMP_" >> ${HPCBIND_LOG}
-  echo "[XLSMPOPTS] (xlc, xlc++, and xlf)" >> ${HPCBIND_LOG}
-  echo "${TMP_ENV}" | grep -E "^XLSMPOPTS" >> ${HPCBIND_LOG}
 
   if [[ ${HPCBIND_HAS_HWLOC} -eq 1 ]]; then
     echo "[BINDINGS]" >> ${HPCBIND_LOG}
@@ -610,8 +608,6 @@ else
   echo "${TMP_ENV}" | grep -E "^GOMP_" > >(tee -a ${HPCBIND_LOG})
   echo "[KMP] (icc, icpc, and ifort)" > >(tee -a ${HPCBIND_LOG})
   echo "${TMP_ENV}" | grep -E "^KMP_" > >(tee -a ${HPCBIND_LOG})
-  echo "[XLSMPOPTS] (xlc, xlc++, and xlf)" > >(tee -a ${HPCBIND_LOG})
-  echo "${TMP_ENV}" | grep -E "^XLSMPOPTS" > >(tee -a ${HPCBIND_LOG})
 
   if [[ ${HPCBIND_HAS_HWLOC} -eq 1 ]]; then
     echo "[BINDINGS]" > >(tee -a ${HPCBIND_LOG})
diff --git a/packages/kokkos/bin/nvcc_wrapper b/packages/kokkos/bin/nvcc_wrapper
index e1a208813863515b88cce5399f53c79239d4c0fe..0c55651460ad9570fd0815c078e833e39c6d99aa 100755
--- a/packages/kokkos/bin/nvcc_wrapper
+++ b/packages/kokkos/bin/nvcc_wrapper
@@ -10,10 +10,12 @@
 # Default settings: change those according to your machine.  For
 # example, you may have have two different wrappers with either icpc
 # or g++ as their back-end compiler.  The defaults can be overwritten
-# by using the usual arguments (e.g., -arch=sm_30 -ccbin icpc).
+# by using the usual arguments (e.g., -arch=sm_80 -ccbin icpc).
+# sm_70 is supported by every CUDA version from 9-12 and is thus
+# chosen as default
 
-default_arch="sm_35"
-#default_arch="sm_50"
+default_arch="sm_70"
+#default_arch="sm_80"
 
 #
 # The default C++ compiler.
@@ -227,11 +229,11 @@ do
     fi
     ;;
   #Handle known nvcc args
-  --dryrun|--verbose|--keep|--source-in-ptx|-src-in-ptx|--keep-dir*|-G|-lineinfo|-expt-extended-lambda|-expt-relaxed-constexpr|--resource-usage|--fmad=*|--use_fast_math|--Wext-lambda-captures-this|-Wext-lambda-captures-this)
+  --dryrun|--verbose|--keep|--source-in-ptx|-src-in-ptx|--keep-dir*|-G|-lineinfo|-extended-lambda|-expt-extended-lambda|-expt-relaxed-constexpr|--resource-usage|--fmad=*|--use_fast_math|--Wext-lambda-captures-this|-Wext-lambda-captures-this)
     cuda_args="$cuda_args $1"
     ;;
   #Handle more known nvcc args
-  --expt-extended-lambda|--expt-relaxed-constexpr|--Wno-deprecated-gpu-targets|-Wno-deprecated-gpu-targets|-allow-unsupported-compiler|--allow-unsupported-compiler)
+  --extended-lambda|--expt-extended-lambda|--expt-relaxed-constexpr|--Wno-deprecated-gpu-targets|-Wno-deprecated-gpu-targets|-allow-unsupported-compiler|--allow-unsupported-compiler)
     cuda_args="$cuda_args $1"
     ;;
   #Handle known nvcc args that have an argument
@@ -336,6 +338,24 @@ do
     std_flag=$corrected_std_flag
     shared_args="$shared_args $std_flag"
     ;;
+  --std=c++20|-std=c++20)
+    if [ -n "$std_flag" ]; then
+      warn_std_flag
+      shared_args=${shared_args/ $std_flag/}
+    fi
+    # NVCC only has C++20 from version 12 on
+    cuda_main_version=$([[ $(${nvcc_compiler} --version) =~ V([0-9]+) ]] && echo ${BASH_REMATCH[1]})
+    if [ ${cuda_main_version} -lt 12 ]; then
+      fallback_std_flag="-std=c++14"
+      # this is hopefully just occurring in a downstream project during CMake feature tests
+      # we really have no choice here but to accept the flag and change  to an accepted C++ standard
+      echo "nvcc_wrapper does not accept standard flags $1 since partial standard flags and standards after C++14 are not supported. nvcc_wrapper will use $fallback_std_flag instead. It is undefined behavior to use this flag. This should only be occurring during CMake configuration."
+      std_flag=$fallback_std_flag
+    else
+      std_flag=$1
+    fi
+    shared_args="$shared_args $std_flag"
+    ;;
   --std=c++17|-std=c++17)
     if [ -n "$std_flag" ]; then
       warn_std_flag
diff --git a/packages/kokkos/cmake/Dependencies.cmake b/packages/kokkos/cmake/Dependencies.cmake
index 10df9fe45694f7ed74e75fac1127af4b72bc3c02..23b473ce2471c44c67d2fc4b004500b293dd9ef5 100644
--- a/packages/kokkos/cmake/Dependencies.cmake
+++ b/packages/kokkos/cmake/Dependencies.cmake
@@ -1,14 +1,3 @@
-IF (CMAKE_CXX_STANDARD GREATER_EQUAL 17)
-  SET(KOKKOS_SIMD_TEST_CLASS PT)
-ELSE()
-  SET(KOKKOS_SIMD_TEST_CLASS EX)
-  IF (${PROJECT_NAME}_ENABLE_KokkosSimd)
-    MESSAGE(WARNING "KokkosSimd is explicitly enabled but C++17 is not available")
-  ELSE()
-    MESSAGE(STATUS "Disabling KokkosSimd by default because C++17 is not available")
-  ENDIF()
-ENDIF()
-
 TRIBITS_PACKAGE_DEFINE_DEPENDENCIES(
   SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS
     #SubPackageName       Directory         Class    Req/Opt
@@ -17,5 +6,5 @@ TRIBITS_PACKAGE_DEFINE_DEPENDENCIES(
     Core                  core              PS       REQUIRED
     Containers            containers        PS       OPTIONAL
     Algorithms            algorithms        PS       OPTIONAL
-    Simd                  simd              ${KOKKOS_SIMD_TEST_CLASS}       OPTIONAL
+    Simd                  simd              PT       OPTIONAL
   )
diff --git a/packages/kokkos/cmake/KokkosConfigCommon.cmake.in b/packages/kokkos/cmake/KokkosConfigCommon.cmake.in
index 23bc86cc8417080d718f01753ffa5f896d6ab8d5..bb5ce5ff8191fc9f3d75a92d4c1aee3df4258141 100644
--- a/packages/kokkos/cmake/KokkosConfigCommon.cmake.in
+++ b/packages/kokkos/cmake/KokkosConfigCommon.cmake.in
@@ -14,10 +14,6 @@ ENDFOREACH()
 IF(NOT Kokkos_FIND_QUIETLY)
   MESSAGE(STATUS "Enabled Kokkos devices: ${Kokkos_DEVICES}")
 ENDIF()
-IF(Kokkos_ENABLE_THREADS AND NOT DEPRECATED_CODE_3 IN_LIST Kokkos_OPTIONS)  # for backward compatibility
-  SET(Kokkos_ENABLE_PTHREAD ON)
-  LIST(APPEND Kokkos_DEVICES PTHREAD)
-ENDIF()
 
 IF (Kokkos_ENABLE_CUDA)
   # If we are building CUDA, we have tricked CMake because we declare a CXX project
diff --git a/packages/kokkos/cmake/KokkosCore_Config_HeaderSet.in b/packages/kokkos/cmake/KokkosCore_Config_HeaderSet.in
index 8d1eee31b2a78754e599acc4de4b80ca32dd9d06..73fa0b736c6dd2d52aa2c291a07298780b995f4f 100644
--- a/packages/kokkos/cmake/KokkosCore_Config_HeaderSet.in
+++ b/packages/kokkos/cmake/KokkosCore_Config_HeaderSet.in
@@ -2,45 +2,20 @@
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
 */
+
 #ifndef @HEADER_GUARD_TAG@
 #define @HEADER_GUARD_TAG@
 
diff --git a/packages/kokkos/cmake/KokkosCore_config.h.in b/packages/kokkos/cmake/KokkosCore_config.h.in
index 88ddc483786112ca0e70f418921d89ae102b9dde..cb1affa24c3ee257585e7b3de00a9409e39c9226 100644
--- a/packages/kokkos/cmake/KokkosCore_config.h.in
+++ b/packages/kokkos/cmake/KokkosCore_config.h.in
@@ -9,7 +9,10 @@
 // KOKKOS_VERSION % 100 is the patch level
 // KOKKOS_VERSION / 100 % 100 is the minor version
 // KOKKOS_VERSION / 10000 is the major version
-#cmakedefine KOKKOS_VERSION @KOKKOS_VERSION@
+#define KOKKOS_VERSION @KOKKOS_VERSION@
+#define KOKKOS_VERSION_MAJOR @KOKKOS_VERSION_MAJOR@
+#define KOKKOS_VERSION_MINOR @KOKKOS_VERSION_MINOR@
+#define KOKKOS_VERSION_PATCH @KOKKOS_VERSION_PATCH@
 
 /* Execution Spaces */
 #cmakedefine KOKKOS_ENABLE_SERIAL
@@ -25,15 +28,14 @@
 #cmakedefine KOKKOS_ENABLE_SYCL
 
 /* General Settings */
-#cmakedefine KOKKOS_ENABLE_CXX14
 #cmakedefine KOKKOS_ENABLE_CXX17
 #cmakedefine KOKKOS_ENABLE_CXX20
+#cmakedefine KOKKOS_ENABLE_CXX23
 
 #cmakedefine KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE
 #cmakedefine KOKKOS_ENABLE_CUDA_UVM
 #cmakedefine KOKKOS_ENABLE_CUDA_LAMBDA
 #cmakedefine KOKKOS_ENABLE_CUDA_CONSTEXPR
-#cmakedefine KOKKOS_ENABLE_CUDA_LDG_INTRINSIC
 #cmakedefine KOKKOS_ENABLE_IMPL_CUDA_MALLOC_ASYNC
 #cmakedefine KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE
 #cmakedefine KOKKOS_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS
@@ -44,12 +46,14 @@
 #cmakedefine KOKKOS_ENABLE_PROFILING_LOAD_PRINT
 #cmakedefine KOKKOS_ENABLE_TUNING
 #cmakedefine KOKKOS_ENABLE_DEPRECATED_CODE_3
+#cmakedefine KOKKOS_ENABLE_DEPRECATED_CODE_4
 #cmakedefine KOKKOS_ENABLE_DEPRECATION_WARNINGS
 #cmakedefine KOKKOS_ENABLE_LARGE_MEM_TESTS
 #cmakedefine KOKKOS_ENABLE_COMPLEX_ALIGN
 #cmakedefine KOKKOS_ENABLE_IMPL_DESUL_ATOMICS
 #cmakedefine KOKKOS_OPT_RANGE_AGGRESSIVE_VECTORIZATION  // deprecated
 #cmakedefine KOKKOS_ENABLE_AGGRESSIVE_VECTORIZATION
+#cmakedefine KOKKOS_ENABLE_IMPL_MDSPAN
 
 /* TPL Settings */
 #cmakedefine KOKKOS_ENABLE_HWLOC
@@ -59,8 +63,6 @@
 #cmakedefine KOKKOS_ENABLE_LIBQUADMATH
 #cmakedefine KOKKOS_IMPL_CUDA_CLANG_WORKAROUND
 
-#cmakedefine KOKKOS_COMPILER_CUDA_VERSION @KOKKOS_COMPILER_CUDA_VERSION@
-
 #cmakedefine KOKKOS_ARCH_SSE42
 #cmakedefine KOKKOS_ARCH_ARMV80
 #cmakedefine KOKKOS_ARCH_ARMV8_THUNDERX
@@ -82,6 +84,7 @@
 #cmakedefine KOKKOS_ARCH_INTEL_GEN11
 #cmakedefine KOKKOS_ARCH_INTEL_GEN12LP
 #cmakedefine KOKKOS_ARCH_INTEL_XEHP
+#cmakedefine KOKKOS_ARCH_INTEL_PVC
 #cmakedefine KOKKOS_ARCH_INTEL_GPU
 #cmakedefine KOKKOS_ARCH_KEPLER
 #cmakedefine KOKKOS_ARCH_KEPLER30
@@ -102,11 +105,16 @@
 #cmakedefine KOKKOS_ARCH_AMPERE
 #cmakedefine KOKKOS_ARCH_AMPERE80
 #cmakedefine KOKKOS_ARCH_AMPERE86
+#cmakedefine KOKKOS_ARCH_ADA89
+#cmakedefine KOKKOS_ARCH_HOPPER
+#cmakedefine KOKKOS_ARCH_HOPPER90
 #cmakedefine KOKKOS_ARCH_AMD_ZEN
 #cmakedefine KOKKOS_ARCH_AMD_ZEN2
 #cmakedefine KOKKOS_ARCH_AMD_ZEN3
 #cmakedefine KOKKOS_ARCH_VEGA
-#cmakedefine KOKKOS_ARCH_VEGA900
 #cmakedefine KOKKOS_ARCH_VEGA906
 #cmakedefine KOKKOS_ARCH_VEGA908
 #cmakedefine KOKKOS_ARCH_VEGA90A
+#cmakedefine KOKKOS_ARCH_NAVI
+#cmakedefine KOKKOS_ARCH_NAVI1030
+#cmakedefine KOKKOS_ARCH_NAVI1100
diff --git a/packages/kokkos/cmake/Kokkos_Version_Info.cpp.in b/packages/kokkos/cmake/Kokkos_Version_Info.cpp.in
new file mode 100644
index 0000000000000000000000000000000000000000..e9fabe8177e67d76c53f422e36e3057a9880a0fa
--- /dev/null
+++ b/packages/kokkos/cmake/Kokkos_Version_Info.cpp.in
@@ -0,0 +1,30 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#include "Kokkos_Version_Info.hpp"
+
+namespace Kokkos {
+namespace Impl {
+
+std::string GIT_BRANCH             = "@GIT_BRANCH@";
+std::string GIT_COMMIT_HASH        = "@GIT_COMMIT_HASH@";
+std::string GIT_CLEAN_STATUS       = "@GIT_CLEAN_STATUS@";
+std::string GIT_COMMIT_DESCRIPTION = "@GIT_COMMIT_DESCRIPTION@";
+std::string GIT_COMMIT_DATE        = "@GIT_COMMIT_DATE@";
+
+}  // namespace Impl
+
+}  // namespace Kokkos
diff --git a/packages/kokkos/cmake/Kokkos_Version_Info.hpp b/packages/kokkos/cmake/Kokkos_Version_Info.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..ba605a301db4a7e3858c181781a6d331ef7c4517
--- /dev/null
+++ b/packages/kokkos/cmake/Kokkos_Version_Info.hpp
@@ -0,0 +1,34 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef GIT_VERSION_H
+#define GIT_VERSION_H
+
+#include <string>
+
+namespace Kokkos {
+namespace Impl {
+
+extern std::string GIT_BRANCH;
+extern std::string GIT_COMMIT_HASH;
+extern std::string GIT_CLEAN_STATUS;
+extern std::string GIT_COMMIT_DESCRIPTION;
+extern std::string GIT_COMMIT_DATE;
+
+}  // namespace Impl
+}  // namespace Kokkos
+
+#endif
diff --git a/packages/kokkos/cmake/Modules/FindTPLLIBQUADMATH.cmake b/packages/kokkos/cmake/Modules/FindTPLLIBQUADMATH.cmake
index be70b711e0f92ac9d99e3c3fdd2770430f6c2b68..70e0d6c454ad86bf9262495f9658253d79aa42ef 100644
--- a/packages/kokkos/cmake/Modules/FindTPLLIBQUADMATH.cmake
+++ b/packages/kokkos/cmake/Modules/FindTPLLIBQUADMATH.cmake
@@ -1 +1,18 @@
-KOKKOS_FIND_IMPORTED(LIBQUADMATH HEADER quadmath.h LIBRARY quadmath)
+# gcc bundles libquadmath and doesn't need any extra link or include directories
+# (which would not be contained in CMake's search paths anyway).
+# Hence, try if the compiler supports libquadmath natively first before doing
+# the standard package search.
+SET(CMAKE_REQUIRED_LIBRARIES "quadmath")
+INCLUDE(CheckCXXSourceCompiles)
+CHECK_CXX_SOURCE_COMPILES("
+  #include <quadmath.h>
+  int main(void){
+      __float128 foo = ::sqrtq(123.456);
+      return foo;
+  }"
+  KOKKOS_QUADMATH_COMPILER_SUPPORT)
+IF (KOKKOS_QUADMATH_COMPILER_SUPPORT)
+  KOKKOS_CREATE_IMPORTED_TPL(LIBQUADMATH INTERFACE LINK_LIBRARIES quadmath)
+ELSE()
+  KOKKOS_FIND_IMPORTED(LIBQUADMATH HEADER quadmath.h LIBRARY quadmath)
+ENDIF()
diff --git a/packages/kokkos/cmake/Modules/FindTPLROCM.cmake b/packages/kokkos/cmake/Modules/FindTPLROCM.cmake
index 512ad6ceb283dcd27f8db1dfb45f045f998d7875..aacdfcaf19cbb77dba00067bb818d9c065dbfe8b 100644
--- a/packages/kokkos/cmake/Modules/FindTPLROCM.cmake
+++ b/packages/kokkos/cmake/Modules/FindTPLROCM.cmake
@@ -3,9 +3,19 @@ include(FindPackageHandleStandardArgs)
 FIND_LIBRARY(AMD_HIP_LIBRARY amdhip64 PATHS ENV ROCM_PATH PATH_SUFFIXES lib)
 FIND_LIBRARY(HSA_RUNTIME_LIBRARY hsa-runtime64 PATHS ENV ROCM_PATH PATH_SUFFIXES lib)
 
-find_package_handle_standard_args(TPLROCM DEFAULT_MSG AMD_HIP_LIBRARY HSA_RUNTIME_LIBRARY)
+# clang_rt.builtins is necessary to use half precision. The following code to
+# find clang_rt.buitins is based on
+# https://github.com/ROCm-Developer-Tools/HIP/blob/develop/hip-lang-config.cmake.in#L99-L111
+file(GLOB_RECURSE CLANG_RT_DIR "$ENV{ROCM_PATH}/llvm/lib/clang/*/lib/*/*clang_rt.builtins*")
+FIND_LIBRARY(CLANG_RT_LIBRARY
+  NAMES
+  clang_rt.builtins
+  clang_rt.builtins-x86_64
+  PATHS "${CLANG_RT_DIR}/..")
+
+find_package_handle_standard_args(TPLROCM DEFAULT_MSG AMD_HIP_LIBRARY HSA_RUNTIME_LIBRARY CLANG_RT_LIBRARY)
 
 kokkos_create_imported_tpl(ROCM INTERFACE
-  LINK_LIBRARIES ${HSA_RUNTIME_LIBRARY} ${AMD_HIP_LIBRARY}
+  LINK_LIBRARIES ${HSA_RUNTIME_LIBRARY} ${AMD_HIP_LIBRARY} ${CLANG_RT_LIBRARY}
   COMPILE_DEFINITIONS __HIP_ROCclr__
 )
diff --git a/packages/kokkos/cmake/Modules/FindTPLTHREADS.cmake b/packages/kokkos/cmake/Modules/FindTPLTHREADS.cmake
index 0e3c9f8dd6f978d9a43a8b88f7b0fd4aa3f9a352..ff0db5123f8e982806d92f62dae9da82413ba6ec 100644
--- a/packages/kokkos/cmake/Modules/FindTPLTHREADS.cmake
+++ b/packages/kokkos/cmake/Modules/FindTPLTHREADS.cmake
@@ -1,5 +1,5 @@
 INCLUDE(FindPackageHandleStandardArgs)
-INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/tpls/FindTPLPthread.cmake")
+FIND_PACKAGE(Threads)
 
 IF (TARGET Threads::Threads)
   SET(FOUND_THREADS TRUE)
@@ -11,5 +11,5 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(TPLTHREADS DEFAULT_MSG FOUND_THREADS)
 #Only create the TPL if we succeed
 IF (FOUND_THREADS)
   KOKKOS_CREATE_IMPORTED_TPL(THREADS INTERFACE LINK_OPTIONS
-          ${TPL_Pthread_LIBRARIES})
+          ${CMAKE_THREAD_LIBS_INIT})
 ENDIF()
diff --git a/packages/kokkos/cmake/build_env_info.cmake b/packages/kokkos/cmake/build_env_info.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..2cd169cba417e9194f8208a59cd8f590f0b0612f
--- /dev/null
+++ b/packages/kokkos/cmake/build_env_info.cmake
@@ -0,0 +1,121 @@
+# https://jonathanhamberg.com/post/cmake-embedding-git-hash/
+
+find_package(Git QUIET)
+
+SET(CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR})
+SET(pre_configure_dir ${CMAKE_CURRENT_LIST_DIR})
+SET(post_configure_dir ${CMAKE_BINARY_DIR}/generated)
+
+SET(pre_configure_file ${pre_configure_dir}/Kokkos_Version_Info.cpp.in)
+SET(post_configure_file ${post_configure_dir}/Kokkos_Version_Info.cpp)
+
+FUNCTION(check_git_write git_hash git_clean_status)
+  FILE(
+    WRITE
+    ${CMAKE_BINARY_DIR}/git-state.txt
+    "${git_hash}-${git_clean_status}")
+ENDFUNCTION()
+
+FUNCTION(check_git_read git_hash)
+  IF(EXISTS ${CMAKE_BINARY_DIR}/git-state.txt)
+    FILE(STRINGS ${CMAKE_BINARY_DIR}/git-state.txt CONTENT)
+    LIST(GET CONTENT 0 var)
+
+    message(DEBUG "Cached Git hash: ${var}")
+    SET(${git_hash} ${var} PARENT_SCOPE)
+  else()
+    SET(${git_hash} "INVALID" PARENT_SCOPE)
+  ENDIF()
+ENDFUNCTION()
+
+FUNCTION(check_git_version)
+  IF(NOT EXISTS ${post_configure_dir}/Kokkos_Version_Info.hpp)
+    FILE(
+      COPY ${pre_configure_dir}/Kokkos_Version_Info.hpp
+      DESTINATION ${post_configure_dir})
+  ENDIF()
+
+  IF(NOT Git_FOUND OR NOT EXISTS ${KOKKOS_SOURCE_DIR}/.git)
+    configure_file(${pre_configure_file} ${post_configure_file} @ONLY)
+    return()
+  ENDIF()
+
+  # Get the current working branch
+  execute_process(
+    COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
+    WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR}
+    OUTPUT_VARIABLE GIT_BRANCH
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+  # Get the latest commit description
+  execute_process(
+    COMMAND ${GIT_EXECUTABLE} show -s --format=%s
+    WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR}
+    OUTPUT_VARIABLE GIT_COMMIT_DESCRIPTION
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+  # Get the latest commit date
+  execute_process(
+    COMMAND ${GIT_EXECUTABLE} log -1 --format=%cI
+    WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR}
+    OUTPUT_VARIABLE GIT_COMMIT_DATE
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+  # Check if repo is dirty / clean
+  execute_process(
+    COMMAND ${GIT_EXECUTABLE} diff-index --quiet HEAD --
+    WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR}
+    RESULT_VARIABLE IS_DIRTY
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+  IF(IS_DIRTY EQUAL 0)
+    SET(GIT_CLEAN_STATUS "CLEAN")
+  else()
+    SET(GIT_CLEAN_STATUS "DIRTY")
+  ENDIF()
+
+  # Get the latest abbreviated commit hash of the working branch
+  execute_process(
+    COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
+    WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR}
+    OUTPUT_VARIABLE GIT_COMMIT_HASH
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+  check_git_read(GIT_HASH_CACHE)
+
+  IF(NOT EXISTS ${post_configure_dir})
+    file(MAKE_DIRECTORY ${post_configure_dir})
+  ENDIF()
+
+  # Only update the git_version.cpp if the hash has changed. This will
+  # prevent us from rebuilding the project more than we need to.
+  IF(NOT "${GIT_COMMIT_HASH}-${GIT_CLEAN_STATUS}" STREQUAL ${GIT_HASH_CACHE}
+    OR NOT EXISTS ${post_configure_file})
+    # Set the GIT_HASH_CACHE variable so the next build won't have
+    # to regenerate the source file.
+    check_git_write(${GIT_COMMIT_HASH} ${GIT_CLEAN_STATUS})
+
+    configure_file(${pre_configure_file} ${post_configure_file} @ONLY)
+    message(STATUS "Configured git information in ${post_configure_file}")
+  ENDIF()
+ENDFUNCTION()
+
+FUNCTION(check_git_setup)
+  add_custom_target(
+    AlwaysCheckGit COMMAND ${CMAKE_COMMAND}
+    -DRUN_CHECK_GIT_VERSION=1
+    -DKOKKOS_SOURCE_DIR=${Kokkos_SOURCE_DIR}
+    -P ${CURRENT_LIST_DIR}/build_env_info.cmake
+    BYPRODUCTS ${post_configure_file})
+
+  add_library(impl_git_version ${CMAKE_BINARY_DIR}/generated/Kokkos_Version_Info.cpp)
+  target_include_directories(impl_git_version PUBLIC ${CMAKE_BINARY_DIR}/generated)
+  add_dependencies(impl_git_version AlwaysCheckGit)
+
+  check_git_version()
+ENDFUNCTION()
+
+# This is used to run this function from an external cmake process.
+IF(RUN_CHECK_GIT_VERSION)
+  check_git_version()
+ENDIF()
diff --git a/packages/kokkos/cmake/compile_tests/clang_omp.cpp b/packages/kokkos/cmake/compile_tests/clang_omp.cpp
index 60a5c522820cdb03cbde8a2cf3a796c57292b46b..153130f968edd0a4565cc477c636bc0dcdd9c261 100644
--- a/packages/kokkos/cmake/compile_tests/clang_omp.cpp
+++ b/packages/kokkos/cmake/compile_tests/clang_omp.cpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #include <omp.h>
 
 int main(int, char**) {
diff --git a/packages/kokkos/cmake/compile_tests/cplusplus14.cpp b/packages/kokkos/cmake/compile_tests/cplusplus14.cpp
deleted file mode 100644
index 52ec9885ec3ed5f4e7c0871f59de3d651df33efe..0000000000000000000000000000000000000000
--- a/packages/kokkos/cmake/compile_tests/cplusplus14.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <type_traits>
-
-int main() {
-  // _t versions of type traits were added in C++14
-  std::remove_cv_t<int> i = 0;
-
-  return i;
-}
diff --git a/packages/kokkos/cmake/compile_tests/cplusplus17.cpp b/packages/kokkos/cmake/compile_tests/cplusplus17.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b425d23adf81d443b8554291db1678a704737455
--- /dev/null
+++ b/packages/kokkos/cmake/compile_tests/cplusplus17.cpp
@@ -0,0 +1,25 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#include <type_traits>
+
+int main() {
+  // _v versions of type traits were added in C++17
+  if constexpr (std::is_same_v<double, int>)
+    return 0;
+  else
+    return 1;
+}
diff --git a/packages/kokkos/cmake/compile_tests/cuda_compute_capability.cc b/packages/kokkos/cmake/compile_tests/cuda_compute_capability.cc
index f56cef16510df4e1b49f13765b4306d2c2fe9420..b81c4218a91f6dc42d71ed98d4439af606db2af9 100644
--- a/packages/kokkos/cmake/compile_tests/cuda_compute_capability.cc
+++ b/packages/kokkos/cmake/compile_tests/cuda_compute_capability.cc
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <iostream>
 #include <cuda_runtime_api.h>
@@ -74,6 +46,8 @@ int main() {
     case 75: std::cout << "Set -DKokkos_ARCH_TURING75=ON ." << std::endl; break;
     case 80: std::cout << "Set -DKokkos_ARCH_AMPERE80=ON ." << std::endl; break;
     case 86: std::cout << "Set -DKokkos_ARCH_AMPERE86=ON ." << std::endl; break;
+    case 89: std::cout << "Set -DKokkos_ARCH_ADA89=ON ." << std::endl; break;
+    case 90: std::cout << "Set -DKokkos_ARCH_HOPPER90=ON ." << std::endl; break;
     default:
       std::cout << "Compute capability " << compute_capability
                 << " is not supported" << std::endl;
diff --git a/packages/kokkos/cmake/compile_tests/pthread.cpp b/packages/kokkos/cmake/compile_tests/pthread.cpp
deleted file mode 100644
index 3f83bf6a5f7fe399fc4a44547792e738177facfb..0000000000000000000000000000000000000000
--- a/packages/kokkos/cmake/compile_tests/pthread.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <pthread.h>
-
-void* kokkos_test(void* args) { return args; }
-
-int main() {
-  pthread_t thread;
-  /* Use NULL to avoid C++11. Some compilers
-     do not have C++11 by default.  Forcing C++11
-     in the compile tests can be done, but is unnecessary
-  */
-  pthread_create(&thread, NULL, kokkos_test, NULL);
-  pthread_join(thread, NULL);
-  return 0;
-}
diff --git a/packages/kokkos/cmake/deps/CUDA.cmake b/packages/kokkos/cmake/deps/CUDA.cmake
index beaf4e6d6cd922e5916dd5f1e35bf43f58bee7da..68bf5b3d5798266c784ee7586751a5ae9d24cd0e 100644
--- a/packages/kokkos/cmake/deps/CUDA.cmake
+++ b/packages/kokkos/cmake/deps/CUDA.cmake
@@ -1,41 +1,16 @@
-# @HEADER
+#@HEADER
 # ************************************************************************
 #
-#                        Kokkos v. 3.0
-#       Copyright (2020) National Technology & Engineering
+#                        Kokkos v. 4.0
+#       Copyright (2022) National Technology & Engineering
 #               Solutions of Sandia, LLC (NTESS).
 #
 # Under the terms of Contract DE-NA0003525 with NTESS,
 # the U.S. Government retains certain rights in this software.
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# 3. Neither the name of the Corporation nor the names of the
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
 #
-# Questions? Contact Christian R. Trott (crtrott@sandia.gov)
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 #
 # ************************************************************************
 # @HEADER
diff --git a/packages/kokkos/cmake/deps/CUSPARSE.cmake b/packages/kokkos/cmake/deps/CUSPARSE.cmake
index 073c40d8140157bb95aac681bf084da2aeadaf5d..b016971ab915021a31981d931e53fff9e483ce00 100644
--- a/packages/kokkos/cmake/deps/CUSPARSE.cmake
+++ b/packages/kokkos/cmake/deps/CUSPARSE.cmake
@@ -1,41 +1,16 @@
-# @HEADER
+#@HEADER
 # ************************************************************************
 #
-#                        Kokkos v. 3.0
-#       Copyright (2020) National Technology & Engineering
+#                        Kokkos v. 4.0
+#       Copyright (2022) National Technology & Engineering
 #               Solutions of Sandia, LLC (NTESS).
 #
 # Under the terms of Contract DE-NA0003525 with NTESS,
 # the U.S. Government retains certain rights in this software.
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# 3. Neither the name of the Corporation nor the names of the
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
 #
-# Questions? Contact Christian R. Trott (crtrott@sandia.gov)
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 #
 # ************************************************************************
 # @HEADER
diff --git a/packages/kokkos/cmake/deps/HWLOC.cmake b/packages/kokkos/cmake/deps/HWLOC.cmake
index f8402db00a7287e3a2526c7569ebd7387941da1b..77d5a9b83a649eea2204ae7a3a6be6c4207c27ef 100644
--- a/packages/kokkos/cmake/deps/HWLOC.cmake
+++ b/packages/kokkos/cmake/deps/HWLOC.cmake
@@ -1,41 +1,16 @@
-# @HEADER
+#@HEADER
 # ************************************************************************
 #
-#                        Kokkos v. 3.0
-#       Copyright (2020) National Technology & Engineering
+#                        Kokkos v. 4.0
+#       Copyright (2022) National Technology & Engineering
 #               Solutions of Sandia, LLC (NTESS).
 #
 # Under the terms of Contract DE-NA0003525 with NTESS,
 # the U.S. Government retains certain rights in this software.
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# 3. Neither the name of the Corporation nor the names of the
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
 #
-# Questions? Contact Christian R. Trott (crtrott@sandia.gov)
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 #
 # ************************************************************************
 # @HEADER
diff --git a/packages/kokkos/cmake/deps/Pthread.cmake b/packages/kokkos/cmake/deps/Pthread.cmake
index 639e4ef6975167f717c7de114b36d6642badd67d..e879bff3741db50ec13b2d71f89d1212015550ff 100644
--- a/packages/kokkos/cmake/deps/Pthread.cmake
+++ b/packages/kokkos/cmake/deps/Pthread.cmake
@@ -1,41 +1,16 @@
-# @HEADER
+#@HEADER
 # ************************************************************************
 #
-#                        Kokkos v. 3.0
-#       Copyright (2020) National Technology & Engineering
+#                        Kokkos v. 4.0
+#       Copyright (2022) National Technology & Engineering
 #               Solutions of Sandia, LLC (NTESS).
 #
 # Under the terms of Contract DE-NA0003525 with NTESS,
 # the U.S. Government retains certain rights in this software.
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# 3. Neither the name of the Corporation nor the names of the
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
 #
-# Questions? Contact Christian R. Trott (crtrott@sandia.gov)
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 #
 # ************************************************************************
 # @HEADER
diff --git a/packages/kokkos/cmake/deps/quadmath.cmake b/packages/kokkos/cmake/deps/quadmath.cmake
index 826f5021d359e99c2aed8b695de7b601dabaf453..6aef08e8812fe23de9cc9802a3f7c46730b4c60f 100644
--- a/packages/kokkos/cmake/deps/quadmath.cmake
+++ b/packages/kokkos/cmake/deps/quadmath.cmake
@@ -1,41 +1,16 @@
-# @HEADER
+#@HEADER
 # ************************************************************************
 #
-#                        Kokkos v. 3.0
-#       Copyright (2020) National Technology & Engineering
+#                        Kokkos v. 4.0
+#       Copyright (2022) National Technology & Engineering
 #               Solutions of Sandia, LLC (NTESS).
 #
 # Under the terms of Contract DE-NA0003525 with NTESS,
 # the U.S. Government retains certain rights in this software.
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# 3. Neither the name of the Corporation nor the names of the
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
 #
-# Questions? Contact Christian R. Trott (crtrott@sandia.gov)
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 #
 # ************************************************************************
 # @HEADER
diff --git a/packages/kokkos/cmake/fake_tribits.cmake b/packages/kokkos/cmake/fake_tribits.cmake
index f39457205735d1b94fd04382e98289d1c6ec54dd..71e85e915c6160ea5dee9c9d6a32c9852a0c39ba 100644
--- a/packages/kokkos/cmake/fake_tribits.cmake
+++ b/packages/kokkos/cmake/fake_tribits.cmake
@@ -117,7 +117,7 @@ FUNCTION(KOKKOS_ADD_TEST)
       if(TEST_TOOL)
         add_dependencies(${EXE} ${TEST_TOOL}) #make sure the exe has to build the tool
         foreach(TEST_ADDED ${ALL_TESTS_ADDED})
-          set_property(TEST ${TEST_ADDED} APPEND PROPERTY ENVIRONMENT "KOKKOS_PROFILE_LIBRARY=$<TARGET_FILE:${TEST_TOOL}>")
+          set_property(TEST ${TEST_ADDED} APPEND PROPERTY ENVIRONMENT "KOKKOS_TOOLS_LIBS=$<TARGET_FILE:${TEST_TOOL}>")
         endforeach()
       endif()
     endif()
diff --git a/packages/kokkos/cmake/kokkos_arch.cmake b/packages/kokkos/cmake/kokkos_arch.cmake
index ef16aad047a96cfb31f3ae6c5ecaa93ff8175539..eb7c271b156e7345de39331968ef27d243fe250d 100644
--- a/packages/kokkos/cmake/kokkos_arch.cmake
+++ b/packages/kokkos/cmake/kokkos_arch.cmake
@@ -68,7 +68,7 @@ DECLARE_AND_CHECK_HOST_ARCH(ZEN               "AMD Zen architecture")
 DECLARE_AND_CHECK_HOST_ARCH(ZEN2              "AMD Zen2 architecture")
 DECLARE_AND_CHECK_HOST_ARCH(ZEN3              "AMD Zen3 architecture")
 
-IF(Kokkos_ENABLE_CUDA OR Kokkos_ENABLE_OPENMPTARGET OR Kokkos_ENABLE_OPENACC OR Kokkos_ENABLE_UNSUPPORTED_ARCHS)
+IF(Kokkos_ENABLE_CUDA OR Kokkos_ENABLE_OPENMPTARGET OR Kokkos_ENABLE_OPENACC OR Kokkos_ENABLE_SYCL)
   SET(KOKKOS_SHOW_CUDA_ARCHS ON)
 ENDIF()
 
@@ -86,17 +86,27 @@ KOKKOS_ARCH_OPTION(VOLTA72         GPU  "NVIDIA Volta generation CC 7.2"   "KOKK
 KOKKOS_ARCH_OPTION(TURING75        GPU  "NVIDIA Turing generation CC 7.5"  "KOKKOS_SHOW_CUDA_ARCHS")
 KOKKOS_ARCH_OPTION(AMPERE80        GPU  "NVIDIA Ampere generation CC 8.0"  "KOKKOS_SHOW_CUDA_ARCHS")
 KOKKOS_ARCH_OPTION(AMPERE86        GPU  "NVIDIA Ampere generation CC 8.6"  "KOKKOS_SHOW_CUDA_ARCHS")
+KOKKOS_ARCH_OPTION(ADA89           GPU  "NVIDIA Ada generation CC 8.9"     "KOKKOS_SHOW_CUDA_ARCHS")
+KOKKOS_ARCH_OPTION(HOPPER90        GPU  "NVIDIA Hopper generation CC 9.0"  "KOKKOS_SHOW_CUDA_ARCHS")
 
-IF(Kokkos_ENABLE_HIP OR Kokkos_ENABLE_OPENMPTARGET OR Kokkos_ENABLE_UNSUPPORTED_ARCHS)
+IF(Kokkos_ENABLE_HIP OR Kokkos_ENABLE_OPENMPTARGET)
   SET(KOKKOS_SHOW_HIP_ARCHS ON)
 ENDIF()
 
-KOKKOS_ARCH_OPTION(VEGA900         GPU  "AMD GPU MI25 GFX900"      "KOKKOS_SHOW_HIP_ARCHS")
-KOKKOS_ARCH_OPTION(VEGA906         GPU  "AMD GPU MI50/MI60 GFX906" "KOKKOS_SHOW_HIP_ARCHS")
-KOKKOS_ARCH_OPTION(VEGA908         GPU  "AMD GPU MI100 GFX908"     "KOKKOS_SHOW_HIP_ARCHS")
-KOKKOS_ARCH_OPTION(VEGA90A         GPU  "AMD GPU MI200 GFX90A"     "KOKKOS_SHOW_HIP_ARCHS")
+# AMD archs ordered in decreasing priority of autodetection
+LIST(APPEND SUPPORTED_AMD_GPUS       MI200    MI100    MI50/60  RX7900XTX  V620/W6800)
+LIST(APPEND SUPPORTED_AMD_ARCHS      VEGA90A  VEGA908  VEGA906  NAVI1100   NAVI1030)
+LIST(APPEND CORRESPONDING_AMD_FLAGS  gfx90a   gfx908   gfx906   gfx1100    gfx1030)
 
-IF(Kokkos_ENABLE_SYCL OR Kokkos_ENABLE_OPENMPTARGET OR Kokkos_ENABLE_UNSUPPORTED_ARCHS)
+#FIXME CAN BE REPLACED WITH LIST_ZIP IN CMAKE 3.17
+FOREACH(ARCH IN LISTS SUPPORTED_AMD_ARCHS)
+  LIST(FIND SUPPORTED_AMD_ARCHS ${ARCH} LIST_INDEX)
+  LIST(GET SUPPORTED_AMD_GPUS ${LIST_INDEX} GPU)
+  LIST(GET CORRESPONDING_AMD_FLAGS ${LIST_INDEX} FLAG)
+  KOKKOS_ARCH_OPTION(${ARCH}         GPU  "AMD GPU ${GPU} ${FLAG}"      "KOKKOS_SHOW_HIP_ARCHS")
+ENDFOREACH()
+
+IF(Kokkos_ENABLE_SYCL OR Kokkos_ENABLE_OPENMPTARGET)
   SET(KOKKOS_SHOW_SYCL_ARCHS ON)
 ENDIF()
 
@@ -137,7 +147,7 @@ IF(KOKKOS_ENABLE_COMPILER_WARNINGS)
 
   SET(GNU_WARNINGS "-Wempty-body" "-Wclobbered" "-Wignored-qualifiers"
     ${COMMON_WARNINGS})
-  IF(KOKKOS_CXX_COMPILER_ID STREQUAL GNU AND KOKKOS_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7)
+  IF(KOKKOS_CXX_COMPILER_ID STREQUAL GNU)
     LIST(APPEND GNU_WARNINGS "-Wimplicit-fallthrough")
   ENDIF()
 
@@ -160,9 +170,7 @@ GLOBAL_SET(KOKKOS_CUDA_OPTIONS)
 IF (KOKKOS_ENABLE_CUDA_LAMBDA)
   IF(KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA)
     GLOBAL_APPEND(KOKKOS_CUDA_OPTIONS "-expt-extended-lambda")
-    IF(KOKKOS_COMPILER_CUDA_VERSION GREATER_EQUAL 110)
-      GLOBAL_APPEND(KOKKOS_CUDA_OPTIONS "-Wext-lambda-captures-this")
-    ENDIF()
+    GLOBAL_APPEND(KOKKOS_CUDA_OPTIONS "-Wext-lambda-captures-this")
   ENDIF()
 ENDIF()
 
@@ -200,9 +208,6 @@ IF (KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA)
     GLOBAL_APPEND(KOKKOS_CUDA_OPTIONS -lineinfo)
   ENDIF()
   UNSET(_UPPERCASE_CMAKE_BUILD_TYPE)
-  IF (KOKKOS_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0 AND KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 10.0)
-    GLOBAL_APPEND(KOKKOS_CUDAFE_OPTIONS --diag_suppress=esa_on_defaulted_function_ignored)
-  ENDIF()
 ENDIF()
 
 
@@ -221,6 +226,10 @@ ENDIF()
 
 
 IF(KOKKOS_ARCH_NATIVE)
+  IF(KOKKOS_CXX_HOST_COMPILER_ID STREQUAL "MSVC")
+    MESSAGE(FATAL_ERROR "MSVC doesn't support ARCH_NATIVE!")
+  ENDIF()
+
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
     DEFAULT -march=native -mtune=native
@@ -231,6 +240,7 @@ IF (KOKKOS_ARCH_ARMV80)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
     Cray    NO-VALUE-SPECIFIED
+    MSVC    /arch:armv8.0
     NVHPC   NO-VALUE-SPECIFIED
     DEFAULT -march=armv8-a
   )
@@ -240,6 +250,7 @@ IF (KOKKOS_ARCH_ARMV81)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
     Cray    NO-VALUE-SPECIFIED
+    MSVC    /arch:armv8.1
     NVHPC   NO-VALUE-SPECIFIED
     DEFAULT -march=armv8.1-a
   )
@@ -250,6 +261,7 @@ IF (KOKKOS_ARCH_ARMV8_THUNDERX)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
     Cray    NO-VALUE-SPECIFIED
+    MSVC    /arch:armv8.0
     NVHPC   NO-VALUE-SPECIFIED
     DEFAULT -march=armv8-a -mtune=thunderx
   )
@@ -260,6 +272,7 @@ IF (KOKKOS_ARCH_ARMV8_THUNDERX2)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
     Cray    NO-VALUE-SPECIFIED
+    MSVC    /arch:armv8.1
     NVHPC   NO-VALUE-SPECIFIED
     DEFAULT -mcpu=thunderx2t99 -mtune=thunderx2t99
   )
@@ -268,10 +281,11 @@ ENDIF()
 IF (KOKKOS_ARCH_A64FX)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
-    NVHPC   NO-VALUE-SPECIFIED
-    DEFAULT -march=armv8.2-a+sve
     Clang   -march=armv8.2-a+sve -msve-vector-bits=512
     GNU     -march=armv8.2-a+sve -msve-vector-bits=512
+    MSVC    NO-VALUE-SPECIFIED
+    NVHPC   NO-VALUE-SPECIFIED
+    DEFAULT -march=armv8.2-a+sve
   )
 ENDIF()
 
@@ -279,6 +293,7 @@ IF (KOKKOS_ARCH_ZEN)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
     Intel   -mavx2
+    MSVC    /arch:AVX2
     NVHPC   -tp=zen
     DEFAULT -march=znver1 -mtune=znver1
   )
@@ -290,6 +305,7 @@ IF (KOKKOS_ARCH_ZEN2)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
     Intel   -mavx2
+    MSVC    /arch:AVX2
     NVHPC   -tp=zen2
     DEFAULT -march=znver2 -mtune=znver2
   )
@@ -301,6 +317,7 @@ IF (KOKKOS_ARCH_ZEN3)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
     Intel   -mavx2
+    MSVC    /arch:AVX2
     NVHPC   -tp=zen2
     DEFAULT -march=znver3 -mtune=znver3
   )
@@ -311,9 +328,10 @@ ENDIF()
 IF (KOKKOS_ARCH_WSM)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
+    Cray    NO-VALUE-SPECIFIED
     Intel   -xSSE4.2
+    MSVC    NO-VALUE-SPECIFIED
     NVHPC   -tp=px
-    Cray    NO-VALUE-SPECIFIED
     DEFAULT -msse4.2
   )
   SET(KOKKOS_ARCH_SSE42 ON)
@@ -323,9 +341,10 @@ IF (KOKKOS_ARCH_SNB OR KOKKOS_ARCH_AMDAVX)
   SET(KOKKOS_ARCH_AVX ON)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
+    Cray    NO-VALUE-SPECIFIED
     Intel   -mavx
+    MSVC    /arch:AVX
     NVHPC   -tp=sandybridge
-    Cray    NO-VALUE-SPECIFIED
     DEFAULT -mavx
   )
 ENDIF()
@@ -334,9 +353,10 @@ IF (KOKKOS_ARCH_HSW)
   SET(KOKKOS_ARCH_AVX2 ON)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
+    Cray    NO-VALUE-SPECIFIED
     Intel   -xCORE-AVX2
+    MSVC    /arch:AVX2
     NVHPC   -tp=haswell
-    Cray    NO-VALUE-SPECIFIED
     DEFAULT -march=core-avx2 -mtune=core-avx2
   )
 ENDIF()
@@ -345,9 +365,10 @@ IF (KOKKOS_ARCH_BDW)
   SET(KOKKOS_ARCH_AVX2 ON)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
+    Cray    NO-VALUE-SPECIFIED
     Intel   -xCORE-AVX2
+    MSVC    /arch:AVX2
     NVHPC   -tp=haswell
-    Cray    NO-VALUE-SPECIFIED
     DEFAULT -march=core-avx2 -mtune=core-avx2 -mrtm
   )
 ENDIF()
@@ -357,9 +378,10 @@ IF (KOKKOS_ARCH_KNL)
   SET(KOKKOS_ARCH_AVX512MIC ON) #not a cache variable
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
+    Cray    NO-VALUE-SPECIFIED
     Intel   -xMIC-AVX512
+    MSVC    /arch:AVX512
     NVHPC   -tp=knl
-    Cray    NO-VALUE-SPECIFIED
     DEFAULT -march=knl -mtune=knl
   )
 ENDIF()
@@ -367,6 +389,7 @@ ENDIF()
 IF (KOKKOS_ARCH_KNC)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
+    MSVC    NO-VALUE-SPECIFIED
     DEFAULT -mmic
   )
 ENDIF()
@@ -374,9 +397,10 @@ ENDIF()
 IF (KOKKOS_ARCH_SKL)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
+    Cray    NO-VALUE-SPECIFIED
     Intel   -xSKYLAKE
+    MSVC    /arch:AVX2
     NVHPC   -tp=skylake
-    Cray    NO-VALUE-SPECIFIED
     DEFAULT -march=skylake -mtune=skylake
   )
 ENDIF()
@@ -386,9 +410,10 @@ IF (KOKKOS_ARCH_SKX)
   SET(KOKKOS_ARCH_AVX512XEON ON)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
+    Cray    NO-VALUE-SPECIFIED
     Intel   -xCORE-AVX512
+    MSVC    /arch:AVX512
     NVHPC   -tp=skylake
-    Cray    NO-VALUE-SPECIFIED
     DEFAULT -march=skylake-avx512 -mtune=skylake-avx512
   )
 ENDIF()
@@ -397,6 +422,7 @@ IF (KOKKOS_ARCH_ICL)
   SET(KOKKOS_ARCH_AVX512XEON ON)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
+    MSVC    /arch:AVX512
     DEFAULT -march=icelake-client -mtune=icelake-client
   )
 ENDIF()
@@ -405,6 +431,7 @@ IF (KOKKOS_ARCH_ICX)
   SET(KOKKOS_ARCH_AVX512XEON ON)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
+    MSVC    /arch:AVX512
     DEFAULT -march=icelake-server -mtune=icelake-server
   )
 ENDIF()
@@ -413,6 +440,7 @@ IF (KOKKOS_ARCH_SPR)
   SET(KOKKOS_ARCH_AVX512XEON ON)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
+    MSVC    /arch:AVX512
     DEFAULT -march=sapphirerapids -mtune=sapphirerapids
   )
 ENDIF()
@@ -420,6 +448,7 @@ ENDIF()
 IF (KOKKOS_ARCH_POWER7)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
+    MSVC    NO-VALUE-SPECIFIED
     NVHPC   NO-VALUE-SPECIFIED
     DEFAULT -mcpu=power7 -mtune=power7
   )
@@ -428,6 +457,7 @@ ENDIF()
 IF (KOKKOS_ARCH_POWER8)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
+    MSVC    NO-VALUE-SPECIFIED
     NVHPC   -tp=pwr8
     DEFAULT -mcpu=power8 -mtune=power8
   )
@@ -436,21 +466,24 @@ ENDIF()
 IF (KOKKOS_ARCH_POWER9)
   COMPILER_SPECIFIC_FLAGS(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
+    MSVC    NO-VALUE-SPECIFIED
     NVHPC   -tp=pwr9
     DEFAULT -mcpu=power9 -mtune=power9
   )
 ENDIF()
 
-IF (KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE)
-  COMPILER_SPECIFIC_FLAGS(
-    Clang  -fcuda-rdc
-    NVIDIA --relocatable-device-code=true
-    NVHPC -gpu=rdc
-  )
-ELSEIF(KOKKOS_ENABLE_CUDA)
-  COMPILER_SPECIFIC_FLAGS(
-    NVHPC -gpu=nordc
-  )
+IF (NOT KOKKOS_COMPILE_LANGUAGE STREQUAL CUDA)
+  IF (KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE)
+      COMPILER_SPECIFIC_FLAGS(
+        Clang  -fcuda-rdc
+        NVIDIA --relocatable-device-code=true
+        NVHPC -gpu=rdc
+      )
+  ELSEIF(KOKKOS_ENABLE_CUDA)
+    COMPILER_SPECIFIC_FLAGS(
+      NVHPC -gpu=nordc
+    )
+  ENDIF()
 ENDIF()
 
 # Clang needs mcx16 option enabled for Windows atomic functions
@@ -461,7 +494,7 @@ IF (CMAKE_CXX_COMPILER_ID STREQUAL Clang AND WIN32)
 ENDIF()
 
 # MSVC ABI has many deprecation warnings, so ignore them
-IF (CMAKE_CXX_COMPILER_ID STREQUAL MSVC OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+IF (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
   COMPILER_SPECIFIC_DEFS(
     Clang _CRT_SECURE_NO_WARNINGS
   )
@@ -544,6 +577,8 @@ CHECK_CUDA_ARCH(VOLTA72   sm_72)
 CHECK_CUDA_ARCH(TURING75  sm_75)
 CHECK_CUDA_ARCH(AMPERE80  sm_80)
 CHECK_CUDA_ARCH(AMPERE86  sm_86)
+CHECK_CUDA_ARCH(ADA89     sm_89)
+CHECK_CUDA_ARCH(HOPPER90  sm_90)
 
 SET(AMDGPU_ARCH_ALREADY_SPECIFIED "")
 FUNCTION(CHECK_AMDGPU_ARCH ARCH FLAG)
@@ -567,26 +602,17 @@ ENDFUNCTION()
 
 #These will define KOKKOS_AMDGPU_ARCH_FLAG
 #to the corresponding flag name if ON
-CHECK_AMDGPU_ARCH(VEGA900 gfx900) # Radeon Instinct MI25
-CHECK_AMDGPU_ARCH(VEGA906 gfx906) # Radeon Instinct MI50 and MI60
-CHECK_AMDGPU_ARCH(VEGA908 gfx908) # Radeon Instinct MI100
-CHECK_AMDGPU_ARCH(VEGA90A gfx90a) # Radeon Instinct MI200
+FOREACH(ARCH IN LISTS SUPPORTED_AMD_ARCHS)
+  LIST(FIND SUPPORTED_AMD_ARCHS ${ARCH} LIST_INDEX)
+  LIST(GET CORRESPONDING_AMD_FLAGS ${LIST_INDEX} FLAG)
+  CHECK_AMDGPU_ARCH(${ARCH} ${FLAG})
+ENDFOREACH()
 
-IF(KOKKOS_ENABLE_HIP AND NOT AMDGPU_ARCH_ALREADY_SPECIFIED)
-  IF(KOKKOS_CXX_COMPILER_ID STREQUAL HIPCC)
-    FIND_PROGRAM(ROCM_ENUMERATOR rocm_agent_enumerator)
-    EXECUTE_PROCESS(COMMAND ${ROCM_ENUMERATOR} OUTPUT_VARIABLE GPU_ARCHS)
-    STRING(LENGTH "${GPU_ARCHS}" len_str)
-    # enumerator always output gfx000 as the first line
-    IF(${len_str} LESS 8)
-      MESSAGE(SEND_ERROR "HIP enabled but no AMD GPU architecture currently enabled. "
-                         "Please enable one AMD GPU architecture via -DKokkos_ARCH_{..}=ON'.")
-    ENDIF()
-  ELSE()
-    MESSAGE(SEND_ERROR "HIP enabled but no AMD GPU architecture currently enabled. "
-                       "Please enable one AMD GPU architecture via -DKokkos_ARCH_{..}=ON'.")
-  ENDIF()
-ENDIF()
+MACRO(SET_AND_CHECK_AMD_ARCH ARCH FLAG)
+  KOKKOS_SET_OPTION(ARCH_${ARCH} ON)
+  CHECK_AMDGPU_ARCH(${ARCH} ${FLAG})
+  LIST(APPEND KOKKOS_ENABLED_ARCH_LIST ${ARCH})
+ENDMACRO()
 
 MACRO(CHECK_MULTIPLE_INTEL_ARCH)
   IF(KOKKOS_ARCH_INTEL_GPU)
@@ -623,7 +649,6 @@ IF (KOKKOS_ENABLE_OPENMPTARGET)
     STRING(REPLACE "sm_" "cc" NVHPC_CUDA_ARCH ${CLANG_CUDA_ARCH})
     COMPILER_SPECIFIC_FLAGS(
       Clang -Xopenmp-target -march=${CLANG_CUDA_ARCH} -fopenmp-targets=nvptx64
-      XL    -qtgtarch=${KOKKOS_CUDA_ARCH_FLAG}
       NVHPC -gpu=${NVHPC_CUDA_ARCH}
     )
   ENDIF()
@@ -655,11 +680,11 @@ IF (KOKKOS_ENABLE_OPENMPTARGET)
     )
   ELSEIF(KOKKOS_ARCH_INTEL_XEHP)
     COMPILER_SPECIFIC_FLAGS(
-      IntelLLVM -fopenmp-targets=spir64_gen -Xopenmp-target-backend "-device xehp" -D__STRICT_ANSI__
+      IntelLLVM -fopenmp-targets=spir64_gen -Xopenmp-target-backend "-device 12.50.4" -D__STRICT_ANSI__
     )
   ELSEIF(KOKKOS_ARCH_INTEL_PVC)
     COMPILER_SPECIFIC_FLAGS(
-      IntelLLVM -fopenmp-targets=spir64_gen -Xopenmp-target-backend "-device 12.4.0" -D__STRICT_ANSI__
+      IntelLLVM -fopenmp-targets=spir64_gen -Xopenmp-target-backend "-device 12.60.7" -D__STRICT_ANSI__
     )
   ENDIF()
 ENDIF()
@@ -708,11 +733,11 @@ IF (KOKKOS_ENABLE_SYCL)
     )
   ELSEIF(KOKKOS_ARCH_INTEL_XEHP)
     COMPILER_SPECIFIC_FLAGS(
-      DEFAULT -fsycl-targets=spir64_gen -Xsycl-target-backend "-device xehp"
+      DEFAULT -fsycl-targets=spir64_gen -Xsycl-target-backend "-device 12.50.4"
     )
   ELSEIF(KOKKOS_ARCH_INTEL_PVC)
     COMPILER_SPECIFIC_FLAGS(
-      DEFAULT -fsycl-targets=spir64_gen -Xsycl-target-backend "-device 12.4.0"
+      DEFAULT -fsycl-targets=spir64_gen -Xsycl-target-backend "-device 12.60.7"
     )
   ENDIF()
 ENDIF()
@@ -752,8 +777,8 @@ IF(KOKKOS_ENABLE_CUDA AND NOT CUDA_ARCH_ALREADY_SPECIFIED)
     IF(CMAKE_CUDA_COMPILER)
       # copy our test to .cu so cmake compiles as CUDA
       CONFIGURE_FILE(
-        ${PROJECT_SOURCE_DIR}/cmake/compile_tests/cuda_compute_capability.cc
-        ${PROJECT_BINARY_DIR}/compile_tests/cuda_compute_capability.cu
+        ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compile_tests/cuda_compute_capability.cc
+        ${CMAKE_CURRENT_BINARY_DIR}/compile_tests/cuda_compute_capability.cu
         COPYONLY
       )
       # run test again
@@ -761,7 +786,7 @@ IF(KOKKOS_ENABLE_CUDA AND NOT CUDA_ARCH_ALREADY_SPECIFIED)
         _RESULT
         _COMPILE_RESULT
         ${_BINARY_TEST_DIR}
-        ${PROJECT_BINARY_DIR}/compile_tests/cuda_compute_capability.cu
+        ${CMAKE_CURRENT_BINARY_DIR}/compile_tests/cuda_compute_capability.cu
         COMPILE_DEFINITIONS -DSM_ONLY
         RUN_OUTPUT_VARIABLE _CUDA_COMPUTE_CAPABILITY)
     ENDIF()
@@ -806,11 +831,62 @@ IF (KOKKOS_ARCH_AMPERE80 OR KOKKOS_ARCH_AMPERE86)
   SET(KOKKOS_ARCH_AMPERE ON)
 ENDIF()
 
-#Regardless of version, make sure we define the general architecture name
-IF (KOKKOS_ARCH_VEGA900 OR KOKKOS_ARCH_VEGA906 OR KOKKOS_ARCH_VEGA908 OR KOKKOS_ARCH_VEGA90A)
-  SET(KOKKOS_ARCH_VEGA ON)
+IF (KOKKOS_ARCH_HOPPER90)
+  SET(KOKKOS_ARCH_HOPPER ON)
 ENDIF()
 
+#HIP detection of gpu arch
+IF(KOKKOS_ENABLE_HIP AND NOT AMDGPU_ARCH_ALREADY_SPECIFIED)
+  FIND_PROGRAM(ROCM_ENUMERATOR rocm_agent_enumerator)
+  IF(NOT ROCM_ENUMERATOR)
+    MESSAGE(FATAL_ERROR "Autodetection of AMD GPU architecture not possible as "
+      "rocm_agent_enumerator could not be found. "
+      "Please specify an arch manually via -DKokkos_ARCH_{..}=ON")
+  ELSE()
+    EXECUTE_PROCESS(COMMAND ${ROCM_ENUMERATOR} OUTPUT_VARIABLE GPU_ARCHS)
+    STRING(LENGTH "${GPU_ARCHS}" len_str)
+    # enumerator always output gfx000 as the first line
+    IF(${len_str} LESS 8)
+      MESSAGE(SEND_ERROR "HIP enabled but no AMD GPU architecture could be automatically detected. "
+                         "Please manually specify one AMD GPU architecture via -DKokkos_ARCH_{..}=ON'.")
+    # check for known gpu archs, otherwise error out
+    ELSE()
+      SET(AMD_ARCH_DETECTED "")
+      FOREACH(ARCH IN LISTS SUPPORTED_AMD_ARCHS)
+        LIST(FIND SUPPORTED_AMD_ARCHS ${ARCH} LIST_INDEX)
+        LIST(GET CORRESPONDING_AMD_FLAGS ${LIST_INDEX} FLAG)
+        STRING(REGEX MATCH "(${FLAG})" DETECTED_GPU_ARCH ${GPU_ARCHS})
+        IF("${DETECTED_GPU_ARCH}" STREQUAL "${FLAG}")
+          SET_AND_CHECK_AMD_ARCH(${ARCH} ${FLAG})
+          SET(AMD_ARCH_DETECTED ${ARCH})
+          BREAK()
+        ENDIF()
+      ENDFOREACH()
+      IF("${AMD_ARCH_DETECTED}" STREQUAL "")
+        MESSAGE(FATAL_ERROR "HIP enabled but no automatically detected AMD GPU architecture "
+         "is supported. "
+         "Please manually specify one AMD GPU architecture via -DKokkos_ARCH_{..}=ON'.")
+      ENDIF()
+    ENDIF()
+  ENDIF()
+ENDIF()
+
+#Regardless of version, make sure we define the general architecture name
+FOREACH(ARCH IN LISTS SUPPORTED_AMD_ARCHS)
+  IF (KOKKOS_ARCH_${ARCH})
+    STRING(REGEX MATCH "(VEGA)" IS_VEGA ${ARCH})
+    IF(IS_VEGA)
+      SET(KOKKOS_ARCH_VEGA ON)
+      BREAK()
+    ENDIF()
+    STRING(REGEX MATCH "(NAVI)" IS_NAVI ${ARCH})
+    IF(IS_NAVI)
+      SET(KOKKOS_ARCH_NAVI ON)
+      BREAK()
+    ENDIF()
+  ENDIF()
+ENDFOREACH()
+
 #CMake verbose is kind of pointless
 #Let's just always print things
 MESSAGE(STATUS "Built-in Execution Spaces:")
@@ -826,11 +902,19 @@ FOREACH (_BACKEND Cuda OpenMPTarget HIP SYCL OpenACC)
     ENDIF()
     IF (${_BACKEND} STREQUAL "Cuda")
        IF(KOKKOS_ENABLE_CUDA_UVM)
-          SET(_DEFAULT_DEVICE_MEMSPACE "Kokkos::${_BACKEND}UVMSpace")
+          MESSAGE(DEPRECATION "Setting Kokkos_ENABLE_CUDA_UVM is deprecated - use the portable Kokkos::SharedSpace as an explicit memory space in your code instead")
+          IF(KOKKOS_ENABLE_DEPRECATED_CODE_4)
+            SET(_DEFAULT_DEVICE_MEMSPACE "Kokkos::${_BACKEND}UVMSpace")
+          ELSE()
+            MESSAGE(FATAL_ERROR "Kokkos_ENABLE_DEPRECATED_CODE_4 must be set to use Kokkos_ENABLE_CUDA_UVM")
+          ENDIF()
        ELSE()
           SET(_DEFAULT_DEVICE_MEMSPACE "Kokkos::${_BACKEND}Space")
        ENDIF()
        SET(_DEVICE_PARALLEL "Kokkos::${_BACKEND}")
+    ELSEIF(${_BACKEND} STREQUAL "HIP")
+       SET(_DEFAULT_DEVICE_MEMSPACE "Kokkos::${_BACKEND}Space")
+       SET(_DEVICE_PARALLEL "Kokkos::${_BACKEND}")
     ELSE()
        SET(_DEFAULT_DEVICE_MEMSPACE "Kokkos::Experimental::${_BACKEND}Space")
        SET(_DEVICE_PARALLEL "Kokkos::Experimental::${_BACKEND}")
diff --git a/packages/kokkos/cmake/kokkos_compiler_id.cmake b/packages/kokkos/cmake/kokkos_compiler_id.cmake
index b9fe2ffab0bd200a497f4a504ee24ed7f6990a67..27a3102a6b524fbecb83c21fef477a234a32fec1 100644
--- a/packages/kokkos/cmake/kokkos_compiler_id.cmake
+++ b/packages/kokkos/cmake/kokkos_compiler_id.cmake
@@ -147,49 +147,66 @@ ENDIF()
 
 # Enforce the minimum compilers supported by Kokkos.
 SET(KOKKOS_MESSAGE_TEXT "Compiler not supported by Kokkos.  Required compiler versions:")
-SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    Clang        4.0.0 or higher")
-SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    GCC          5.3.0 or higher")
-SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    Intel       17.0.0 or higher")
-SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    IntelLLVM 2022.0.0 or higher")
-SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    NVCC        9.2.88 or higher")
-SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    HIPCC        4.5.0 or higher")
-SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    PGI           17.4 or higher")
+SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    Clang(CPU)         8.0.0 or higher")
+SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    Clang(CUDA)       10.0.0 or higher")
+SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    GCC                8.2.0 or higher")
+SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    Intel             19.0.5 or higher")
+SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    IntelLLVM(CPU)  2021.1.1 or higher")
+SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    IntelLLVM(SYCL) 2022.0.0 or higher") #FIXME
+SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    NVCC              11.0.0 or higher")
+SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    HIPCC              5.2.0 or higher")
+SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    NVHPC/PGI           22.3 or higher")
+SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    MSVC               19.29 or higher")
+SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    XL/XLClang           not supported")
 SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\nCompiler: ${KOKKOS_CXX_COMPILER_ID} ${KOKKOS_CXX_COMPILER_VERSION}\n")
 
-IF(KOKKOS_CXX_COMPILER_ID STREQUAL Clang)
-  IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 4.0.0)
+IF(KOKKOS_CXX_COMPILER_ID STREQUAL Clang AND NOT Kokkos_ENABLE_CUDA)
+  IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 8.0.0)
+    MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}")
+  ENDIF()
+ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL Clang AND Kokkos_ENABLE_CUDA)
+  IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 10.0.0)
     MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}")
   ENDIF()
 ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL GNU)
-  IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 5.3.0)
+  IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 8.2.0)
     MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}")
   ENDIF()
 ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL Intel)
-  IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 17.0.0)
+  IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 19.0.5)
+    MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}")
+  ENDIF()
+ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM AND NOT Kokkos_ENABLE_SYCL)
+  IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 2021.1.1)
     MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}")
   ENDIF()
 ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM AND Kokkos_ENABLE_SYCL)
-  IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 2022.0.0)
+  IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 2022.0.0) #FIXME 2022.2.0
     MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}")
   ENDIF()
 ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA)
-  IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 9.2.88)
+  IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 11.0.0)
     MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}")
   ENDIF()
   SET(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Kokkos turns off CXX extensions" FORCE)
 ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL HIPCC)
-  # Note that ROCm 4.5 reports as version 4.4
-  IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 4.4.0)
+  IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 5.2.0)
     MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}")
   ENDIF()
-ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL PGI)
-  IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 17.4)
+ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL PGI OR KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC)
+  IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 22.3)
     MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}")
   ENDIF()
   # Treat PGI internally as NVHPC to simplify handling both compilers.
   # Before CMake 3.20 NVHPC was identified as PGI, nvc++ is
   # backward-compatible to pgc++.
   SET(KOKKOS_CXX_COMPILER_ID NVHPC CACHE STRING INTERNAL FORCE)
+ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL "MSVC")
+  IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 19.29)
+    MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}")
+  ENDIF()
+ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL XL OR KOKKOS_CXX_COMPILER_ID STREQUAL XLClang)
+  MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}")
 ENDIF()
 
 IF(NOT DEFINED KOKKOS_CXX_HOST_COMPILER_ID)
@@ -201,4 +218,12 @@ ENDIF()
 STRING(REPLACE "." ";" VERSION_LIST ${KOKKOS_CXX_COMPILER_VERSION})
 LIST(GET VERSION_LIST 0 KOKKOS_COMPILER_VERSION_MAJOR)
 LIST(GET VERSION_LIST 1 KOKKOS_COMPILER_VERSION_MINOR)
-LIST(GET VERSION_LIST 2 KOKKOS_COMPILER_VERSION_PATCH)
+LIST(LENGTH VERSION_LIST LIST_LENGTH)
+
+# On Android, the compiler doesn't have a patch version, just a major/minor
+IF(LIST_LENGTH GREATER 2)
+  LIST(GET VERSION_LIST 2 KOKKOS_COMPILER_VERSION_PATCH)
+ELSE()
+  SET(KOKKOS_COMPILER_VERSION_PATCH 0)
+ENDIF()
+
diff --git a/packages/kokkos/cmake/kokkos_corner_cases.cmake b/packages/kokkos/cmake/kokkos_corner_cases.cmake
index a84ac2b63027e7112cb3a7b76e5e9a7b8fc892e3..ede2b4e0caf8661ece061c19eb81ae501082b73e 100644
--- a/packages/kokkos/cmake/kokkos_corner_cases.cmake
+++ b/packages/kokkos/cmake/kokkos_corner_cases.cmake
@@ -1,62 +1,4 @@
-IF(KOKKOS_CXX_COMPILER_ID STREQUAL Clang AND KOKKOS_ENABLE_OPENMP AND NOT KOKKOS_CLANG_IS_CRAY AND NOT KOKKOS_COMPILER_CLANG_MSVC)
-  # The clang "version" doesn't actually tell you what runtimes and tools
-  # were built into Clang. We should therefore make sure that libomp
-  # was actually built into Clang. Otherwise the user will get nonsensical
-  # errors when they try to build.
-
-  #Try compile is the height of CMake nonsense
-  #I can't just give it compiler and link flags
-  #I have to hackily pretend that compiler flags are compiler definitions
-  #and that linker flags are libraries
-  #also - this is easier to use than CMakeCheckCXXSourceCompiles
-  TRY_COMPILE(CLANG_HAS_OMP
-    ${KOKKOS_TOP_BUILD_DIR}/corner_cases
-    ${KOKKOS_SOURCE_DIR}/cmake/compile_tests/clang_omp.cpp
-    COMPILE_DEFINITIONS -fopenmp=libomp
-    LINK_LIBRARIES -fopenmp=libomp
-  )
-  IF (NOT CLANG_HAS_OMP)
-    UNSET(CLANG_HAS_OMP CACHE) #make sure CMake always re-runs this
-    MESSAGE(FATAL_ERROR "Clang failed OpenMP check. You have requested -DKokkos_ENABLE_OPENMP=ON, but the Clang compiler does not appear to have been built with OpenMP support")
-  ENDIF()
-  UNSET(CLANG_HAS_OMP CACHE) #make sure CMake always re-runs this
-ENDIF()
-
-IF(KOKKOS_CXX_COMPILER_ID STREQUAL AppleClang AND KOKKOS_ENABLE_OPENMP)
-  # The clang "version" doesn't actually tell you what runtimes and tools
-  # were built into Clang. We should therefore make sure that libomp
-  # was actually built into Clang. Otherwise the user will get nonsensical
-  # errors when they try to build.
-
-  #Try compile is the height of CMake nonsense
-  #I can't just give it compiler and link flags
-  #I have to hackily pretend that compiler flags are compiler definitions
-  #and that linker flags are libraries
-  #also - this is easier to use than CMakeCheckCXXSourceCompiles
-  TRY_COMPILE(APPLECLANG_HAS_OMP
-    ${KOKKOS_TOP_BUILD_DIR}/corner_cases
-    ${KOKKOS_SOURCE_DIR}/cmake/compile_tests/clang_omp.cpp
-    COMPILE_DEFINITIONS -Xpreprocessor -fopenmp
-    LINK_LIBRARIES -lomp
-  )
-  IF (NOT APPLECLANG_HAS_OMP)
-    UNSET(APPLECLANG_HAS_OMP CACHE) #make sure CMake always re-runs this
-    MESSAGE(FATAL_ERROR "AppleClang failed OpenMP check. You have requested -DKokkos_ENABLE_OPENMP=ON, but the AppleClang compiler does not appear to have been built with OpenMP support")
-  ENDIF()
-  UNSET(APPLECLANG_HAS_OMP CACHE) #make sure CMake always re-runs this
-ENDIF()
-
-
-IF (KOKKOS_CXX_STANDARD STREQUAL 17)
-  IF (KOKKOS_CXX_COMPILER_ID STREQUAL GNU AND KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 7)
-    MESSAGE(FATAL_ERROR "You have requested C++17 support for GCC ${KOKKOS_CXX_COMPILER_VERSION}. Although CMake has allowed this and GCC accepts -std=c++1z/c++17, GCC < 7 does not properly support *this capture. Please reduce the C++ standard to 14 or upgrade the compiler if you do need C++17 support.")
-  ENDIF()
-
-  IF (KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA AND KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 11)
-    MESSAGE(FATAL_ERROR "You have requested C++17 support for NVCC ${KOKKOS_CXX_COMPILER_VERSION}. NVCC only supports C++17 from version 11 on. Please reduce the C++ standard to 14 or upgrade the compiler if you need C++17 support.")
-  ENDIF()
-  IF (KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA AND KOKKOS_ENABLE_CUDA_CONSTEXPR)
-    MESSAGE(WARNING "You have requested -DKokkos_ENABLE_CUDA_CONSTEXPR=ON with C++17 support for NVCC ${KOKKOS_CXX_COMPILER_VERSION} which is known to trigger compiler bugs. See https://github.com/kokkos/kokkos/issues/3496")
-  ENDIF()
+IF (KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA AND KOKKOS_ENABLE_CUDA_CONSTEXPR AND KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 11.2)
+  MESSAGE(WARNING "You have requested -DKokkos_ENABLE_CUDA_CONSTEXPR=ON for NVCC ${KOKKOS_CXX_COMPILER_VERSION} which is known to trigger compiler bugs before NVCC version 11.2. See https://github.com/kokkos/kokkos/issues/3496")
 ENDIF()
 
diff --git a/packages/kokkos/cmake/kokkos_enable_devices.cmake b/packages/kokkos/cmake/kokkos_enable_devices.cmake
index c7a454c214b0f974d357cb16324e9f4659e11d5f..d4a7744eb59b74a89059dfb421f470fca62e0b9e 100644
--- a/packages/kokkos/cmake/kokkos_enable_devices.cmake
+++ b/packages/kokkos/cmake/kokkos_enable_devices.cmake
@@ -20,13 +20,6 @@ KOKKOS_DEPRECATED_LIST(DEVICES ENABLE)
 
 
 KOKKOS_DEVICE_OPTION(THREADS OFF HOST "Whether to build C++ threads backend")
-IF(Kokkos_ENABLE_PTHREAD)  # for backward compatibility
-  SET(Kokkos_ENABLE_THREADS ON CACHE BOOL "Whether to build C++ threads backend" FORCE)
-  SET(KOKKOS_ENABLE_THREADS ON)
-  LIST(APPEND KOKKOS_ENABLED_DEVICES THREADS)
-  SET(KOKKOS_HAS_HOST ON)
-  MESSAGE(DEPRECATION "The Kokkos_ENABLE_PTHREAD option is deprecated. Use Kokkos_ENABLE_THREADS instead!")
-ENDIF()
 
 # detect clang++ / cl / clang-cl clashes
 IF (CMAKE_CXX_COMPILER_ID STREQUAL Clang AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
@@ -46,45 +39,6 @@ ELSE()
   SET(OMP_DEFAULT OFF)
 ENDIF()
 KOKKOS_DEVICE_OPTION(OPENMP ${OMP_DEFAULT} HOST "Whether to build OpenMP backend")
-IF(KOKKOS_ENABLE_OPENMP)
-  SET(ClangOpenMPFlag -fopenmp=libomp)
-  IF(KOKKOS_CLANG_IS_CRAY)
-    SET(ClangOpenMPFlag -fopenmp)
-  ENDIF()
-  IF(KOKKOS_COMPILER_CLANG_MSVC)
-    #for clang-cl expression /openmp yields an error, so directly add the specific Clang flag
-    SET(ClangOpenMPFlag /clang:-fopenmp=libomp)
-  ENDIF()
-  IF(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)
-    #link omp library from LLVM lib dir, no matter if it is clang-cl or clang++
-    get_filename_component(LLVM_BIN_DIR ${CMAKE_CXX_COMPILER_AR} DIRECTORY)
-    COMPILER_SPECIFIC_LIBS(Clang "${LLVM_BIN_DIR}/../lib/libomp.lib")
-  ENDIF()
-  IF(KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA)
-    COMPILER_SPECIFIC_FLAGS(
-      COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID
-      Clang      -Xcompiler ${ClangOpenMPFlag}
-      IntelLLVM  -Xcompiler -fiopenmp
-      NVHPC      -Xcompiler -mp
-      Cray       NO-VALUE-SPECIFIED
-      XL         -Xcompiler -qsmp=omp
-      DEFAULT    -Xcompiler -fopenmp
-    )
-  ELSE()
-    COMPILER_SPECIFIC_FLAGS(
-      Clang      ${ClangOpenMPFlag}
-      IntelLLVM  -fiopenmp
-      AppleClang -Xpreprocessor -fopenmp
-      NVHPC      -mp
-      Cray       NO-VALUE-SPECIFIED
-      XL         -qsmp=omp
-      DEFAULT    -fopenmp
-    )
-    COMPILER_SPECIFIC_LIBS(
-      AppleClang -lomp
-    )
-  ENDIF()
-ENDIF()
 
 KOKKOS_DEVICE_OPTION(OPENACC OFF DEVICE "Whether to build the OpenACC backend")
 
@@ -98,12 +52,10 @@ IF (KOKKOS_ENABLE_OPENMPTARGET)
   COMPILER_SPECIFIC_FLAGS(
     Clang      ${ClangOpenMPFlag} -Wno-openmp-mapping
     IntelLLVM  -fiopenmp -Wno-openmp-mapping
-    XL         -qsmp=omp -qoffload -qnoeh
     NVHPC      -mp=gpu
     DEFAULT    -fopenmp
   )
   COMPILER_SPECIFIC_DEFS(
-    XL    KOKKOS_IBM_XL_OMP45_WORKAROUND
     Clang KOKKOS_WORKAROUND_OPENMPTARGET_CLANG
   )
 # Are there compilers which identify as Clang and need this library?
diff --git a/packages/kokkos/cmake/kokkos_enable_options.cmake b/packages/kokkos/cmake/kokkos_enable_options.cmake
index ea606bb0c96c0051ef08c4d49de578a1ddca72c1..f9f1bc5a8b5170028de88341a9b3398823618629 100644
--- a/packages/kokkos/cmake/kokkos_enable_options.cmake
+++ b/packages/kokkos/cmake/kokkos_enable_options.cmake
@@ -34,11 +34,13 @@ KOKKOS_ENABLE_OPTION(CUDA_UVM             OFF "Whether to use unified memory (UM
 KOKKOS_ENABLE_OPTION(CUDA_LDG_INTRINSIC   OFF "Whether to use CUDA LDG intrinsics")
 # As of 08/12/2021 CudaMallocAsync causes issues if UCX is used as MPI communication layer.
 KOKKOS_ENABLE_OPTION(IMPL_CUDA_MALLOC_ASYNC      OFF  "Whether to enable CudaMallocAsync (requires CUDA Toolkit 11.2)")
-KOKKOS_ENABLE_OPTION(DEPRECATED_CODE_3    ON "Whether code deprecated in major release 3 is available" )
+KOKKOS_ENABLE_OPTION(DEPRECATED_CODE_3    OFF "Whether code deprecated in major release 3 is available" )
+KOKKOS_ENABLE_OPTION(DEPRECATED_CODE_4    ON "Whether code deprecated in major release 4 is available" )
 KOKKOS_ENABLE_OPTION(DEPRECATION_WARNINGS ON "Whether to emit deprecation warnings" )
 KOKKOS_ENABLE_OPTION(HIP_RELOCATABLE_DEVICE_CODE  OFF "Whether to enable relocatable device code (RDC) for HIP")
 KOKKOS_ENABLE_OPTION(HPX_ASYNC_DISPATCH   OFF "Whether HPX supports asynchronous dispatch")
 KOKKOS_ENABLE_OPTION(TESTS         OFF  "Whether to build the unit tests")
+KOKKOS_ENABLE_OPTION(BENCHMARKS    OFF  "Whether to build the benchmarks")
 KOKKOS_ENABLE_OPTION(EXAMPLES      OFF  "Whether to build the examples")
 STRING(TOUPPER "${CMAKE_BUILD_TYPE}" UPPERCASE_CMAKE_BUILD_TYPE)
 IF(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
@@ -63,13 +65,16 @@ KOKKOS_ENABLE_OPTION(HIP_MULTIPLE_KERNEL_INSTANTIATIONS OFF "Whether multiple ke
 KOKKOS_ENABLE_OPTION(IMPL_DESUL_ATOMICS   ON  "Whether to use desul based atomics - option only during beta")
 KOKKOS_ENABLE_OPTION(DESUL_ATOMICS_EXTERNAL OFF "Whether to use an external desul installation")
 
-IF (KOKKOS_ENABLE_CUDA)
-  SET(KOKKOS_COMPILER_CUDA_VERSION "${KOKKOS_COMPILER_VERSION_MAJOR}${KOKKOS_COMPILER_VERSION_MINOR}")
-ENDIF()
+KOKKOS_ENABLE_OPTION(IMPL_MDSPAN OFF "Whether to enable experimental mdspan support")
+KOKKOS_ENABLE_OPTION(MDSPAN_EXTERNAL OFF BOOL "Whether to use an external version of mdspan")
+KOKKOS_ENABLE_OPTION(IMPL_SKIP_COMPILER_MDSPAN OFF BOOL "Whether to use an internal version of mdspan even if the compiler supports mdspan")
+mark_as_advanced(Kokkos_ENABLE_IMPL_MDSPAN)
+mark_as_advanced(Kokkos_ENABLE_MDSPAN_EXTERNAL)
+mark_as_advanced(Kokkos_ENABLE_IMPL_SKIP_COMPILER_MDSPAN)
 
 IF (Trilinos_ENABLE_Kokkos AND TPL_ENABLE_CUDA)
   SET(CUDA_LAMBDA_DEFAULT ON)
-ELSEIF (KOKKOS_ENABLE_CUDA AND (KOKKOS_CXX_COMPILER_ID STREQUAL Clang))
+ELSEIF (KOKKOS_ENABLE_CUDA)
   SET(CUDA_LAMBDA_DEFAULT ON)
 ELSE()
   SET(CUDA_LAMBDA_DEFAULT OFF)
@@ -125,6 +130,23 @@ IF (KOKKOS_ENABLE_AGGRESSIVE_VECTORIZATION)
   SET(KOKKOS_OPT_RANGE_AGGRESSIVE_VECTORIZATION ON)
 ENDIF()
 
+# Force consistency of KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE
+# and CMAKE_CUDA_SEPARABLE_COMPILATION when we are compiling
+# using the CMake CUDA language support.
+# Either one being on will turn the other one on.
+IF (KOKKOS_COMPILE_LANGUAGE STREQUAL CUDA)
+  IF (KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE)
+    IF (NOT CMAKE_CUDA_SEPARABLE_COMPILATION)
+      MESSAGE(STATUS "Setting CMAKE_CUDA_SEPARABLE_COMPILATION=ON since Kokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE is true. When compiling Kokkos with CMake language CUDA, please use CMAKE_CUDA_SEPARABLE_COMPILATION to control RDC support")
+      SET(CMAKE_CUDA_SEPARABLE_COMPILATION ON)
+    ENDIF()
+  ELSE()
+    IF (CMAKE_CUDA_SEPARABLE_COMPILATION)
+      SET(KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE ON)
+    ENDIF()
+  ENDIF()
+ENDIF()
+
 # This is known to occur with Clang 9. We would need to use nvcc as the linker
 # http://lists.llvm.org/pipermail/cfe-dev/2018-June/058296.html
 # TODO: Through great effort we can use a different linker by hacking
@@ -136,3 +158,11 @@ ENDIF()
 IF (KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE AND BUILD_SHARED_LIBS)
   MESSAGE(FATAL_ERROR "Relocatable device code requires static libraries.")
 ENDIF()
+
+IF(Kokkos_ENABLE_CUDA_LDG_INTRINSIC)
+  IF(KOKKOS_ENABLE_DEPRECATED_CODE_4)
+    MESSAGE(DEPRECATION "Setting Kokkos_ENABLE_CUDA_LDG_INTRINSIC is deprecated. LDG intrinsics are always enabled.")
+  ELSE()
+    MESSAGE(FATAL_ERROR "Kokkos_ENABLE_CUDA_LDG_INTRINSIC has been removed. LDG intrinsics are always enabled.")
+  ENDIF()
+ENDIF()
diff --git a/packages/kokkos/cmake/kokkos_functions.cmake b/packages/kokkos/cmake/kokkos_functions.cmake
index 11fa9b302cc239939b792610543ad72cfd5befbd..55b1ebbf818ea0a972c069324c1f08d29010a51b 100644
--- a/packages/kokkos/cmake/kokkos_functions.cmake
+++ b/packages/kokkos/cmake/kokkos_functions.cmake
@@ -5,6 +5,9 @@
 # Validate options are given with correct case and define an internal
 # upper-case version for use within
 
+set(Kokkos_OPTIONS_NOT_TO_EXPORT
+  Kokkos_ENABLE_TESTS  Kokkos_ENABLE_EXAMPLES)
+
 #
 #
 # @FUNCTION: kokkos_deprecated_list
@@ -57,6 +60,12 @@ FUNCTION(kokkos_option CAMEL_SUFFIX DEFAULT TYPE DOCSTRING)
   # Make sure this appears in the cache with the appropriate DOCSTRING
   SET(${CAMEL_NAME} ${DEFAULT} CACHE ${TYPE} ${DOCSTRING})
 
+  IF (KOKKOS_HAS_TRILINOS)
+    IF (NOT CAMEL_NAME IN_LIST Kokkos_OPTIONS_NOT_TO_EXPORT)
+      TRIBITS_PKG_EXPORT_CACHE_VAR(${CAMEL_NAME})
+    ENDIF()
+  ENDIF()
+
   #I don't love doing it this way because it's N^2 in number options, but c'est la vie
   FOREACH(opt ${KOKKOS_GIVEN_VARIABLES})
     STRING(TOUPPER ${opt} OPT_UC)
@@ -281,7 +290,11 @@ MACRO(kokkos_import_tpl NAME)
       MESSAGE(FATAL_ERROR "Find module succeeded for ${NAME}, but did not produce valid target ${TPL_IMPORTED_NAME}")
     ENDIF()
     IF(NOT TPL_NO_EXPORT)
-      KOKKOS_EXPORT_IMPORTED_TPL(${TPL_IMPORTED_NAME})
+      GET_TARGET_PROPERTY(TPL_ORIGINAL_NAME ${TPL_IMPORTED_NAME} ALIASED_TARGET)
+      IF (NOT TPL_ORIGINAL_NAME)
+        SET(TPL_ORIGINAL_NAME ${TPL_IMPORTED_NAME})
+      ENDIF()
+      KOKKOS_EXPORT_IMPORTED_TPL(${TPL_ORIGINAL_NAME})
     ENDIF()
     LIST(APPEND KOKKOS_ENABLED_TPLS ${NAME})
   ENDIF()
@@ -823,7 +836,7 @@ FUNCTION(kokkos_link_tpl TARGET)
 ENDFUNCTION()
 
 FUNCTION(COMPILER_SPECIFIC_OPTIONS_HELPER)
-  SET(COMPILERS NVIDIA NVHPC XL XLClang DEFAULT Cray Intel Clang AppleClang IntelLLVM GNU HIPCC Fujitsu)
+  SET(COMPILERS NVIDIA NVHPC DEFAULT Cray Intel Clang AppleClang IntelLLVM GNU HIPCC Fujitsu MSVC)
   CMAKE_PARSE_ARGUMENTS(
     PARSE
     "LINK_OPTIONS;COMPILE_OPTIONS;COMPILE_DEFINITIONS;LINK_LIBRARIES"
diff --git a/packages/kokkos/cmake/kokkos_install.cmake b/packages/kokkos/cmake/kokkos_install.cmake
index ff66d015fb421632bd59a7ccc47a5db3de86a3c7..fb658239d8d82c568eff465f8d8839151896ff3b 100644
--- a/packages/kokkos/cmake/kokkos_install.cmake
+++ b/packages/kokkos/cmake/kokkos_install.cmake
@@ -19,7 +19,7 @@ IF (NOT KOKKOS_HAS_TRILINOS AND NOT Kokkos_INSTALL_TESTING)
 
   WRITE_BASIC_PACKAGE_VERSION_FILE("${Kokkos_BINARY_DIR}/KokkosConfigVersion.cmake"
       VERSION "${Kokkos_VERSION}"
-      COMPATIBILITY SameMajorVersion)
+      COMPATIBILITY AnyNewerVersion)
 
   # Install the KokkosConfig*.cmake files
   install(FILES
@@ -38,7 +38,7 @@ ELSE()
 
   WRITE_BASIC_PACKAGE_VERSION_FILE("${CMAKE_CURRENT_BINARY_DIR}/KokkosConfigVersion.cmake"
       VERSION "${Kokkos_VERSION}"
-      COMPATIBILITY SameMajorVersion)
+      COMPATIBILITY AnyNewerVersion)
 
   install(FILES ${CMAKE_CURRENT_BINARY_DIR}/KokkosConfigVersion.cmake
       DESTINATION "${${PROJECT_NAME}_INSTALL_LIB_DIR}/cmake/${PACKAGE_NAME}")
diff --git a/packages/kokkos/cmake/kokkos_pick_cxx_std.cmake b/packages/kokkos/cmake/kokkos_pick_cxx_std.cmake
index 03f1a0d18a9a47d96d9ef8926165f40df8a4856c..d4eca651d423fd7567b25ac8fdf8af6985dee050 100644
--- a/packages/kokkos/cmake/kokkos_pick_cxx_std.cmake
+++ b/packages/kokkos/cmake/kokkos_pick_cxx_std.cmake
@@ -1,46 +1,19 @@
 # From CMake 3.10 documentation
 
 #This can run at any time
-KOKKOS_OPTION(CXX_STANDARD "" STRING "[[DEPRECATED - USE CMAKE_CXX_STANDARD INSTEAD]] The C++ standard for Kokkos to use: 14, 17, or 20. If empty, this will default to CMAKE_CXX_STANDARD. If both CMAKE_CXX_STANDARD and Kokkos_CXX_STANDARD are empty, this will default to 14")
+KOKKOS_OPTION(CXX_STANDARD "" STRING "[[DEPRECATED - USE CMAKE_CXX_STANDARD INSTEAD]] The C++ standard for Kokkos to use: 17 or 20. If empty, this will default to CMAKE_CXX_STANDARD. If both CMAKE_CXX_STANDARD and Kokkos_CXX_STANDARD are empty, this will default to 17")
 
 # Set CXX standard flags
-SET(KOKKOS_ENABLE_CXX14 OFF)
 SET(KOKKOS_ENABLE_CXX17 OFF)
 SET(KOKKOS_ENABLE_CXX20 OFF)
+SET(KOKKOS_ENABLE_CXX23 OFF)
 IF (KOKKOS_CXX_STANDARD)
-  MESSAGE(DEPRECATION "Setting the variable Kokkos_CXX_STANDARD in configuration is deprecated - set CMAKE_CXX_STANDARD directly instead")
-
-  IF (${KOKKOS_CXX_STANDARD} STREQUAL "c++98")
-    MESSAGE(FATAL_ERROR "Kokkos no longer supports C++98 - minimum C++14")
-  ELSEIF (${KOKKOS_CXX_STANDARD} STREQUAL "c++11")
-    MESSAGE(FATAL_ERROR "Kokkos no longer supports C++11 - minimum C++14")
-  ELSEIF(${KOKKOS_CXX_STANDARD} STREQUAL "c++14")
-    MESSAGE(WARNING "Deprecated Kokkos C++ standard set as 'c++14'. Use '14' instead.")
-    SET(KOKKOS_CXX_STANDARD "14")
-  ELSEIF(${KOKKOS_CXX_STANDARD} STREQUAL "c++17")
-    MESSAGE(WARNING "Deprecated Kokkos C++ standard set as 'c++17'. Use '17' instead.")
-    SET(KOKKOS_CXX_STANDARD "17")
-  ELSEIF(${KOKKOS_CXX_STANDARD} STREQUAL "c++1y")
-    MESSAGE(WARNING "Deprecated Kokkos C++ standard set as 'c++1y'. Use '1Y' instead.")
-    SET(KOKKOS_CXX_STANDARD "1Y")
-  ELSEIF(${KOKKOS_CXX_STANDARD} STREQUAL "c++1z")
-    MESSAGE(WARNING "Deprecated Kokkos C++ standard set as 'c++1z'. Use '1Z' instead.")
-    SET(KOKKOS_CXX_STANDARD "1Z")
-  ELSEIF(${KOKKOS_CXX_STANDARD} STREQUAL "c++2a")
-    MESSAGE(WARNING "Deprecated Kokkos C++ standard set as 'c++2a'. Use '2A' instead.")
-    SET(KOKKOS_CXX_STANDARD "2A")
-  ENDIF()
+  MESSAGE(FATAL_ERROR "Setting the variable Kokkos_CXX_STANDARD in configuration is deprecated - set CMAKE_CXX_STANDARD directly instead")
 ENDIF()
 
-IF (NOT KOKKOS_CXX_STANDARD AND NOT CMAKE_CXX_STANDARD)
-  MESSAGE(STATUS "Setting default Kokkos CXX standard to 14")
-  SET(KOKKOS_CXX_STANDARD "14")
-ELSEIF(NOT KOKKOS_CXX_STANDARD)
-  MESSAGE(STATUS "Setting default Kokkos CXX standard to ${CMAKE_CXX_STANDARD}")
+IF (NOT CMAKE_CXX_STANDARD)
+  SET(KOKKOS_CXX_STANDARD "17")
+ELSE()
   SET(KOKKOS_CXX_STANDARD ${CMAKE_CXX_STANDARD})
 ENDIF()
-
-
-
-
-
+MESSAGE(STATUS "Setting default Kokkos CXX standard to ${KOKKOS_CXX_STANDARD}")
diff --git a/packages/kokkos/cmake/kokkos_test_cxx_std.cmake b/packages/kokkos/cmake/kokkos_test_cxx_std.cmake
index a5a8f40af813e3edf926eb00bafbb84fcc9c0311..5f8e15cd67373688d39338e630b82e74223ece77 100644
--- a/packages/kokkos/cmake/kokkos_test_cxx_std.cmake
+++ b/packages/kokkos/cmake/kokkos_test_cxx_std.cmake
@@ -29,7 +29,11 @@ FUNCTION(kokkos_set_cxx_standard_feature standard)
   ELSEIF(NOT KOKKOS_USE_CXX_EXTENSIONS AND ${STANDARD_NAME})
     MESSAGE(STATUS "Using ${${STANDARD_NAME}} for C++${standard} standard as feature")
     IF (KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA AND (KOKKOS_CXX_HOST_COMPILER_ID STREQUAL GNU OR KOKKOS_CXX_HOST_COMPILER_ID STREQUAL Clang))
-      SET(SUPPORTED_NVCC_FLAGS "-std=c++14;-std=c++17")
+      IF(${KOKKOS_CXX_COMPILER_VERSION} VERSION_LESS 12.0.0)
+        SET(SUPPORTED_NVCC_FLAGS "-std=c++17")
+      ELSE()
+        SET(SUPPORTED_NVCC_FLAGS "-std=c++17" "-std=c++20")
+      ENDIF()
       IF (NOT ${${STANDARD_NAME}} IN_LIST SUPPORTED_NVCC_FLAGS)
         MESSAGE(FATAL_ERROR "CMake wants to use ${${STANDARD_NAME}} which is not supported by NVCC. Using a more recent host compiler or a more recent CMake version might help.")
       ENDIF()
@@ -58,21 +62,7 @@ FUNCTION(kokkos_set_cxx_standard_feature standard)
   ENDIF()
 ENDFUNCTION()
 
-
-IF (KOKKOS_CXX_STANDARD AND CMAKE_CXX_STANDARD)
-  #make sure these are consistent
-  IF (NOT KOKKOS_CXX_STANDARD STREQUAL CMAKE_CXX_STANDARD)
-    MESSAGE(WARNING "Specified both CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} and KOKKOS_CXX_STANDARD=${KOKKOS_CXX_STANDARD}, but they don't match")
-    SET(CMAKE_CXX_STANDARD ${KOKKOS_CXX_STANDARD} CACHE STRING "C++ standard" FORCE)
-  ENDIF()
-ENDIF()
-
-
-IF(KOKKOS_CXX_STANDARD STREQUAL "14")
-  kokkos_set_cxx_standard_feature(14)
-  SET(KOKKOS_CXX_INTERMEDIATE_STANDARD "1Y")
-  SET(KOKKOS_ENABLE_CXX14 ON)
-ELSEIF(KOKKOS_CXX_STANDARD STREQUAL "17")
+IF(KOKKOS_CXX_STANDARD STREQUAL "17")
   kokkos_set_cxx_standard_feature(17)
   SET(KOKKOS_CXX_INTERMEDIATE_STANDARD "1Z")
   SET(KOKKOS_ENABLE_CXX17 ON)
@@ -80,34 +70,36 @@ ELSEIF(KOKKOS_CXX_STANDARD STREQUAL "20")
   kokkos_set_cxx_standard_feature(20)
   SET(KOKKOS_CXX_INTERMEDIATE_STANDARD "2A")
   SET(KOKKOS_ENABLE_CXX20 ON)
-ELSEIF(KOKKOS_CXX_STANDARD STREQUAL "98" OR KOKKOS_CXX_STANDARD STREQUAL "11")
-  MESSAGE(FATAL_ERROR "Kokkos requires C++14 or newer!")
+ELSEIF(KOKKOS_CXX_STANDARD STREQUAL "23")
+  kokkos_set_cxx_standard_feature(23)
+  SET(KOKKOS_CXX_INTERMEDIATE_STANDARD "2B")
+  SET(KOKKOS_ENABLE_CXX23 ON)
 ELSE()
-  MESSAGE(FATAL_ERROR "Unknown C++ standard ${KOKKOS_CXX_STANDARD} - must be 14, 17, or 20")
+  MESSAGE(FATAL_ERROR "Kokkos requires C++17 or newer but requested ${KOKKOS_CXX_STANDARD}!")
 ENDIF()
 
-# Enforce that we can compile a simple C++14 program
+# Enforce that we can compile a simple C++17 program
 
-TRY_COMPILE(CAN_COMPILE_CPP14
+TRY_COMPILE(CAN_COMPILE_CPP17
   ${KOKKOS_TOP_BUILD_DIR}/corner_cases
-  ${KOKKOS_SOURCE_DIR}/cmake/compile_tests/cplusplus14.cpp
+  ${KOKKOS_SOURCE_DIR}/cmake/compile_tests/cplusplus17.cpp
   OUTPUT_VARIABLE ERROR_MESSAGE
-  CXX_STANDARD 14
+  CXX_STANDARD 17
 )
-if (NOT CAN_COMPILE_CPP14)
-  UNSET(CAN_COMPILE_CPP14 CACHE) #make sure CMake always re-runs this
-  MESSAGE(FATAL_ERROR "C++${KOKKOS_CXX_STANDARD}-compliant compiler detected, but unable to compile C++14 or later program. Verify that ${CMAKE_CXX_COMPILER_ID}:${CMAKE_CXX_COMPILER_VERSION} is set up correctly (e.g., check that correct library headers are being used).\nFailing output:\n ${ERROR_MESSAGE}")
+if (NOT CAN_COMPILE_CPP17)
+  UNSET(CAN_COMPILE_CPP17 CACHE) #make sure CMake always re-runs this
+  MESSAGE(FATAL_ERROR "C++${KOKKOS_CXX_STANDARD}-compliant compiler detected, but unable to compile C++17 or later program. Verify that ${CMAKE_CXX_COMPILER_ID}:${CMAKE_CXX_COMPILER_VERSION} is set up correctly (e.g., check that correct library headers are being used).\nFailing output:\n ${ERROR_MESSAGE}")
 ENDIF()
-UNSET(CAN_COMPILE_CPP14 CACHE) #make sure CMake always re-runs this
+UNSET(CAN_COMPILE_CPP17 CACHE) #make sure CMake always re-runs this
 
 
 # Enforce that extensions are turned off for nvcc_wrapper.
 # For compiling CUDA code using nvcc_wrapper, we will use the host compiler's
-# flags for turning on C++14.  Since for compiler ID and versioning purposes
+# flags for turning on C++17.  Since for compiler ID and versioning purposes
 # CMake recognizes the host compiler when calling nvcc_wrapper, this just
-# works.  Both NVCC and nvcc_wrapper only recognize '-std=c++14' which means
+# works.  Both NVCC and nvcc_wrapper only recognize '-std=c++17' which means
 # that we can only use host compilers for CUDA builds that use those flags.
-# It also means that extensions (gnu++14) can't be turned on for CUDA builds.
+# It also means that extensions (gnu++17) can't be turned on for CUDA builds.
 
 IF(KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA)
   IF(NOT DEFINED CMAKE_CXX_EXTENSIONS)
diff --git a/packages/kokkos/cmake/kokkos_tpls.cmake b/packages/kokkos/cmake/kokkos_tpls.cmake
index 2c712a519bd734c1c020818a8c61d264347ccc1e..ba66ee4d38dcfa5cd3f7e3b12c2bc7acb2de5eb4 100644
--- a/packages/kokkos/cmake/kokkos_tpls.cmake
+++ b/packages/kokkos/cmake/kokkos_tpls.cmake
@@ -39,7 +39,8 @@ IF(KOKKOS_ENABLE_MEMKIND)
 ENDIF()
 KOKKOS_TPL_OPTION(CUDA    ${Kokkos_ENABLE_CUDA} TRIBITS CUDA)
 KOKKOS_TPL_OPTION(LIBRT   Off)
-IF(KOKKOS_ENABLE_HIP AND NOT KOKKOS_CXX_COMPILER_ID STREQUAL HIPCC)
+IF(KOKKOS_ENABLE_HIP AND NOT KOKKOS_CXX_COMPILER_ID STREQUAL HIPCC AND NOT
+    KOKKOS_HAS_TRILINOS)
   SET(ROCM_DEFAULT ON)
 ELSE()
   SET(ROCM_DEFAULT OFF)
@@ -82,7 +83,9 @@ KOKKOS_IMPORT_TPL(MEMKIND)
 IF (NOT WIN32)
   KOKKOS_IMPORT_TPL(THREADS INTERFACE)
 ENDIF()
-KOKKOS_IMPORT_TPL(ROCM INTERFACE)
+IF (NOT KOKKOS_ENABLE_COMPILE_AS_CMAKE_LANGUAGE)
+  KOKKOS_IMPORT_TPL(ROCM INTERFACE)
+ENDIF()
 KOKKOS_IMPORT_TPL(LIBQUADMATH)
 
 IF (Kokkos_ENABLE_IMPL_DESUL_ATOMICS AND Kokkos_ENABLE_DESUL_ATOMICS_EXTERNAL)
@@ -90,6 +93,22 @@ IF (Kokkos_ENABLE_IMPL_DESUL_ATOMICS AND Kokkos_ENABLE_DESUL_ATOMICS_EXTERNAL)
   KOKKOS_EXPORT_CMAKE_TPL(desul REQUIRED COMPONENTS atomics)
 ENDIF()
 
+if (Kokkos_ENABLE_IMPL_MDSPAN AND Kokkos_ENABLE_MDSPAN_EXTERNAL)
+  find_package(mdspan REQUIRED)
+  KOKKOS_EXPORT_CMAKE_TPL(mdspan REQUIRED)
+endif()
+
+IF (Kokkos_ENABLE_OPENMP)
+  find_package(OpenMP REQUIRED)
+  # FIXME_TRILINOS Trilinos doesn't allow for Kokkos to use find_dependency
+  # so we just append the flags here instead of linking with the OpenMP target.
+  IF(KOKKOS_HAS_TRILINOS)
+    COMPILER_SPECIFIC_FLAGS(DEFAULT ${OpenMP_CXX_FLAGS})
+  ELSE()
+    KOKKOS_EXPORT_CMAKE_TPL(OpenMP REQUIRED)
+  ENDIF()
+ENDIF()
+
 #Convert list to newlines (which CMake doesn't always like in cache variables)
 STRING(REPLACE ";" "\n" KOKKOS_TPL_EXPORT_TEMP "${KOKKOS_TPL_EXPORTS}")
 #Convert to a regular variable
diff --git a/packages/kokkos/cmake/kokkos_tribits.cmake b/packages/kokkos/cmake/kokkos_tribits.cmake
index 34e45ecf7247af3095ca52d7d034eddd5cd03d24..0f39551423fb1e731de7efbc5499fe4803493c7f 100644
--- a/packages/kokkos/cmake/kokkos_tribits.cmake
+++ b/packages/kokkos/cmake/kokkos_tribits.cmake
@@ -8,8 +8,10 @@ MESSAGE(STATUS "The project name is: ${PROJECT_NAME}")
 
 IF(GTest_FOUND)
   SET(KOKKOS_GTEST_LIB GTest::gtest)
+  MESSAGE(STATUS "Using gtest found in ${GTest_DIR}")
 ELSE()  # fallback to internal gtest
   SET(KOKKOS_GTEST_LIB kokkos_gtest)
+  MESSAGE(STATUS "Using internal gtest for testing")
 ENDIF()
 
 FUNCTION(VERIFY_EMPTY CONTEXT)
@@ -88,9 +90,7 @@ MACRO(KOKKOS_PROCESS_SUBPACKAGES)
     ADD_SUBDIRECTORY(core)
     ADD_SUBDIRECTORY(containers)
     ADD_SUBDIRECTORY(algorithms)
-    if (KOKKOS_CXX_STANDARD GREATER_EQUAL 17)
-      ADD_SUBDIRECTORY(simd)
-    endif()
+    ADD_SUBDIRECTORY(simd)
     ADD_SUBDIRECTORY(example)
   endif()
 ENDMACRO()
@@ -217,6 +217,7 @@ MACRO(KOKKOS_SETUP_BUILD_ENVIRONMENT)
   SET(Kokkos_INSTALL_TESTING OFF CACHE INTERNAL "Whether to build tests and examples against installation")
   IF (Kokkos_INSTALL_TESTING)
     SET(KOKKOS_ENABLE_TESTS ON)
+    SET(KOKKOS_ENABLE_BENCHMARKS ON)
     SET(KOKKOS_ENABLE_EXAMPLES ON)
     # This looks a little weird, but what we are doing
     # is to NOT build Kokkos but instead look for an
@@ -281,11 +282,7 @@ MACRO(KOKKOS_CONFIGURE_CORE)
       LIST(APPEND FWD_BACKEND_LIST ${MEMSPACE})
    ENDFOREACH()
    FOREACH(BACKEND_ ${KOKKOS_ENABLED_DEVICES})
-      IF( ${BACKEND_} STREQUAL "PTHREAD")
-         LIST(APPEND FWD_BACKEND_LIST THREADS)
-      ELSE()
-         LIST(APPEND FWD_BACKEND_LIST ${BACKEND_})
-      ENDIF()
+      LIST(APPEND FWD_BACKEND_LIST ${BACKEND_})
    ENDFOREACH()
    MESSAGE(STATUS "Kokkos Devices: ${KOKKOS_ENABLED_DEVICES}, Kokkos Backends: ${FWD_BACKEND_LIST}")
    KOKKOS_CONFIG_HEADER( KokkosCore_Config_HeaderSet.in KokkosCore_Config_FwdBackend.hpp "KOKKOS_FWD" "fwd/Kokkos_Fwd" "${FWD_BACKEND_LIST}")
@@ -356,6 +353,7 @@ MACRO(KOKKOS_INSTALL_ADDITIONAL_FILES)
           DESTINATION ${KOKKOS_HEADER_DIR})
 ENDMACRO()
 
+
 FUNCTION(KOKKOS_SET_LIBRARY_PROPERTIES LIBRARY_NAME)
   CMAKE_PARSE_ARGUMENTS(PARSE
     "PLAIN_STYLE"
@@ -444,6 +442,7 @@ FUNCTION(KOKKOS_SET_LIBRARY_PROPERTIES LIBRARY_NAME)
   ENDIF()
 ENDFUNCTION()
 
+
 FUNCTION(KOKKOS_INTERNAL_ADD_LIBRARY LIBRARY_NAME)
   CMAKE_PARSE_ARGUMENTS(PARSE
     "STATIC;SHARED"
@@ -506,19 +505,11 @@ FUNCTION(KOKKOS_ADD_LIBRARY LIBRARY_NAME)
     # preserving the directory structure, e.g. impl
     # If headers got installed in both locations, it breaks some
     # downstream packages
-    TRIBITS_ADD_LIBRARY(${LIBRARY_NAME} ${PARSE_UNPARSED_ARGUMENTS})
-    #Stolen from Tribits - it can add prefixes
-    SET(TRIBITS_LIBRARY_NAME_PREFIX "${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}")
-    SET(TRIBITS_LIBRARY_NAME ${TRIBITS_LIBRARY_NAME_PREFIX}${LIBRARY_NAME})
-    #Tribits has way too much techinical debt and baggage to even
-    #allow PUBLIC target_compile_options to be used. It forces C++ flags on projects
-    #as a giant blob of space-separated strings. We end up with duplicated
-    #flags between the flags implicitly forced on Kokkos-dependent and those Kokkos
-    #has in its public INTERFACE_COMPILE_OPTIONS.
-    #These do NOT get de-deduplicated because Tribits
-    #creates flags as a giant monolithic space-separated string
-    #Do not set any transitive properties and keep everything working as before
-    #KOKKOS_SET_LIBRARY_PROPERTIES(${TRIBITS_LIBRARY_NAME} PLAIN_STYLE)
+    TRIBITS_ADD_LIBRARY(${LIBRARY_NAME} ${PARSE_UNPARSED_ARGUMENTS}
+      ADDED_LIB_TARGET_NAME_OUT  ${LIBRARY_NAME}_TARGET_NAME )
+    IF (PARSE_ADD_BUILD_OPTIONS)
+      KOKKOS_SET_LIBRARY_PROPERTIES(${${LIBRARY_NAME}_TARGET_NAME})
+    ENDIF()
   ELSE()
     # Forward the headers, we want to know about all headers
     # to make sure they appear correctly in IDEs
@@ -530,22 +521,17 @@ FUNCTION(KOKKOS_ADD_LIBRARY LIBRARY_NAME)
   ENDIF()
 ENDFUNCTION()
 
-FUNCTION(KOKKOS_ADD_INTERFACE_LIBRARY NAME)
-IF (KOKKOS_HAS_TRILINOS)
-  TRIBITS_ADD_LIBRARY(${NAME} ${ARGN})
-ELSE()
-  CMAKE_PARSE_ARGUMENTS(PARSE
-    ""
-    ""
-    "HEADERS;SOURCES"
-    ${ARGN}
-  )
 
-  ADD_LIBRARY(${NAME} INTERFACE)
-  KOKKOS_INTERNAL_ADD_LIBRARY_INSTALL(${NAME})
-ENDIF()
+FUNCTION(KOKKOS_ADD_INTERFACE_LIBRARY NAME)
+  IF (KOKKOS_HAS_TRILINOS)
+    TRIBITS_ADD_LIBRARY(${NAME} ${ARGN})
+  ELSE()
+    ADD_LIBRARY(${NAME} INTERFACE)
+    KOKKOS_INTERNAL_ADD_LIBRARY_INSTALL(${NAME})
+  ENDIF()
 ENDFUNCTION()
 
+
 FUNCTION(KOKKOS_LIB_INCLUDE_DIRECTORIES TARGET)
   IF(KOKKOS_HAS_TRILINOS)
     #ignore the target, tribits doesn't do anything directly with targets
@@ -559,13 +545,8 @@ FUNCTION(KOKKOS_LIB_INCLUDE_DIRECTORIES TARGET)
 ENDFUNCTION()
 
 FUNCTION(KOKKOS_LIB_COMPILE_OPTIONS TARGET)
-  IF(KOKKOS_HAS_TRILINOS)
-    #don't trust tribits to do this correctly
-    KOKKOS_TARGET_COMPILE_OPTIONS(${TARGET} ${ARGN})
-  ELSE()
-    KOKKOS_LIB_TYPE(${TARGET} INCTYPE)
-    KOKKOS_TARGET_COMPILE_OPTIONS(${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}${TARGET} ${INCTYPE} ${ARGN})
-  ENDIF()
+  KOKKOS_LIB_TYPE(${TARGET} INCTYPE)
+  KOKKOS_TARGET_COMPILE_OPTIONS(${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}${TARGET} ${INCTYPE} ${ARGN})
 ENDFUNCTION()
 
 MACRO(KOKKOS_ADD_TEST_DIRECTORIES)
diff --git a/packages/kokkos/cmake/tpls/FindTPLCUSPARSE.cmake b/packages/kokkos/cmake/tpls/FindTPLCUSPARSE.cmake
index 1ae4f19dd4036df21d22c758a7e535f432734415..4709f8002b11923f1f20801e077ea98172b58c7c 100644
--- a/packages/kokkos/cmake/tpls/FindTPLCUSPARSE.cmake
+++ b/packages/kokkos/cmake/tpls/FindTPLCUSPARSE.cmake
@@ -1,44 +1,18 @@
-# @HEADER
+#@HEADER
 # ************************************************************************
 #
-#                        Kokkos v. 3.0
-#       Copyright (2020) National Technology & Engineering
+#                        Kokkos v. 4.0
+#       Copyright (2022) National Technology & Engineering
 #               Solutions of Sandia, LLC (NTESS).
 #
 # Under the terms of Contract DE-NA0003525 with NTESS,
 # the U.S. Government retains certain rights in this software.
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
+# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
 #
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 #
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# 3. Neither the name of the Corporation nor the names of the
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# 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 Christian R. Trott (crtrott@sandia.gov)
-#
-# ************************************************************************
-# @HEADER
+#@HEADER
 
 # Check for CUDA support
 
diff --git a/packages/kokkos/cmake/tpls/FindTPLHWLOC.cmake b/packages/kokkos/cmake/tpls/FindTPLHWLOC.cmake
index 467635083f2bdf83db722d51e4eea1ead1b604b4..4e05d22534893961c6ba16e8a1664d312de5fc31 100644
--- a/packages/kokkos/cmake/tpls/FindTPLHWLOC.cmake
+++ b/packages/kokkos/cmake/tpls/FindTPLHWLOC.cmake
@@ -1,41 +1,16 @@
-# @HEADER
+#@HEADER
 # ************************************************************************
 #
-#                        Kokkos v. 3.0
-#       Copyright (2020) National Technology & Engineering
+#                        Kokkos v. 4.0
+#       Copyright (2022) National Technology & Engineering
 #               Solutions of Sandia, LLC (NTESS).
 #
 # Under the terms of Contract DE-NA0003525 with NTESS,
 # the U.S. Government retains certain rights in this software.
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# 3. Neither the name of the Corporation nor the names of the
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
 #
-# Questions? Contact Christian R. Trott (crtrott@sandia.gov)
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 #
 # ************************************************************************
 # @HEADER
diff --git a/packages/kokkos/cmake/tpls/FindTPLPthread.cmake b/packages/kokkos/cmake/tpls/FindTPLPthread.cmake
index c78630b7f19108da4c730c24b7151dfec57204b7..3d5b03805d4d9bd299af7d6ffda62440b223cdce 100644
--- a/packages/kokkos/cmake/tpls/FindTPLPthread.cmake
+++ b/packages/kokkos/cmake/tpls/FindTPLPthread.cmake
@@ -1,46 +1,20 @@
-# @HEADER
+#@HEADER
 # ************************************************************************
 #
-#                        Kokkos v. 3.0
-#       Copyright (2020) National Technology & Engineering
+#                        Kokkos v. 4.0
+#       Copyright (2022) National Technology & Engineering
 #               Solutions of Sandia, LLC (NTESS).
 #
 # Under the terms of Contract DE-NA0003525 with NTESS,
 # the U.S. Government retains certain rights in this software.
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
+# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
 #
-# 3. Neither the name of the Corporation nor the names of the
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# 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 Christian R. Trott (crtrott@sandia.gov)
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 #
 # ************************************************************************
 # @HEADER
 
-
 SET(USE_THREADS FALSE)
 
 IF(NOT TPL_Pthread_INCLUDE_DIRS AND NOT TPL_Pthread_LIBRARY_DIRS AND NOT TPL_Pthread_LIBRARIES)
diff --git a/packages/kokkos/cmake/tpls/FindTPLquadmath.cmake b/packages/kokkos/cmake/tpls/FindTPLquadmath.cmake
index 1f7587da808fd587f6380079f9a672f124b3a25b..8560ec60f1b52ae2bab9c0c9c9c754c85da373af 100644
--- a/packages/kokkos/cmake/tpls/FindTPLquadmath.cmake
+++ b/packages/kokkos/cmake/tpls/FindTPLquadmath.cmake
@@ -1,41 +1,16 @@
-# @HEADER
+#@HEADER
 # ************************************************************************
 #
-#                        Kokkos v. 3.0
-#       Copyright (2020) National Technology & Engineering
+#                        Kokkos v. 4.0
+#       Copyright (2022) National Technology & Engineering
 #               Solutions of Sandia, LLC (NTESS).
 #
 # Under the terms of Contract DE-NA0003525 with NTESS,
 # the U.S. Government retains certain rights in this software.
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# 3. Neither the name of the Corporation nor the names of the
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
 #
-# Questions? Contact Christian R. Trott (crtrott@sandia.gov)
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 #
 # ************************************************************************
 # @HEADER
diff --git a/packages/kokkos/containers/CMakeLists.txt b/packages/kokkos/containers/CMakeLists.txt
index b0e0c4eadea7f64ac2cf8a5cf4d56fec786ff416..b450c2720993752460aa07035fed38415440e739 100644
--- a/packages/kokkos/containers/CMakeLists.txt
+++ b/packages/kokkos/containers/CMakeLists.txt
@@ -6,7 +6,10 @@ IF (NOT Kokkos_INSTALL_TESTING)
   ADD_SUBDIRECTORY(src)
 ENDIF()
 
+# FIXME_OPENACC: temporarily disabled due to unimplemented features
+IF(NOT KOKKOS_ENABLE_OPENACC)
 KOKKOS_ADD_TEST_DIRECTORIES(unit_tests)
 KOKKOS_ADD_TEST_DIRECTORIES(performance_tests)
+ENDIF()
 
 KOKKOS_SUBPACKAGE_POSTPROCESS()
diff --git a/packages/kokkos/containers/performance_tests/TestCuda.cpp b/packages/kokkos/containers/performance_tests/TestCuda.cpp
index 8874590e2acad12369989d87b78670fa004b2086..e98595a41e4d5d3c30bc7ee3ee3efed6aa1c70a4 100644
--- a/packages/kokkos/containers/performance_tests/TestCuda.cpp
+++ b/packages/kokkos/containers/performance_tests/TestCuda.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Macros.hpp>
 
@@ -72,6 +44,10 @@ TEST(TEST_CATEGORY, dynrankview_perf) {
 }
 
 TEST(TEST_CATEGORY, global_2_local) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  GTEST_SKIP() << "errors reported for all sizes";
+#endif
   std::cout << "Cuda" << std::endl;
   std::cout << "size, create, generate, fill, find" << std::endl;
   for (unsigned i = Performance::begin_id_size; i <= Performance::end_id_size;
diff --git a/packages/kokkos/containers/performance_tests/TestDynRankView.hpp b/packages/kokkos/containers/performance_tests/TestDynRankView.hpp
index 7ed9a0271a51db453ff29a982e57cd17d70a642d..48c5defeb79669f9a33ab24f7d4ae7605ed1c238 100644
--- a/packages/kokkos/containers/performance_tests/TestDynRankView.hpp
+++ b/packages/kokkos/containers/performance_tests/TestDynRankView.hpp
@@ -1,44 +1,17 @@
-
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
 
 #ifndef KOKKOS_TEST_DYNRANKVIEW_HPP
diff --git a/packages/kokkos/containers/performance_tests/TestGlobal2LocalIds.hpp b/packages/kokkos/containers/performance_tests/TestGlobal2LocalIds.hpp
index 77451bb9e8f7ae99d84fbcb3fac05ad58a80850b..ac11d2493ffd33da7c181594ec5bbd75f872b85e 100644
--- a/packages/kokkos/containers/performance_tests/TestGlobal2LocalIds.hpp
+++ b/packages/kokkos/containers/performance_tests/TestGlobal2LocalIds.hpp
@@ -1,43 +1,17 @@
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
 
 #ifndef KOKKOS_TEST_GLOBAL_TO_LOCAL_IDS_HPP
diff --git a/packages/kokkos/containers/performance_tests/TestHIP.cpp b/packages/kokkos/containers/performance_tests/TestHIP.cpp
index 8033c76be6cfaf491ba7ff9abd63856aca589c89..56680f7d64897df456d22a071fc44c99e08fd6fa 100644
--- a/packages/kokkos/containers/performance_tests/TestHIP.cpp
+++ b/packages/kokkos/containers/performance_tests/TestHIP.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Macros.hpp>
 
@@ -68,7 +40,7 @@ namespace Performance {
 TEST(TEST_CATEGORY, dynrankview_perf) {
   std::cout << "HIP" << std::endl;
   std::cout << " DynRankView vs View: Initialization Only " << std::endl;
-  test_dynrankview_op_perf<Kokkos::Experimental::HIP>(40960);
+  test_dynrankview_op_perf<Kokkos::HIP>(40960);
 }
 
 TEST(TEST_CATEGORY, global_2_local) {
@@ -76,15 +48,15 @@ TEST(TEST_CATEGORY, global_2_local) {
   std::cout << "size, create, generate, fill, find" << std::endl;
   for (unsigned i = Performance::begin_id_size; i <= Performance::end_id_size;
        i *= Performance::id_step)
-    test_global_to_local_ids<Kokkos::Experimental::HIP>(i);
+    test_global_to_local_ids<Kokkos::HIP>(i);
 }
 
 TEST(TEST_CATEGORY, unordered_map_performance_near) {
-  Perf::run_performance_tests<Kokkos::Experimental::HIP, true>("hip-near");
+  Perf::run_performance_tests<Kokkos::HIP, true>("hip-near");
 }
 
 TEST(TEST_CATEGORY, unordered_map_performance_far) {
-  Perf::run_performance_tests<Kokkos::Experimental::HIP, false>("hip-far");
+  Perf::run_performance_tests<Kokkos::HIP, false>("hip-far");
 }
 
 }  // namespace Performance
diff --git a/packages/kokkos/containers/performance_tests/TestHPX.cpp b/packages/kokkos/containers/performance_tests/TestHPX.cpp
index f229901dcc421f964d731380172690986b65163a..b3bfb2140b2c1595dd69ad2059d4354ec55a3535 100644
--- a/packages/kokkos/containers/performance_tests/TestHPX.cpp
+++ b/packages/kokkos/containers/performance_tests/TestHPX.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Macros.hpp>
 
diff --git a/packages/kokkos/containers/performance_tests/TestMain.cpp b/packages/kokkos/containers/performance_tests/TestMain.cpp
index 140ba418fdac4eda95ed362a9b5bf64e50676cc2..0bf647012ac64a64fde6218e4f49aad0b47e2f89 100644
--- a/packages/kokkos/containers/performance_tests/TestMain.cpp
+++ b/packages/kokkos/containers/performance_tests/TestMain.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 #include <cstdlib>
diff --git a/packages/kokkos/containers/performance_tests/TestOpenMP.cpp b/packages/kokkos/containers/performance_tests/TestOpenMP.cpp
index f414b0d8282b62c01b64d7c1275c2bc1bf7bbdf4..0e16200961da5194d03a43115be02140ec04dbda 100644
--- a/packages/kokkos/containers/performance_tests/TestOpenMP.cpp
+++ b/packages/kokkos/containers/performance_tests/TestOpenMP.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Macros.hpp>
 
diff --git a/packages/kokkos/containers/performance_tests/TestScatterView.hpp b/packages/kokkos/containers/performance_tests/TestScatterView.hpp
index bd06be9667be33f81ad607903ac97dbd1b65895c..a74f833b9f524a524a2a1bd09b49d1a71940cd7f 100644
--- a/packages/kokkos/containers/performance_tests/TestScatterView.hpp
+++ b/packages/kokkos/containers/performance_tests/TestScatterView.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SCATTER_VIEW_HPP
 #define KOKKOS_TEST_SCATTER_VIEW_HPP
diff --git a/packages/kokkos/containers/performance_tests/TestThreads.cpp b/packages/kokkos/containers/performance_tests/TestThreads.cpp
index 72bef1a3ad027a2ba780230fb39e742f6a335327..d32b09702af6bdd14094e3bf37e659dc284a5a29 100644
--- a/packages/kokkos/containers/performance_tests/TestThreads.cpp
+++ b/packages/kokkos/containers/performance_tests/TestThreads.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Macros.hpp>
 
diff --git a/packages/kokkos/containers/performance_tests/TestUnorderedMapPerformance.hpp b/packages/kokkos/containers/performance_tests/TestUnorderedMapPerformance.hpp
index 8ff208d6a867bc424334a953723d21235f09bac0..6d3764a989d1d39de8a4a1a54450fad789eb6c1d 100644
--- a/packages/kokkos/containers/performance_tests/TestUnorderedMapPerformance.hpp
+++ b/packages/kokkos/containers/performance_tests/TestUnorderedMapPerformance.hpp
@@ -1,43 +1,17 @@
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
 
 #ifndef KOKKOS_TEST_UNORDERED_MAP_PERFORMANCE_HPP
diff --git a/packages/kokkos/containers/src/Kokkos_Bitset.hpp b/packages/kokkos/containers/src/Kokkos_Bitset.hpp
index 05121b4e51195651c3bd05d01529f311beaa5863..35f691ecf4e0db1e4d77dfeb364ce4726a0ab124 100644
--- a/packages/kokkos/containers/src/Kokkos_Bitset.hpp
+++ b/packages/kokkos/containers/src/Kokkos_Bitset.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_BITSET_HPP
 #define KOKKOS_BITSET_HPP
diff --git a/packages/kokkos/containers/src/Kokkos_DualView.hpp b/packages/kokkos/containers/src/Kokkos_DualView.hpp
index 916c54d605545ef8fe8a39f5e98a36d000bfa85a..07256b446426f9a0024df1755a8dd42045eaf65e 100644
--- a/packages/kokkos/containers/src/Kokkos_DualView.hpp
+++ b/packages/kokkos/containers/src/Kokkos_DualView.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /// \file Kokkos_DualView.hpp
 /// \brief Declaration and definition of Kokkos::DualView.
@@ -939,20 +911,9 @@ class DualView : public ViewTraits<DataType, Arg1Type, Arg2Type, Arg3Type> {
                                     typename t_host::memory_space(), d_view);
       }
     } else if (alloc_prop_input::initialize) {
-      if (alloc_prop_input::has_execution_space) {
-        // Add execution_space if not provided to avoid need for if constexpr
-        using alloc_prop = Impl::ViewCtorProp<
-            ViewCtorArgs...,
-            std::conditional_t<alloc_prop_input::has_execution_space,
-                               std::integral_constant<unsigned int, 2>,
-                               typename t_dev::execution_space>>;
-        alloc_prop arg_prop_copy(arg_prop);
-        using execution_space_type = typename alloc_prop::execution_space;
-        const execution_space_type& exec_space =
-            static_cast<
-                Kokkos::Impl::ViewCtorProp<void, execution_space_type> const&>(
-                arg_prop_copy)
-                .value;
+      if constexpr (alloc_prop_input::has_execution_space) {
+        const auto& exec_space =
+            Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop);
         ::Kokkos::deep_copy(exec_space, d_view, typename t_dev::value_type{});
       } else
         ::Kokkos::deep_copy(d_view, typename t_dev::value_type{});
@@ -1032,10 +993,11 @@ class DualView : public ViewTraits<DataType, Arg1Type, Arg2Type, Arg3Type> {
     if (modified_flags.data() == nullptr) {
       modified_flags = t_modified_flags("DualView::modified_flags");
     }
-    if (modified_flags(1) >= modified_flags(0)) {
+
+    [[maybe_unused]] auto resize_on_device = [&](const auto& properties) {
       /* Resize on Device */
       if (sizeMismatch) {
-        ::Kokkos::resize(arg_prop, d_view, n0, n1, n2, n3, n4, n5, n6, n7);
+        ::Kokkos::resize(properties, d_view, n0, n1, n2, n3, n4, n5, n6, n7);
         if (alloc_prop_input::initialize) {
           h_view = create_mirror_view(typename t_host::memory_space(), d_view);
         } else {
@@ -1046,10 +1008,12 @@ class DualView : public ViewTraits<DataType, Arg1Type, Arg2Type, Arg3Type> {
         /* Mark Device copy as modified */
         ++modified_flags(1);
       }
-    } else {
+    };
+
+    [[maybe_unused]] auto resize_on_host = [&](const auto& properties) {
       /* Resize on Host */
       if (sizeMismatch) {
-        ::Kokkos::resize(arg_prop, h_view, n0, n1, n2, n3, n4, n5, n6, n7);
+        ::Kokkos::resize(properties, h_view, n0, n1, n2, n3, n4, n5, n6, n7);
         if (alloc_prop_input::initialize) {
           d_view = create_mirror_view(typename t_dev::memory_space(), h_view);
 
@@ -1061,6 +1025,37 @@ class DualView : public ViewTraits<DataType, Arg1Type, Arg2Type, Arg3Type> {
         /* Mark Host copy as modified */
         ++modified_flags(0);
       }
+    };
+
+    constexpr bool has_execution_space = alloc_prop_input::has_execution_space;
+
+    if constexpr (has_execution_space) {
+      using ExecSpace = typename alloc_prop_input::execution_space;
+      const auto& exec_space =
+          Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop);
+      constexpr bool exec_space_can_access_device =
+          SpaceAccessibility<ExecSpace,
+                             typename t_dev::memory_space>::accessible;
+      constexpr bool exec_space_can_access_host =
+          SpaceAccessibility<ExecSpace,
+                             typename t_host::memory_space>::accessible;
+      static_assert(exec_space_can_access_device || exec_space_can_access_host);
+      if constexpr (exec_space_can_access_device) {
+        sync<typename t_dev::memory_space>(exec_space);
+        resize_on_device(arg_prop);
+        return;
+      }
+      if constexpr (exec_space_can_access_host) {
+        sync<typename t_host::memory_space>(exec_space);
+        resize_on_host(arg_prop);
+        return;
+      }
+    } else {
+      if (modified_flags(1) >= modified_flags(0)) {
+        resize_on_device(arg_prop);
+      } else {
+        resize_on_host(arg_prop);
+      }
     }
   }
 
diff --git a/packages/kokkos/containers/src/Kokkos_DynRankView.hpp b/packages/kokkos/containers/src/Kokkos_DynRankView.hpp
index 059ce8a610d26c9072b1cd15a282364855130d9a..ce433b0bfc088a0cea29cd15ff3cbde0c9af5acb 100644
--- a/packages/kokkos/containers/src/Kokkos_DynRankView.hpp
+++ b/packages/kokkos/containers/src/Kokkos_DynRankView.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /// \file Kokkos_DynRankView.hpp
 /// \brief Declaration and definition of Kokkos::DynRankView.
@@ -1099,21 +1071,11 @@ class DynRankView : public ViewTraits<DataType, Properties...> {
         m_rank(Impl::DynRankDimTraits<typename traits::specialize>::
                    template computeRank<typename traits::array_layout, P...>(
                        arg_prop, arg_layout)) {
-    // Append layout and spaces if not input
-    using alloc_prop_input = Kokkos::Impl::ViewCtorProp<P...>;
-
-    // use 'std::integral_constant<unsigned,I>' for non-types
-    // to avoid duplicate class error.
-    using alloc_prop = Kokkos::Impl::ViewCtorProp<
-        P...,
-        std::conditional_t<alloc_prop_input::has_label,
-                           std::integral_constant<unsigned, 0>, std::string>,
-        std::conditional_t<alloc_prop_input::has_memory_space,
-                           std::integral_constant<unsigned, 1>,
-                           typename traits::device_type::memory_space>,
-        std::conditional_t<alloc_prop_input::has_execution_space,
-                           std::integral_constant<unsigned, 2>,
-                           typename traits::device_type::execution_space>>;
+    // Copy the input allocation properties with possibly defaulted properties
+    auto prop_copy = Impl::with_properties_if_unset(
+        arg_prop, std::string{}, typename traits::device_type::memory_space{},
+        typename traits::device_type::execution_space{});
+    using alloc_prop = decltype(prop_copy);
 
     static_assert(traits::is_managed,
                   "View allocation constructor requires managed memory");
@@ -1127,9 +1089,6 @@ class DynRankView : public ViewTraits<DataType, Properties...> {
           "execution space");
     }
 
-    // Copy the input allocation properties with possibly defaulted properties
-    alloc_prop prop_copy(arg_prop);
-
 //------------------------------------------------------------
 #if defined(KOKKOS_ENABLE_CUDA)
     // If allocating in CudaUVMSpace must fence before and after
@@ -2011,10 +1970,8 @@ inline typename DynRankView<T, P...>::HostMirror create_mirror(
       "The view constructor arguments passed to Kokkos::create_mirror must "
       "not explicitly allow padding!");
 
-  using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>;
-  alloc_prop prop_copy(arg_prop);
-  static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value =
-      std::string(src.label()).append("_mirror");
+  auto prop_copy = Impl::with_properties_if_unset(
+      arg_prop, std::string(src.label()).append("_mirror"));
 
   return dst_type(prop_copy, Impl::reconstructLayout(src.layout(), src.rank()));
 }
@@ -2044,10 +2001,8 @@ inline auto create_mirror(
       "The view constructor arguments passed to Kokkos::create_mirror must "
       "not explicitly allow padding!");
 
-  using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>;
-  alloc_prop prop_copy(arg_prop);
-  static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value =
-      std::string(src.label()).append("_mirror");
+  auto prop_copy = Impl::with_properties_if_unset(
+      arg_prop, std::string(src.label()).append("_mirror"));
 
   return dst_type(prop_copy, Impl::reconstructLayout(src.layout(), src.rank()));
 }
@@ -2308,30 +2263,17 @@ auto create_mirror_view_and_copy(
   using Space  = typename alloc_prop_input::memory_space;
   using Mirror = typename Impl::MirrorDRViewType<Space, T, P...>::view_type;
 
-  // Add some properties if not provided to avoid need for if constexpr
-  using alloc_prop = Impl::ViewCtorProp<
-      ViewCtorArgs...,
-      std::conditional_t<alloc_prop_input::has_label,
-                         std::integral_constant<unsigned int, 12>, std::string>,
-      std::conditional_t<!alloc_prop_input::initialize,
-                         std::integral_constant<unsigned int, 13>,
-                         Impl::WithoutInitializing_t>,
-      std::conditional_t<alloc_prop_input::has_execution_space,
-                         std::integral_constant<unsigned int, 14>,
-                         typename Space::execution_space>>;
-  alloc_prop arg_prop_copy(arg_prop);
-
-  std::string& label =
-      static_cast<Impl::ViewCtorProp<void, std::string>&>(arg_prop_copy).value;
+  auto arg_prop_copy = Impl::with_properties_if_unset(
+      arg_prop, std::string{}, WithoutInitializing,
+      typename Space::execution_space{});
+
+  std::string& label = Impl::get_property<Impl::LabelTag>(arg_prop_copy);
   if (label.empty()) label = src.label();
   auto mirror = typename Mirror::non_const_type{
       arg_prop_copy, Impl::reconstructLayout(src.layout(), src.rank())};
-  if (alloc_prop_input::has_execution_space) {
-    using ExecutionSpace = typename alloc_prop::execution_space;
-    deep_copy(
-        static_cast<Impl::ViewCtorProp<void, ExecutionSpace>&>(arg_prop_copy)
-            .value,
-        mirror, src);
+  if constexpr (alloc_prop_input::has_execution_space) {
+    deep_copy(Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop_copy),
+              mirror, src);
   } else
     deep_copy(mirror, src);
   return mirror;
@@ -2374,24 +2316,14 @@ inline void impl_resize(const Impl::ViewCtorProp<ViewCtorArgs...>& arg_prop,
                 "The view constructor arguments passed to Kokkos::resize must "
                 "not include a memory space instance!");
 
-  // Add execution space here to avoid the need for if constexpr below
-  using alloc_prop = Impl::ViewCtorProp<
-      ViewCtorArgs..., std::string,
-      std::conditional_t<alloc_prop_input::has_execution_space,
-                         std::integral_constant<unsigned int, 10>,
-                         typename drview_type::execution_space>>;
-  alloc_prop prop_copy(arg_prop);
-  static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value =
-      v.label();
+  auto prop_copy = Impl::with_properties_if_unset(
+      arg_prop, v.label(), typename drview_type::execution_space{});
 
   drview_type v_resized(prop_copy, n0, n1, n2, n3, n4, n5, n6, n7);
 
-  if (alloc_prop_input::has_execution_space)
+  if constexpr (alloc_prop_input::has_execution_space)
     Kokkos::Impl::DynRankViewRemap<drview_type, drview_type>(
-        static_cast<const Impl::ViewCtorProp<
-            void, typename alloc_prop::execution_space>&>(prop_copy)
-            .value,
-        v_resized, v);
+        Impl::get_property<Impl::ExecutionSpaceTag>(prop_copy), v_resized, v);
   else
     Kokkos::Impl::DynRankViewRemap<drview_type, drview_type>(v_resized, v);
 
@@ -2462,10 +2394,7 @@ inline void impl_realloc(DynRankView<T, P...>& v, const size_t n0,
                 "The view constructor arguments passed to Kokkos::realloc must "
                 "not include a memory space instance!");
 
-  using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>;
-  alloc_prop arg_prop_copy(arg_prop);
-  static_cast<Kokkos::Impl::ViewCtorProp<void, std::string>&>(arg_prop_copy)
-      .value = v.label();
+  auto arg_prop_copy = Impl::with_properties_if_unset(arg_prop, v.label());
 
   v = drview_type();  // Deallocate first, if the only view to allocation
   v = drview_type(arg_prop_copy, n0, n1, n2, n3, n4, n5, n6, n7);
diff --git a/packages/kokkos/containers/src/Kokkos_DynamicView.hpp b/packages/kokkos/containers/src/Kokkos_DynamicView.hpp
index a2b68064de13bd2b8988b6a2025bc3c9ef2c2685..f8636b6212fdcf32d525d12ae1e1d0e3521441a8 100644
--- a/packages/kokkos/containers/src/Kokkos_DynamicView.hpp
+++ b/packages/kokkos/containers/src/Kokkos_DynamicView.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_DYNAMIC_VIEW_HPP
 #define KOKKOS_DYNAMIC_VIEW_HPP
@@ -535,9 +507,7 @@ class DynamicView : public Kokkos::ViewTraits<DataType, P...> {
     m_chunks = device_accessor(m_chunk_max, m_chunk_size);
 
     const std::string& label =
-        static_cast<Kokkos::Impl::ViewCtorProp<void, std::string> const&>(
-            arg_prop)
-            .value;
+        Kokkos::Impl::get_property<Kokkos::Impl::LabelTag>(arg_prop);
 
     if (device_accessor::template IsAccessibleFrom<host_space>::value) {
       m_chunks.template allocate_with_destroy<device_space>(label);
@@ -552,17 +522,14 @@ class DynamicView : public Kokkos::ViewTraits<DataType, P...> {
           label, m_chunks.get_ptr());
       m_chunks_host.initialize();
 
-      // Add some properties if not provided to avoid need for if constexpr
       using alloc_prop_input = Kokkos::Impl::ViewCtorProp<Prop...>;
-      using alloc_prop       = Kokkos::Impl::ViewCtorProp<
-          Prop..., std::conditional_t<alloc_prop_input::has_execution_space,
-                                      std::integral_constant<unsigned int, 15>,
-                                      typename device_space::execution_space>>;
-      alloc_prop arg_prop_copy(arg_prop);
-
-      const auto& exec = static_cast<const Kokkos::Impl::ViewCtorProp<
-          void, typename alloc_prop::execution_space>&>(arg_prop_copy)
-                             .value;
+
+      auto arg_prop_copy = ::Kokkos::Impl::with_properties_if_unset(
+          arg_prop, typename device_space::execution_space{});
+
+      const auto& exec =
+          Kokkos::Impl::get_property<Kokkos::Impl::ExecutionSpaceTag>(
+              arg_prop_copy);
       m_chunks_host.deep_copy_to(exec, m_chunks);
       if (!alloc_prop_input::has_execution_space)
         exec.fence(
@@ -641,10 +608,8 @@ inline auto create_mirror(
       "The view constructor arguments passed to Kokkos::create_mirror must "
       "not explicitly allow padding!");
 
-  using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>;
-  alloc_prop prop_copy(arg_prop);
-  static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value =
-      std::string(src.label()).append("_mirror");
+  auto prop_copy = Impl::with_properties_if_unset(
+      arg_prop, std::string(src.label()).append("_mirror"));
 
   auto ret = typename Kokkos::Experimental::DynamicView<T, P...>::HostMirror(
       prop_copy, src.chunk_size(), src.chunk_max() * src.chunk_size());
@@ -676,10 +641,8 @@ inline auto create_mirror(
       "not explicitly allow padding!");
 
   using MemorySpace = typename alloc_prop_input::memory_space;
-  using alloc_prop  = Impl::ViewCtorProp<ViewCtorArgs..., std::string>;
-  alloc_prop prop_copy(arg_prop);
-  static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value =
-      std::string(src.label()).append("_mirror");
+  auto prop_copy    = Impl::with_properties_if_unset(
+      arg_prop, std::string(src.label()).append("_mirror"));
 
   auto ret = typename Kokkos::Impl::MirrorDynamicViewType<
       MemorySpace, T, P...>::view_type(prop_copy, src.chunk_size(),
@@ -915,8 +878,8 @@ inline void deep_copy(const View<T, DP...>& dst,
 template <class T, class... DP, class... SP>
 inline void deep_copy(const Kokkos::Experimental::DynamicView<T, DP...>& dst,
                       const View<T, SP...>& src) {
-  using dst_type = Kokkos::Experimental::DynamicView<T, SP...>;
-  using src_type = View<T, DP...>;
+  using dst_type = Kokkos::Experimental::DynamicView<T, DP...>;
+  using src_type = View<T, SP...>;
 
   using dst_execution_space = typename ViewTraits<T, DP...>::execution_space;
   using src_memory_space    = typename ViewTraits<T, SP...>::memory_space;
@@ -1075,31 +1038,18 @@ auto create_mirror_view_and_copy(
   using Mirror =
       typename Impl::MirrorDynamicViewType<Space, T, P...>::view_type;
 
-  // Add some properties if not provided to avoid need for if constexpr
-  using alloc_prop = Impl::ViewCtorProp<
-      ViewCtorArgs...,
-      std::conditional_t<alloc_prop_input::has_label,
-                         std::integral_constant<unsigned int, 12>, std::string>,
-      std::conditional_t<!alloc_prop_input::initialize,
-                         std::integral_constant<unsigned int, 13>,
-                         Impl::WithoutInitializing_t>,
-      std::conditional_t<alloc_prop_input::has_execution_space,
-                         std::integral_constant<unsigned int, 14>,
-                         typename Space::execution_space>>;
-  alloc_prop arg_prop_copy(arg_prop);
-
-  std::string& label =
-      static_cast<Impl::ViewCtorProp<void, std::string>&>(arg_prop_copy).value;
+  auto arg_prop_copy = Impl::with_properties_if_unset(
+      arg_prop, std::string{}, WithoutInitializing,
+      typename Space::execution_space{});
+
+  std::string& label = Impl::get_property<Impl::LabelTag>(arg_prop_copy);
   if (label.empty()) label = src.label();
   auto mirror = typename Mirror::non_const_type(
       arg_prop_copy, src.chunk_size(), src.chunk_max() * src.chunk_size());
   mirror.resize_serial(src.extent(0));
-  if (alloc_prop_input::has_execution_space) {
-    using ExecutionSpace = typename alloc_prop::execution_space;
-    deep_copy(
-        static_cast<Impl::ViewCtorProp<void, ExecutionSpace>&>(arg_prop_copy)
-            .value,
-        mirror, src);
+  if constexpr (alloc_prop_input::has_execution_space) {
+    deep_copy(Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop_copy),
+              mirror, src);
   } else
     deep_copy(mirror, src);
   return mirror;
diff --git a/packages/kokkos/containers/src/Kokkos_ErrorReporter.hpp b/packages/kokkos/containers/src/Kokkos_ErrorReporter.hpp
index 8affa0bac4f87a95df1e5200540ac191b1f817a3..0482bb6fb38b022df9ec83fe450811ac26a3fe59 100644
--- a/packages/kokkos/containers/src/Kokkos_ErrorReporter.hpp
+++ b/packages/kokkos/containers/src/Kokkos_ErrorReporter.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_EXPERIMENTAL_ERROR_REPORTER_HPP
 #define KOKKOS_EXPERIMENTAL_ERROR_REPORTER_HPP
diff --git a/packages/kokkos/containers/src/Kokkos_Functional.hpp b/packages/kokkos/containers/src/Kokkos_Functional.hpp
index 478a087d0c32185f87da8b9f8cc664bdcb7fa170..4d39716cc3f118953c317fe2a4e8a5e2e01f1d59 100644
--- a/packages/kokkos/containers/src/Kokkos_Functional.hpp
+++ b/packages/kokkos/containers/src/Kokkos_Functional.hpp
@@ -1,43 +1,17 @@
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
 
 #ifndef KOKKOS_FUNCTIONAL_HPP
@@ -56,13 +30,6 @@ namespace Kokkos {
 
 template <typename T>
 struct pod_hash {
-#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3
-  using argument_type KOKKOS_DEPRECATED        = T;
-  using first_argument_type KOKKOS_DEPRECATED  = T;
-  using second_argument_type KOKKOS_DEPRECATED = uint32_t;
-  using result_type KOKKOS_DEPRECATED          = uint32_t;
-#endif
-
   KOKKOS_FORCEINLINE_FUNCTION
   uint32_t operator()(T const& t) const {
     return Impl::MurmurHash3_x86_32(&t, sizeof(T), 0);
@@ -76,12 +43,6 @@ struct pod_hash {
 
 template <typename T>
 struct pod_equal_to {
-#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3
-  using first_argument_type KOKKOS_DEPRECATED  = T;
-  using second_argument_type KOKKOS_DEPRECATED = T;
-  using result_type KOKKOS_DEPRECATED          = bool;
-#endif
-
   KOKKOS_FORCEINLINE_FUNCTION
   bool operator()(T const& a, T const& b) const {
     return Impl::bitwise_equal(&a, &b);
@@ -90,12 +51,6 @@ struct pod_equal_to {
 
 template <typename T>
 struct pod_not_equal_to {
-#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3
-  using first_argument_type KOKKOS_DEPRECATED  = T;
-  using second_argument_type KOKKOS_DEPRECATED = T;
-  using result_type KOKKOS_DEPRECATED          = bool;
-#endif
-
   KOKKOS_FORCEINLINE_FUNCTION
   bool operator()(T const& a, T const& b) const {
     return !Impl::bitwise_equal(&a, &b);
@@ -104,72 +59,36 @@ struct pod_not_equal_to {
 
 template <typename T>
 struct equal_to {
-#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3
-  using first_argument_type KOKKOS_DEPRECATED  = T;
-  using second_argument_type KOKKOS_DEPRECATED = T;
-  using result_type KOKKOS_DEPRECATED          = bool;
-#endif
-
   KOKKOS_FORCEINLINE_FUNCTION
   bool operator()(T const& a, T const& b) const { return a == b; }
 };
 
 template <typename T>
 struct not_equal_to {
-#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3
-  using first_argument_type KOKKOS_DEPRECATED  = T;
-  using second_argument_type KOKKOS_DEPRECATED = T;
-  using result_type KOKKOS_DEPRECATED          = bool;
-#endif
-
   KOKKOS_FORCEINLINE_FUNCTION
   bool operator()(T const& a, T const& b) const { return a != b; }
 };
 
 template <typename T>
 struct greater {
-#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3
-  using first_argument_type KOKKOS_DEPRECATED  = T;
-  using second_argument_type KOKKOS_DEPRECATED = T;
-  using result_type KOKKOS_DEPRECATED          = bool;
-#endif
-
   KOKKOS_FORCEINLINE_FUNCTION
   bool operator()(T const& a, T const& b) const { return a > b; }
 };
 
 template <typename T>
 struct less {
-#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3
-  using first_argument_type KOKKOS_DEPRECATED  = T;
-  using second_argument_type KOKKOS_DEPRECATED = T;
-  using result_type KOKKOS_DEPRECATED          = bool;
-#endif
-
   KOKKOS_FORCEINLINE_FUNCTION
   bool operator()(T const& a, T const& b) const { return a < b; }
 };
 
 template <typename T>
 struct greater_equal {
-#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3
-  using first_argument_type KOKKOS_DEPRECATED  = T;
-  using second_argument_type KOKKOS_DEPRECATED = T;
-  using result_type KOKKOS_DEPRECATED          = bool;
-#endif
-
   KOKKOS_FORCEINLINE_FUNCTION
   bool operator()(T const& a, T const& b) const { return a >= b; }
 };
 
 template <typename T>
 struct less_equal {
-#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3
-  using first_argument_type KOKKOS_DEPRECATED  = T;
-  using second_argument_type KOKKOS_DEPRECATED = T;
-  using result_type KOKKOS_DEPRECATED          = bool;
-#endif
-
   KOKKOS_FORCEINLINE_FUNCTION
   bool operator()(T const& a, T const& b) const { return a <= b; }
 };
diff --git a/packages/kokkos/containers/src/Kokkos_OffsetView.hpp b/packages/kokkos/containers/src/Kokkos_OffsetView.hpp
index 5027763a0297a00c2b9dfb28734da628e763d7dc..35b28999c1ddb077162535cdbd7a8f92f30ace75 100644
--- a/packages/kokkos/containers/src/Kokkos_OffsetView.hpp
+++ b/packages/kokkos/containers/src/Kokkos_OffsetView.hpp
@@ -1,9 +1,18 @@
-/*
- * Kokkos_OffsetView.hpp
- *
- *  Created on: Apr 23, 2018
- *      Author: swbova
- */
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
 
 #ifndef KOKKOS_OFFSETVIEW_HPP_
 #define KOKKOS_OFFSETVIEW_HPP_
@@ -196,17 +205,17 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
 
   template <typename iType,
             std::enable_if_t<std::is_integral<iType>::value, iType> = 0>
-  KOKKOS_INLINE_FUNCTION int64_t begin(const iType local_dimension) const {
+  KOKKOS_FUNCTION int64_t begin(const iType local_dimension) const {
     return local_dimension < Rank ? m_begins[local_dimension]
                                   : KOKKOS_INVALID_OFFSET;
   }
 
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   begins_type begins() const { return m_begins; }
 
   template <typename iType,
             std::enable_if_t<std::is_integral<iType>::value, iType> = 0>
-  KOKKOS_INLINE_FUNCTION int64_t end(const iType local_dimension) const {
+  KOKKOS_FUNCTION int64_t end(const iType local_dimension) const {
     return begin(local_dimension) + m_map.extent(local_dimension);
   }
 
@@ -245,63 +254,46 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
 
   /** \brief rank() to be implemented
    */
-  // KOKKOS_INLINE_FUNCTION
+  // KOKKOS_FUNCTION
   // static
   // constexpr unsigned rank() { return map_type::Rank; }
 
   template <typename iType>
-  KOKKOS_INLINE_FUNCTION constexpr std::enable_if_t<
-      std::is_integral<iType>::value, size_t>
+  KOKKOS_FUNCTION constexpr std::enable_if_t<std::is_integral<iType>::value,
+                                             size_t>
   extent(const iType& r) const {
     return m_map.extent(r);
   }
 
   template <typename iType>
-  KOKKOS_INLINE_FUNCTION constexpr std::enable_if_t<
-      std::is_integral<iType>::value, int>
+  KOKKOS_FUNCTION constexpr std::enable_if_t<std::is_integral<iType>::value,
+                                             int>
   extent_int(const iType& r) const {
     return static_cast<int>(m_map.extent(r));
   }
 
-  KOKKOS_INLINE_FUNCTION constexpr typename traits::array_layout layout()
-      const {
+  KOKKOS_FUNCTION constexpr typename traits::array_layout layout() const {
     return m_map.layout();
   }
 
-  KOKKOS_INLINE_FUNCTION constexpr size_t size() const {
+  KOKKOS_FUNCTION constexpr size_t size() const {
     return m_map.dimension_0() * m_map.dimension_1() * m_map.dimension_2() *
            m_map.dimension_3() * m_map.dimension_4() * m_map.dimension_5() *
            m_map.dimension_6() * m_map.dimension_7();
   }
 
-  KOKKOS_INLINE_FUNCTION constexpr size_t stride_0() const {
-    return m_map.stride_0();
-  }
-  KOKKOS_INLINE_FUNCTION constexpr size_t stride_1() const {
-    return m_map.stride_1();
-  }
-  KOKKOS_INLINE_FUNCTION constexpr size_t stride_2() const {
-    return m_map.stride_2();
-  }
-  KOKKOS_INLINE_FUNCTION constexpr size_t stride_3() const {
-    return m_map.stride_3();
-  }
-  KOKKOS_INLINE_FUNCTION constexpr size_t stride_4() const {
-    return m_map.stride_4();
-  }
-  KOKKOS_INLINE_FUNCTION constexpr size_t stride_5() const {
-    return m_map.stride_5();
-  }
-  KOKKOS_INLINE_FUNCTION constexpr size_t stride_6() const {
-    return m_map.stride_6();
-  }
-  KOKKOS_INLINE_FUNCTION constexpr size_t stride_7() const {
-    return m_map.stride_7();
-  }
+  KOKKOS_FUNCTION constexpr size_t stride_0() const { return m_map.stride_0(); }
+  KOKKOS_FUNCTION constexpr size_t stride_1() const { return m_map.stride_1(); }
+  KOKKOS_FUNCTION constexpr size_t stride_2() const { return m_map.stride_2(); }
+  KOKKOS_FUNCTION constexpr size_t stride_3() const { return m_map.stride_3(); }
+  KOKKOS_FUNCTION constexpr size_t stride_4() const { return m_map.stride_4(); }
+  KOKKOS_FUNCTION constexpr size_t stride_5() const { return m_map.stride_5(); }
+  KOKKOS_FUNCTION constexpr size_t stride_6() const { return m_map.stride_6(); }
+  KOKKOS_FUNCTION constexpr size_t stride_7() const { return m_map.stride_7(); }
 
   template <typename iType>
-  KOKKOS_INLINE_FUNCTION constexpr std::enable_if_t<
-      std::is_integral<iType>::value, size_t>
+  KOKKOS_FUNCTION constexpr std::enable_if_t<std::is_integral<iType>::value,
+                                             size_t>
   stride(iType r) const {
     return (
         r == 0
@@ -322,7 +314,7 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
   }
 
   template <typename iType>
-  KOKKOS_INLINE_FUNCTION void stride(iType* const s) const {
+  KOKKOS_FUNCTION void stride(iType* const s) const {
     m_map.stride(s);
   }
 
@@ -337,21 +329,19 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
         std::is_lvalue_reference<reference_type>::value
   };
 
-  KOKKOS_INLINE_FUNCTION constexpr size_t span() const { return m_map.span(); }
-  KOKKOS_INLINE_FUNCTION bool span_is_contiguous() const {
+  KOKKOS_FUNCTION constexpr size_t span() const { return m_map.span(); }
+  KOKKOS_FUNCTION bool span_is_contiguous() const {
     return m_map.span_is_contiguous();
   }
-  KOKKOS_INLINE_FUNCTION constexpr bool is_allocated() const {
+  KOKKOS_FUNCTION constexpr bool is_allocated() const {
     return m_map.data() != nullptr;
   }
-  KOKKOS_INLINE_FUNCTION constexpr pointer_type data() const {
-    return m_map.data();
-  }
+  KOKKOS_FUNCTION constexpr pointer_type data() const { return m_map.data(); }
 
   //----------------------------------------
   // Allow specializations to query their specialized map
 
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   const Kokkos::Impl::ViewMapping<traits, void>& implementation_map() const {
     return m_map;
   }
@@ -782,24 +772,24 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
   KOKKOS_DEFAULTED_FUNCTION
   ~OffsetView() = default;
 
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   OffsetView() : m_track(), m_map() {
     for (size_t i = 0; i < Rank; ++i) m_begins[i] = KOKKOS_INVALID_OFFSET;
   }
 
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   OffsetView(const OffsetView& rhs)
       : m_track(rhs.m_track, traits::is_managed),
         m_map(rhs.m_map),
         m_begins(rhs.m_begins) {}
 
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   OffsetView(OffsetView&& rhs)
       : m_track(std::move(rhs.m_track)),
         m_map(std::move(rhs.m_map)),
         m_begins(std::move(rhs.m_begins)) {}
 
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   OffsetView& operator=(const OffsetView& rhs) {
     m_track  = rhs.m_track;
     m_map    = rhs.m_map;
@@ -807,7 +797,7 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
     return *this;
   }
 
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   OffsetView& operator=(OffsetView&& rhs) {
     m_track  = std::move(rhs.m_track);
     m_map    = std::move(rhs.m_map);
@@ -822,14 +812,14 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
            typename traits::device_type, typename traits::memory_traits>;
 
  public:
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   view_type view() const {
     view_type v(m_track, m_map);
     return v;
   }
 
   template <class RT, class... RP>
-  KOKKOS_INLINE_FUNCTION OffsetView(const View<RT, RP...>& aview)
+  KOKKOS_FUNCTION OffsetView(const View<RT, RP...>& aview)
       : m_track(aview.impl_track()), m_map() {
     using SrcTraits = typename OffsetView<RT, RP...>::traits;
     using Mapping   = Kokkos::Impl::ViewMapping<traits, SrcTraits, void>;
@@ -843,8 +833,8 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
   }
 
   template <class RT, class... RP>
-  KOKKOS_INLINE_FUNCTION OffsetView(const View<RT, RP...>& aview,
-                                    const index_list_type& minIndices)
+  KOKKOS_FUNCTION OffsetView(const View<RT, RP...>& aview,
+                             const index_list_type& minIndices)
       : m_track(aview.impl_track()), m_map() {
     using SrcTraits = typename OffsetView<RT, RP...>::traits;
     using Mapping   = Kokkos::Impl::ViewMapping<traits, SrcTraits, void>;
@@ -863,8 +853,8 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
     }
   }
   template <class RT, class... RP>
-  KOKKOS_INLINE_FUNCTION OffsetView(const View<RT, RP...>& aview,
-                                    const begins_type& beg)
+  KOKKOS_FUNCTION OffsetView(const View<RT, RP...>& aview,
+                             const begins_type& beg)
       : m_track(aview.impl_track()), m_map(), m_begins(beg) {
     using SrcTraits = typename OffsetView<RT, RP...>::traits;
     using Mapping   = Kokkos::Impl::ViewMapping<traits, SrcTraits, void>;
@@ -876,7 +866,7 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
   // may assign unmanaged from managed.
 
   template <class RT, class... RP>
-  KOKKOS_INLINE_FUNCTION OffsetView(const OffsetView<RT, RP...>& rhs)
+  KOKKOS_FUNCTION OffsetView(const OffsetView<RT, RP...>& rhs)
       : m_track(rhs.m_track, traits::is_managed),
         m_map(),
         m_begins(rhs.m_begins) {
@@ -895,8 +885,8 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
   };
 
   // Subtraction should return a non-negative number and not overflow
-  KOKKOS_INLINE_FUNCTION static subtraction_failure check_subtraction(
-      int64_t lhs, int64_t rhs) {
+  KOKKOS_FUNCTION static subtraction_failure check_subtraction(int64_t lhs,
+                                                               int64_t rhs) {
     if (lhs < rhs) return subtraction_failure::negative;
 
     if (static_cast<uint64_t>(-1) / static_cast<uint64_t>(2) <
@@ -910,10 +900,10 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
   // which doesn't have iterators) and index_list_type (aka
   // std::initializer_list which doesn't have .data() or operator[]).
   // Returns by value
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   static int64_t at(const begins_type& a, size_t pos) { return a[pos]; }
 
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   static int64_t at(index_list_type a, size_t pos) {
     return *(a.begin() + pos);
   }
@@ -994,8 +984,8 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
 
   // Check the begins < ends for all elements
   template <typename B, typename E>
-  KOKKOS_INLINE_FUNCTION static subtraction_failure
-  runtime_check_begins_ends_device(const B& begins, const E& ends) {
+  KOKKOS_FUNCTION static subtraction_failure runtime_check_begins_ends_device(
+      const B& begins, const E& ends) {
     if (begins.size() != Rank)
       Kokkos::abort(
           "Kokkos::Experimental::OffsetView ERROR: for unmanaged "
@@ -1025,7 +1015,7 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
   }
 
   template <typename B, typename E>
-  KOKKOS_INLINE_FUNCTION static subtraction_failure runtime_check_begins_ends(
+  KOKKOS_FUNCTION static subtraction_failure runtime_check_begins_ends(
       const B& begins, const E& ends) {
     KOKKOS_IF_ON_HOST((return runtime_check_begins_ends_host(begins, ends);))
     KOKKOS_IF_ON_DEVICE(
@@ -1037,9 +1027,9 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
   // Each of B, E can be begins_type and/or index_list_type
   // Precondition: begins.size() == ends.size() == m_begins.size() == Rank
   template <typename B, typename E>
-  KOKKOS_INLINE_FUNCTION OffsetView(const pointer_type& p, const B& begins_,
-                                    const E& ends_,
-                                    subtraction_failure)
+  KOKKOS_FUNCTION OffsetView(const pointer_type& p, const B& begins_,
+                             const E& ends_,
+                             subtraction_failure)
       : m_track()  // no tracking
         ,
         m_map(Kokkos::Impl::ViewCtorProp<pointer_type>(p),
@@ -1061,25 +1051,25 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
   // Constructor around unmanaged data
   // Four overloads, as both begins and ends can be either
   // begins_type or index_list_type
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   OffsetView(const pointer_type& p, const begins_type& begins_,
              const begins_type& ends_)
       : OffsetView(p, begins_, ends_,
                    runtime_check_begins_ends(begins_, ends_)) {}
 
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   OffsetView(const pointer_type& p, const begins_type& begins_,
              index_list_type ends_)
       : OffsetView(p, begins_, ends_,
                    runtime_check_begins_ends(begins_, ends_)) {}
 
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   OffsetView(const pointer_type& p, index_list_type begins_,
              const begins_type& ends_)
       : OffsetView(p, begins_, ends_,
                    runtime_check_begins_ends(begins_, ends_)) {}
 
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   OffsetView(const pointer_type& p, index_list_type begins_,
              index_list_type ends_)
       : OffsetView(p, begins_, ends_,
@@ -1087,10 +1077,10 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
 
   //----------------------------------------
   // Allocation tracking properties
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   int use_count() const { return m_track.use_count(); }
 
-  inline const std::string label() const {
+  const std::string label() const {
     return m_track.template get_label<typename traits::memory_space>();
   }
 
@@ -1101,7 +1091,7 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
   // std::get<{0,1}>(RangeType const&) with std::tuple_size<RangeType>::value==2
   // but this wouldn't allow using the syntax in the example above.
   template <typename Label>
-  explicit inline OffsetView(
+  explicit OffsetView(
       const Label& arg_label,
       std::enable_if_t<Kokkos::Impl::is_view_label<Label>::value,
                        const std::pair<int64_t, int64_t>>
@@ -1128,38 +1118,32 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
             {range0.first, range1.first, range2.first, range3.first,
              range4.first, range5.first, range6.first, range7.first}) {}
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  template <typename Label>
-  KOKKOS_DEPRECATED_WITH_COMMENT(
-      "Use the constructor taking std::pair<int64_t, int64_t> arguments "
-      "instead!")
-  explicit inline OffsetView(
-      const Label& arg_label,
-      std::enable_if_t<Kokkos::Impl::is_view_label<Label>::value,
-                       const index_list_type>
-          range0,
-      const index_list_type range1 = KOKKOS_INVALID_INDEX_RANGE,
-      const index_list_type range2 = KOKKOS_INVALID_INDEX_RANGE,
-      const index_list_type range3 = KOKKOS_INVALID_INDEX_RANGE,
-      const index_list_type range4 = KOKKOS_INVALID_INDEX_RANGE,
-      const index_list_type range5 = KOKKOS_INVALID_INDEX_RANGE,
-      const index_list_type range6 = KOKKOS_INVALID_INDEX_RANGE,
-      const index_list_type range7 = KOKKOS_INVALID_INDEX_RANGE)
+  template <class... P>
+  explicit OffsetView(
+      const Kokkos::Impl::ViewCtorProp<P...>& arg_prop,
+      const std::pair<int64_t, int64_t> range0 = KOKKOS_INVALID_INDEX_RANGE,
+      const std::pair<int64_t, int64_t> range1 = KOKKOS_INVALID_INDEX_RANGE,
+      const std::pair<int64_t, int64_t> range2 = KOKKOS_INVALID_INDEX_RANGE,
+      const std::pair<int64_t, int64_t> range3 = KOKKOS_INVALID_INDEX_RANGE,
+      const std::pair<int64_t, int64_t> range4 = KOKKOS_INVALID_INDEX_RANGE,
+      const std::pair<int64_t, int64_t> range5 = KOKKOS_INVALID_INDEX_RANGE,
+      const std::pair<int64_t, int64_t> range6 = KOKKOS_INVALID_INDEX_RANGE,
+      const std::pair<int64_t, int64_t> range7 = KOKKOS_INVALID_INDEX_RANGE)
       : OffsetView(
-            arg_label,
-            std::pair<int64_t, int64_t>(range0.begin()[0], range0.begin()[1]),
-            std::pair<int64_t, int64_t>(range1.begin()[0], range1.begin()[1]),
-            std::pair<int64_t, int64_t>(range2.begin()[0], range2.begin()[1]),
-            std::pair<int64_t, int64_t>(range3.begin()[0], range3.begin()[1]),
-            std::pair<int64_t, int64_t>(range4.begin()[0], range4.begin()[1]),
-            std::pair<int64_t, int64_t>(range5.begin()[0], range5.begin()[1]),
-            std::pair<int64_t, int64_t>(range6.begin()[0], range6.begin()[1]),
-            std::pair<int64_t, int64_t>(range7.begin()[0], range7.begin()[1])) {
-  }
-#endif
+            arg_prop,
+            typename traits::array_layout(range0.second - range0.first + 1,
+                                          range1.second - range1.first + 1,
+                                          range2.second - range2.first + 1,
+                                          range3.second - range3.first + 1,
+                                          range4.second - range4.first + 1,
+                                          range5.second - range5.first + 1,
+                                          range6.second - range6.first + 1,
+                                          range7.second - range7.first + 1),
+            {range0.first, range1.first, range2.first, range3.first,
+             range4.first, range5.first, range6.first, range7.first}) {}
 
   template <class... P>
-  explicit KOKKOS_INLINE_FUNCTION OffsetView(
+  explicit KOKKOS_FUNCTION OffsetView(
       const Kokkos::Impl::ViewCtorProp<P...>& arg_prop,
       std::enable_if_t<Kokkos::Impl::ViewCtorProp<P...>::has_pointer,
                        typename traits::array_layout> const& arg_layout,
@@ -1178,7 +1162,7 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
   }
 
   template <class... P>
-  explicit inline OffsetView(
+  explicit OffsetView(
       const Kokkos::Impl::ViewCtorProp<P...>& arg_prop,
       std::enable_if_t<!Kokkos::Impl::ViewCtorProp<P...>::has_pointer,
                        typename traits::array_layout> const& arg_layout,
@@ -1189,21 +1173,11 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
   {
     for (size_t i = 0; i < Rank; ++i) m_begins[i] = minIndices.begin()[i];
 
-    // Append layout and spaces if not input
-    using alloc_prop_input = Kokkos::Impl::ViewCtorProp<P...>;
-
-    // use 'std::integral_constant<unsigned,I>' for non-types
-    // to avoid duplicate class error.
-    using alloc_prop = Kokkos::Impl::ViewCtorProp<
-        P...,
-        std::conditional_t<alloc_prop_input::has_label,
-                           std::integral_constant<unsigned, 0>, std::string>,
-        std::conditional_t<alloc_prop_input::has_memory_space,
-                           std::integral_constant<unsigned, 1>,
-                           typename traits::device_type::memory_space>,
-        std::conditional_t<alloc_prop_input::has_execution_space,
-                           std::integral_constant<unsigned, 2>,
-                           typename traits::device_type::execution_space>>;
+    // Copy the input allocation properties with possibly defaulted properties
+    auto prop_copy = Kokkos::Impl::with_properties_if_unset(
+        arg_prop, std::string{}, typename traits::device_type::memory_space{},
+        typename traits::device_type::execution_space{});
+    using alloc_prop = decltype(prop_copy);
 
     static_assert(traits::is_managed,
                   "OffsetView allocation constructor requires managed memory");
@@ -1217,9 +1191,6 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
           "execution space");
     }
 
-    // Copy the input allocation properties with possibly defaulted properties
-    alloc_prop prop_copy(arg_prop);
-
     //------------------------------------------------------------
 #if defined(KOKKOS_ENABLE_CUDA)
     // If allocating in CudaUVMSpace must fence before and after
@@ -1931,10 +1902,8 @@ inline auto create_mirror(const Kokkos::Experimental::OffsetView<T, P...>& src,
       "The view constructor arguments passed to Kokkos::create_mirror must "
       "not explicitly allow padding!");
 
-  using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>;
-  alloc_prop prop_copy(arg_prop);
-  static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value =
-      std::string(src.label()).append("_mirror");
+  auto prop_copy = Impl::with_properties_if_unset(
+      arg_prop, std::string(src.label()).append("_mirror"));
 
   return typename Kokkos::Impl::MirrorOffsetType<Space, T, P...>::view_type(
       prop_copy, src.layout(),
diff --git a/packages/kokkos/containers/src/Kokkos_ScatterView.hpp b/packages/kokkos/containers/src/Kokkos_ScatterView.hpp
index a9529d1c87c4f13dcb5d0054f5cd79ba1d2d3bfd..3b30996ad635a886142a12f75dd8ce8285191296 100644
--- a/packages/kokkos/containers/src/Kokkos_ScatterView.hpp
+++ b/packages/kokkos/containers/src/Kokkos_ScatterView.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /// \file Kokkos_ScatterView.hpp
 /// \brief Declaration and definition of Kokkos::ScatterView.
@@ -195,16 +167,16 @@ struct DefaultContribution<Kokkos::Cuda,
 
 #ifdef KOKKOS_ENABLE_HIP
 template <>
-struct DefaultDuplication<Kokkos::Experimental::HIP> {
+struct DefaultDuplication<Kokkos::HIP> {
   using type = Kokkos::Experimental::ScatterNonDuplicated;
 };
 template <>
-struct DefaultContribution<Kokkos::Experimental::HIP,
+struct DefaultContribution<Kokkos::HIP,
                            Kokkos::Experimental::ScatterNonDuplicated> {
   using type = Kokkos::Experimental::ScatterAtomic;
 };
 template <>
-struct DefaultContribution<Kokkos::Experimental::HIP,
+struct DefaultContribution<Kokkos::HIP,
                            Kokkos::Experimental::ScatterDuplicated> {
   using type = Kokkos::Experimental::ScatterAtomic;
 };
@@ -1027,10 +999,8 @@ class ScatterView<DataType, Kokkos::LayoutRight, DeviceType, Op,
         check_scatter_view_allocation_properties_argument;
     check_scatter_view_allocation_properties_argument(arg_prop);
 
-    auto const exec_space =
-        static_cast<::Kokkos::Impl::ViewCtorProp<void, execution_space> const&>(
-            arg_prop)
-            .value;
+    auto const& exec_space =
+        Kokkos::Impl::get_property<Kokkos::Impl::ExecutionSpaceTag>(arg_prop);
     reset(exec_space);
   }
 
@@ -1289,18 +1259,14 @@ class ScatterView<DataType, Kokkos::LayoutLeft, DeviceType, Op,
     Kokkos::Impl::Experimental::args_to_array(arg_N, 0, dims...);
     arg_N[internal_view_type::rank - 1] = unique_token.size();
 
-    auto const name =
-        static_cast<::Kokkos::Impl::ViewCtorProp<void, std::string> const&>(
-            arg_prop)
-            .value;
+    auto const& name =
+        Kokkos::Impl::get_property<Kokkos::Impl::LabelTag>(arg_prop);
     internal_view = internal_view_type(view_alloc(WithoutInitializing, name),
                                        arg_N[0], arg_N[1], arg_N[2], arg_N[3],
                                        arg_N[4], arg_N[5], arg_N[6], arg_N[7]);
 
-    auto const exec_space =
-        static_cast<::Kokkos::Impl::ViewCtorProp<void, execution_space> const&>(
-            arg_prop)
-            .value;
+    auto const& exec_space =
+        Kokkos::Impl::get_property<Kokkos::Impl::ExecutionSpaceTag>(arg_prop);
     reset(exec_space);
   }
 
diff --git a/packages/kokkos/containers/src/Kokkos_StaticCrsGraph.hpp b/packages/kokkos/containers/src/Kokkos_StaticCrsGraph.hpp
index 219b08b4b40cd8c9f9788a36fb31d488c52f7af3..8ce868cac2172b417d2bde8e1f18bc390ed78fc1 100644
--- a/packages/kokkos/containers/src/Kokkos_StaticCrsGraph.hpp
+++ b/packages/kokkos/containers/src/Kokkos_StaticCrsGraph.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STATICCRSGRAPH_HPP
 #define KOKKOS_STATICCRSGRAPH_HPP
diff --git a/packages/kokkos/containers/src/Kokkos_UnorderedMap.hpp b/packages/kokkos/containers/src/Kokkos_UnorderedMap.hpp
index 6c112644c9bc289d1758cd620d06ce4ffaf77331..058b6626c40cb13a8c6352a86a7914b9aa785ed2 100644
--- a/packages/kokkos/containers/src/Kokkos_UnorderedMap.hpp
+++ b/packages/kokkos/containers/src/Kokkos_UnorderedMap.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /// \file Kokkos_UnorderedMap.hpp
 /// \brief Declaration and definition of Kokkos::UnorderedMap.
@@ -311,13 +283,8 @@ class UnorderedMap {
                      capacity() + 1)  // +1 so that the *_at functions can
                                       // always return a valid reference
         ,
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-        m_keys("UnorderedMap keys", capacity() + 1),
-        m_values("UnorderedMap values", (is_set ? 1 : capacity() + 1)),
-#else
         m_keys("UnorderedMap keys", capacity()),
         m_values("UnorderedMap values", (is_set ? 0 : capacity())),
-#endif
         m_scalars("UnorderedMap scalars") {
     if (!is_insertable_map) {
       Kokkos::Impl::throw_runtime_exception(
@@ -347,24 +314,13 @@ class UnorderedMap {
       const key_type tmp = key_type();
       Kokkos::deep_copy(m_keys, tmp);
     }
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-    if (is_set) {
-      const impl_value_type tmp = impl_value_type();
-      Kokkos::deep_copy(m_values, tmp);
-    }
-#endif
     Kokkos::deep_copy(m_scalars, 0);
     m_size = 0;
   }
 
   KOKKOS_INLINE_FUNCTION constexpr bool is_allocated() const {
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-    return (m_keys.is_allocated() && m_values.is_allocated() &&
-            m_scalars.is_allocated());
-#else
     return (m_keys.is_allocated() && (is_set || m_values.is_allocated()) &&
             m_scalars.is_allocated());
-#endif
   }
 
   /// \brief Change the capacity of the the map
@@ -702,26 +658,10 @@ class UnorderedMap {
       !std::is_void<Dummy>::value,  // !is_set
       std::conditional_t<has_const_value, impl_value_type, impl_value_type &>>
   value_at(size_type i) const {
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-    return m_values[i < capacity() ? i : capacity()];
-#else
     KOKKOS_EXPECTS(i < capacity());
     return m_values[i];
-#endif
   }
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  template <typename Dummy = value_type>
-  KOKKOS_DEPRECATED_WITH_COMMENT(
-      "Calling value_at for value_type==void is deprecated!")
-  KOKKOS_FORCEINLINE_FUNCTION std::enable_if_t<
-      std::is_void<Dummy>::value,  // is_set
-      std::conditional_t<has_const_value, impl_value_type,
-                         impl_value_type &>> value_at(size_type /*i*/) const {
-    return m_values[0];
-  }
-#endif
-
   /// \brief Get the key with \c i as its direct index.
   ///
   /// \param i [in] Index directly into the array of entries.
@@ -730,12 +670,8 @@ class UnorderedMap {
   /// kernel.
   KOKKOS_FORCEINLINE_FUNCTION
   key_type key_at(size_type i) const {
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-    return m_keys[i < capacity() ? i : capacity()];
-#else
     KOKKOS_EXPECTS(i < capacity());
     return m_keys[i];
-#endif
   }
 
   KOKKOS_FORCEINLINE_FUNCTION
diff --git a/packages/kokkos/containers/src/Kokkos_Vector.hpp b/packages/kokkos/containers/src/Kokkos_Vector.hpp
index 8dd080737b49b52a63704611fc86cb71eee5491b..29bb15f5eab84ea32522889417d34806b525edce 100644
--- a/packages/kokkos/containers/src/Kokkos_Vector.hpp
+++ b/packages/kokkos/containers/src/Kokkos_Vector.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_VECTOR_HPP
 #define KOKKOS_VECTOR_HPP
@@ -183,8 +155,8 @@ class vector : public DualView<Scalar*, LayoutLeft, Arg1Type> {
  private:
   template <class T>
   struct impl_is_input_iterator
-      : /* TODO replace this */ std::integral_constant<
-            bool, !std::is_convertible<T, size_type>::value> {};
+      : /* TODO replace this */ std::bool_constant<
+            !std::is_convertible<T, size_type>::value> {};
 
  public:
   // TODO: can use detection idiom to generate better error message here later
diff --git a/packages/kokkos/containers/src/impl/Kokkos_Bitset_impl.hpp b/packages/kokkos/containers/src/impl/Kokkos_Bitset_impl.hpp
index 134b30769fb1d8a65e6e5d779a39c93f255268ad..c598e4b67b26596cbec7dc261860f8fdc7231825 100644
--- a/packages/kokkos/containers/src/impl/Kokkos_Bitset_impl.hpp
+++ b/packages/kokkos/containers/src/impl/Kokkos_Bitset_impl.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_BITSET_IMPL_HPP
 #define KOKKOS_BITSET_IMPL_HPP
diff --git a/packages/kokkos/containers/src/impl/Kokkos_Functional_impl.hpp b/packages/kokkos/containers/src/impl/Kokkos_Functional_impl.hpp
index 5fe3ab0df563db75a0ee6f34128fe16745a1258c..d77c673e813c407fb644adda104b6d5d5b657402 100644
--- a/packages/kokkos/containers/src/impl/Kokkos_Functional_impl.hpp
+++ b/packages/kokkos/containers/src/impl/Kokkos_Functional_impl.hpp
@@ -1,43 +1,17 @@
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
 
 #ifndef KOKKOS_FUNCTIONAL_IMPL_HPP
@@ -106,8 +80,8 @@ uint32_t MurmurHash3_x86_32(const void* key, int len, uint32_t seed) {
   uint32_t k1 = 0;
 
   switch (len & 3) {
-    case 3: k1 ^= tail[2] << 16; KOKKOS_IMPL_FALLTHROUGH
-    case 2: k1 ^= tail[1] << 8; KOKKOS_IMPL_FALLTHROUGH
+    case 3: k1 ^= tail[2] << 16; [[fallthrough]];
+    case 2: k1 ^= tail[1] << 8; [[fallthrough]];
     case 1:
       k1 ^= tail[0];
       k1 *= c1;
diff --git a/packages/kokkos/containers/src/impl/Kokkos_StaticCrsGraph_factory.hpp b/packages/kokkos/containers/src/impl/Kokkos_StaticCrsGraph_factory.hpp
index b81b1eee1e2475c2966e7aaa517611452ea37a9d..468e617d50657622d01421277b339e088d700a13 100644
--- a/packages/kokkos/containers/src/impl/Kokkos_StaticCrsGraph_factory.hpp
+++ b/packages/kokkos/containers/src/impl/Kokkos_StaticCrsGraph_factory.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_STATICCRSGRAPH_FACTORY_HPP
 #define KOKKOS_IMPL_STATICCRSGRAPH_FACTORY_HPP
diff --git a/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.cpp b/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.cpp
index fc861992f0e6d4f9f5ee2ccab96ee9bb31072444..5a22bf31f37d0dd6036566d306b1db65bf4f4278 100644
--- a/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.cpp
+++ b/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
diff --git a/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.hpp b/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.hpp
index 5acba244f60801f3541ef85e31896180685181eb..2c431d1579276606a97fd92bf2688a73a70dba7b 100644
--- a/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.hpp
+++ b/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_UNORDERED_MAP_IMPL_HPP
 #define KOKKOS_UNORDERED_MAP_IMPL_HPP
@@ -76,16 +48,13 @@ struct UnorderedMapRehash {
                  *this);
   }
 
-  template <typename Dummy = typename map_type::value_type>
-  KOKKOS_INLINE_FUNCTION std::enable_if_t<std::is_void<Dummy>::value>
-  operator()(size_type i) const {
-    if (m_src.valid_at(i)) m_dst.insert(m_src.key_at(i));
-  }
-
-  template <typename Dummy = typename map_type::value_type>
-  KOKKOS_INLINE_FUNCTION std::enable_if_t<!std::is_void<Dummy>::value>
-  operator()(size_type i) const {
-    if (m_src.valid_at(i)) m_dst.insert(m_src.key_at(i), m_src.value_at(i));
+  KOKKOS_INLINE_FUNCTION
+  void operator()(size_type i) const {
+    if constexpr (std::is_void_v<typename map_type::value_type>) {
+      if (m_src.valid_at(i)) m_dst.insert(m_src.key_at(i));
+    } else {
+      if (m_src.valid_at(i)) m_dst.insert(m_src.key_at(i), m_src.value_at(i));
+    }
   }
 };
 
diff --git a/packages/kokkos/containers/unit_tests/TestBitset.hpp b/packages/kokkos/containers/unit_tests/TestBitset.hpp
index 6cb03d6c5648556e97ca7e794742948cb15f7530..d97bdf9679f18ffad68903a4bc419788f93a444c 100644
--- a/packages/kokkos/containers/unit_tests/TestBitset.hpp
+++ b/packages/kokkos/containers/unit_tests/TestBitset.hpp
@@ -1,43 +1,17 @@
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
 
 #ifndef KOKKOS_TEST_BITSET_HPP
@@ -216,8 +190,19 @@ void test_bitset() {
     {
       Impl::TestBitsetTest<const_bitset_type> f(bitset);
       uint32_t count = f.testit();
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+      if constexpr (!std::is_same_v<typename Device::execution_space,
+                                    Kokkos::Cuda>) {
+        EXPECT_EQ(bitset.size(), count);
+        EXPECT_EQ(count, bitset.count());
+      } else {
+        (void)count;
+      }
+#else
       EXPECT_EQ(bitset.size(), count);
       EXPECT_EQ(count, bitset.count());
+#endif
     }
 
     // std::cout << "  Check reset() " << std::endl;
diff --git a/packages/kokkos/containers/unit_tests/TestCompileMain.cpp b/packages/kokkos/containers/unit_tests/TestCompileMain.cpp
index 237c8ce181774d991a9dbdd8cacf1a5fb9f199f1..fe164b5ba81e800e28eeba16670a9463de53cacb 100644
--- a/packages/kokkos/containers/unit_tests/TestCompileMain.cpp
+++ b/packages/kokkos/containers/unit_tests/TestCompileMain.cpp
@@ -1 +1,17 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 int main() {}
diff --git a/packages/kokkos/containers/unit_tests/TestCreateMirror.cpp b/packages/kokkos/containers/unit_tests/TestCreateMirror.cpp
index 0e43be4364154393b30cd349a563d7984a5ca2f0..8556f756b0bc7379c0038cf5cd2ed3fd6b4e2787 100644
--- a/packages/kokkos/containers/unit_tests/TestCreateMirror.cpp
+++ b/packages/kokkos/containers/unit_tests/TestCreateMirror.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <Kokkos_DynamicView.hpp>
@@ -49,8 +21,7 @@
 
 template <typename TestView, typename MemorySpace>
 void check_memory_space(TestView, MemorySpace) {
-  static_assert(
-      std::is_same<typename TestView::memory_space, MemorySpace>::value, "");
+  static_assert(std::is_same_v<typename TestView::memory_space, MemorySpace>);
 }
 
 template <class View>
@@ -69,70 +40,58 @@ void test_create_mirror_properties(const View& view) {
   // clang-format off
   
   // create_mirror
-#ifndef KOKKOS_ENABLE_CXX14
   // FIXME DynamicView: HostMirror is the same type
   if constexpr (!is_dynamic_view<View>::value) {
     check_memory_space(create_mirror(WithoutInitializing,                        view), host_mirror_test_space(view));
     check_memory_space(create_mirror(                                            view), host_mirror_test_space(view));
   }
-#endif
   check_memory_space(create_mirror(WithoutInitializing, DefaultExecutionSpace{}, view), DeviceMemorySpace{});
   check_memory_space(create_mirror(                     DefaultExecutionSpace{}, view), DeviceMemorySpace{});
 
   // create_mirror_view
-#ifndef KOKKOS_ENABLE_CXX14
   // FIXME DynamicView: HostMirror is the same type
   if constexpr (!is_dynamic_view<View>::value) {
     check_memory_space(create_mirror_view(WithoutInitializing,                        view), host_mirror_test_space(view));
     check_memory_space(create_mirror_view(                                            view), host_mirror_test_space(view));
   }
-#endif
   check_memory_space(create_mirror_view(WithoutInitializing, DefaultExecutionSpace{}, view), DeviceMemorySpace{});
   check_memory_space(create_mirror_view(                     DefaultExecutionSpace{}, view), DeviceMemorySpace{});
 
   // create_mirror view_alloc
-#ifndef KOKKOS_ENABLE_CXX14
   // FIXME DynamicView: HostMirror is the same type
   if constexpr (!is_dynamic_view<View>::value) {
     check_memory_space(create_mirror(view_alloc(WithoutInitializing),                    view), host_mirror_test_space(view));
     check_memory_space(create_mirror(view_alloc(),                                       view), host_mirror_test_space(view));
   }
-#endif
   check_memory_space(create_mirror(view_alloc(WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{});
   check_memory_space(create_mirror(view_alloc(                     DeviceMemorySpace{}), view), DeviceMemorySpace{});
 
   // create_mirror_view view_alloc
-#ifndef KOKKOS_ENABLE_CXX14
   // FIXME DynamicView: HostMirror is the same type
   if constexpr (!is_dynamic_view<View>::value) {
     check_memory_space(create_mirror_view(view_alloc(WithoutInitializing),                    view), host_mirror_test_space(view));
     check_memory_space(create_mirror_view(view_alloc(),                                       view), host_mirror_test_space(view));
   }
-#endif
   check_memory_space(create_mirror_view(view_alloc(WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{});
   check_memory_space(create_mirror_view(view_alloc(                     DeviceMemorySpace{}), view), DeviceMemorySpace{});
 
   // create_mirror view_alloc + execution space
-#ifndef KOKKOS_ENABLE_CXX14
   // FIXME DynamicView: HostMirror is the same type
   if constexpr (!is_dynamic_view<View>::value) {
-    check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{}, WithoutInitializing),                      view), host_mirror_test_space(view));
-    check_memory_space(create_mirror(view_alloc(DefaultHostExecutionSpace{}),                                       view), host_mirror_test_space(view));
+    check_memory_space(create_mirror(view_alloc(DefaultHostExecutionSpace{}, WithoutInitializing),                      view), host_mirror_test_space(view));
+    check_memory_space(create_mirror(view_alloc(DefaultHostExecutionSpace{}),                                           view), host_mirror_test_space(view));
   }
-#endif
-  check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{},   WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{});
-  check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{},                        DeviceMemorySpace{}), view), DeviceMemorySpace{});
+  check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{},       WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{});
+  check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{},                            DeviceMemorySpace{}), view), DeviceMemorySpace{});
 
   // create_mirror_view view_alloc + execution space
-#ifndef KOKKOS_ENABLE_CXX14
   // FIXME DynamicView: HostMirror is the same type
   if constexpr (!is_dynamic_view<View>::value) {
-    check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{}, WithoutInitializing),                      view), host_mirror_test_space(view));
-    check_memory_space(create_mirror_view(view_alloc(DefaultHostExecutionSpace{}),                                       view), host_mirror_test_space(view));
+    check_memory_space(create_mirror_view(view_alloc(DefaultHostExecutionSpace{}, WithoutInitializing),                      view), host_mirror_test_space(view));
+    check_memory_space(create_mirror_view(view_alloc(DefaultHostExecutionSpace{}),                                           view), host_mirror_test_space(view));
   }
-#endif
-  check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{},   WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{});
-  check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{},                        DeviceMemorySpace{}), view), DeviceMemorySpace{});
+  check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{},       WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{});
+  check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{},                            DeviceMemorySpace{}), view), DeviceMemorySpace{});
 
   // create_mirror_view_and_copy
   check_memory_space(create_mirror_view_and_copy(HostSpace{},         view), HostSpace{});
diff --git a/packages/kokkos/containers/unit_tests/TestDualView.hpp b/packages/kokkos/containers/unit_tests/TestDualView.hpp
index 3085f091cee81672f048903b3242d2fc49d24399..6e2e56c5cf7864ba9897bbb3f29bf0f2a8e326d7 100644
--- a/packages/kokkos/containers/unit_tests/TestDualView.hpp
+++ b/packages/kokkos/containers/unit_tests/TestDualView.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_DUALVIEW_HPP
 #define KOKKOS_TEST_DUALVIEW_HPP
@@ -492,8 +464,8 @@ struct UVMSpaceFor<Kokkos::Experimental::SYCL> {
 
 #ifdef KOKKOS_ENABLE_HIP  // specific to HIP
 template <>
-struct UVMSpaceFor<Kokkos::Experimental::HIP> {
-  using type = Kokkos::Experimental::HIPManagedSpace;
+struct UVMSpaceFor<Kokkos::HIP> {
+  using type = Kokkos::HIPManagedSpace;
 };
 #endif
 
diff --git a/packages/kokkos/containers/unit_tests/TestDynViewAPI.hpp b/packages/kokkos/containers/unit_tests/TestDynViewAPI.hpp
index 5fbd32956053e097c62247cc0a366866c34d8983..c7a5b13dbbecd3f07a83269c446e61fc63aa8259 100644
--- a/packages/kokkos/containers/unit_tests/TestDynViewAPI.hpp
+++ b/packages/kokkos/containers/unit_tests/TestDynViewAPI.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/containers/unit_tests/TestDynViewAPI_generic.hpp b/packages/kokkos/containers/unit_tests/TestDynViewAPI_generic.hpp
index 90ca5df194d5c33f53446125470ab7f464085095..d4747538d9b254a1d322a3b8e2f5718fe8b6372f 100644
--- a/packages/kokkos/containers/unit_tests/TestDynViewAPI_generic.hpp
+++ b/packages/kokkos/containers/unit_tests/TestDynViewAPI_generic.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestDynViewAPI.hpp>
 namespace Test {
diff --git a/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank12345.hpp b/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank12345.hpp
index 050ebbe35cab5e85b726b7ad5f9a10f3170607bb..d6019e823960852ae681b0b7d984503ea78ae8fe 100644
--- a/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank12345.hpp
+++ b/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank12345.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestDynViewAPI.hpp>
 
diff --git a/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank67.hpp b/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank67.hpp
index eb8df60a89d204fee4e454956304e48026a7c120..703811e0f4b4cfaf0f6b4ce65915514c9f7330a6 100644
--- a/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank67.hpp
+++ b/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank67.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestDynViewAPI.hpp>
 namespace Test {
diff --git a/packages/kokkos/containers/unit_tests/TestDynamicView.hpp b/packages/kokkos/containers/unit_tests/TestDynamicView.hpp
index 5345f8ea2459f69df6ba5074216db0a594407d5d..cd1511276f46785b04a33ae08c77214ac806fff8 100644
--- a/packages/kokkos/containers/unit_tests/TestDynamicView.hpp
+++ b/packages/kokkos/containers/unit_tests/TestDynamicView.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_DYNAMICVIEW_HPP
 #define KOKKOS_TEST_DYNAMICVIEW_HPP
@@ -240,6 +212,83 @@ struct TestDynamicView {
       ASSERT_EQ(new_result_sum, (value_type)(da_resize * (da_resize - 1) / 2));
 #endif
     }  // end scope
+
+    // Test: Reproducer to demonstrate compile-time error of deep_copy
+    // of DynamicView to/from on-host View.
+    //   Case 4:
+    {
+      using device_view_type = Kokkos::View<Scalar*, Space>;
+      using host_view_type = typename Kokkos::View<Scalar*, Space>::HostMirror;
+
+      view_type device_dynamic_view("on-device DynamicView", 1024,
+                                    arg_total_size);
+      device_view_type device_view("on-device View", arg_total_size);
+      host_view_type host_view("on-host View", arg_total_size);
+
+      unsigned da_size = arg_total_size / 8;
+      device_dynamic_view.resize_serial(da_size);
+
+      // Use parallel_for to populate device_dynamic_view and verify values
+#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
+      Kokkos::parallel_for(
+          Kokkos::RangePolicy<execution_space>(0, da_size),
+          KOKKOS_LAMBDA(const int i) { device_dynamic_view(i) = Scalar(i); });
+
+      value_type result_sum = 0.0;
+      Kokkos::parallel_reduce(
+          Kokkos::RangePolicy<execution_space>(0, da_size),
+          KOKKOS_LAMBDA(const int i, value_type& partial_sum) {
+            partial_sum += (value_type)device_dynamic_view(i);
+          },
+          result_sum);
+
+      ASSERT_EQ(result_sum, (value_type)(da_size * (da_size - 1) / 2));
+#endif
+
+      // Use an on-device View as intermediate to deep_copy the
+      // device_dynamic_view to host, zero out the device_dynamic_view,
+      // deep_copy from host back to the device_dynamic_view and verify
+      Kokkos::deep_copy(device_view, device_dynamic_view);
+      Kokkos::deep_copy(host_view, device_view);
+      Kokkos::deep_copy(device_view, host_view);
+#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
+      Kokkos::parallel_for(
+          Kokkos::RangePolicy<execution_space>(0, da_size),
+          KOKKOS_LAMBDA(const int i) { device_dynamic_view(i) = Scalar(0); });
+#endif
+      Kokkos::deep_copy(device_dynamic_view, device_view);
+#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
+      value_type new_result_sum = 0.0;
+      Kokkos::parallel_reduce(
+          Kokkos::RangePolicy<execution_space>(0, da_size),
+          KOKKOS_LAMBDA(const int i, value_type& partial_sum) {
+            partial_sum += (value_type)device_dynamic_view(i);
+          },
+          new_result_sum);
+
+      ASSERT_EQ(new_result_sum, (value_type)(da_size * (da_size - 1) / 2));
+#endif
+
+      // Try to deep_copy device_dynamic_view directly to/from host.
+      // host-to-device currently fails to compile because DP and SP are
+      // swapped in the deep_copy implementation.
+      // Once that's fixed, both deep_copy's will fail at runtime because the
+      // destination execution space cannot access the source memory space.
+      try {
+        Kokkos::deep_copy(host_view, device_dynamic_view);
+      } catch (std::runtime_error const& error) {
+        std::string msg = error.what();
+        std::cerr << "Copy from on-device DynamicView to on-host View failed:\n"
+                  << msg << std::endl;
+      }
+      try {
+        Kokkos::deep_copy(device_dynamic_view, host_view);
+      } catch (std::runtime_error const& error) {
+        std::string msg = error.what();
+        std::cerr << "Copy from on-host View to on-device DynamicView failed:\n"
+                  << msg << std::endl;
+      }
+    }
   }
 };
 
diff --git a/packages/kokkos/containers/unit_tests/TestErrorReporter.hpp b/packages/kokkos/containers/unit_tests/TestErrorReporter.hpp
index c5394d81a613bbd7fa1c42ea17eb392d3fd95693..0003a29468c5b430e863f27a52e2ec4379ba3c67 100644
--- a/packages/kokkos/containers/unit_tests/TestErrorReporter.hpp
+++ b/packages/kokkos/containers/unit_tests/TestErrorReporter.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_EXPERIMENTAL_ERROR_REPORTER_HPP
 #define KOKKOS_TEST_EXPERIMENTAL_ERROR_REPORTER_HPP
@@ -170,16 +142,14 @@ struct ErrorReporterDriver : public ErrorReporterDriverBase<DeviceType> {
   KOKKOS_INLINE_FUNCTION
   void operator()(const int work_idx) const {
     if (driver_base::error_condition(work_idx)) {
-      double val =
-          Kokkos::Experimental::pi_v<double> * static_cast<double>(work_idx);
+      double val = Kokkos::numbers::pi * static_cast<double>(work_idx);
       typename driver_base::report_type report = {work_idx, -2 * work_idx, val};
       driver_base::m_errorReporter.add_report(work_idx, report);
     }
   }
 };
 
-#if defined(KOKKOS_CLASS_LAMBDA) && \
-    (!defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_CUDA_LAMBDA))
+#if !defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_CUDA_LAMBDA)
 template <typename DeviceType>
 struct ErrorReporterDriverUseLambda
     : public ErrorReporterDriverBase<DeviceType> {
@@ -195,10 +165,10 @@ struct ErrorReporterDriverUseLambda
   void execute(int reporter_capacity, int test_size) {
     Kokkos::parallel_for(
         Kokkos::RangePolicy<execution_space>(0, test_size),
+        // NOLINTNEXTLINE(kokkos-implicit-this-capture)
         KOKKOS_CLASS_LAMBDA(const int work_idx) {
           if (driver_base::error_condition(work_idx)) {
-            double val = Kokkos::Experimental::pi_v<double> *
-                         static_cast<double>(work_idx);
+            double val = Kokkos::numbers::pi * static_cast<double>(work_idx);
             typename driver_base::report_type report = {work_idx, -2 * work_idx,
                                                         val};
             driver_base::m_errorReporter.add_report(work_idx, report);
@@ -222,8 +192,7 @@ struct ErrorReporterDriverNativeOpenMP
 #pragma omp parallel for
     for (int work_idx = 0; work_idx < test_size; ++work_idx) {
       if (driver_base::error_condition(work_idx)) {
-        double val =
-            Kokkos::Experimental::pi_v<double> * static_cast<double>(work_idx);
+        double val = Kokkos::numbers::pi * static_cast<double>(work_idx);
         typename driver_base::report_type report = {work_idx, -2 * work_idx,
                                                     val};
         driver_base::m_errorReporter.add_report(work_idx, report);
@@ -234,7 +203,9 @@ struct ErrorReporterDriverNativeOpenMP
 };
 #endif
 
-#if defined(KOKKOS_CLASS_LAMBDA) && \
+// FIXME_MSVC MSVC just gets confused when using the base class in the
+// KOKKOS_CLASS_LAMBDA
+#if !defined(KOKKOS_COMPILER_MSVC) && \
     (!defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_CUDA_LAMBDA))
 TEST(TEST_CATEGORY, ErrorReporterViaLambda) {
   TestErrorReporter<ErrorReporterDriverUseLambda<TEST_EXECSPACE>>();
diff --git a/packages/kokkos/containers/unit_tests/TestOffsetView.hpp b/packages/kokkos/containers/unit_tests/TestOffsetView.hpp
index 9e9edc80b51236b6bbed60a59f6c66e501f8fe03..c133922e3defb049d50ee8b13cc74229d83f98d6 100644
--- a/packages/kokkos/containers/unit_tests/TestOffsetView.hpp
+++ b/packages/kokkos/containers/unit_tests/TestOffsetView.hpp
@@ -1,43 +1,17 @@
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
 
 /*
@@ -63,13 +37,8 @@ void test_offsetview_construction() {
   using offset_view_type = Kokkos::Experimental::OffsetView<Scalar**, Device>;
   using view_type        = Kokkos::View<Scalar**, Device>;
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  Kokkos::Experimental::index_list_type range0 = {-1, 3};
-  Kokkos::Experimental::index_list_type range1 = {-2, 2};
-#else
   std::pair<int64_t, int64_t> range0 = {-1, 3};
   std::pair<int64_t, int64_t> range1 = {-2, 2};
-#endif
 
   {
     offset_view_type o1;
diff --git a/packages/kokkos/containers/unit_tests/TestScatterView.hpp b/packages/kokkos/containers/unit_tests/TestScatterView.hpp
index b2f5c5a91309d2514505b2c8817410a837091d14..347e914ea50b0c809085762b93817e5e1c0e27c0 100644
--- a/packages/kokkos/containers/unit_tests/TestScatterView.hpp
+++ b/packages/kokkos/containers/unit_tests/TestScatterView.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SCATTER_VIEW_HPP
 #define KOKKOS_TEST_SCATTER_VIEW_HPP
@@ -106,51 +78,11 @@ struct test_scatter_view_impl_cls<DeviceType, Layout, Duplication, Contribution,
       scatter_access(k, 3)++;
       scatter_access(k, 4)--;
       scatter_access(k, 5) -= 5;
-// Workaround Intel 17 compiler bug which sometimes add random
-// instruction alignment which makes the lock instruction
-// illegal. Seems to be mostly just for unsigned int atomics.
-// Looking at the assembly the compiler
-// appears to insert cache line alignment for the instruction.
-// Isn't restricted to specific archs. Seen it on SNB and SKX, but for
-// different code. Another occurrence was with Desul atomics in
-// a different unit test. This one here happens without desul atomics.
-// Inserting an assembly nop instruction changes the alignment and
-// works round this.
-#ifdef KOKKOS_COMPILER_INTEL
-#if (KOKKOS_COMPILER_INTEL < 1800)
-      asm volatile("nop\n");
-#endif
-#endif
       scatter_access_atomic(k, 6) += 2;
-#ifdef KOKKOS_COMPILER_INTEL
-#if (KOKKOS_COMPILER_INTEL < 1800)
-      asm volatile("nop\n");
-#endif
-#endif
       scatter_access_atomic(k, 7)++;
-#ifdef KOKKOS_COMPILER_INTEL
-#if (KOKKOS_COMPILER_INTEL < 1800)
-      asm volatile("nop\n");
-#endif
-#endif
       scatter_access_atomic(k, 8)--;
-#ifdef KOKKOS_COMPILER_INTEL
-#if (KOKKOS_COMPILER_INTEL < 1800)
-      asm volatile("nop\n");
-#endif
-#endif
       --scatter_access_atomic(k, 9);
-#ifdef KOKKOS_COMPILER_INTEL
-#if (KOKKOS_COMPILER_INTEL < 1800)
-      asm volatile("nop\n");
-#endif
-#endif
       ++scatter_access_atomic(k, 10);
-#ifdef KOKKOS_COMPILER_INTEL
-#if (KOKKOS_COMPILER_INTEL < 1800)
-      asm volatile("nop\n");
-#endif
-#endif
       scatter_access(k, 11) -= 3;
     }
   }
@@ -872,9 +804,9 @@ TEST(TEST_CATEGORY, scatterview_devicetype) {
   using device_memory_space    = Kokkos::CudaSpace;
   using host_accessible_space  = Kokkos::CudaUVMSpace;
 #else
-  using device_execution_space = Kokkos::Experimental::HIP;
-  using device_memory_space    = Kokkos::Experimental::HIPSpace;
-  using host_accessible_space  = Kokkos::Experimental::HIPManagedSpace;
+  using device_execution_space = Kokkos::HIP;
+  using device_memory_space    = Kokkos::HIPSpace;
+  using host_accessible_space  = Kokkos::HIPManagedSpace;
 #endif
   if (std::is_same<TEST_EXECSPACE, device_execution_space>::value) {
     using device_device_type =
diff --git a/packages/kokkos/containers/unit_tests/TestStaticCrsGraph.hpp b/packages/kokkos/containers/unit_tests/TestStaticCrsGraph.hpp
index 907a2d61d6d07cce48e2a6a6d937d783f09516c7..acff5d0be04bf6d1c9afeeb95f550844986c4fc3 100644
--- a/packages/kokkos/containers/unit_tests/TestStaticCrsGraph.hpp
+++ b/packages/kokkos/containers/unit_tests/TestStaticCrsGraph.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/containers/unit_tests/TestUnorderedMap.hpp b/packages/kokkos/containers/unit_tests/TestUnorderedMap.hpp
index 3f5f97d6bbae887f7e6084cb6f5cdf5705ed3299..989779b53a0320f39520ecd099f9a5c9e3a5416e 100644
--- a/packages/kokkos/containers/unit_tests/TestUnorderedMap.hpp
+++ b/packages/kokkos/containers/unit_tests/TestUnorderedMap.hpp
@@ -1,43 +1,17 @@
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
 
 #ifndef KOKKOS_TEST_UNORDERED_MAP_HPP
@@ -293,6 +267,12 @@ void test_deep_copy(uint32_t num_nodes) {
 
 #if !defined(_WIN32)
 TEST(TEST_CATEGORY, UnorderedMap_insert) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<TEST_EXECSPACE, Kokkos::Cuda>) {
+    GTEST_SKIP() << "unit test is hanging from index 0";
+  }
+#endif
   for (int i = 0; i < 500; ++i) {
     test_insert<TEST_EXECSPACE>(100000, 90000, 100, true);
     test_insert<TEST_EXECSPACE>(100000, 90000, 100, false);
@@ -305,6 +285,12 @@ TEST(TEST_CATEGORY, UnorderedMap_failed_insert) {
 }
 
 TEST(TEST_CATEGORY, UnorderedMap_deep_copy) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<TEST_EXECSPACE, Kokkos::Cuda>) {
+    GTEST_SKIP() << "unit test is hanging from index 0";
+  }
+#endif
   for (int i = 0; i < 2; ++i) test_deep_copy<TEST_EXECSPACE>(10000);
 }
 
diff --git a/packages/kokkos/containers/unit_tests/TestVector.hpp b/packages/kokkos/containers/unit_tests/TestVector.hpp
index efb21fe131e4d90abc1551e9340b814659986115..fa59607484663a80d2b76bb2bef572dc89297f4d 100644
--- a/packages/kokkos/containers/unit_tests/TestVector.hpp
+++ b/packages/kokkos/containers/unit_tests/TestVector.hpp
@@ -1,43 +1,17 @@
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
 
 #ifndef KOKKOS_TEST_VECTOR_HPP
diff --git a/packages/kokkos/containers/unit_tests/TestViewCtorPropEmbeddedDim.hpp b/packages/kokkos/containers/unit_tests/TestViewCtorPropEmbeddedDim.hpp
index d402160ef4bafb176647bf309b507129265de514..0246f11ddfe7ba4fc557e10ce6a15592341e3068 100644
--- a/packages/kokkos/containers/unit_tests/TestViewCtorPropEmbeddedDim.hpp
+++ b/packages/kokkos/containers/unit_tests/TestViewCtorPropEmbeddedDim.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <cstdio>
 
diff --git a/packages/kokkos/containers/unit_tests/TestWithoutInitializing.hpp b/packages/kokkos/containers/unit_tests/TestWithoutInitializing.hpp
index 174773f19886ad48779756859cce504ffb7b9221..d3bb05195cc5f7900ea29f35eec60e4b461670f8 100644
--- a/packages/kokkos/containers/unit_tests/TestWithoutInitializing.hpp
+++ b/packages/kokkos/containers/unit_tests/TestWithoutInitializing.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 #include <Kokkos_Core.hpp>
@@ -442,12 +414,16 @@ TEST(TEST_CATEGORY, create_mirror_no_init_dynrankview) {
       [&]() {
         auto mirror_device =
             Kokkos::create_mirror(Kokkos::WithoutInitializing, device_view);
+        ASSERT_EQ(device_view.size(), mirror_device.size());
         auto mirror_host = Kokkos::create_mirror(Kokkos::WithoutInitializing,
                                                  TEST_EXECSPACE{}, host_view);
+        ASSERT_EQ(host_view.size(), mirror_host.size());
         auto mirror_device_view = Kokkos::create_mirror_view(
             Kokkos::WithoutInitializing, device_view);
+        ASSERT_EQ(device_view.size(), mirror_device_view.size());
         auto mirror_host_view = Kokkos::create_mirror_view(
             Kokkos::WithoutInitializing, TEST_EXECSPACE{}, host_view);
+        ASSERT_EQ(host_view.size(), mirror_host_view.size());
       },
       [&](BeginParallelForEvent) {
         return MatchDiagnostic{true, {"Found begin event"}};
@@ -469,16 +445,20 @@ TEST(TEST_CATEGORY, create_mirror_no_init_dynrankview_viewctor) {
       [&]() {
         auto mirror_device = Kokkos::create_mirror(
             Kokkos::view_alloc(Kokkos::WithoutInitializing), device_view);
+        ASSERT_EQ(device_view.size(), mirror_device.size());
         auto mirror_host = Kokkos::create_mirror(
             Kokkos::view_alloc(Kokkos::WithoutInitializing,
-                               Kokkos::DefaultExecutionSpace{}),
+                               Kokkos::DefaultHostExecutionSpace{}),
             host_view);
+        ASSERT_EQ(host_view.size(), mirror_host.size());
         auto mirror_device_view = Kokkos::create_mirror_view(
             Kokkos::view_alloc(Kokkos::WithoutInitializing), device_view);
+        ASSERT_EQ(device_view.size(), mirror_device_view.size());
         auto mirror_host_view = Kokkos::create_mirror_view(
             Kokkos::view_alloc(Kokkos::WithoutInitializing,
                                Kokkos::DefaultExecutionSpace{}),
             host_view);
+        ASSERT_EQ(host_view.size(), mirror_host_view.size());
       },
       [&](BeginParallelForEvent) {
         return MatchDiagnostic{true, {"Found begin event"}};
@@ -509,6 +489,7 @@ TEST(TEST_CATEGORY, create_mirror_view_and_copy_dynrankview) {
             Kokkos::view_alloc(TEST_EXECSPACE{},
                                typename TEST_EXECSPACE::memory_space{}),
             host_view);
+        ASSERT_EQ(host_view.size(), mirror_device.size());
         // Avoid fences for deallocation when mirror_device goes out of scope.
         device_view = mirror_device;
       },
@@ -531,14 +512,24 @@ TEST(TEST_CATEGORY, create_mirror_no_init_offsetview) {
 
   auto success = validate_absence(
       [&]() {
+        device_view = Kokkos::Experimental::OffsetView<int*, TEST_EXECSPACE>(
+            Kokkos::view_alloc(Kokkos::WithoutInitializing, "device view"),
+            {0, 10});
+
         auto mirror_device =
             Kokkos::create_mirror(Kokkos::WithoutInitializing, device_view);
-        auto mirror_host = Kokkos::create_mirror(Kokkos::WithoutInitializing,
-                                                 TEST_EXECSPACE{}, host_view);
+        ASSERT_EQ(device_view.size(), mirror_device.size());
+        auto mirror_host = Kokkos::create_mirror(
+            Kokkos::WithoutInitializing, Kokkos::DefaultHostExecutionSpace{},
+            host_view);
+        ASSERT_EQ(host_view.size(), mirror_host.size());
         auto mirror_device_view = Kokkos::create_mirror_view(
             Kokkos::WithoutInitializing, device_view);
+        ASSERT_EQ(device_view.size(), mirror_device_view.size());
         auto mirror_host_view = Kokkos::create_mirror_view(
-            Kokkos::WithoutInitializing, TEST_EXECSPACE{}, host_view);
+            Kokkos::WithoutInitializing, Kokkos::DefaultHostExecutionSpace{},
+            host_view);
+        ASSERT_EQ(host_view.size(), mirror_host_view.size());
       },
       [&](BeginParallelForEvent) {
         return MatchDiagnostic{true, {"Found begin event"}};
@@ -561,16 +552,20 @@ TEST(TEST_CATEGORY, create_mirror_no_init_offsetview_view_ctor) {
       [&]() {
         auto mirror_device = Kokkos::create_mirror(
             Kokkos::view_alloc(Kokkos::WithoutInitializing), device_view);
+        ASSERT_EQ(device_view.size(), mirror_device.size());
         auto mirror_host = Kokkos::create_mirror(
             Kokkos::view_alloc(Kokkos::WithoutInitializing,
-                               Kokkos::DefaultExecutionSpace{}),
+                               Kokkos::DefaultHostExecutionSpace{}),
             host_view);
+        ASSERT_EQ(host_view.size(), mirror_host.size());
         auto mirror_device_view = Kokkos::create_mirror_view(
             Kokkos::view_alloc(Kokkos::WithoutInitializing), device_view);
+        ASSERT_EQ(device_view.size(), mirror_device_view.size());
         auto mirror_host_view = Kokkos::create_mirror_view(
             Kokkos::view_alloc(Kokkos::WithoutInitializing,
-                               Kokkos::DefaultExecutionSpace{}),
+                               Kokkos::DefaultHostExecutionSpace{}),
             host_view);
+        ASSERT_EQ(host_view.size(), mirror_host_view.size());
       },
       [&](BeginParallelForEvent) {
         return MatchDiagnostic{true, {"Found begin event"}};
@@ -602,12 +597,14 @@ TEST(TEST_CATEGORY, create_mirror_view_and_copy_offsetview) {
             Kokkos::view_alloc(TEST_EXECSPACE{},
                                typename TEST_EXECSPACE::memory_space{}),
             host_view);
+        ASSERT_EQ(host_view.size(), mirror_device.size());
         // Avoid fences for deallocation when mirror_device goes out of scope.
         device_view               = mirror_device;
         auto mirror_device_mirror = Kokkos::create_mirror_view_and_copy(
             Kokkos::view_alloc(TEST_EXECSPACE{},
                                typename TEST_EXECSPACE::memory_space{}),
             mirror_device);
+        ASSERT_EQ(mirror_device_mirror.size(), mirror_device.size());
       },
       [&](BeginParallelForEvent) {
         return MatchDiagnostic{true, {"Found parallel_for event"}};
@@ -625,19 +622,25 @@ TEST(TEST_CATEGORY, create_mirror_no_init_dynamicview) {
   listen_tool_events(Config::DisableAll(), Config::EnableKernels());
   Kokkos::Experimental::DynamicView<int*, TEST_EXECSPACE> device_view(
       "device view", 2, 10);
+  device_view.resize_serial(10);
   Kokkos::Experimental::DynamicView<int*, Kokkos::HostSpace> host_view(
       "host view", 2, 10);
+  host_view.resize_serial(10);
 
   auto success = validate_absence(
       [&]() {
         auto mirror_device =
             Kokkos::create_mirror(Kokkos::WithoutInitializing, device_view);
+        ASSERT_EQ(device_view.size(), mirror_device.size());
         auto mirror_host = Kokkos::create_mirror(Kokkos::WithoutInitializing,
                                                  TEST_EXECSPACE{}, host_view);
+        ASSERT_EQ(host_view.size(), mirror_host.size());
         auto mirror_device_view = Kokkos::create_mirror_view(
             Kokkos::WithoutInitializing, device_view);
+        ASSERT_EQ(device_view.size(), mirror_device_view.size());
         auto mirror_host_view = Kokkos::create_mirror_view(
             Kokkos::WithoutInitializing, TEST_EXECSPACE{}, host_view);
+        ASSERT_EQ(host_view.size(), mirror_host_view.size());
       },
       [&](BeginParallelForEvent) {
         return MatchDiagnostic{true, {"Found begin event"}};
@@ -660,6 +663,7 @@ TEST(TEST_CATEGORY, create_mirror_view_and_copy_dynamicview) {
 
   Kokkos::Experimental::DynamicView<int*, Kokkos::HostSpace> host_view(
       "host view", 2, 10);
+  host_view.resize_serial(10);
   decltype(Kokkos::create_mirror_view_and_copy(TEST_EXECSPACE{},
                                                host_view)) device_view;
 
@@ -669,12 +673,14 @@ TEST(TEST_CATEGORY, create_mirror_view_and_copy_dynamicview) {
             Kokkos::view_alloc(TEST_EXECSPACE{},
                                typename TEST_EXECSPACE::memory_space{}),
             host_view);
+        ASSERT_EQ(host_view.size(), mirror_device.size());
         // Avoid fences for deallocation when mirror_device goes out of scope.
         device_view               = mirror_device;
         auto mirror_device_mirror = Kokkos::create_mirror_view_and_copy(
             Kokkos::view_alloc(TEST_EXECSPACE{},
                                typename TEST_EXECSPACE::memory_space{}),
             mirror_device);
+        ASSERT_EQ(mirror_device_mirror.size(), mirror_device.size());
       },
       [&](BeginFenceEvent event) {
         if (event.descriptor().find("DynamicView::resize_serial: Fence after "
@@ -698,23 +704,29 @@ TEST(TEST_CATEGORY, create_mirror_no_init_dynamicview_view_ctor) {
   listen_tool_events(Config::DisableAll(), Config::EnableKernels());
   Kokkos::Experimental::DynamicView<int*, Kokkos::DefaultExecutionSpace>
       device_view("device view", 2, 10);
+  device_view.resize_serial(10);
   Kokkos::Experimental::DynamicView<int*, Kokkos::HostSpace> host_view(
       "host view", 2, 10);
+  host_view.resize_serial(10);
 
   auto success = validate_absence(
       [&]() {
         auto mirror_device = Kokkos::create_mirror(
             Kokkos::view_alloc(Kokkos::WithoutInitializing), device_view);
+        ASSERT_EQ(device_view.size(), mirror_device.size());
         auto mirror_host = Kokkos::create_mirror(
             Kokkos::view_alloc(Kokkos::WithoutInitializing,
                                Kokkos::DefaultExecutionSpace{}),
             host_view);
+        ASSERT_EQ(host_view.size(), mirror_host.size());
         auto mirror_device_view = Kokkos::create_mirror_view(
             Kokkos::view_alloc(Kokkos::WithoutInitializing), device_view);
+        ASSERT_EQ(device_view.size(), mirror_device_view.size());
         auto mirror_host_view = Kokkos::create_mirror_view(
             Kokkos::view_alloc(Kokkos::WithoutInitializing,
                                Kokkos::DefaultExecutionSpace{}),
             host_view);
+        ASSERT_EQ(host_view.size(), mirror_host_view.size());
       },
       [&](BeginFenceEvent event) {
         if (event.descriptor().find("DynamicView::resize_serial: Fence after "
diff --git a/packages/kokkos/containers/unit_tests/UnitTestMain.cpp b/packages/kokkos/containers/unit_tests/UnitTestMain.cpp
index e245aad35fc33a595a16f711dbd4a63a0c7f8948..11a1cb717a3414b42aec8cda20e13be5ab99ce09 100644
--- a/packages/kokkos/containers/unit_tests/UnitTestMain.cpp
+++ b/packages/kokkos/containers/unit_tests/UnitTestMain.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 #include <Kokkos_Core.hpp>
diff --git a/packages/kokkos/core/CMakeLists.txt b/packages/kokkos/core/CMakeLists.txt
index bb60c368f7ce7e6bd935dcd277426571fd863d6f..5d9fde56d202685f05a5e5db49608489986dcbc3 100644
--- a/packages/kokkos/core/CMakeLists.txt
+++ b/packages/kokkos/core/CMakeLists.txt
@@ -7,6 +7,9 @@ IF (NOT Kokkos_INSTALL_TESTING)
 ENDIF()
 
 KOKKOS_ADD_TEST_DIRECTORIES(unit_test)
-KOKKOS_ADD_TEST_DIRECTORIES(perf_test)
+IF (NOT KOKKOS_HAS_TRILINOS)
+  # We are using the githash etc in here, which does not work correct in Trilinos
+  KOKKOS_ADD_TEST_DIRECTORIES(perf_test)
+ENDIF()
 
 KOKKOS_SUBPACKAGE_POSTPROCESS()
diff --git a/packages/kokkos/core/perf_test/BenchmarkMain.cpp b/packages/kokkos/core/perf_test/BenchmarkMain.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..bba2bca36d89277da1690c97e56d5bd75e7de301
--- /dev/null
+++ b/packages/kokkos/core/perf_test/BenchmarkMain.cpp
@@ -0,0 +1,33 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#include <benchmark/benchmark.h>
+
+#include <Benchmark_Context.hpp>
+#include <Kokkos_Core.hpp>
+
+int main(int argc, char** argv) {
+  Kokkos::initialize(argc, argv);
+  benchmark::Initialize(&argc, argv);
+  benchmark::SetDefaultTimeUnit(benchmark::kSecond);
+  KokkosBenchmark::add_benchmark_context(true);
+
+  benchmark::RunSpecifiedBenchmarks();
+
+  benchmark::Shutdown();
+  Kokkos::finalize();
+  return 0;
+}
diff --git a/packages/kokkos/core/perf_test/Benchmark_Context.hpp b/packages/kokkos/core/perf_test/Benchmark_Context.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..ba6eff6646c85e3beefab1bb2a3ba8ae15ed017f
--- /dev/null
+++ b/packages/kokkos/core/perf_test/Benchmark_Context.hpp
@@ -0,0 +1,89 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_CORE_PERFTEST_BENCHMARK_CONTEXT_HPP
+#define KOKKOS_CORE_PERFTEST_BENCHMARK_CONTEXT_HPP
+
+#include <string>
+
+#include <benchmark/benchmark.h>
+
+#include <Kokkos_Core.hpp>
+#include <Kokkos_Version_Info.hpp>
+
+namespace KokkosBenchmark {
+
+/// \brief Remove unwanted spaces and colon signs from input string. In case of
+/// invalid input it will return an empty string.
+std::string remove_unwanted_characters(std::string str) {
+  auto from = str.find_first_not_of(" :");
+  auto to   = str.find_last_not_of(" :");
+
+  if (from == std::string::npos || to == std::string::npos) {
+    return "";
+  }
+
+  // return extracted part of string without unwanted spaces and colon signs
+  return str.substr(from, to + 1);
+}
+
+/// \brief Extract all key:value pairs from kokkos configuration and add it to
+/// the benchmark context
+void add_kokkos_configuration(bool verbose) {
+  std::ostringstream msg;
+  Kokkos::print_configuration(msg, verbose);
+
+  // Iterate over lines returned from kokkos and extract key:value pairs
+  std::stringstream ss{msg.str()};
+  for (std::string line; std::getline(ss, line, '\n');) {
+    auto found = line.find_first_of(':');
+    if (found != std::string::npos) {
+      auto val = remove_unwanted_characters(line.substr(found + 1));
+      // Ignore line without value, for example a category name
+      if (!val.empty()) {
+        benchmark::AddCustomContext(
+            remove_unwanted_characters(line.substr(0, found)), val);
+      }
+    }
+  }
+}
+
+/// \brief Add all data related to git to benchmark context
+void add_git_info() {
+  if (!Kokkos::Impl::GIT_BRANCH.empty()) {
+    benchmark::AddCustomContext("GIT_BRANCH", Kokkos::Impl::GIT_BRANCH);
+    benchmark::AddCustomContext("GIT_COMMIT_HASH",
+                                Kokkos::Impl::GIT_COMMIT_HASH);
+    benchmark::AddCustomContext("GIT_CLEAN_STATUS",
+                                Kokkos::Impl::GIT_CLEAN_STATUS);
+    benchmark::AddCustomContext("GIT_COMMIT_DESCRIPTION",
+                                Kokkos::Impl::GIT_COMMIT_DESCRIPTION);
+    benchmark::AddCustomContext("GIT_COMMIT_DATE",
+                                Kokkos::Impl::GIT_COMMIT_DATE);
+  }
+}
+
+/// \brief Gather all context information and add it to benchmark context data
+void add_benchmark_context(bool verbose = false) {
+  // Add Kokkos configuration to benchmark context data
+  add_kokkos_configuration(verbose);
+  // Add git information to benchmark context data
+  add_git_info();
+}
+
+}  // namespace KokkosBenchmark
+
+#endif
diff --git a/packages/kokkos/core/perf_test/CMakeLists.txt b/packages/kokkos/core/perf_test/CMakeLists.txt
index 7ba97dbfbb9c2c20bf7457534cdcf468c91772d9..814102975f5a5d7bd39b013a7de4380dc25fb08d 100644
--- a/packages/kokkos/core/perf_test/CMakeLists.txt
+++ b/packages/kokkos/core/perf_test/CMakeLists.txt
@@ -10,7 +10,8 @@
 #INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/../../algorithms/src")
 
 # FIXME_OPENMPTARGET - the NVIDIA HPC compiler nvc++ in the OpenMPTarget backend does not pass the perf_tests.
-IF (KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC)
+# FIXME_OPENACC - temporarily disabled due to unimplemented features
+IF ((KOKKOS_ENABLE_OPENMPTARGET OR KOKKOS_ENABLE_OPENACC) AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC)
   RETURN()
 ENDIF()
 
@@ -21,26 +22,6 @@ SET(SOURCES
   PerfTestHexGrad.cpp
   PerfTest_CustomReduction.cpp
   PerfTest_ExecSpacePartitioning.cpp
-  PerfTest_ViewCopy_a123.cpp
-  PerfTest_ViewCopy_b123.cpp
-  PerfTest_ViewCopy_c123.cpp
-  PerfTest_ViewCopy_d123.cpp
-  PerfTest_ViewCopy_a45.cpp
-  PerfTest_ViewCopy_b45.cpp
-  PerfTest_ViewCopy_c45.cpp
-  PerfTest_ViewCopy_d45.cpp
-  PerfTest_ViewCopy_a6.cpp
-  PerfTest_ViewCopy_b6.cpp
-  PerfTest_ViewCopy_c6.cpp
-  PerfTest_ViewCopy_d6.cpp
-  PerfTest_ViewCopy_a7.cpp
-  PerfTest_ViewCopy_b7.cpp
-  PerfTest_ViewCopy_c7.cpp
-  PerfTest_ViewCopy_d7.cpp
-  PerfTest_ViewCopy_a8.cpp
-  PerfTest_ViewCopy_b8.cpp
-  PerfTest_ViewCopy_c8.cpp
-  PerfTest_ViewCopy_d8.cpp
   PerfTest_ViewAllocate.cpp
   PerfTest_ViewFill_123.cpp
   PerfTest_ViewFill_45.cpp
@@ -63,6 +44,13 @@ IF(Kokkos_ENABLE_OPENMPTARGET)
   )
 ENDIF()
 
+IF(KOKKOS_ENABLE_CUDA OR KOKKOS_ENABLE_HIP OR KOKKOS_ENABLE_SYCL)
+  KOKKOS_ADD_EXECUTABLE (
+    PerformanceTest_SharedSpace
+    SOURCES test_sharedSpace.cpp
+  )
+ENDIF()
+
 # Per #374, we always want to build this test, but we only want to run
 # it as a PERFORMANCE test.  That's why we separate building the test
 # from running the test.
@@ -113,3 +101,118 @@ IF(NOT Kokkos_ENABLE_OPENMPTARGET)
     CATEGORIES PERFORMANCE
   )
 ENDIF()
+
+
+IF(NOT Kokkos_ENABLE_BENCHMARKS)
+  RETURN()
+ENDIF()
+
+IF (KOKKOS_HAS_TRILINOS)
+  message(FATAL_ERROR "Benchmarks are not supported when building as part of Trilinos")
+ENDIF()
+
+find_package(benchmark QUIET)
+IF(benchmark_FOUND)
+  MESSAGE(STATUS "Using google benchmark found in ${benchmark_DIR}")
+ELSE()
+  message(STATUS "No installed google benchmark found, fetching from GitHub")
+  include(FetchContent)
+  SET(BENCHMARK_ENABLE_TESTING OFF)
+
+  list(APPEND CMAKE_MESSAGE_INDENT "    ")
+  FetchContent_Declare(
+    googlebenchmark
+    URL https://github.com/google/benchmark/archive/refs/tags/v1.6.2.tar.gz
+    URL_HASH MD5=14d14849e075af116143a161bc3b927b
+  )
+  FetchContent_MakeAvailable(googlebenchmark)
+  list(POP_BACK CMAKE_MESSAGE_INDENT)
+
+  include_directories(${benchmark_SOURCE_DIR}/include)
+
+  # Suppress clang-tidy diagnostics on code that we do not have control over
+  IF(CMAKE_CXX_CLANG_TIDY)
+    SET_TARGET_PROPERTIES(benchmark PROPERTIES CXX_CLANG_TIDY "")
+  ENDIF()
+
+  target_compile_options(benchmark PRIVATE -w)
+  target_compile_options(benchmark_main PRIVATE -w)
+ENDIF()
+
+
+FUNCTION(KOKKOS_ADD_BENCHMARK NAME)
+  CMAKE_PARSE_ARGUMENTS(
+    BENCHMARK
+    ""
+    ""
+    "SOURCES"
+    ${ARGN}
+  )
+  IF(DEFINED BENCHMARK_UNPARSED_ARGUMENTS)
+    MESSAGE(
+      WARNING
+      "Unexpected arguments when adding a benchmark: "
+      ${BENCHMARK_UNPARSED_ARGUMENTS}
+    )
+  ENDIF()
+
+  SET(BENCHMARK_NAME ${PACKAGE_NAME}_${NAME})
+
+  ADD_EXECUTABLE(
+    ${BENCHMARK_NAME}
+    ${BENCHMARK_SOURCES}
+  )
+  TARGET_LINK_LIBRARIES(
+    ${BENCHMARK_NAME}
+    PRIVATE benchmark::benchmark Kokkos::kokkos impl_git_version
+  )
+  FOREACH(SOURCE_FILE ${BENCHMARK_SOURCES})
+    SET_SOURCE_FILES_PROPERTIES(
+      ${SOURCE_FILE}
+      PROPERTIES LANGUAGE ${KOKKOS_COMPILE_LANGUAGE}
+    )
+  ENDFOREACH()
+
+  STRING(TIMESTAMP BENCHMARK_TIME "%Y-%m-%d_T%H-%M-%S" UTC)
+  SET(
+    BENCHMARK_ARGS
+    --benchmark_counters_tabular=true
+    --benchmark_out=${BENCHMARK_NAME}_${BENCHMARK_TIME}.json
+  )
+
+  ADD_TEST(
+    NAME ${BENCHMARK_NAME}
+    COMMAND ${BENCHMARK_NAME} ${BENCHMARK_ARGS}
+  )
+ENDFUNCTION()
+
+SET(
+  BENCHMARK_SOURCES
+  BenchmarkMain.cpp
+  PerfTest_ViewCopy_a123.cpp
+  PerfTest_ViewCopy_b123.cpp
+  PerfTest_ViewCopy_c123.cpp
+  PerfTest_ViewCopy_d123.cpp
+  PerfTest_ViewCopy_a45.cpp
+  PerfTest_ViewCopy_b45.cpp
+  PerfTest_ViewCopy_c45.cpp
+  PerfTest_ViewCopy_d45.cpp
+  PerfTest_ViewCopy_a6.cpp
+  PerfTest_ViewCopy_b6.cpp
+  PerfTest_ViewCopy_c6.cpp
+  PerfTest_ViewCopy_d6.cpp
+  PerfTest_ViewCopy_a7.cpp
+  PerfTest_ViewCopy_b7.cpp
+  PerfTest_ViewCopy_c7.cpp
+  PerfTest_ViewCopy_d7.cpp
+  PerfTest_ViewCopy_a8.cpp
+  PerfTest_ViewCopy_b8.cpp
+  PerfTest_ViewCopy_c8.cpp
+  PerfTest_ViewCopy_d8.cpp
+  PerfTest_ViewCopy_Raw.cpp
+)
+
+KOKKOS_ADD_BENCHMARK(
+  PerformanceTest_Benchmark
+  SOURCES ${BENCHMARK_SOURCES}
+)
diff --git a/packages/kokkos/core/perf_test/Makefile b/packages/kokkos/core/perf_test/Makefile
index ac06c89757d243ae6af6de755cae749bdd959e5b..396387c622f112d81cadcc75dc59bd1403a5cc28 100644
--- a/packages/kokkos/core/perf_test/Makefile
+++ b/packages/kokkos/core/perf_test/Makefile
@@ -34,11 +34,6 @@ OBJ_PERF += PerfTest_ExecSpacePartitioning.o
 OBJ_PERF += PerfTestGramSchmidt.o
 OBJ_PERF += PerfTestHexGrad.o
 OBJ_PERF += PerfTest_CustomReduction.o
-OBJ_PERF += PerfTest_ViewCopy_a123.o PerfTest_ViewCopy_b123.o PerfTest_ViewCopy_c123.o PerfTest_ViewCopy_d123.o
-OBJ_PERF += PerfTest_ViewCopy_a45.o PerfTest_ViewCopy_b45.o PerfTest_ViewCopy_c45.o PerfTest_ViewCopy_d45.o
-OBJ_PERF += PerfTest_ViewCopy_a6.o PerfTest_ViewCopy_b6.o PerfTest_ViewCopy_c6.o PerfTest_ViewCopy_d6.o
-OBJ_PERF += PerfTest_ViewCopy_a7.o PerfTest_ViewCopy_b7.o PerfTest_ViewCopy_c7.o PerfTest_ViewCopy_d7.o
-OBJ_PERF += PerfTest_ViewCopy_a8.o PerfTest_ViewCopy_b8.o PerfTest_ViewCopy_c8.o PerfTest_ViewCopy_d8.o
 OBJ_PERF += PerfTest_ViewAllocate.o
 OBJ_PERF += PerfTest_ViewFill_123.o PerfTest_ViewFill_45.o PerfTest_ViewFill_6.o PerfTest_ViewFill_7.o PerfTest_ViewFill_8.o
 OBJ_PERF += PerfTest_ViewResize_123.o PerfTest_ViewResize_45.o PerfTest_ViewResize_6.o PerfTest_ViewResize_7.o PerfTest_ViewResize_8.o
diff --git a/packages/kokkos/core/perf_test/PerfTestBlasKernels.hpp b/packages/kokkos/core/perf_test/PerfTestBlasKernels.hpp
index 5be29e65d724e28b5d4990ff905f10bfe25f2dc7..1d7073fe5a5f334e5833b0206a89f81992bee4d6 100644
--- a/packages/kokkos/core/perf_test/PerfTestBlasKernels.hpp
+++ b/packages/kokkos/core/perf_test/PerfTestBlasKernels.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_BLAS_KERNELS_HPP
 #define KOKKOS_BLAS_KERNELS_HPP
diff --git a/packages/kokkos/core/perf_test/PerfTestDriver.hpp b/packages/kokkos/core/perf_test/PerfTestDriver.hpp
index 95d5128abf312086edd055b5cce158178d5e3cac..ea54f31902b5e5a222279f85ca06f71a615c8c4b 100644
--- a/packages/kokkos/core/perf_test/PerfTestDriver.hpp
+++ b/packages/kokkos/core/perf_test/PerfTestDriver.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <iostream>
 #include <string>
diff --git a/packages/kokkos/core/perf_test/PerfTestGramSchmidt.cpp b/packages/kokkos/core/perf_test/PerfTestGramSchmidt.cpp
index 31a01184c17cf167def6e614fcb68a7050d58f79..c8f8487ffc9f6f6cad816f97136034eb18f840ee 100644
--- a/packages/kokkos/core/perf_test/PerfTestGramSchmidt.cpp
+++ b/packages/kokkos/core/perf_test/PerfTestGramSchmidt.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <gtest/gtest.h>
diff --git a/packages/kokkos/core/perf_test/PerfTestHexGrad.cpp b/packages/kokkos/core/perf_test/PerfTestHexGrad.cpp
index 24c1898e0a16a4149c21df08e82c3da54ef0a25a..ef92de7ce1095a18be29ed58352193e01dd0db9c 100644
--- a/packages/kokkos/core/perf_test/PerfTestHexGrad.cpp
+++ b/packages/kokkos/core/perf_test/PerfTestHexGrad.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <gtest/gtest.h>
diff --git a/packages/kokkos/core/perf_test/PerfTestMDRange.hpp b/packages/kokkos/core/perf_test/PerfTestMDRange.hpp
index ec0452d5f197888d1cdbdf2c189e2c614e1b66d8..7ec1cd6996a73a1a3fc4c4db07ed11aef52de9bf 100644
--- a/packages/kokkos/core/perf_test/PerfTestMDRange.hpp
+++ b/packages/kokkos/core/perf_test/PerfTestMDRange.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 namespace Test {
 template <class DeviceType, typename ScalarType = double,
diff --git a/packages/kokkos/core/perf_test/PerfTestMain.cpp b/packages/kokkos/core/perf_test/PerfTestMain.cpp
index 8f4d48d57bf3f2c21ed78054a22abc6c4694bdcb..2729432adc32d727d305606bf024b94dd4ad235d 100644
--- a/packages/kokkos/core/perf_test/PerfTestMain.cpp
+++ b/packages/kokkos/core/perf_test/PerfTestMain.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 #include <cstdlib>
diff --git a/packages/kokkos/core/perf_test/PerfTest_Category.hpp b/packages/kokkos/core/perf_test/PerfTest_Category.hpp
index 0f24490bfeb77df3e86b4af14e9dcfdf5680efbb..126c9611479b453df799a17b9592e7675f312086 100644
--- a/packages/kokkos/core/perf_test/PerfTest_Category.hpp
+++ b/packages/kokkos/core/perf_test/PerfTest_Category.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_PERFTEST_CAT_HPP
 #define KOKKOS_TEST_PERFTEST_CAT_HPP
diff --git a/packages/kokkos/core/perf_test/PerfTest_CustomReduction.cpp b/packages/kokkos/core/perf_test/PerfTest_CustomReduction.cpp
index 1ab76d6e543996be34b40800c8da31022cd625cd..049301f9a712cac5fced36fed114d3135e0b5a59 100644
--- a/packages/kokkos/core/perf_test/PerfTest_CustomReduction.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_CustomReduction.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <gtest/gtest.h>
@@ -58,8 +30,8 @@ void custom_reduction_test(int N, int R, int num_trials) {
   Scalar max;
 
   int team_size = 32;
-  if (team_size > Kokkos::DefaultExecutionSpace::concurrency())
-    team_size = Kokkos::DefaultExecutionSpace::concurrency();
+  if (team_size > Kokkos::DefaultExecutionSpace().concurrency())
+    team_size = Kokkos::DefaultExecutionSpace().concurrency();
   // Warm up
   Kokkos::parallel_reduce(
       Kokkos::TeamPolicy<>(N / 1024, team_size),
diff --git a/packages/kokkos/core/perf_test/PerfTest_ExecSpacePartitioning.cpp b/packages/kokkos/core/perf_test/PerfTest_ExecSpacePartitioning.cpp
index b1a7bf1e8376d3f4402820207387231ecb9252a8..48419c7ec681be818183e66eb89a78a8337dd877 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ExecSpacePartitioning.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ExecSpacePartitioning.cpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #include <Kokkos_Core.hpp>
 #include <gtest/gtest.h>
 #include <PerfTest_Category.hpp>
@@ -26,8 +42,7 @@ bool is_overlapping<Kokkos::Cuda>(const Kokkos::Cuda&) {
 
 #ifdef KOKKOS_ENABLE_HIP
 template <>
-bool is_overlapping<Kokkos::Experimental::HIP>(
-    const Kokkos::Experimental::HIP&) {
+bool is_overlapping<Kokkos::HIP>(const Kokkos::HIP&) {
   // FIXME_HIP This doesn't pass yet in CI.
   return false;
   // bool value          = true;
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewAllocate.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewAllocate.cpp
index 555a05ea279cd2280c510a03976dd75e8ee171f2..c1d98958476429b6a37c5568c449d189904019eb 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewAllocate.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewAllocate.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <gtest/gtest.h>
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy.hpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy.hpp
index 8e7bf25e809cf7649574c332af9bc35dfb0e1d94..b0216ca6fc4ce2436c2e5246ae1acce7ca45b6fa 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy.hpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy.hpp
@@ -1,261 +1,168 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
+
+#ifndef KOKKOS_CORE_PERFTEST_BENCHMARK_VIEW_COPY_HPP
+#define KOKKOS_CORE_PERFTEST_BENCHMARK_VIEW_COPY_HPP
 
 #include <Kokkos_Core.hpp>
-#include <gtest/gtest.h>
-#include <cstdio>
-#include <PerfTest_Category.hpp>
+#include <benchmark/benchmark.h>
+#include <cmath>
 
 namespace Test {
 
+/**
+ * \brief Mark the label as a figure of merit.
+ */
+inline std::string benchmark_fom(const std::string& label) {
+  return "FOM: " + label;
+}
+
+inline void report_results(benchmark::State& state, std::size_t num_elems,
+                           double time) {
+  state.SetIterationTime(time);
+
+  // data size in megabytes
+  const auto size = 1.0 * num_elems * sizeof(double) / 1000 / 1000;
+  // data processed in gigabytes
+  const auto data_processed = 2 * size / 1000;
+
+  state.counters["MB"] =
+      benchmark::Counter(size, benchmark::Counter::kDefaults);
+  state.counters[benchmark_fom("GB/s")] = benchmark::Counter(
+      data_processed, benchmark::Counter::kIsIterationInvariantRate);
+}
+
 template <class ViewTypeA, class ViewTypeB>
-double deepcopy_view(ViewTypeA& a, ViewTypeB& b, int repeat) {
-  Kokkos::Timer timer;
-  for (int i = 0; i < repeat; i++) {
+void deepcopy_view(ViewTypeA& a, ViewTypeB& b, benchmark::State& state) {
+  for (auto _ : state) {
+    Kokkos::fence();
+    Kokkos::Timer timer;
     Kokkos::deep_copy(a, b);
+    report_results(state, a.size(), timer.seconds());
   }
-  Kokkos::fence();
-  return timer.seconds();
 }
 
 template <class LayoutA, class LayoutB>
-void run_deepcopyview_tests123(int N, int R) {
-  const int N1 = N;
+static void ViewDeepCopy_Rank1(benchmark::State& state) {
+  const int N8 = std::pow(state.range(0), 8);
+
+  Kokkos::View<double*, LayoutA> a("A1", N8);
+  Kokkos::View<double*, LayoutB> b("B1", N8);
+
+  deepcopy_view(a, b, state);
+}
+
+template <class LayoutA, class LayoutB>
+static void ViewDeepCopy_Rank2(benchmark::State& state) {
+  const int N1 = state.range(0);
   const int N2 = N1 * N1;
-  const int N3 = N2 * N1;
   const int N4 = N2 * N2;
-  const int N8 = N4 * N4;
 
-  double time1, time2, time3, time_raw = 100000.0;
-  {
-    Kokkos::View<double*, LayoutA> a("A1", N8);
-    Kokkos::View<double*, LayoutB> b("B1", N8);
-    time1 = deepcopy_view(a, b, R) / R;
-  }
-  {
-    Kokkos::View<double**, LayoutA> a("A2", N4, N4);
-    Kokkos::View<double**, LayoutB> b("B2", N4, N4);
-    time2 = deepcopy_view(a, b, R) / R;
-  }
-  {
-    Kokkos::View<double***, LayoutA> a("A3", N3, N3, N2);
-    Kokkos::View<double***, LayoutB> b("B3", N3, N3, N2);
-    time3 = deepcopy_view(a, b, R) / R;
-  }
-#if defined(KOKKOS_ENABLE_CUDA_LAMBDA) || !defined(KOKKOS_ENABLE_CUDA)
-  {
-    Kokkos::View<double*, LayoutA> a("A1", N8);
-    Kokkos::View<double*, LayoutB> b("B1", N8);
-    double* const a_ptr       = a.data();
-    const double* const b_ptr = b.data();
-    Kokkos::Timer timer;
-    for (int r = 0; r < R; r++) {
-      Kokkos::parallel_for(
-          N8, KOKKOS_LAMBDA(const int& i) { a_ptr[i] = b_ptr[i]; });
-    }
-    Kokkos::fence();
-    time_raw = timer.seconds() / R;
-  }
-#endif
-  double size = 1.0 * N8 * 8 / 1024 / 1024;
-  printf("   Raw:   %lf s   %lf MB   %lf GB/s\n", time_raw, size,
-         2.0 * size / 1024 / time_raw);
-  printf("   Rank1: %lf s   %lf MB   %lf GB/s\n", time1, size,
-         2.0 * size / 1024 / time1);
-  printf("   Rank2: %lf s   %lf MB   %lf GB/s\n", time2, size,
-         2.0 * size / 1024 / time2);
-  printf("   Rank3: %lf s   %lf MB   %lf GB/s\n", time3, size,
-         2.0 * size / 1024 / time3);
+  Kokkos::View<double**, LayoutA> a("A2", N4, N4);
+  Kokkos::View<double**, LayoutB> b("B2", N4, N4);
+
+  deepcopy_view(a, b, state);
 }
 
 template <class LayoutA, class LayoutB>
-void run_deepcopyview_tests45(int N, int R) {
-  const int N1 = N;
+static void ViewDeepCopy_Rank3(benchmark::State& state) {
+  const int N1 = state.range(0);
   const int N2 = N1 * N1;
-  const int N4 = N2 * N2;
-  const int N8 = N4 * N4;
+  const int N3 = N2 * N1;
 
-  double time4, time5, time_raw = 100000.0;
-  {
-    Kokkos::View<double****, LayoutA> a("A4", N2, N2, N2, N2);
-    Kokkos::View<double****, LayoutB> b("B4", N2, N2, N2, N2);
-    time4 = deepcopy_view(a, b, R) / R;
-  }
-  {
-    Kokkos::View<double*****, LayoutA> a("A5", N2, N2, N1, N1, N2);
-    Kokkos::View<double*****, LayoutB> b("B5", N2, N2, N1, N1, N2);
-    time5 = deepcopy_view(a, b, R) / R;
-  }
-#if defined(KOKKOS_ENABLE_CUDA_LAMBDA) || !defined(KOKKOS_ENABLE_CUDA)
-  {
-    Kokkos::View<double*, LayoutA> a("A1", N8);
-    Kokkos::View<double*, LayoutB> b("B1", N8);
-    double* const a_ptr       = a.data();
-    const double* const b_ptr = b.data();
-    Kokkos::Timer timer;
-    for (int r = 0; r < R; r++) {
-      Kokkos::parallel_for(
-          N8, KOKKOS_LAMBDA(const int& i) { a_ptr[i] = b_ptr[i]; });
-    }
-    Kokkos::fence();
-    time_raw = timer.seconds() / R;
-  }
-#endif
-  double size = 1.0 * N8 * 8 / 1024 / 1024;
-  printf("   Raw:   %lf s   %lf MB   %lf GB/s\n", time_raw, size,
-         2.0 * size / 1024 / time_raw);
-  printf("   Rank4: %lf s   %lf MB   %lf GB/s\n", time4, size,
-         2.0 * size / 1024 / time4);
-  printf("   Rank5: %lf s   %lf MB   %lf GB/s\n", time5, size,
-         2.0 * size / 1024 / time5);
+  Kokkos::View<double***, LayoutA> a("A3", N3, N3, N2);
+  Kokkos::View<double***, LayoutB> b("B3", N3, N3, N2);
+
+  deepcopy_view(a, b, state);
 }
 
 template <class LayoutA, class LayoutB>
-void run_deepcopyview_tests6(int N, int R) {
-  const int N1 = N;
+static void ViewDeepCopy_Rank4(benchmark::State& state) {
+  const int N1 = state.range(0);
   const int N2 = N1 * N1;
-  const int N4 = N2 * N2;
-  const int N8 = N4 * N4;
 
-  double time6, time_raw = 100000.0;
-  {
-    Kokkos::View<double******, LayoutA> a("A6", N2, N1, N1, N1, N1, N2);
-    Kokkos::View<double******, LayoutB> b("B6", N2, N1, N1, N1, N1, N2);
-    time6 = deepcopy_view(a, b, R) / R;
-  }
-#if defined(KOKKOS_ENABLE_CUDA_LAMBDA) || !defined(KOKKOS_ENABLE_CUDA)
-  {
-    Kokkos::View<double*, LayoutA> a("A1", N8);
-    Kokkos::View<double*, LayoutB> b("B1", N8);
-    double* const a_ptr       = a.data();
-    const double* const b_ptr = b.data();
-    Kokkos::Timer timer;
-    for (int r = 0; r < R; r++) {
-      Kokkos::parallel_for(
-          N8, KOKKOS_LAMBDA(const int& i) { a_ptr[i] = b_ptr[i]; });
-    }
-    Kokkos::fence();
-    time_raw = timer.seconds() / R;
-  }
-#endif
-  double size = 1.0 * N8 * 8 / 1024 / 1024;
-  printf("   Raw:   %lf s   %lf MB   %lf GB/s\n", time_raw, size,
-         2.0 * size / 1024 / time_raw);
-  printf("   Rank6: %lf s   %lf MB   %lf GB/s\n", time6, size,
-         2.0 * size / 1024 / time6);
+  Kokkos::View<double****, LayoutA> a("A4", N2, N2, N2, N2);
+  Kokkos::View<double****, LayoutB> b("B4", N2, N2, N2, N2);
+
+  deepcopy_view(a, b, state);
 }
 
 template <class LayoutA, class LayoutB>
-void run_deepcopyview_tests7(int N, int R) {
-  const int N1 = N;
+static void ViewDeepCopy_Rank5(benchmark::State& state) {
+  const int N1 = state.range(0);
   const int N2 = N1 * N1;
-  const int N4 = N2 * N2;
-  const int N8 = N4 * N4;
 
-  double time7, time_raw = 100000.0;
-  {
-    Kokkos::View<double*******, LayoutA> a("A7", N2, N1, N1, N1, N1, N1, N1);
-    Kokkos::View<double*******, LayoutB> b("B7", N2, N1, N1, N1, N1, N1, N1);
-    time7 = deepcopy_view(a, b, R) / R;
-  }
-#if defined(KOKKOS_ENABLE_CUDA_LAMBDA) || !defined(KOKKOS_ENABLE_CUDA)
-  {
-    Kokkos::View<double*, LayoutA> a("A1", N8);
-    Kokkos::View<double*, LayoutB> b("B1", N8);
-    double* const a_ptr       = a.data();
-    const double* const b_ptr = b.data();
-    Kokkos::Timer timer;
-    for (int r = 0; r < R; r++) {
-      Kokkos::parallel_for(
-          N8, KOKKOS_LAMBDA(const int& i) { a_ptr[i] = b_ptr[i]; });
-    }
-    Kokkos::fence();
-    time_raw = timer.seconds() / R;
-  }
-#endif
-  double size = 1.0 * N8 * 8 / 1024 / 1024;
-  printf("   Raw:   %lf s   %lf MB   %lf GB/s\n", time_raw, size,
-         2.0 * size / 1024 / time_raw);
-  printf("   Rank7: %lf s   %lf MB   %lf GB/s\n", time7, size,
-         2.0 * size / 1024 / time7);
+  Kokkos::View<double*****, LayoutA> a("A5", N2, N2, N1, N1, N2);
+  Kokkos::View<double*****, LayoutB> b("B5", N2, N2, N1, N1, N2);
+
+  deepcopy_view(a, b, state);
 }
 
 template <class LayoutA, class LayoutB>
-void run_deepcopyview_tests8(int N, int R) {
-  const int N1 = N;
+static void ViewDeepCopy_Rank6(benchmark::State& state) {
+  const int N1 = state.range(0);
   const int N2 = N1 * N1;
-  const int N4 = N2 * N2;
-  const int N8 = N4 * N4;
-
-  double time8, time_raw = 100000.0;
-  {
-    Kokkos::View<double********, LayoutA> a("A8", N1, N1, N1, N1, N1, N1, N1,
-                                            N1);
-    Kokkos::View<double********, LayoutB> b("B8", N1, N1, N1, N1, N1, N1, N1,
-                                            N1);
-    time8 = deepcopy_view(a, b, R) / R;
-  }
-#if defined(KOKKOS_ENABLE_CUDA_LAMBDA) || !defined(KOKKOS_ENABLE_CUDA)
-  {
-    Kokkos::View<double*, LayoutA> a("A1", N8);
-    Kokkos::View<double*, LayoutB> b("B1", N8);
-    double* const a_ptr       = a.data();
-    const double* const b_ptr = b.data();
+
+  Kokkos::View<double******, LayoutA> a("A6", N2, N1, N1, N1, N1, N2);
+  Kokkos::View<double******, LayoutB> b("B6", N2, N1, N1, N1, N1, N2);
+
+  deepcopy_view(a, b, state);
+}
+
+template <class LayoutA, class LayoutB>
+static void ViewDeepCopy_Rank7(benchmark::State& state) {
+  const int N1 = state.range(0);
+  const int N2 = N1 * N1;
+
+  Kokkos::View<double*******, LayoutA> a("A7", N2, N1, N1, N1, N1, N1, N1);
+  Kokkos::View<double*******, LayoutB> b("B7", N2, N1, N1, N1, N1, N1, N1);
+
+  deepcopy_view(a, b, state);
+}
+
+template <class LayoutA, class LayoutB>
+static void ViewDeepCopy_Rank8(benchmark::State& state) {
+  const int N1 = state.range(0);
+
+  Kokkos::View<double********, LayoutA> a("A8", N1, N1, N1, N1, N1, N1, N1, N1);
+  Kokkos::View<double********, LayoutB> b("B8", N1, N1, N1, N1, N1, N1, N1, N1);
+
+  deepcopy_view(a, b, state);
+}
+
+template <class LayoutA, class LayoutB>
+static void ViewDeepCopy_Raw(benchmark::State& state) {
+  const int N8 = std::pow(state.range(0), 8);
+
+  Kokkos::View<double*, LayoutA> a("A1", N8);
+  Kokkos::View<double*, LayoutB> b("B1", N8);
+  double* const a_ptr       = a.data();
+  const double* const b_ptr = b.data();
+
+  for (auto _ : state) {
+    Kokkos::fence();
     Kokkos::Timer timer;
-    for (int r = 0; r < R; r++) {
-      Kokkos::parallel_for(
-          N8, KOKKOS_LAMBDA(const int& i) { a_ptr[i] = b_ptr[i]; });
-    }
+    Kokkos::parallel_for(
+        N8, KOKKOS_LAMBDA(const int& i) { a_ptr[i] = b_ptr[i]; });
     Kokkos::fence();
-    time_raw = timer.seconds() / R;
+
+    report_results(state, a.size(), timer.seconds());
   }
-#endif
-  double size = 1.0 * N8 * 8 / 1024 / 1024;
-  printf("   Raw:   %lf s   %lf MB   %lf GB/s\n", time_raw, size,
-         2.0 * size / 1024 / time_raw);
-  printf("   Rank8: %lf s   %lf MB   %lf GB/s\n", time8, size,
-         2.0 * size / 1024 / time8);
 }
 
 }  // namespace Test
+
+#endif
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_Raw.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_Raw.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..976f800487878f2ee40a94cf7982577de390e66c
--- /dev/null
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_Raw.cpp
@@ -0,0 +1,43 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#include <PerfTest_ViewCopy.hpp>
+
+namespace Test {
+
+#if defined(KOKKOS_ENABLE_CUDA_LAMBDA) || !defined(KOKKOS_ENABLE_CUDA)
+BENCHMARK(ViewDeepCopy_Raw<Kokkos::LayoutLeft, Kokkos::LayoutLeft>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
+BENCHMARK(ViewDeepCopy_Raw<Kokkos::LayoutRight, Kokkos::LayoutRight>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
+BENCHMARK(ViewDeepCopy_Raw<Kokkos::LayoutLeft, Kokkos::LayoutRight>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
+BENCHMARK(ViewDeepCopy_Raw<Kokkos::LayoutRight, Kokkos::LayoutLeft>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+#endif
+
+}  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a123.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a123.cpp
index dceef801aa8bc295403505c16e8d664d61541bf7..3fc1c2480cf2c95e1c68993967c9eb86025b2237 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a123.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a123.cpp
@@ -1,51 +1,36 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_LeftLeft_Rank123) {
-  printf("DeepCopy Performance for LayoutLeft to LayoutLeft:\n");
-  run_deepcopyview_tests123<Kokkos::LayoutLeft, Kokkos::LayoutLeft>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank1<Kokkos::LayoutLeft, Kokkos::LayoutLeft>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
+BENCHMARK(ViewDeepCopy_Rank2<Kokkos::LayoutLeft, Kokkos::LayoutLeft>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
+BENCHMARK(ViewDeepCopy_Rank3<Kokkos::LayoutLeft, Kokkos::LayoutLeft>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a45.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a45.cpp
index 3f9b694461211933cf4fffc7424b6fa38c47af02..542f5534be7ef0a01a419bf8d8b31a9fdc3684aa 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a45.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a45.cpp
@@ -1,51 +1,31 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_LeftLeft_Rank45) {
-  printf("DeepCopy Performance for LayoutLeft to LayoutLeft:\n");
-  run_deepcopyview_tests45<Kokkos::LayoutLeft, Kokkos::LayoutLeft>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank4<Kokkos::LayoutLeft, Kokkos::LayoutLeft>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
+BENCHMARK(ViewDeepCopy_Rank5<Kokkos::LayoutLeft, Kokkos::LayoutLeft>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a6.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a6.cpp
index ac364c31cbc53a002334811817220558cbc225be..782628072db34bd0aa3cc44c5eec430e8e4b99ca 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a6.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a6.cpp
@@ -1,51 +1,26 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_LeftLeft_Rank6) {
-  printf("DeepCopy Performance for LayoutLeft to LayoutLeft:\n");
-  run_deepcopyview_tests6<Kokkos::LayoutLeft, Kokkos::LayoutLeft>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank6<Kokkos::LayoutLeft, Kokkos::LayoutLeft>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a7.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a7.cpp
index 94f30bac9fb529de334344a48dd20539751a4a6e..000c8b401c97f4b56ec8a9dfe442a20afe08844b 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a7.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a7.cpp
@@ -1,51 +1,26 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_LeftLeft_Rank7) {
-  printf("DeepCopy Performance for LayoutLeft to LayoutLeft:\n");
-  run_deepcopyview_tests7<Kokkos::LayoutLeft, Kokkos::LayoutLeft>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank7<Kokkos::LayoutLeft, Kokkos::LayoutLeft>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a8.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a8.cpp
index b916169f1b732843d2070232885cfeb87b2e64e1..f7d7c6040a61ad242797d4f64df66eed31787a50 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a8.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a8.cpp
@@ -1,51 +1,26 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_LeftLeft_Rank8) {
-  printf("DeepCopy Performance for LayoutLeft to LayoutLeft:\n");
-  run_deepcopyview_tests8<Kokkos::LayoutLeft, Kokkos::LayoutLeft>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank8<Kokkos::LayoutLeft, Kokkos::LayoutLeft>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b123.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b123.cpp
index f314cb0ff43c4d1e68e81574e273b7411c25118a..7820e8997314824ab870dcef926e611c89182854 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b123.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b123.cpp
@@ -1,51 +1,36 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_RightRight_Rank123) {
-  printf("DeepCopy Performance for LayoutRight to LayoutRight:\n");
-  run_deepcopyview_tests123<Kokkos::LayoutRight, Kokkos::LayoutRight>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank1<Kokkos::LayoutRight, Kokkos::LayoutRight>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
+BENCHMARK(ViewDeepCopy_Rank2<Kokkos::LayoutRight, Kokkos::LayoutRight>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
+BENCHMARK(ViewDeepCopy_Rank3<Kokkos::LayoutRight, Kokkos::LayoutRight>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b45.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b45.cpp
index 5d06f060afa91d7be89c140613f1ef93f9e1d46a..58f58314b093b8ce0788705d3d352ccd0947a866 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b45.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b45.cpp
@@ -1,51 +1,31 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_RightRight_Rank45) {
-  printf("DeepCopy Performance for LayoutRight to LayoutRight:\n");
-  run_deepcopyview_tests45<Kokkos::LayoutRight, Kokkos::LayoutRight>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank4<Kokkos::LayoutRight, Kokkos::LayoutRight>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
+BENCHMARK(ViewDeepCopy_Rank5<Kokkos::LayoutRight, Kokkos::LayoutRight>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b6.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b6.cpp
index 0e28fee631eb29ec1d70a38b834fc0744d45bb04..920bf1222f140d0a716d9a845e7af5e9bebb5b98 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b6.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b6.cpp
@@ -1,51 +1,26 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_RightRight_Rank6) {
-  printf("DeepCopy Performance for LayoutRight to LayoutRight:\n");
-  run_deepcopyview_tests6<Kokkos::LayoutRight, Kokkos::LayoutRight>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank6<Kokkos::LayoutRight, Kokkos::LayoutRight>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b7.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b7.cpp
index 37e1325fc4c0b1928dcc160e8c0a12cd364830ec..11b7a0d0d1caa04966896c165a551efed7d59835 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b7.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b7.cpp
@@ -1,51 +1,26 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_RightRight_Rank7) {
-  printf("DeepCopy Performance for LayoutRight to LayoutRight:\n");
-  run_deepcopyview_tests7<Kokkos::LayoutRight, Kokkos::LayoutRight>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank7<Kokkos::LayoutRight, Kokkos::LayoutRight>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b8.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b8.cpp
index 986c39aaf447d4f6fc04e54b06e5222007e4ace9..56a3d8d4c3221d8d84213dbd1b2ed839c29c8168 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b8.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b8.cpp
@@ -1,51 +1,26 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_RightRight_Rank8) {
-  printf("DeepCopy Performance for LayoutRight to LayoutRight:\n");
-  run_deepcopyview_tests8<Kokkos::LayoutRight, Kokkos::LayoutRight>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank8<Kokkos::LayoutRight, Kokkos::LayoutRight>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c123.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c123.cpp
index b98563ee429564d1944a45426f3fd5afbc7e2e3d..375f7c8985b2f560553a06ae762178a4a10b8908 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c123.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c123.cpp
@@ -1,51 +1,36 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_LeftRight_Rank123) {
-  printf("DeepCopy Performance for LayoutLeft to LayoutRight:\n");
-  run_deepcopyview_tests123<Kokkos::LayoutLeft, Kokkos::LayoutRight>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank1<Kokkos::LayoutLeft, Kokkos::LayoutRight>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
+BENCHMARK(ViewDeepCopy_Rank2<Kokkos::LayoutLeft, Kokkos::LayoutRight>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
+BENCHMARK(ViewDeepCopy_Rank3<Kokkos::LayoutLeft, Kokkos::LayoutRight>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c45.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c45.cpp
index a0ef11e09b8736009afcebb6fe5e3070fadcbbe0..3625631617d86429b67e771c9773ea581e7b2b3c 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c45.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c45.cpp
@@ -1,51 +1,31 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_LeftRight_Rank45) {
-  printf("DeepCopy Performance for LayoutLeft to LayoutRight:\n");
-  run_deepcopyview_tests45<Kokkos::LayoutLeft, Kokkos::LayoutRight>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank4<Kokkos::LayoutLeft, Kokkos::LayoutRight>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
+BENCHMARK(ViewDeepCopy_Rank5<Kokkos::LayoutLeft, Kokkos::LayoutRight>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c6.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c6.cpp
index fea5dde73adf69ec45bd8d6549882102dd4cbddc..bcb70b6764196e8ba7fc445156b390879fdfe121 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c6.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c6.cpp
@@ -1,51 +1,26 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_LeftRight_Rank6) {
-  printf("DeepCopy Performance for LayoutLeft to LayoutRight:\n");
-  run_deepcopyview_tests6<Kokkos::LayoutLeft, Kokkos::LayoutRight>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank6<Kokkos::LayoutLeft, Kokkos::LayoutRight>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c7.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c7.cpp
index a8c8d866f927a40f7d6b29a759a6fadeda7c96e4..055d0e344c8bbbc7aae154f2b0288dafcc20884a 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c7.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c7.cpp
@@ -1,51 +1,26 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_LeftRight_Rank7) {
-  printf("DeepCopy Performance for LayoutLeft to LayoutRight:\n");
-  run_deepcopyview_tests7<Kokkos::LayoutLeft, Kokkos::LayoutRight>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank7<Kokkos::LayoutLeft, Kokkos::LayoutRight>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c8.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c8.cpp
index e5abdaa5d81f9e147a9180b54a0a897b40ee08a0..1e5342ef5217ee53231e9bbdb2f2a9f7af8ddea7 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c8.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c8.cpp
@@ -1,51 +1,26 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_LeftRight_Rank8) {
-  printf("DeepCopy Performance for LayoutLeft to LayoutRight:\n");
-  run_deepcopyview_tests8<Kokkos::LayoutLeft, Kokkos::LayoutRight>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank8<Kokkos::LayoutLeft, Kokkos::LayoutRight>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d123.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d123.cpp
index 2b58f8dd1f6b2554f2aeaa89052e0d52403da118..d61e01f9f6a9ea0d7f1ed1cdde2d94b6a7c097f8 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d123.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d123.cpp
@@ -1,51 +1,36 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_RightLeft_Rank123) {
-  printf("DeepCopy Performance for LayoutRight to LayoutLeft:\n");
-  run_deepcopyview_tests123<Kokkos::LayoutRight, Kokkos::LayoutLeft>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank1<Kokkos::LayoutRight, Kokkos::LayoutLeft>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
+BENCHMARK(ViewDeepCopy_Rank2<Kokkos::LayoutRight, Kokkos::LayoutLeft>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
+BENCHMARK(ViewDeepCopy_Rank3<Kokkos::LayoutRight, Kokkos::LayoutLeft>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d45.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d45.cpp
index fe34e4fd1a84a1960a37893bc0e8dfd26ed0a42f..385d5b48ae96c39a4c6656bf34ca62a57bd69476 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d45.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d45.cpp
@@ -1,51 +1,31 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_RightLeft_Rank45) {
-  printf("DeepCopy Performance for LayoutRight to LayoutLeft:\n");
-  run_deepcopyview_tests45<Kokkos::LayoutRight, Kokkos::LayoutLeft>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank4<Kokkos::LayoutRight, Kokkos::LayoutLeft>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
+BENCHMARK(ViewDeepCopy_Rank5<Kokkos::LayoutRight, Kokkos::LayoutLeft>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d6.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d6.cpp
index 115b223e68b88b297d96cfe9fe6db7fdd9c5591c..0ae16012d6a65a1128757facef98df8eaeeffd96 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d6.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d6.cpp
@@ -1,51 +1,26 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_RightLeft_Rank6) {
-  printf("DeepCopy Performance for LayoutRight to LayoutLeft:\n");
-  run_deepcopyview_tests6<Kokkos::LayoutRight, Kokkos::LayoutLeft>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank6<Kokkos::LayoutRight, Kokkos::LayoutLeft>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d7.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d7.cpp
index 51e88795e73a9b802c6410a99e63190c1cdb91eb..4ebbb6359b59cc1ea475a206c7ff855d9c2a5276 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d7.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d7.cpp
@@ -1,51 +1,26 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_RightLeft_Rank7) {
-  printf("DeepCopy Performance for LayoutRight to LayoutLeft:\n");
-  run_deepcopyview_tests7<Kokkos::LayoutRight, Kokkos::LayoutLeft>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank7<Kokkos::LayoutRight, Kokkos::LayoutLeft>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d8.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d8.cpp
index 2a53cdef213079833e3c1c4b48b760e643dc7f23..3a888b6155737819f263e0fae7faee5cf9dc9c84 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d8.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d8.cpp
@@ -1,51 +1,26 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewCopy.hpp>
+
 namespace Test {
-TEST(default_exec, ViewDeepCopy_RightLeft_Rank8) {
-  printf("DeepCopy Performance for LayoutRight to LayoutLeft:\n");
-  run_deepcopyview_tests8<Kokkos::LayoutRight, Kokkos::LayoutLeft>(10, 1);
-}
+
+BENCHMARK(ViewDeepCopy_Rank8<Kokkos::LayoutRight, Kokkos::LayoutLeft>)
+    ->ArgName("N")
+    ->Arg(10)
+    ->UseManualTime();
+
 }  // namespace Test
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill.hpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill.hpp
index 38be4bb212c8527ccb246712dc5c2d8b32d53a56..7f76ed0ff70f41faf44f6c3999a9ec68ffbe7ae1 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewFill.hpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <gtest/gtest.h>
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill_123.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill_123.cpp
index 0bf8a28329e8993282e407955fe96b5caaabb5e3..1e050e2311fdd2b2e046be663ee77210ec7384b3 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewFill_123.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill_123.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewFill.hpp>
 
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill_45.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill_45.cpp
index 53ac509da804c3fa6766f956fe9e2eabdbc27e01..2bf93b2048bee4b15edbd932fd3945f13bd81f21 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewFill_45.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill_45.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewFill.hpp>
 
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill_6.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill_6.cpp
index f0a2e248f238542084917497dec7c203a254a6fc..588a1e2293cac76cacfde24db1bc0e9f7570af68 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewFill_6.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill_6.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewFill.hpp>
 
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill_7.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill_7.cpp
index 675d9e636f27577b1deaa9202de5f21770163f8d..fffeb951c94c345871613272f58614d5113bc67d 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewFill_7.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill_7.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewFill.hpp>
 
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill_8.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill_8.cpp
index 35e1e81c43dbc6e36f6760694529d3b175b8d7d1..b2188af1a3a54917dee7865592693b38a170de86 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewFill_8.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill_8.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewFill.hpp>
 
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize.hpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize.hpp
index 66a631e3890359bb32fa6f0e2055e1f8d9bb9309..dfcd3f1347f74dd022af61d952d47a552aa0e8fb 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewResize.hpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <gtest/gtest.h>
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize_123.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize_123.cpp
index 1dc4f285f56479b4987a0e3adf39664d8590ddc0..ed2e58192c9bc498dbd988c5a4bba3c82d5cc2ba 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewResize_123.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize_123.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewResize.hpp>
 
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize_45.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize_45.cpp
index 3754a5bb147b8d5a057d3c385179aa7645d63e11..69028fab08c593962e251b01196ed1bf8efc5416 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewResize_45.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize_45.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewResize.hpp>
 
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize_6.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize_6.cpp
index 1b8d6fbc8a04528f6ea30d6c52bd17e55ff2a683..486b44a0c1b1b2fe0a8903aa7d0ac64ebf174839 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewResize_6.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize_6.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewResize.hpp>
 
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize_7.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize_7.cpp
index f8efa195fc8e90eb9cbbde39a002b142192800a6..84c2a79ad68b993420e7a94207ca2cd95b573814 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewResize_7.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize_7.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewResize.hpp>
 
diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize_8.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize_8.cpp
index b0562f2fd12227f1e3270c332cd3f1a6c4298fad..25910fb5754b7e9835cebcacadf2186848c2045b 100644
--- a/packages/kokkos/core/perf_test/PerfTest_ViewResize_8.cpp
+++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize_8.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <PerfTest_ViewResize.hpp>
 
diff --git a/packages/kokkos/core/perf_test/test_atomic.cpp b/packages/kokkos/core/perf_test/test_atomic.cpp
index 54824e5b39b91456a81e541e39a441d20b2879a7..5f10afc45a18200caca69274bb968719929dd688 100644
--- a/packages/kokkos/core/perf_test/test_atomic.cpp
+++ b/packages/kokkos/core/perf_test/test_atomic.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <cstdio>
 #include <cstring>
@@ -73,7 +45,7 @@ void textcolor(int attr, int fg, int bg) {
   char command[40];
 
   /* Command is the control command to the terminal */
-  sprintf(command, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40);
+  snprintf(command, 40, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40);
   printf("%s", command);
 }
 void textcolor_standard() { textcolor(RESET, BLACK, WHITE); }
diff --git a/packages/kokkos/core/perf_test/test_atomic_minmax_simple.cpp b/packages/kokkos/core/perf_test/test_atomic_minmax_simple.cpp
index 4086ef58163ff4ec144d2c151241952752d3453d..4c2ae5c2d18144f91c420e2d8def00b2da710b2f 100644
--- a/packages/kokkos/core/perf_test/test_atomic_minmax_simple.cpp
+++ b/packages/kokkos/core/perf_test/test_atomic_minmax_simple.cpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 // export OMP_PROC_BIND=spread ; export OMP_PLACES=threads
 // c++  -O2 -g -DNDEBUG  -fopenmp
 // ../core/perf_test/test_atomic_minmax_simple.cpp -I../core/src/ -I. -o
diff --git a/packages/kokkos/core/perf_test/test_mempool.cpp b/packages/kokkos/core/perf_test/test_mempool.cpp
index 7887d4ba55196ddbc283baa023884e2f43a48991..e4e1b4c9a3944bd43ea855ce6a69c85c3af76fd8 100644
--- a/packages/kokkos/core/perf_test/test_mempool.cpp
+++ b/packages/kokkos/core/perf_test/test_mempool.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <cstdio>
 #include <cstring>
diff --git a/packages/kokkos/core/perf_test/test_sharedSpace.cpp b/packages/kokkos/core/perf_test/test_sharedSpace.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4f140c9409ad5e3b4db5d7b3522bbb2f931cceb8
--- /dev/null
+++ b/packages/kokkos/core/perf_test/test_sharedSpace.cpp
@@ -0,0 +1,311 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+#include <Kokkos_Core.hpp>
+
+#if defined _WIN32
+#include <windows.h>
+unsigned getBytesPerPage() {
+  SYSTEM_INFO si;
+  GetSystemInfo(&si);
+  return si.dwPageSize;
+}
+#else  // unix/posix system
+#include <unistd.h>
+unsigned getBytesPerPage() { return sysconf(_SC_PAGESIZE); }
+#endif
+
+#include <algorithm>
+#include <numeric>
+#include <iostream>
+
+namespace {
+void printTimings(std::ostream& out, std::vector<double> const& tr,
+                  size_t numBytes,
+                  double threshold = (std::numeric_limits<double>::max)()) {
+  out << "TimingResult contains " << tr.size() << " results:\n";
+  for (auto it = tr.begin(); it != tr.end(); ++it) {
+    out << "Duration of loop " << it - tr.begin() << " is " << *it
+        << " seconds.";
+    if ((*it) > threshold) {
+      out << " Marked as page migation.";
+    }
+    out << " The transfer rate is "
+        << (double)numBytes / std::pow(1000.0, 3) / (*it) *
+               2.0  // as we read and write
+        << " GB/s \n";
+  }
+}
+
+template <typename T>
+T computeMean(std::vector<T> const& results) {
+  return std::accumulate(results.begin(), results.end(), T{}) / results.size();
+}
+
+template <typename ViewType>
+class IncrementFunctor {
+ private:
+  using index_type = decltype(std::declval<ViewType>().size());
+  ViewType view_;
+
+ public:
+  IncrementFunctor() = delete;
+
+  explicit IncrementFunctor(ViewType view) : view_(view) {}
+
+  KOKKOS_INLINE_FUNCTION
+  void operator()(const index_type idx) const { ++view_(idx); }
+};
+
+// TIMING CAPTURED KERNEL
+// PREMISE: This kernel should always be memory bound, as we are measuring
+// memory access times. The compute load of an increment is small enough on
+// current hardware but this could be different for new hardware. As we count
+// the wall-clock time in the kernel, the core frequency of the device has to be
+// at the maximum to guarantee accurate masurements.
+template <typename ExecSpace, typename ViewType>
+std::vector<double> incrementInLoop(ViewType& view,
+                                    unsigned int numRepetitions) {
+  using index_type = decltype(view.size());
+  Kokkos::Timer timer;
+  std::vector<double> results;
+
+  Kokkos::fence();
+  for (unsigned i = 0; i < numRepetitions; ++i) {
+    IncrementFunctor<ViewType> func(view);
+    timer.reset();
+    Kokkos::parallel_for(
+        "increment",
+        Kokkos::RangePolicy<ExecSpace, Kokkos::IndexType<index_type>>{
+            0, view.size()},
+        func);
+    Kokkos::fence();
+    results.push_back(timer.seconds());
+  }
+  return results;
+}
+
+size_t getDeviceMemorySize() {
+#if defined KOKKOS_ENABLE_CUDA
+  return Kokkos::Cuda{}.cuda_device_prop().totalGlobalMem;
+#elif defined KOKKOS_ENABLE_HIP
+  return Kokkos::HIP{}.hip_device_prop().totalGlobalMem;
+#elif defined KOKKOS_ENABLE_SYCL
+  auto device = Kokkos::Experimental::SYCL{}.sycl_queue().get_device();
+  return device.get_info<sycl::info::device::global_mem_size>();
+#else
+#error \
+    "The sharedMemory test is only defined for Kokkos::Cuda, Kokkos::HIP, and Kokkos::SYCL"
+  return 0;
+#endif
+}
+
+struct Arguments {
+  unsigned int numRepetitions       = 10;
+  unsigned int numWarmupRepetitions = 100;
+  unsigned int numDeviceHostCycles  = 3;
+  double fractionOfDeviceMemory     = 0.4;
+  double threshold                  = 2.0;
+};
+
+void test_sharedSpace(Arguments args) {
+  const unsigned int numRepetitions       = args.numRepetitions;
+  const unsigned int numWarmupRepetitions = args.numWarmupRepetitions;
+  const unsigned int numDeviceHostCycles  = args.numDeviceHostCycles;
+  double fractionOfDeviceMemory           = args.fractionOfDeviceMemory;
+  double threshold                        = args.threshold;
+  size_t numBytes = fractionOfDeviceMemory * getDeviceMemorySize();
+  size_t numPages = numBytes / getBytesPerPage();
+
+  // ALLOCATION
+  Kokkos::View<int*, Kokkos::SharedSpace> migratableData(
+      "migratableData", numPages * getBytesPerPage() / sizeof(int));
+  Kokkos::View<int*, Kokkos::DefaultExecutionSpace::memory_space> deviceData(
+      "deviceData", numPages * getBytesPerPage() / sizeof(int));
+  Kokkos::View<int*, Kokkos::DefaultHostExecutionSpace::memory_space> hostData(
+      "hostData", numPages * getBytesPerPage() / sizeof(int));
+  Kokkos::fence();
+
+  // WARMUP GPU
+  incrementInLoop<Kokkos::DefaultExecutionSpace>(
+      deviceData,
+      numWarmupRepetitions);  // warming up gpu
+
+  // GET DEVICE LOCAL TIMINGS
+  auto deviceLocalResults = incrementInLoop<Kokkos::DefaultExecutionSpace>(
+      deviceData, numRepetitions);
+
+  // WARMUP HOST
+  incrementInLoop<Kokkos::DefaultHostExecutionSpace>(
+      hostData,
+      numWarmupRepetitions);  // warming up host
+  // GET HOST LOCAL TIMINGS
+  auto hostLocalResults = incrementInLoop<Kokkos::DefaultHostExecutionSpace>(
+      hostData, numRepetitions);
+
+  // GET PAGE MIGRATING TIMINGS DATA
+  std::vector<decltype(deviceLocalResults)> deviceResults{};
+  std::vector<decltype(hostLocalResults)> hostResults{};
+  for (unsigned i = 0; i < numDeviceHostCycles; ++i) {
+    // WARMUP GPU
+    incrementInLoop<Kokkos::DefaultExecutionSpace>(
+        deviceData,
+        numWarmupRepetitions);  // warming up gpu without touching the
+                                // migratableData to get measurements of initial
+                                // position
+    // GET RESULTS DEVICE
+    deviceResults.push_back(incrementInLoop<Kokkos::DefaultExecutionSpace>(
+        migratableData, numRepetitions));
+
+    // WARMUP HOST
+    incrementInLoop<Kokkos::DefaultHostExecutionSpace>(
+        hostData,
+        numWarmupRepetitions);  // warming up host without touching the
+                                // migratableData to get measurements of initial
+                                // position
+    // GET RESULTS HOST
+    hostResults.push_back(incrementInLoop<Kokkos::DefaultHostExecutionSpace>(
+        migratableData, numRepetitions));
+  }
+
+  // COMPUTE STATISTICS OF HOST AND DEVICE LOCAL KERNELS
+  auto hostLocalMean   = computeMean(hostLocalResults);
+  auto deviceLocalMean = computeMean(deviceLocalResults);
+
+  // ASSESS PAGE MIGRATIONS
+  bool initialPlacementOnDevice   = false;
+  bool migratesOnEverySpaceAccess = true;
+  bool migratesOnlyOncePerAccess  = true;
+
+  for (unsigned cycle = 0; cycle < numDeviceHostCycles; ++cycle) {
+    unsigned int indicatedPageMigrationsDevice = std::count_if(
+        deviceResults[cycle].begin(), deviceResults[cycle].end(),
+        [&](auto const& val) { return val > (threshold * deviceLocalMean); });
+
+    if (cycle == 0 && indicatedPageMigrationsDevice == 0)
+      initialPlacementOnDevice = true;
+    else {
+      if (indicatedPageMigrationsDevice != 1) migratesOnlyOncePerAccess = false;
+    }
+
+    unsigned int indicatedPageMigrationsHost = std::count_if(
+        hostResults[cycle].begin(), hostResults[cycle].end(),
+        [&](auto const& val) { return val > (threshold * hostLocalMean); });
+
+    if (indicatedPageMigrationsHost != 1) migratesOnlyOncePerAccess = false;
+
+    if (cycle != 0 && indicatedPageMigrationsDevice != 1 &&
+        indicatedPageMigrationsHost != 1)
+      migratesOnEverySpaceAccess = false;
+  }
+
+  std::cout << "Page size as reported by os: " << getBytesPerPage()
+            << " bytes \n";
+  std::cout << "Allocating " << numPages
+            << " pages of memory in pageMigratingMemorySpace.\n"
+            << "This corresponds to " << fractionOfDeviceMemory * 100
+            << " % of the device memory.\n"
+            << "The view size is " << migratableData.size() << "\n";
+
+  std::cout << "Behavior found: \n";
+  std::cout << "Initial placement on device is " << initialPlacementOnDevice
+            << "\n";
+  std::cout << "Memory migrates on every space access is "
+            << migratesOnEverySpaceAccess << "\n";
+  std::cout << "Memory migrates only once per access "
+            << migratesOnlyOncePerAccess << "\n\n";
+
+  std::cout << "Please look at the following timings. A migration was "
+               "marked detected if the time was larger than "
+            << threshold * hostLocalMean << " for the host and "
+            << threshold * deviceLocalMean << " for the device\n\n";
+
+  std::cout << "#############TIMINGS WITH SHAREDSPACE##################\n";
+
+  for (unsigned cycle = 0; cycle < numDeviceHostCycles; ++cycle) {
+    std::cout << "device timings of run " << cycle << ":\n";
+    printTimings(std::cout, deviceResults[cycle], numBytes,
+                 threshold * deviceLocalMean);
+    std::cout << "host timings of run " << cycle << ":\n";
+    printTimings(std::cout, hostResults[cycle], numBytes,
+                 threshold * hostLocalMean);
+  }
+  std::cout << "\n#############TIMINGS WITH LOCALSPACE##################\n";
+  std::cout << "Device local memory timings for comparison:\n";
+  printTimings(std::cout, deviceLocalResults, numBytes);
+  std::cout << "Host local memory timings for comparison:\n";
+  printTimings(std::cout, hostLocalResults, numBytes);
+}
+}  // namespace
+
+int main(int argc, char* argv[]) {
+  static const char help_flag[]                   = "--help";
+  static const char numRepetitions_flag[]         = "--numRepetitions=";
+  static const char numWarmupRepetitions_flag[]   = "--numWarmupRepetitions=";
+  static const char numDeviceHostCycles_flag[]    = "--numDeviceHostCycles=";
+  static const char fractionOfDeviceMemory_flag[] = "--fractionOfDeviceMemory=";
+  static const char threshold_flag[]              = "--threshold=";
+
+  int ask_help = 0;
+  Arguments args;
+
+  for (int i = 1; i < argc; i++) {
+    const char* const a = argv[i];
+
+    if (!strncmp(a, help_flag, strlen(help_flag))) ask_help = 1;
+
+    if (!strncmp(a, numRepetitions_flag, strlen(numRepetitions_flag)))
+      args.numRepetitions = std::stoi(a + strlen(numRepetitions_flag));
+
+    if (!strncmp(a, numWarmupRepetitions_flag,
+                 strlen(numWarmupRepetitions_flag)))
+      args.numWarmupRepetitions =
+          std::stoi(a + strlen(numWarmupRepetitions_flag));
+
+    if (!strncmp(a, numDeviceHostCycles_flag, strlen(numDeviceHostCycles_flag)))
+      args.numDeviceHostCycles =
+          std::stoi(a + strlen(numDeviceHostCycles_flag));
+
+    if (!strncmp(a, fractionOfDeviceMemory_flag,
+                 strlen(fractionOfDeviceMemory_flag)))
+      args.fractionOfDeviceMemory =
+          std::stod(a + strlen(fractionOfDeviceMemory_flag));
+
+    if (!strncmp(a, threshold_flag, strlen(threshold_flag)))
+      args.threshold = std::stod(a + strlen(threshold_flag));
+  }
+
+  if (ask_help) {
+    std::cout << "command line options:"
+              << " " << help_flag << " " << numRepetitions_flag << "##"
+              << " " << numWarmupRepetitions_flag << "##"
+              << " " << numDeviceHostCycles_flag << "##"
+              << " " << fractionOfDeviceMemory_flag << "##"
+              << " " << threshold_flag << "##"
+              << " any given Kokkos args are passed to Kokkos::initialize ##"
+              << std::endl;
+    return 0;
+  }
+
+  Kokkos::initialize(argc, argv);
+  if constexpr (Kokkos::has_shared_space)
+    test_sharedSpace(args);
+  else
+    std::cout
+        << "The used Kokkos configuration does not support SharedSpace \n";
+  Kokkos::finalize();
+
+  return 0;
+}
diff --git a/packages/kokkos/core/perf_test/test_taskdag.cpp b/packages/kokkos/core/perf_test/test_taskdag.cpp
index 49957ae9323db825ebcfa6d3c19dddb38856862d..bbb48af6c43e8bd16b350aad9ca4f0633f5fb8dc 100644
--- a/packages/kokkos/core/perf_test/test_taskdag.cpp
+++ b/packages/kokkos/core/perf_test/test_taskdag.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 
diff --git a/packages/kokkos/core/src/CMakeLists.txt b/packages/kokkos/core/src/CMakeLists.txt
index 684ea353ae35f024211eef1c1d4642fbbbe6a2ff..862c0c47dd2598815dd262fc2cb645addfa0245b 100644
--- a/packages/kokkos/core/src/CMakeLists.txt
+++ b/packages/kokkos/core/src/CMakeLists.txt
@@ -4,12 +4,27 @@ KOKKOS_INCLUDE_DIRECTORIES(
   ${KOKKOS_TOP_BUILD_DIR}
 )
 IF (Kokkos_ENABLE_IMPL_DESUL_ATOMICS AND NOT desul_FOUND)
+  IF(KOKKOS_ENABLE_CUDA)
+    SET(DESUL_ATOMICS_ENABLE_CUDA ON)
+  ENDIF()
+  IF(KOKKOS_ENABLE_HIP)
+    SET(DESUL_ATOMICS_ENABLE_HIP ON)
+  ENDIF()
+  IF(KOKKOS_ENABLE_SYCL)
+    SET(DESUL_ATOMICS_ENABLE_SYCL ON)
+  ENDIF()
+  IF(KOKKOS_ENABLE_OPENMPTARGET)
+    SET(DESUL_ATOMICS_ENABLE_OPENMP ON) # not a typo Kokkos OpenMPTarget -> Desul OpenMP
+  ENDIF()
+  CONFIGURE_FILE(
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/desul/Config.hpp.cmake.in
+    ${CMAKE_CURRENT_BINARY_DIR}/desul/atomics/Config.hpp
+  )
   KOKKOS_INCLUDE_DIRECTORIES(
     ${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/desul/include
   )
 ENDIF()
 
-
 INSTALL (DIRECTORY
   "${CMAKE_CURRENT_SOURCE_DIR}/"
   DESTINATION ${KOKKOS_HEADER_DIR}
@@ -79,15 +94,18 @@ IF (Kokkos_ENABLE_IMPL_DESUL_ATOMICS AND NOT desul_FOUND)
   APPEND_GLOB(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/desul/include/desul/*/*.hpp)
   APPEND_GLOB(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/desul/include/desul/*/*/*.hpp)
   APPEND_GLOB(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/desul/include/*/*/*.inc*)
+  APPEND_GLOB(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/desul/*.hpp)
 
   INSTALL (DIRECTORY
     "${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/desul/include/desul"
+    "${CMAKE_CURRENT_BINARY_DIR}/desul"
     DESTINATION ${KOKKOS_HEADER_DIR}
     FILES_MATCHING
     PATTERN "*.inc"
     PATTERN "*.inc_*"
     PATTERN "*.hpp"
   )
+
   MESSAGE(STATUS "Using internal desul_atomics copy")
 ELSE()
   MESSAGE(STATUS "Using external desul_atomics install found at:")
@@ -113,6 +131,42 @@ IF (Kokkos_ENABLE_IMPL_DESUL_ATOMICS AND NOT desul_FOUND)
   )
 ENDIF()
 
+IF (Kokkos_ENABLE_IMPL_MDSPAN)
+  MESSAGE(STATUS "Experimental mdspan support is enabled")
+
+  # Some compilers now include mdspan... we just flag on their version
+  # for now until we can get some compiler detection support
+  include(CheckIncludeFileCXX)
+  check_include_file_cxx(experimental/mdspan KOKKOS_COMPILER_SUPPORTS_EXPERIMENTAL_MDSPAN)
+  check_include_file_cxx(mdspan KOKKOS_COMPILER_SUPPORTS_MDSPAN)
+
+  if (Kokkos_ENABLE_MDSPAN_EXTERNAL)
+    MESSAGE(STATUS "Using external mdspan")
+    target_link_libraries(kokkoscore PUBLIC std::mdspan)
+  elseif(KOKKOS_COMPILER_SUPPORTS_MDSPAN AND NOT Kokkos_ENABLE_IMPL_SKIP_COMPILER_MDSPAN)
+    message(STATUS "Using compiler-supplied mdspan")
+  elseif(KOKKOS_COMPILER_SUPPORTS_EXPERIMENTAL_MDSPAN AND NOT Kokkos_ENABLE_IMPL_SKIP_COMPILER_MDSPAN)
+    message(STATUS "Using compiler-supplied experimental/mdspan")
+  else()
+    KOKKOS_LIB_INCLUDE_DIRECTORIES(
+      kokkoscore
+      ${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/mdspan/include
+    )
+
+    APPEND_GLOB(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/mdspan/include/experimental/__p0009_bits/*.hpp)
+    APPEND_GLOB(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/mdspan/include/experimental/mdspan)
+
+    INSTALL (DIRECTORY
+      "${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/mdspan/include/"
+      DESTINATION ${KOKKOS_HEADER_DIR}
+      FILES_MATCHING
+      PATTERN "mdspan"
+      PATTERN "*.hpp"
+    )
+    MESSAGE(STATUS "Using internal mdspan directory ${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/mdspan/include")
+  endif()
+ENDIF()
+
 KOKKOS_LINK_TPL(kokkoscore PUBLIC HWLOC)
 KOKKOS_LINK_TPL(kokkoscore PUBLIC MEMKIND)
 IF (NOT KOKKOS_ENABLE_COMPILE_AS_CMAKE_LANGUAGE)
@@ -125,14 +179,15 @@ KOKKOS_LINK_TPL(kokkoscore PUBLIC LIBRT)
 IF (NOT WIN32)
   KOKKOS_LINK_TPL(kokkoscore PUBLIC THREADS)
 ENDIF()
-KOKKOS_LINK_TPL(kokkoscore PUBLIC ROCM)
+IF (NOT KOKKOS_ENABLE_COMPILE_AS_CMAKE_LANGUAGE)
+  KOKKOS_LINK_TPL(kokkoscore PUBLIC ROCM)
+ENDIF()
 
 # FIXME: We need a proper solution to figure out whether to enable
 #        libatomic
-# XL requires libatomic even for 64 bit CAS, most others only for 128
+# Most compilers only require libatomic for 128-bit CAS
 # I (CT) had removed 128bit CAS from desul to not need libatomic.
-IF (Kokkos_ENABLE_IMPL_DESUL_ATOMICS AND
-    (KOKKOS_ENABLE_OPENMPTARGET OR (CMAKE_CXX_COMPILER_ID STREQUAL XLClang)))
+IF (Kokkos_ENABLE_IMPL_DESUL_ATOMICS AND KOKKOS_ENABLE_OPENMPTARGET)
   target_link_libraries(kokkoscore PUBLIC atomic)
 ENDIF()
 
@@ -140,4 +195,11 @@ IF (Kokkos_ENABLE_IMPL_DESUL_ATOMICS AND desul_FOUND)
   target_link_libraries(kokkoscore PUBLIC desul_atomics)
 ENDIF()
 
+# FIXME_TRILINOS Trilinos doesn't allow for Kokkos to use find_dependency so we
+# just append the flags in cmake/kokkos_tpls.cmake instead of linking with the
+# OpenMP target.
+IF(Kokkos_ENABLE_OPENMP AND NOT KOKKOS_HAS_TRILINOS)
+  target_link_libraries(kokkoscore PUBLIC OpenMP::OpenMP_CXX)
+ENDIF()
+
 KOKKOS_LINK_TPL(kokkoscore PUBLIC LIBQUADMATH)
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_CudaSpace.cpp b/packages/kokkos/core/src/Cuda/Kokkos_CudaSpace.cpp
index b2161bc1fa50000ca99d85fcab28bca0947963cb..87b4c8c00c999efc64e0edf9e0ffd1037c20d95d 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_CudaSpace.cpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_CudaSpace.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -122,40 +94,12 @@ void DeepCopyAsyncCuda(void *dst, const void *src, size_t n) {
 
 namespace Kokkos {
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-KOKKOS_DEPRECATED void CudaSpace::access_error() {
-  const std::string msg(
-      "Kokkos::CudaSpace::access_error attempt to execute Cuda function from "
-      "non-Cuda space");
-  Kokkos::Impl::throw_runtime_exception(msg);
-}
-
-KOKKOS_DEPRECATED void CudaSpace::access_error(const void *const) {
-  const std::string msg(
-      "Kokkos::CudaSpace::access_error attempt to execute Cuda function from "
-      "non-Cuda space");
-  Kokkos::Impl::throw_runtime_exception(msg);
-}
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
+bool CudaUVMSpace::available() { return true; }
 #endif
 
 /*--------------------------------------------------------------------------*/
 
-bool CudaUVMSpace::available() {
-#if defined(CUDA_VERSION) && !defined(__APPLE__)
-  enum : bool { UVM_available = true };
-#else
-  enum : bool { UVM_available = false };
-#endif
-  return UVM_available;
-}
-
-/*--------------------------------------------------------------------------*/
-
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-int CudaUVMSpace::number_of_allocations() {
-  return Kokkos::Impl::num_uvm_allocations.load();
-}
-#endif
 #ifdef KOKKOS_IMPL_DEBUG_CUDA_PIN_UVM_TO_HOST
 // The purpose of the following variable is to allow a state-based choice
 // for pinning UVM allocations to the CPU. For now this is considered
@@ -674,11 +618,7 @@ void cuda_prefetch_pointer(const Cuda &space, const void *ptr, size_t bytes,
   // DualView syncs down. Probably because the latency is not too bad in the
   // first place for the pull down. If we want to change that provde
   // cudaCpuDeviceId as the device if to_device is false
-#if CUDA_VERSION < 10000
-  bool is_managed = attr.isManaged;
-#else
   bool is_managed = attr.type == cudaMemoryTypeManaged;
-#endif
   if (to_device && is_managed &&
       space.cuda_device_prop().concurrentManagedAccess) {
     KOKKOS_IMPL_CUDA_SAFE_CALL(cudaMemPrefetchAsync(
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Alloc.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Alloc.hpp
deleted file mode 100644
index e76133fae8702484874cc6afe5b7aa92934cba02..0000000000000000000000000000000000000000
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Alloc.hpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
-//               Solutions of Sandia, LLC (NTESS).
-//
-// Under the terms of Contract DE-NA0003525 with NTESS,
-// the U.S. Government retains certain rights in this software.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
-//@HEADER
-*/
-
-#ifndef KOKKOS_CUDA_ALLOCATION_TRACKING_HPP
-#define KOKKOS_CUDA_ALLOCATION_TRACKING_HPP
-
-#include <Kokkos_Macros.hpp>
-#ifdef KOKKOS_ENABLE_CUDA
-
-#include <impl/Kokkos_Traits.hpp>
-
-namespace Kokkos {
-namespace Impl {
-
-template <class DestructFunctor>
-SharedAllocationRecord* shared_allocation_record(
-    Kokkos::CudaSpace const& arg_space, void* const arg_alloc_ptr,
-    DestructFunctor const& arg_destruct) {
-  SharedAllocationRecord* const record =
-      SharedAllocationRecord::get_record(arg_alloc_ptr);
-
-  // assert: record != 0
-
-  // assert: sizeof(DestructFunctor) <= record->m_destruct_size
-
-  // assert: record->m_destruct_function == 0
-
-  DestructFunctor* const functor = reinterpret_cast<DestructFunctor*>(
-      reinterpret_cast<uintptr_t>(record) + sizeof(SharedAllocationRecord));
-
-  new (functor) DestructFunctor(arg_destruct);
-
-  record->m_destruct_functor = &shared_allocation_destroy<DestructFunctor>;
-
-  return record;
-}
-
-/// class CudaUnmanagedAllocator
-/// does nothing when deallocate(ptr,size) is called
-struct CudaUnmanagedAllocator {
-  static const char* name() { return "Cuda Unmanaged Allocator"; }
-
-  static void deallocate(void* /*ptr*/, size_t /*size*/) {}
-
-  static bool support_texture_binding() { return true; }
-};
-
-/// class CudaUnmanagedAllocator
-/// does nothing when deallocate(ptr,size) is called
-struct CudaUnmanagedUVMAllocator {
-  static const char* name() { return "Cuda Unmanaged UVM Allocator"; }
-
-  static void deallocate(void* /*ptr*/, size_t /*size*/) {}
-
-  static bool support_texture_binding() { return true; }
-};
-
-/// class CudaUnmanagedHostAllocator
-/// does nothing when deallocate(ptr,size) is called
-class CudaUnmanagedHostAllocator {
- public:
-  static const char* name() { return "Cuda Unmanaged Host Allocator"; }
-  // Unmanaged deallocate does nothing
-  static void deallocate(void* /*ptr*/, size_t /*size*/) {}
-};
-
-/// class CudaMallocAllocator
-class CudaMallocAllocator {
- public:
-  static const char* name() { return "Cuda Malloc Allocator"; }
-
-  static void* allocate(size_t size);
-
-  static void deallocate(void* ptr, size_t);
-
-  static void* reallocate(void* old_ptr, size_t old_size, size_t new_size);
-
-  static bool support_texture_binding() { return true; }
-};
-
-/// class CudaUVMAllocator
-class CudaUVMAllocator {
- public:
-  static const char* name() { return "Cuda UVM Allocator"; }
-
-  static void* allocate(size_t size);
-
-  static void deallocate(void* ptr, size_t);
-
-  static void* reallocate(void* old_ptr, size_t old_size, size_t new_size);
-
-  static bool support_texture_binding() { return true; }
-};
-
-/// class CudaHostAllocator
-class CudaHostAllocator {
- public:
-  static const char* name() { return "Cuda Host Allocator"; }
-
-  static void* allocate(size_t size);
-
-  static void deallocate(void* ptr, size_t);
-
-  static void* reallocate(void* old_ptr, size_t old_size, size_t new_size);
-};
-
-}  // namespace Impl
-}  // namespace Kokkos
-
-#endif  // KOKKOS_ENABLE_CUDA
-
-#endif  // #ifndef KOKKOS_CUDA_ALLOCATION_TRACKING_HPP
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics.hpp
index 8e8dff67763f495771377a2cff5b412fd233a4dc..cb196f6e8ffa062716b583faf257b085d101a1b7 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics.hpp
@@ -32,40 +32,16 @@ LICENSE ASSOCIATED WITH SUBSEQUENT MODIFICATIONS
 
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//              Copyright (2019) Sandia Corporation
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 // ************************************************************************
 @HEADER
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics_Restore_Builtins.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics_Restore_Builtins.hpp
index d7cd1bab1303a76e08723c07d6ff32cb613c0245..a7dfc15d7a74781cf1c36b6d5eb362714000d81e 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics_Restore_Builtins.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics_Restore_Builtins.hpp
@@ -1,45 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//              Copyright (2019) Sandia Corporation
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifdef KOKKOS_SIMT_ATOMIC_BUILTIN_REPLACEMENTS_DEFINED
 
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_BlockSize_Deduction.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_BlockSize_Deduction.hpp
index 993c8d1bbadc4ebff2fcc9bdc905fca6bb37a9cf..75c1686dc2ccff2bf67e591f9a6ec07824f28eaf 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_BlockSize_Deduction.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_BlockSize_Deduction.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CUDA_INTERNAL_HPP
 #define KOKKOS_CUDA_INTERNAL_HPP
@@ -53,13 +25,67 @@
 namespace Kokkos {
 namespace Impl {
 
+inline int cuda_warp_per_sm_allocation_granularity(
+    cudaDeviceProp const& properties) {
+  // Allocation granularity of warps in each sm
+  switch (properties.major) {
+    case 3:
+    case 5:
+    case 7:
+    case 8:
+    case 9: return 4;
+    case 6: return (properties.minor == 0 ? 2 : 4);
+    default:
+      throw_runtime_exception(
+          "Unknown device in cuda warp per sm allocation granularity");
+      return 0;
+  }
+}
+
+inline int cuda_max_warps_per_sm_registers(
+    cudaDeviceProp const& properties, cudaFuncAttributes const& attributes) {
+  // Maximum number of warps per sm as a function of register counts,
+  // subject to the constraint that warps are allocated with a fixed granularity
+  int const max_regs_per_block = properties.regsPerBlock;
+  int const regs_per_warp      = attributes.numRegs * properties.warpSize;
+  int const warp_granularity =
+      cuda_warp_per_sm_allocation_granularity(properties);
+  // The granularity of register allocation is chunks of 256 registers per warp,
+  // which implies a need to over-allocate, so we round up
+  int const allocated_regs_per_warp = 256 * ((regs_per_warp + 256 - 1) / 256);
+
+  // The maximum number of warps per SM is constrained from above by register
+  // allocation. To satisfy the constraint that warps per SM is allocated at a
+  // finite granularity, we need to round down.
+  int const max_warps_per_sm =
+      warp_granularity *
+      (max_regs_per_block / (allocated_regs_per_warp * warp_granularity));
+
+  return max_warps_per_sm;
+}
+
 inline int cuda_max_active_blocks_per_sm(cudaDeviceProp const& properties,
                                          cudaFuncAttributes const& attributes,
                                          int block_size, size_t dynamic_shmem) {
-  // Limits due do registers/SM
+  // Limits due to registers/SM
   int const regs_per_sm     = properties.regsPerMultiprocessor;
   int const regs_per_thread = attributes.numRegs;
-  int const max_blocks_regs = regs_per_sm / (regs_per_thread * block_size);
+  // The granularity of register allocation is chunks of 256 registers per warp
+  // -> 8 registers per thread
+  int const allocated_regs_per_thread = 8 * ((regs_per_thread + 8 - 1) / 8);
+  int max_blocks_regs = regs_per_sm / (allocated_regs_per_thread * block_size);
+
+  // Compute the maximum number of warps as a function of the number of
+  // registers
+  int const max_warps_per_sm_registers =
+      cuda_max_warps_per_sm_registers(properties, attributes);
+
+  // Correct the number of blocks to respect the maximum number of warps per
+  // SM, which is constrained to be a multiple of the warp allocation
+  // granularity defined in `cuda_warp_per_sm_allocation_granularity`.
+  while ((max_blocks_regs * block_size / properties.warpSize) >
+         max_warps_per_sm_registers)
+    max_blocks_regs--;
 
   // Limits due to shared memory/SM
   size_t const shmem_per_sm            = properties.sharedMemPerMultiprocessor;
@@ -203,40 +229,16 @@ int cuda_get_opt_block_size(const CudaInternal* cuda_instance,
                                 LaunchBounds{});
 }
 
-// Assuming cudaFuncSetCacheConfig(MyKernel, cudaFuncCachePreferL1)
-// NOTE these number can be obtained several ways:
-// * One option is to download the CUDA Occupancy Calculator spreadsheet, select
-// "Compute Capability" first and check what is the smallest "Shared Memory
-// Size Config" that is available.  The "Shared Memory Per Multiprocessor" in
-// bytes is then to be found below in the summary.
-// * Another option would be to look for the information in the "Tuning
-// Guide(s)" of the CUDA Toolkit Documentation for each GPU architecture, in
-// the "Shared Memory" section (more tedious)
-inline size_t get_shmem_per_sm_prefer_l1(cudaDeviceProp const& properties) {
-  int const compute_capability = properties.major * 10 + properties.minor;
-  return [compute_capability]() {
-    switch (compute_capability) {
-      case 30:
-      case 32:
-      case 35: return 16;
-      case 37: return 80;
-      case 50:
-      case 53:
-      case 60:
-      case 62: return 64;
-      case 52:
-      case 61: return 96;
-      case 70:
-      case 80:
-      case 86: return 8;
-      case 75: return 32;
-      default:
-        Kokkos::Impl::throw_runtime_exception(
-            "Unknown device in cuda block size deduction");
-    }
-    return 0;
-  }() * 1024;
+// Thin version of cuda_get_opt_block_size for cases where there is no shared
+// memory
+template <class LaunchBounds>
+int cuda_get_opt_block_size_no_shmem(const cudaDeviceProp& prop,
+                                     const cudaFuncAttributes& attr,
+                                     LaunchBounds) {
+  return cuda_deduce_block_size(
+      false, prop, attr, [](int /*block_size*/) { return 0; }, LaunchBounds{});
 }
+
 }  // namespace Impl
 }  // namespace Kokkos
 
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Error.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Error.hpp
index e28e964d36aabfccf31e688050d286e2d25a0268..f68e05f7804028e4264224e543af87b4e3edb404 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Error.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Error.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CUDA_ERROR_HPP
 #define KOKKOS_CUDA_ERROR_HPP
@@ -100,21 +72,6 @@ inline void cuda_internal_safe_call(cudaError e, const char* name,
 #define KOKKOS_IMPL_CUDA_SAFE_CALL(call) \
   Kokkos::Impl::cuda_internal_safe_call(call, #call, __FILE__, __LINE__)
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-
-KOKKOS_DEPRECATED
-inline void cuda_internal_safe_call_deprecated(cudaError e, const char* name,
-                                               const char* file = nullptr,
-                                               const int line   = 0) {
-  cuda_internal_safe_call(e, name, file, line);
-}
-
-#define CUDA_SAFE_CALL(call)                                              \
-  Kokkos::Impl::cuda_internal_safe_call_deprecated(call, #call, __FILE__, \
-                                                   __LINE__)
-
-#endif
-
 }  // namespace Impl
 
 namespace Experimental {
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNodeKernel.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNodeKernel.hpp
index d6fadd82c0fbbb2d3927afe2b6b5b4566710dc1a..8e5d4a07068bfca839ac19de371796fb9c01ce5e 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNodeKernel.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNodeKernel.hpp
@@ -1,53 +1,25 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_CUDA_GRAPHNODEKERNEL_IMPL_HPP
 #define KOKKOS_KOKKOS_CUDA_GRAPHNODEKERNEL_IMPL_HPP
 
 #include <Kokkos_Macros.hpp>
 
-#if defined(KOKKOS_ENABLE_CUDA) && defined(KOKKOS_CUDA_ENABLE_GRAPHS)
+#if defined(KOKKOS_ENABLE_CUDA)
 
 #include <Kokkos_Graph_fwd.hpp>
 
@@ -154,14 +126,15 @@ template <class KernelType,
           class Tag =
               typename PatternTagFromImplSpecialization<KernelType>::type>
 struct get_graph_node_kernel_type
-    : identity<GraphNodeKernelImpl<Kokkos::Cuda, typename KernelType::Policy,
-                                   typename KernelType::functor_type, Tag>> {};
+    : type_identity<
+          GraphNodeKernelImpl<Kokkos::Cuda, typename KernelType::Policy,
+                              typename KernelType::functor_type, Tag>> {};
 template <class KernelType>
 struct get_graph_node_kernel_type<KernelType, Kokkos::ParallelReduceTag>
-    : identity<GraphNodeKernelImpl<Kokkos::Cuda, typename KernelType::Policy,
-                                   typename KernelType::functor_type,
-                                   Kokkos::ParallelReduceTag,
-                                   typename KernelType::reducer_type>> {};
+    : type_identity<GraphNodeKernelImpl<
+          Kokkos::Cuda, typename KernelType::Policy,
+          typename KernelType::functor_type, Kokkos::ParallelReduceTag,
+          typename KernelType::reducer_type>> {};
 
 //==============================================================================
 // <editor-fold desc="get_cuda_graph_*() helper functions"> {{{1
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNode_Impl.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNode_Impl.hpp
index f4539cd2ca378a95c845d4e189512cf9ba21a200..a586d30147a87f71fcd780f1e413ebd9b8bf9714 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNode_Impl.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNode_Impl.hpp
@@ -1,53 +1,25 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_CUDA_GRAPHNODE_IMPL_HPP
 #define KOKKOS_KOKKOS_CUDA_GRAPHNODE_IMPL_HPP
 
 #include <Kokkos_Macros.hpp>
 
-#if defined(KOKKOS_ENABLE_CUDA) && defined(KOKKOS_CUDA_ENABLE_GRAPHS)
+#if defined(KOKKOS_ENABLE_CUDA)
 
 #include <Kokkos_Graph_fwd.hpp>
 
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Graph_Impl.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Graph_Impl.hpp
index bd514f5e88d915b46eccc6ccd5da7baa311088e3..26face64c91701638978ff5e39dcce6021f6be58 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Graph_Impl.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Graph_Impl.hpp
@@ -1,53 +1,25 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_CUDA_GRAPH_IMPL_HPP
 #define KOKKOS_KOKKOS_CUDA_GRAPH_IMPL_HPP
 
 #include <Kokkos_Macros.hpp>
 
-#if defined(KOKKOS_ENABLE_CUDA) && defined(KOKKOS_CUDA_ENABLE_GRAPHS)
+#if defined(KOKKOS_ENABLE_CUDA)
 
 #include <Kokkos_Graph_fwd.hpp>
 
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Conversion.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Conversion.hpp
index 40a263561f4cd1b1389d0f8ac4a9e5afa9d58fb8..eaa6263c406fc2e0d76de023a193e8a3f5dcec93 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Conversion.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Conversion.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CUDA_HALF_HPP_
 #define KOKKOS_CUDA_HALF_HPP_
@@ -48,7 +20,7 @@
 #ifdef KOKKOS_IMPL_CUDA_HALF_TYPE_DEFINED
 
 #include <Kokkos_Half.hpp>
-#include <Kokkos_NumericTraits.hpp>  // reduction_identity
+#include <Kokkos_ReductionIdentity.hpp>
 
 #if CUDA_VERSION >= 11000
 #include <cuda_bf16.h>
@@ -290,7 +262,8 @@ KOKKOS_INLINE_FUNCTION
 // Go in this branch if CUDA version is >= 11.0.0 and less than 11.1.0 or if the
 // architecture is not Ampere
 #if CUDA_VERSION >= 11000 && \
-    (CUDA_VERSION < 11010 || !defined(KOKKOS_ARCH_AMPERE))
+    (CUDA_VERSION < 11010 || \
+     !(defined(KOKKOS_ARCH_AMPERE) || defined(KOKKOS_ARCH_HOPPER)))
 KOKKOS_INLINE_FUNCTION
 bhalf_t cast_to_bhalf(bhalf_t val) { return val; }
 
@@ -418,7 +391,7 @@ KOKKOS_INLINE_FUNCTION
 #endif  // CUDA_VERSION >= 11000 && CUDA_VERSION < 11010
 
 #if CUDA_VERSION >= 11010 && \
-    ((defined(KOKKOS_ARCH_AMPERE80) || defined(KOKKOS_ARCH_AMPERE86)))
+    ((defined(KOKKOS_ARCH_AMPERE) || defined(KOKKOS_ARCH_HOPPER)))
 KOKKOS_INLINE_FUNCTION
 bhalf_t cast_to_bhalf(bhalf_t val) { return val; }
 KOKKOS_INLINE_FUNCTION
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Impl_Type.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Impl_Type.hpp
index e296a9239a6f0cc35604a84cda6cd7a919b7130a..79d3322da2823b00894de9d42f9a42d35932c393 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Impl_Type.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Impl_Type.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CUDA_HALF_IMPL_TYPE_HPP_
 #define KOKKOS_CUDA_HALF_IMPL_TYPE_HPP_
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.cpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.cpp
index 5811498e010f4b34ededc6b763f3d6cbd7cf9490..3dbe179d66ed24a7f88d6af074db8f1e45344b77 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.cpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /*--------------------------------------------------------------------------*/
 /* Kokkos interfaces */
@@ -202,7 +174,9 @@ void cuda_internal_error_abort(cudaError e, const char *name, const char *file,
   if (file) {
     out << " " << file << ":" << line;
   }
-  abort(out.str().c_str());
+  // FIXME Call Kokkos::Impl::host_abort instead of Kokkos::abort to avoid a
+  // warning about Kokkos::abort returning in some cases.
+  host_abort(out.str().c_str());
 }
 
 //----------------------------------------------------------------------------
@@ -291,12 +265,14 @@ const CudaInternalDevices &CudaInternalDevices::singleton() {
 
 }  // namespace
 
-unsigned long *CudaInternal::constantMemHostStaging = nullptr;
-cudaEvent_t CudaInternal::constantMemReusable       = nullptr;
-std::mutex CudaInternal::constantMemMutex;
-
 //----------------------------------------------------------------------------
 
+int Impl::CudaInternal::concurrency() {
+  static int const concurrency = m_deviceProp.maxThreadsPerMultiProcessor *
+                                 m_deviceProp.multiProcessorCount;
+  return concurrency;
+}
+
 void CudaInternal::print_configuration(std::ostream &s) const {
   const CudaInternalDevices &dev_info = CudaInternalDevices::singleton();
 
@@ -328,22 +304,13 @@ CudaInternal::~CudaInternal() {
               << std::endl;
   }
 
-  m_cudaDev                 = -1;
-  m_cudaArch                = -1;
-  m_multiProcCount          = 0;
-  m_maxWarpCount            = 0;
-  m_maxBlock                = {0, 0, 0};
-  m_maxSharedWords          = 0;
-  m_maxConcurrency          = 0;
-  m_scratchSpaceCount       = 0;
-  m_scratchFlagsCount       = 0;
-  m_scratchUnifiedCount     = 0;
-  m_scratchUnifiedSupported = 0;
-  m_streamCount             = 0;
-  m_scratchSpace            = nullptr;
-  m_scratchFlags            = nullptr;
-  m_scratchUnified          = nullptr;
-  m_stream                  = nullptr;
+  m_scratchSpaceCount   = 0;
+  m_scratchFlagsCount   = 0;
+  m_scratchUnifiedCount = 0;
+  m_scratchSpace        = nullptr;
+  m_scratchFlags        = nullptr;
+  m_scratchUnified      = nullptr;
+  m_stream              = nullptr;
   for (int i = 0; i < m_n_team_scratch; ++i) {
     m_team_scratch_current_size[i] = 0;
     m_team_scratch_ptr[i]          = nullptr;
@@ -370,15 +337,12 @@ void CudaInternal::fence() const {
   fence("Kokkos::CudaInternal::fence(): Unnamed Instance Fence");
 }
 
-void CudaInternal::initialize(int cuda_device_id, cudaStream_t stream,
-                              bool manage_stream) {
+void CudaInternal::initialize(cudaStream_t stream, bool manage_stream) {
   if (was_finalized)
     Kokkos::abort("Calling Cuda::initialize after Cuda::finalize is illegal\n");
   was_initialized = true;
   if (is_initialized()) return;
 
-  enum { WordSize = sizeof(size_type) };
-
 #ifndef KOKKOS_IMPL_TURN_OFF_CUDA_HOST_INIT_CHECK
   if (!HostSpace::execution_space::impl_is_initialized()) {
     const std::string msg(
@@ -388,107 +352,9 @@ void CudaInternal::initialize(int cuda_device_id, cudaStream_t stream,
   }
 #endif
 
-  const CudaInternalDevices &dev_info = CudaInternalDevices::singleton();
-
   const bool ok_init = nullptr == m_scratchSpace || nullptr == m_scratchFlags;
 
-  const bool ok_id =
-      0 <= cuda_device_id && cuda_device_id < dev_info.m_cudaDevCount;
-
-  // Need device capability 3.0 or better
-
-  const bool ok_dev =
-      ok_id && (3 <= dev_info.m_cudaProp[cuda_device_id].major &&
-                0 <= dev_info.m_cudaProp[cuda_device_id].minor);
-
-  if (ok_init && ok_dev) {
-    const struct cudaDeviceProp &cudaProp = dev_info.m_cudaProp[cuda_device_id];
-
-    m_cudaDev    = cuda_device_id;
-    m_deviceProp = cudaProp;
-
-    KOKKOS_IMPL_CUDA_SAFE_CALL(cudaSetDevice(m_cudaDev));
-    Kokkos::Impl::cuda_device_synchronize(
-        "Kokkos::CudaInternal::initialize: Fence on space initialization");
-
-    // Query what compute capability architecture a kernel executes:
-    m_cudaArch = cuda_kernel_arch();
-
-    if (m_cudaArch == 0) {
-      std::stringstream ss;
-      ss << "Kokkos::Cuda::initialize ERROR: likely mismatch of architecture\n";
-      std::string msg = ss.str();
-      Kokkos::abort(msg.c_str());
-    }
-
-    int compiled_major = m_cudaArch / 100;
-    int compiled_minor = (m_cudaArch % 100) / 10;
-
-    if (compiled_major != cudaProp.major || compiled_minor > cudaProp.minor) {
-      std::stringstream ss;
-      ss << "Kokkos::Cuda::initialize ERROR: running kernels compiled for "
-            "compute capability "
-         << compiled_major << "." << compiled_minor
-         << " on device with compute capability " << cudaProp.major << "."
-         << cudaProp.minor << " is not supported by CUDA!\n";
-      std::string msg = ss.str();
-      Kokkos::abort(msg.c_str());
-    }
-    if (Kokkos::show_warnings() && (compiled_major != cudaProp.major ||
-                                    compiled_minor != cudaProp.minor)) {
-      std::cerr << "Kokkos::Cuda::initialize WARNING: running kernels compiled "
-                   "for compute capability "
-                << compiled_major << "." << compiled_minor
-                << " on device with compute capability " << cudaProp.major
-                << "." << cudaProp.minor
-                << " , this will likely reduce potential performance."
-                << std::endl;
-    }
-
-    // number of multiprocessors
-
-    m_multiProcCount = cudaProp.multiProcessorCount;
-
-    //----------------------------------
-    // Maximum number of warps,
-    // at most one warp per thread in a warp for reduction.
-
-    m_maxWarpCount = cudaProp.maxThreadsPerBlock / Impl::CudaTraits::WarpSize;
-
-    if (Impl::CudaTraits::WarpSize < m_maxWarpCount) {
-      m_maxWarpCount = Impl::CudaTraits::WarpSize;
-    }
-
-    m_maxSharedWords = cudaProp.sharedMemPerBlock / WordSize;
-
-    //----------------------------------
-    // Maximum number of blocks:
-
-    m_maxBlock[0] = cudaProp.maxGridSize[0];
-    m_maxBlock[1] = cudaProp.maxGridSize[1];
-    m_maxBlock[2] = cudaProp.maxGridSize[2];
-
-    m_shmemPerSM       = cudaProp.sharedMemPerMultiprocessor;
-    m_maxShmemPerBlock = cudaProp.sharedMemPerBlock;
-    m_regsPerSM        = cudaProp.regsPerMultiprocessor;
-    m_maxBlocksPerSM =
-        m_cudaArch < 500
-            ? 16
-            : (m_cudaArch < 750 ? 32 : (m_cudaArch == 750 ? 16 : 32));
-    m_maxThreadsPerSM    = cudaProp.maxThreadsPerMultiProcessor;
-    m_maxThreadsPerBlock = cudaProp.maxThreadsPerBlock;
-
-    //----------------------------------
-
-    m_scratchUnifiedSupported = cudaProp.unifiedAddressing;
-
-    if (Kokkos::show_warnings() && !m_scratchUnifiedSupported) {
-      std::cerr << "Kokkos::Cuda device " << cudaProp.name << " capability "
-                << cudaProp.major << "." << cudaProp.minor
-                << " does not support unified virtual address space"
-                << std::endl;
-    }
-
+  if (ok_init) {
     //----------------------------------
     // Multiblock reduction uses scratch flags for counters
     // and scratch space for partial reduction values.
@@ -502,45 +368,10 @@ void CudaInternal::initialize(int cuda_device_id, cudaStream_t stream,
       (void)scratch_flags(reduce_block_count * 2 * sizeof(size_type));
       (void)scratch_space(reduce_block_count * 16 * sizeof(size_type));
     }
-    //----------------------------------
-    // Concurrent bitset for obtaining unique tokens from within
-    // an executing kernel.
-    {
-      m_maxConcurrency = m_maxThreadsPerSM * cudaProp.multiProcessorCount;
-
-      const int32_t buffer_bound =
-          Kokkos::Impl::concurrent_bitset::buffer_bound(m_maxConcurrency);
-
-      // Allocate and initialize uint32_t[ buffer_bound ]
-
-      using Record =
-          Kokkos::Impl::SharedAllocationRecord<Kokkos::CudaSpace, void>;
-
-      Record *const r =
-          Record::allocate(Kokkos::CudaSpace(), "Kokkos::InternalScratchBitset",
-                           sizeof(uint32_t) * buffer_bound);
-
-      Record::increment(r);
-    }
-    //----------------------------------
-
   } else {
     std::ostringstream msg;
-    msg << "Kokkos::Cuda::initialize(" << cuda_device_id << ") FAILED";
-
-    if (!ok_init) {
-      msg << " : Already initialized";
-    }
-    if (!ok_id) {
-      msg << " : Device identifier out of range "
-          << "[0.." << dev_info.m_cudaDevCount << "]";
-    } else if (!ok_dev) {
-      msg << " : Device ";
-      msg << dev_info.m_cudaProp[cuda_device_id].major;
-      msg << ".";
-      msg << dev_info.m_cudaProp[cuda_device_id].minor;
-      msg << " has insufficient capability, required 3.0 or better";
-    }
+    msg << "Kokkos::Cuda::initialize(" << m_cudaDev
+        << ") FAILED : Already initialized";
     Kokkos::Impl::throw_runtime_exception(msg.str());
   }
 
@@ -569,18 +400,12 @@ Kokkos::Cuda::initialize WARNING: Cuda is allocating into UVMSpace by default
   }
 #endif
 
-#ifdef KOKKOS_ENABLE_PRE_CUDA_10_DEPRECATION_API
-  cudaThreadSetCacheConfig(cudaFuncCachePreferShared);
-#else
-  cudaDeviceSetCacheConfig(cudaFuncCachePreferShared);
-#endif
-
   // Init the array for used for arbitrarily sized atomics
-  if (stream == nullptr) Impl::initialize_host_cuda_lock_arrays();
+  if (this == &singleton()) Impl::initialize_host_cuda_lock_arrays();
 
   // Allocate a staging buffer for constant mem in pinned host memory
   // and an event to avoid overwriting driver for previous kernel launches
-  if (stream == nullptr) {
+  if (this == &singleton()) {
     KOKKOS_IMPL_CUDA_SAFE_CALL(
         cudaMallocHost(reinterpret_cast<void **>(&constantMemHostStaging),
                        CudaTraits::ConstantMemoryUsage));
@@ -596,9 +421,9 @@ Kokkos::Cuda::initialize WARNING: Cuda is allocating into UVMSpace by default
   }
 
   KOKKOS_IMPL_CUDA_SAFE_CALL(
-      cudaMalloc(&m_scratch_locks, sizeof(int32_t) * m_maxConcurrency));
+      cudaMalloc(&m_scratch_locks, sizeof(int32_t) * concurrency()));
   KOKKOS_IMPL_CUDA_SAFE_CALL(
-      cudaMemset(m_scratch_locks, 0, sizeof(int32_t) * m_maxConcurrency));
+      cudaMemset(m_scratch_locks, 0, sizeof(int32_t) * concurrency()));
 }
 
 //----------------------------------------------------------------------------
@@ -698,37 +523,44 @@ Cuda::size_type *CudaInternal::scratch_functor(const std::size_t size) const {
   return m_scratchFunctor;
 }
 
-std::pair<void *, int> CudaInternal::resize_team_scratch_space(
-    std::int64_t bytes, bool force_shrink) {
-  // Multiple ParallelFor/Reduce Teams can call this function at the same time
-  // and invalidate the m_team_scratch_ptr. We use a pool to avoid any race
-  // condition.
-
+int CudaInternal::acquire_team_scratch_space() {
   int current_team_scratch = 0;
   int zero                 = 0;
-  int one                  = 1;
   while (!m_team_scratch_pool[current_team_scratch].compare_exchange_weak(
-      zero, one, std::memory_order_release, std::memory_order_relaxed)) {
+      zero, 1, std::memory_order_release, std::memory_order_relaxed)) {
     current_team_scratch = (current_team_scratch + 1) % m_n_team_scratch;
   }
-  if (m_team_scratch_current_size[current_team_scratch] == 0) {
-    m_team_scratch_current_size[current_team_scratch] = bytes;
-    m_team_scratch_ptr[current_team_scratch] =
+
+  return current_team_scratch;
+}
+
+void *CudaInternal::resize_team_scratch_space(int scratch_pool_id,
+                                              std::int64_t bytes,
+                                              bool force_shrink) {
+  // Multiple ParallelFor/Reduce Teams can call this function at the same time
+  // and invalidate the m_team_scratch_ptr. We use a pool to avoid any race
+  // condition.
+  if (m_team_scratch_current_size[scratch_pool_id] == 0) {
+    m_team_scratch_current_size[scratch_pool_id] = bytes;
+    m_team_scratch_ptr[scratch_pool_id] =
         Kokkos::kokkos_malloc<Kokkos::CudaSpace>(
             "Kokkos::CudaSpace::TeamScratchMemory",
-            m_team_scratch_current_size[current_team_scratch]);
+            m_team_scratch_current_size[scratch_pool_id]);
   }
-  if ((bytes > m_team_scratch_current_size[current_team_scratch]) ||
-      ((bytes < m_team_scratch_current_size[current_team_scratch]) &&
+  if ((bytes > m_team_scratch_current_size[scratch_pool_id]) ||
+      ((bytes < m_team_scratch_current_size[scratch_pool_id]) &&
        (force_shrink))) {
-    m_team_scratch_current_size[current_team_scratch] = bytes;
-    m_team_scratch_ptr[current_team_scratch] =
+    m_team_scratch_current_size[scratch_pool_id] = bytes;
+    m_team_scratch_ptr[scratch_pool_id] =
         Kokkos::kokkos_realloc<Kokkos::CudaSpace>(
-            m_team_scratch_ptr[current_team_scratch],
-            m_team_scratch_current_size[current_team_scratch]);
+            m_team_scratch_ptr[scratch_pool_id],
+            m_team_scratch_current_size[scratch_pool_id]);
   }
-  return std::make_pair(m_team_scratch_ptr[current_team_scratch],
-                        current_team_scratch);
+  return m_team_scratch_ptr[scratch_pool_id];
+}
+
+void CudaInternal::release_team_scratch_space(int scratch_pool_id) {
+  m_team_scratch_pool[scratch_pool_id] = 0;
 }
 
 //----------------------------------------------------------------------------
@@ -773,15 +605,9 @@ void CudaInternal::finalize() {
   if (m_manage_stream && m_stream != nullptr)
     KOKKOS_IMPL_CUDA_SAFE_CALL(cudaStreamDestroy(m_stream));
 
-  m_cudaDev             = -1;
-  m_multiProcCount      = 0;
-  m_maxWarpCount        = 0;
-  m_maxBlock            = {0, 0, 0};
-  m_maxSharedWords      = 0;
   m_scratchSpaceCount   = 0;
   m_scratchFlagsCount   = 0;
   m_scratchUnifiedCount = 0;
-  m_streamCount         = 0;
   m_scratchSpace        = nullptr;
   m_scratchFlags        = nullptr;
   m_scratchUnified      = nullptr;
@@ -851,8 +677,12 @@ Cuda::size_type Cuda::detect_device_count() {
   return Impl::CudaInternalDevices::singleton().m_cudaDevCount;
 }
 
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
 int Cuda::concurrency() {
-  return Impl::CudaInternal::singleton().m_maxConcurrency;
+#else
+int Cuda::concurrency() const {
+#endif
+  return Impl::CudaInternal::concurrency();
 }
 
 int Cuda::impl_is_initialized() {
@@ -860,15 +690,120 @@ int Cuda::impl_is_initialized() {
 }
 
 void Cuda::impl_initialize(InitializationSettings const &settings) {
-  Impl::CudaInternal::singleton().initialize(Impl::get_gpu(settings));
+  const int cuda_device_id = Impl::get_gpu(settings);
+  const auto &dev_info     = Impl::CudaInternalDevices::singleton();
+
+  // Need device capability 3.0 or better
+  const bool ok_dev = 3 <= dev_info.m_cudaProp[cuda_device_id].major &&
+                      0 <= dev_info.m_cudaProp[cuda_device_id].minor;
+  if (ok_dev) {
+    const struct cudaDeviceProp &cudaProp = dev_info.m_cudaProp[cuda_device_id];
+
+    Impl::CudaInternal::m_cudaDev    = cuda_device_id;
+    Impl::CudaInternal::m_deviceProp = cudaProp;
+
+    KOKKOS_IMPL_CUDA_SAFE_CALL(cudaSetDevice(cuda_device_id));
+    Kokkos::Impl::cuda_device_synchronize(
+        "Kokkos::CudaInternal::initialize: Fence on space initialization");
+
+    // Query what compute capability architecture a kernel executes:
+    Impl::CudaInternal::m_cudaArch = Impl::cuda_kernel_arch();
+
+    if (Impl::CudaInternal::m_cudaArch == 0) {
+      std::stringstream ss;
+      ss << "Kokkos::Cuda::initialize ERROR: likely mismatch of architecture\n";
+      std::string msg = ss.str();
+      Kokkos::abort(msg.c_str());
+    }
+
+    int compiled_major = Impl::CudaInternal::m_cudaArch / 100;
+    int compiled_minor = (Impl::CudaInternal::m_cudaArch % 100) / 10;
+
+    if ((compiled_major > cudaProp.major) ||
+        ((compiled_major == cudaProp.major) &&
+         (compiled_minor > cudaProp.minor))) {
+      std::stringstream ss;
+      ss << "Kokkos::Cuda::initialize ERROR: running kernels compiled for "
+            "compute capability "
+         << compiled_major << "." << compiled_minor
+         << " on device with compute capability " << cudaProp.major << "."
+         << cudaProp.minor << " is not supported by CUDA!\n";
+      std::string msg = ss.str();
+      Kokkos::abort(msg.c_str());
+    }
+    if (Kokkos::show_warnings() && (compiled_major != cudaProp.major ||
+                                    compiled_minor != cudaProp.minor)) {
+      std::cerr << "Kokkos::Cuda::initialize WARNING: running kernels compiled "
+                   "for compute capability "
+                << compiled_major << "." << compiled_minor
+                << " on device with compute capability " << cudaProp.major
+                << "." << cudaProp.minor
+                << " , this will likely reduce potential performance."
+                << std::endl;
+    }
+
+    // number of multiprocessors
+    Impl::CudaInternal::m_multiProcCount = cudaProp.multiProcessorCount;
+
+    //----------------------------------
+    // Maximum number of warps,
+    // at most one warp per thread in a warp for reduction.
+    Impl::CudaInternal::m_maxWarpCount =
+        cudaProp.maxThreadsPerBlock / Impl::CudaTraits::WarpSize;
+
+    if (Impl::CudaTraits::WarpSize < Impl::CudaInternal::m_maxWarpCount) {
+      Impl::CudaInternal::m_maxWarpCount = Impl::CudaTraits::WarpSize;
+    }
+
+    constexpr auto WordSize = sizeof(size_type);
+    Impl::CudaInternal::m_maxSharedWords =
+        cudaProp.sharedMemPerBlock / WordSize;
+
+    //----------------------------------
+    // Maximum number of blocks:
+
+    Impl::CudaInternal::m_maxBlock[0] = cudaProp.maxGridSize[0];
+    Impl::CudaInternal::m_maxBlock[1] = cudaProp.maxGridSize[1];
+    Impl::CudaInternal::m_maxBlock[2] = cudaProp.maxGridSize[2];
+
+    Impl::CudaInternal::m_shmemPerSM = cudaProp.sharedMemPerMultiprocessor;
+    Impl::CudaInternal::m_maxShmemPerBlock = cudaProp.sharedMemPerBlock;
+    Impl::CudaInternal::m_maxBlocksPerSM =
+        Impl::CudaInternal::m_cudaArch < 500
+            ? 16
+            : (Impl::CudaInternal::m_cudaArch < 750
+                   ? 32
+                   : (Impl::CudaInternal::m_cudaArch == 750 ? 16 : 32));
+    Impl::CudaInternal::m_maxThreadsPerSM =
+        cudaProp.maxThreadsPerMultiProcessor;
+    Impl::CudaInternal::m_maxThreadsPerBlock = cudaProp.maxThreadsPerBlock;
+
+    //----------------------------------
 
-  // In order to support setting an atexit hook for Kokkos::finalize
-  // We need to ensure that the Cuda deep_copy instance is not destroyed
-  // before that atexit hook is getting called.
-  // Thus we create the static instance here, so that it will be deallocated
-  // after the potential atexit call.
-  // This is neccessary since we will access that instance in Kokkos::finalize
-  (void)::Kokkos::Impl::cuda_get_deep_copy_space(true);
+    Impl::CudaInternal::m_scratchUnifiedSupported = cudaProp.unifiedAddressing;
+
+    if (Kokkos::show_warnings() &&
+        !Impl::CudaInternal::m_scratchUnifiedSupported) {
+      std::cerr << "Kokkos::Cuda device " << cudaProp.name << " capability "
+                << cudaProp.major << "." << cudaProp.minor
+                << " does not support unified virtual address space"
+                << std::endl;
+    }
+  } else {
+    std::ostringstream msg;
+    msg << "Kokkos::Cuda::initialize(" << cuda_device_id << ") FAILED: Device ";
+    msg << dev_info.m_cudaProp[cuda_device_id].major;
+    msg << ".";
+    msg << dev_info.m_cudaProp[cuda_device_id].minor;
+    msg << " has insufficient capability, required 3.0 or better";
+    Kokkos::Impl::throw_runtime_exception(msg.str());
+  }
+
+  cudaStream_t singleton_stream;
+  KOKKOS_IMPL_CUDA_SAFE_CALL(cudaStreamCreate(&singleton_stream));
+
+  auto &cuda_singleton = Impl::CudaInternal::singleton();
+  cuda_singleton.initialize(singleton_stream, /*manage*/ true);
 }
 
 std::vector<unsigned> Cuda::detect_device_arch() {
@@ -914,8 +849,7 @@ Cuda::Cuda(cudaStream_t stream, bool manage_stream)
       }) {
   Impl::CudaInternal::singleton().verify_is_initialized(
       "Cuda instance constructor");
-  m_space_instance->initialize(Impl::CudaInternal::singleton().m_cudaDev,
-                               stream, manage_stream);
+  m_space_instance->initialize(stream, manage_stream);
 }
 
 void Cuda::print_configuration(std::ostream &os, bool /*verbose*/) const {
@@ -937,11 +871,9 @@ void Cuda::print_configuration(std::ostream &os, bool /*verbose*/) const {
 #else
   os << "no\n";
 #endif
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
   os << "  KOKKOS_ENABLE_CUDA_LDG_INTRINSIC: ";
-#ifdef KOKKOS_ENABLE_CUDA_LDG_INTRINSIC
   os << "yes\n";
-#else
-  os << "no\n";
 #endif
   os << "  KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE: ";
 #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE
@@ -993,14 +925,6 @@ int g_cuda_space_factory_initialized =
 
 }  // namespace Impl
 
-#ifdef KOKKOS_ENABLE_CXX14
-namespace Tools {
-namespace Experimental {
-constexpr DeviceType DeviceTypeTraits<Cuda>::id;
-}
-}  // namespace Tools
-#endif
-
 }  // namespace Kokkos
 
 #else
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.hpp
index 62b1f09cd564fd233ea57a1c97f25097f15dc795..af34a5b9db345e7ef3225d7a019e5f92b3c816c6 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.hpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #ifndef KOKKOS_CUDA_INSTANCE_HPP_
 #define KOKKOS_CUDA_INSTANCE_HPP_
 
@@ -85,23 +101,22 @@ class CudaInternal {
  public:
   using size_type = Cuda::size_type;
 
-  int m_cudaDev;
+  inline static int m_cudaDev = -1;
 
   // Device Properties
-  int m_cudaArch;
-  unsigned m_multiProcCount;
-  unsigned m_maxWarpCount;
-  std::array<size_type, 3> m_maxBlock;
-  unsigned m_maxSharedWords;
-  uint32_t m_maxConcurrency;
-  int m_shmemPerSM;
-  int m_maxShmemPerBlock;
-  int m_regsPerSM;
-  int m_maxBlocksPerSM;
-  int m_maxThreadsPerSM;
-  int m_maxThreadsPerBlock;
-
-  cudaDeviceProp m_deviceProp;
+  inline static int m_cudaArch                      = -1;
+  inline static unsigned m_multiProcCount           = 0;
+  inline static unsigned m_maxWarpCount             = 0;
+  inline static std::array<size_type, 3> m_maxBlock = {0, 0, 0};
+  inline static unsigned m_maxSharedWords           = 0;
+  inline static int m_shmemPerSM                    = 0;
+  inline static int m_maxShmemPerBlock              = 0;
+  inline static int m_maxBlocksPerSM                = 0;
+  inline static int m_maxThreadsPerSM               = 0;
+  inline static int m_maxThreadsPerBlock            = 0;
+  static int concurrency();
+
+  inline static cudaDeviceProp m_deviceProp;
 
   // Scratch Spaces for Reductions
   mutable std::size_t m_scratchSpaceCount;
@@ -109,8 +124,7 @@ class CudaInternal {
   mutable std::size_t m_scratchUnifiedCount;
   mutable std::size_t m_scratchFunctorSize;
 
-  size_type m_scratchUnifiedSupported;
-  size_type m_streamCount;
+  inline static size_type m_scratchUnifiedSupported = 0;
   mutable size_type* m_scratchSpace;
   mutable size_type* m_scratchFlags;
   mutable size_type* m_scratchUnified;
@@ -131,9 +145,9 @@ class CudaInternal {
 
   // FIXME_CUDA: these want to be per-device, not per-stream...  use of 'static'
   //  here will break once there are multiple devices though
-  static unsigned long* constantMemHostStaging;
-  static cudaEvent_t constantMemReusable;
-  static std::mutex constantMemMutex;
+  inline static unsigned long* constantMemHostStaging = nullptr;
+  inline static cudaEvent_t constantMemReusable       = nullptr;
+  inline static std::mutex constantMemMutex;
 
   static CudaInternal& singleton();
 
@@ -143,8 +157,7 @@ class CudaInternal {
     return nullptr != m_scratchSpace && nullptr != m_scratchFlags;
   }
 
-  void initialize(int cuda_device_id, cudaStream_t stream = nullptr,
-                  bool manage_stream = false);
+  void initialize(cudaStream_t stream, bool manage_stream);
   void finalize();
 
   void print_configuration(std::ostream&) const;
@@ -160,25 +173,10 @@ class CudaInternal {
   ~CudaInternal();
 
   CudaInternal()
-      : m_cudaDev(-1),
-        m_cudaArch(-1),
-        m_multiProcCount(0),
-        m_maxWarpCount(0),
-        m_maxBlock({0, 0, 0}),
-        m_maxSharedWords(0),
-        m_maxConcurrency(0),
-        m_shmemPerSM(0),
-        m_maxShmemPerBlock(0),
-        m_regsPerSM(0),
-        m_maxBlocksPerSM(0),
-        m_maxThreadsPerSM(0),
-        m_maxThreadsPerBlock(0),
-        m_scratchSpaceCount(0),
+      : m_scratchSpaceCount(0),
         m_scratchFlagsCount(0),
         m_scratchUnifiedCount(0),
         m_scratchFunctorSize(0),
-        m_scratchUnifiedSupported(0),
-        m_streamCount(0),
         m_scratchSpace(nullptr),
         m_scratchFlags(nullptr),
         m_scratchUnified(nullptr),
@@ -200,9 +198,11 @@ class CudaInternal {
   size_type* scratch_unified(const std::size_t size) const;
   size_type* scratch_functor(const std::size_t size) const;
   uint32_t impl_get_instance_id() const;
+  int acquire_team_scratch_space();
   // Resizing of team level 1 scratch
-  std::pair<void*, int> resize_team_scratch_space(std::int64_t bytes,
-                                                  bool force_shrink = false);
+  void* resize_team_scratch_space(int scratch_pool_id, std::int64_t bytes,
+                                  bool force_shrink = false);
+  void release_team_scratch_space(int scratch_pool_id);
 };
 
 }  // Namespace Impl
@@ -225,11 +225,9 @@ inline void create_Cuda_instances(std::vector<Cuda>& instances) {
 
 template <class... Args>
 std::vector<Cuda> partition_space(const Cuda&, Args...) {
-#ifdef __cpp_fold_expressions
   static_assert(
       (... && std::is_arithmetic_v<Args>),
       "Kokkos Error: partitioning arguments must be integers or floats");
-#endif
   std::vector<Cuda> instances(sizeof...(Args));
   Impl::create_Cuda_instances(instances);
   return instances;
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp
index b7a80ad84ff22b00d9666956cf5896b259d38b6a..5afad7a6a3d8c113cb3bdf6e14afadbd702bb857 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CUDAEXEC_HPP
 #define KOKKOS_CUDAEXEC_HPP
@@ -93,10 +65,6 @@ namespace Impl {
 //   __launch_bounds__(maxThreadsPerBlock,minBlocksPerMultiprocessor)
 // function qualifier which could be used to improve performance.
 //----------------------------------------------------------------------------
-// Maximize L1 cache and minimize shared memory:
-//   cudaFuncSetCacheConfig(MyKernel, cudaFuncCachePreferL1 );
-// For 2.0 capability: 48 KB L1 and 16 KB shared
-//----------------------------------------------------------------------------
 
 template <class DriverType>
 __global__ static void cuda_parallel_launch_constant_memory() {
@@ -158,63 +126,117 @@ inline void check_shmem_request(CudaInternal const* cuda_instance, int shmem) {
   }
 }
 
-// This function needs to be template on DriverType and LaunchBounds
+// These functions need to be templated on DriverType and LaunchBounds
 // so that the static bool is unique for each type combo
 // KernelFuncPtr does not necessarily contain that type information.
+
 template <class DriverType, class LaunchBounds, class KernelFuncPtr>
-inline void configure_shmem_preference(KernelFuncPtr const& func,
-                                       bool prefer_shmem) {
+const cudaFuncAttributes& get_cuda_kernel_func_attributes(
+    const KernelFuncPtr& func) {
+  // Only call cudaFuncGetAttributes once for each unique kernel
+  // by leveraging static variable initialization rules
+  auto wrap_get_attributes = [&]() -> cudaFuncAttributes {
+    cudaFuncAttributes attr;
+    KOKKOS_IMPL_CUDA_SAFE_CALL(cudaFuncGetAttributes(&attr, func));
+    return attr;
+  };
+  static cudaFuncAttributes func_attr = wrap_get_attributes();
+  return func_attr;
+}
+
+template <class DriverType, class LaunchBounds, class KernelFuncPtr>
+inline void configure_shmem_preference(const KernelFuncPtr& func,
+                                       const cudaDeviceProp& device_props,
+                                       const size_t block_size, int& shmem,
+                                       const size_t occupancy) {
 #ifndef KOKKOS_ARCH_KEPLER
-  // On Kepler the L1 has no benefit since it doesn't cache reads
+
+  const auto& func_attr =
+      get_cuda_kernel_func_attributes<DriverType, LaunchBounds>(func);
+
+  // Compute limits for number of blocks due to registers/SM
+  const size_t regs_per_sm     = device_props.regsPerMultiprocessor;
+  const size_t regs_per_thread = func_attr.numRegs;
+  // The granularity of register allocation is chunks of 256 registers per warp
+  // -> 8 registers per thread
+  const size_t allocated_regs_per_thread = 8 * ((regs_per_thread + 8 - 1) / 8);
+  size_t max_blocks_regs =
+      regs_per_sm / (allocated_regs_per_thread * block_size);
+
+  // Compute the maximum number of warps as a function of the number of
+  // registers
+  const size_t max_warps_per_sm_registers =
+      cuda_max_warps_per_sm_registers(device_props, func_attr);
+
+  // Correct the number of blocks to respect the maximum number of warps per
+  // SM, which is constrained to be a multiple of the warp allocation
+  // granularity defined in `cuda_warp_per_sm_allocation_granularity`.
+  while ((max_blocks_regs * block_size / device_props.warpSize) >
+         max_warps_per_sm_registers)
+    max_blocks_regs--;
+
+  // Compute how many threads per sm we actually want
+  const size_t max_threads_per_sm = device_props.maxThreadsPerMultiProcessor;
+  // only allocate multiples of warp size
+  const size_t num_threads_desired =
+      ((max_threads_per_sm * occupancy / 100 + 31) / 32) * 32;
+  // Get close to the desired occupancy,
+  // don't undershoot by much but also don't allocate a whole new block just
+  // because one is a few threads over otherwise.
+  size_t num_blocks_desired =
+      (num_threads_desired + block_size * 0.8) / block_size;
+  num_blocks_desired = ::std::min(max_blocks_regs, num_blocks_desired);
+  if (num_blocks_desired == 0) num_blocks_desired = 1;
+
+  // Calculate how much shared memory we need per block
+  size_t shmem_per_block = shmem + func_attr.sharedSizeBytes;
+
+  // The minimum shared memory allocation we can have in total per SM is 8kB.
+  // If we want to lower occupancy we have to make sure we request at least that
+  // much in aggregate over all blocks, so that shared memory actually becomes a
+  // limiting factor for occupancy
+  constexpr size_t min_shmem_size_per_sm = 8192;
+  if ((occupancy < 100) &&
+      (shmem_per_block * num_blocks_desired < min_shmem_size_per_sm)) {
+    shmem_per_block = min_shmem_size_per_sm / num_blocks_desired;
+    // Need to set the caller's shmem variable so that the
+    // kernel launch uses the correct dynamic shared memory request
+    shmem = shmem_per_block - func_attr.sharedSizeBytes;
+  }
+
+  // Compute the carveout fraction we need based on occupancy
+  // Use multiples of 8kB
+  const size_t max_shmem_per_sm = device_props.sharedMemPerMultiprocessor;
+  size_t carveout               = shmem_per_block == 0
+                        ? 0
+                        : 100 *
+                              (((num_blocks_desired * shmem_per_block +
+                                 min_shmem_size_per_sm - 1) /
+                                min_shmem_size_per_sm) *
+                               min_shmem_size_per_sm) /
+                              max_shmem_per_sm;
+  if (carveout > 100) carveout = 100;
+
+  // Set the carveout, but only call it once per kernel or when it changes
   auto set_cache_config = [&] {
-    KOKKOS_IMPL_CUDA_SAFE_CALL(cudaFuncSetCacheConfig(
-        func,
-        (prefer_shmem ? cudaFuncCachePreferShared : cudaFuncCachePreferL1)));
-    return prefer_shmem;
+    KOKKOS_IMPL_CUDA_SAFE_CALL(cudaFuncSetAttribute(
+        func, cudaFuncAttributePreferredSharedMemoryCarveout, carveout));
+    return carveout;
   };
-  static bool cache_config_preference_cached = set_cache_config();
-  if (cache_config_preference_cached != prefer_shmem) {
+  // Store the value in a static variable so we only reset if needed
+  static size_t cache_config_preference_cached = set_cache_config();
+  if (cache_config_preference_cached != carveout) {
     cache_config_preference_cached = set_cache_config();
   }
 #else
   // Use the parameters so we don't get a warning
   (void)func;
-  (void)prefer_shmem;
+  (void)device_props;
+  (void)block_size;
+  (void)occupancy;
 #endif
 }
 
-template <class Policy>
-std::enable_if_t<Policy::experimental_contains_desired_occupancy>
-modify_launch_configuration_if_desired_occupancy_is_specified(
-    Policy const& policy, cudaDeviceProp const& properties,
-    cudaFuncAttributes const& attributes, dim3 const& block, int& shmem,
-    bool& prefer_shmem) {
-  int const block_size        = block.x * block.y * block.z;
-  int const desired_occupancy = policy.impl_get_desired_occupancy().value();
-
-  size_t const shmem_per_sm_prefer_l1 = get_shmem_per_sm_prefer_l1(properties);
-  size_t const static_shmem           = attributes.sharedSizeBytes;
-
-  // round to nearest integer and avoid division by zero
-  int active_blocks = std::max(
-      1, static_cast<int>(std::round(
-             static_cast<double>(properties.maxThreadsPerMultiProcessor) /
-             block_size * desired_occupancy / 100)));
-  int const dynamic_shmem =
-      shmem_per_sm_prefer_l1 / active_blocks - static_shmem;
-
-  if (dynamic_shmem > shmem) {
-    shmem        = dynamic_shmem;
-    prefer_shmem = false;
-  }
-}
-
-template <class Policy>
-std::enable_if_t<!Policy::experimental_contains_desired_occupancy>
-modify_launch_configuration_if_desired_occupancy_is_specified(
-    Policy const&, cudaDeviceProp const&, cudaFuncAttributes const&,
-    dim3 const& /*block*/, int& /*shmem*/, bool& /*prefer_shmem*/) {}
-
 // </editor-fold> end Some helper functions for launch code readability }}}1
 //==============================================================================
 
@@ -345,10 +367,9 @@ struct CudaParallelLaunchKernelInvoker<
         driver);
   }
 
-#ifdef KOKKOS_CUDA_ENABLE_GRAPHS
   inline static void create_parallel_launch_graph_node(
       DriverType const& driver, dim3 const& grid, dim3 const& block, int shmem,
-      CudaInternal const* cuda_instance, bool prefer_shmem) {
+      CudaInternal const* cuda_instance) {
     //----------------------------------------
     auto const& graph = Impl::get_cuda_graph_from_kernel(driver);
     KOKKOS_EXPECTS(bool(graph));
@@ -358,8 +379,15 @@ struct CudaParallelLaunchKernelInvoker<
 
     if (!Impl::is_empty_launch(grid, block)) {
       Impl::check_shmem_request(cuda_instance, shmem);
-      Impl::configure_shmem_preference<DriverType, LaunchBounds>(
-          base_t::get_kernel_func(), prefer_shmem);
+      if constexpr (DriverType::Policy::
+                        experimental_contains_desired_occupancy) {
+        int desired_occupancy =
+            driver.get_policy().impl_get_desired_occupancy().value();
+        size_t block_size = block.x * block.y * block.z;
+        Impl::configure_shmem_preference<DriverType, LaunchBounds>(
+            base_t::get_kernel_func(), cuda_instance->m_deviceProp, block_size,
+            shmem, desired_occupancy);
+      }
 
       void const* args[] = {&driver};
 
@@ -384,7 +412,6 @@ struct CudaParallelLaunchKernelInvoker<
     }
     KOKKOS_ENSURES(bool(graph_node))
   }
-#endif
 };
 
 // </editor-fold> end local memory }}}2
@@ -439,10 +466,9 @@ struct CudaParallelLaunchKernelInvoker<
         driver_ptr);
   }
 
-#ifdef KOKKOS_CUDA_ENABLE_GRAPHS
   inline static void create_parallel_launch_graph_node(
       DriverType const& driver, dim3 const& grid, dim3 const& block, int shmem,
-      CudaInternal const* cuda_instance, bool prefer_shmem) {
+      CudaInternal const* cuda_instance) {
     //----------------------------------------
     auto const& graph = Impl::get_cuda_graph_from_kernel(driver);
     KOKKOS_EXPECTS(bool(graph));
@@ -452,8 +478,15 @@ struct CudaParallelLaunchKernelInvoker<
 
     if (!Impl::is_empty_launch(grid, block)) {
       Impl::check_shmem_request(cuda_instance, shmem);
-      Impl::configure_shmem_preference<DriverType, LaunchBounds>(
-          base_t::get_kernel_func(), prefer_shmem);
+      if constexpr (DriverType::Policy::
+                        experimental_contains_desired_occupancy) {
+        int desired_occupancy =
+            driver.get_policy().impl_get_desired_occupancy().value();
+        size_t block_size = block.x * block.y * block.z;
+        Impl::configure_shmem_preference<DriverType, LaunchBounds>(
+            base_t::get_kernel_func(), cuda_instance->m_deviceProp, block_size,
+            shmem, desired_occupancy);
+      }
 
       auto* driver_ptr = Impl::allocate_driver_storage_for_kernel(driver);
 
@@ -488,7 +521,6 @@ struct CudaParallelLaunchKernelInvoker<
     }
     KOKKOS_ENSURES(bool(graph_node))
   }
-#endif
 };
 
 // </editor-fold> end Global Memory }}}2
@@ -563,10 +595,9 @@ struct CudaParallelLaunchKernelInvoker<
                         cudaStream_t(cuda_instance->m_stream)));
   }
 
-#ifdef KOKKOS_CUDA_ENABLE_GRAPHS
   inline static void create_parallel_launch_graph_node(
       DriverType const& driver, dim3 const& grid, dim3 const& block, int shmem,
-      CudaInternal const* cuda_instance, bool prefer_shmem) {
+      CudaInternal const* cuda_instance) {
     // Just use global memory; coordinating through events to share constant
     // memory with the non-graph interface is not really reasonable since
     // events don't work with Graphs directly, and this would anyway require
@@ -580,9 +611,8 @@ struct CudaParallelLaunchKernelInvoker<
         DriverType, LaunchBounds,
         Experimental::CudaLaunchMechanism::GlobalMemory>;
     global_launch_impl_t::create_parallel_launch_graph_node(
-        driver, grid, block, shmem, cuda_instance, prefer_shmem);
+        driver, grid, block, shmem, cuda_instance);
   }
-#endif
 };
 
 // </editor-fold> end Constant Memory }}}2
@@ -613,8 +643,7 @@ struct CudaParallelLaunchImpl<
 
   inline static void launch_kernel(const DriverType& driver, const dim3& grid,
                                    const dim3& block, int shmem,
-                                   const CudaInternal* cuda_instance,
-                                   bool prefer_shmem) {
+                                   const CudaInternal* cuda_instance) {
     if (!Impl::is_empty_launch(grid, block)) {
       // Prevent multiple threads to simultaneously set the cache configuration
       // preference and launch the same kernel
@@ -623,20 +652,19 @@ struct CudaParallelLaunchImpl<
 
       Impl::check_shmem_request(cuda_instance, shmem);
 
-      // If a desired occupancy is specified, we compute how much shared memory
-      // to ask for to achieve that occupancy, assuming that the cache
-      // configuration is `cudaFuncCachePreferL1`.  If the amount of dynamic
-      // shared memory computed is actually smaller than `shmem` we overwrite
-      // `shmem` and set `prefer_shmem` to `false`.
-      modify_launch_configuration_if_desired_occupancy_is_specified(
-          driver.get_policy(), cuda_instance->m_deviceProp,
-          get_cuda_func_attributes(), block, shmem, prefer_shmem);
+      if constexpr (DriverType::Policy::
+                        experimental_contains_desired_occupancy) {
+        int desired_occupancy =
+            driver.get_policy().impl_get_desired_occupancy().value();
+        size_t block_size = block.x * block.y * block.z;
+        Impl::configure_shmem_preference<
+            DriverType,
+            Kokkos::LaunchBounds<MaxThreadsPerBlock, MinBlocksPerSM>>(
+            base_t::get_kernel_func(), cuda_instance->m_deviceProp, block_size,
+            shmem, desired_occupancy);
+      }
 
-      Impl::configure_shmem_preference<
-          DriverType, Kokkos::LaunchBounds<MaxThreadsPerBlock, MinBlocksPerSM>>(
-          base_t::get_kernel_func(), prefer_shmem);
-
-      KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE();
+      ensure_cuda_lock_arrays_on_device();
 
       // Invoke the driver function on the device
       base_t::invoke_kernel(driver, grid, block, shmem, cuda_instance);
@@ -650,18 +678,9 @@ struct CudaParallelLaunchImpl<
   }
 
   static cudaFuncAttributes get_cuda_func_attributes() {
-    // Race condition inside of cudaFuncGetAttributes if the same address is
-    // given requires using a local variable as input instead of a static Rely
-    // on static variable initialization to make sure only one thread executes
-    // the code and the result is visible.
-    auto wrap_get_attributes = []() -> cudaFuncAttributes {
-      cudaFuncAttributes attr_tmp;
-      KOKKOS_IMPL_CUDA_SAFE_CALL(
-          cudaFuncGetAttributes(&attr_tmp, base_t::get_kernel_func()));
-      return attr_tmp;
-    };
-    static cudaFuncAttributes attr = wrap_get_attributes();
-    return attr;
+    return get_cuda_kernel_func_attributes<
+        DriverType, Kokkos::LaunchBounds<MaxThreadsPerBlock, MinBlocksPerSM>>(
+        base_t::get_kernel_func());
   }
 };
 
@@ -674,11 +693,7 @@ struct CudaParallelLaunchImpl<
 template <class DriverType, class LaunchBounds = Kokkos::LaunchBounds<>,
           Experimental::CudaLaunchMechanism LaunchMechanism =
               DeduceCudaLaunchMechanism<DriverType>::launch_mechanism,
-          bool DoGraph = DriverType::Policy::is_graph_kernel::value
-#ifndef KOKKOS_CUDA_ENABLE_GRAPHS
-                         && false
-#endif
-          >
+          bool DoGraph = DriverType::Policy::is_graph_kernel::value>
 struct CudaParallelLaunch;
 
 // General launch mechanism
@@ -695,7 +710,6 @@ struct CudaParallelLaunch<DriverType, LaunchBounds, LaunchMechanism,
   }
 };
 
-#ifdef KOKKOS_CUDA_ENABLE_GRAPHS
 // Launch mechanism for creating graph nodes
 template <class DriverType, class LaunchBounds,
           Experimental::CudaLaunchMechanism LaunchMechanism>
@@ -709,7 +723,6 @@ struct CudaParallelLaunch<DriverType, LaunchBounds, LaunchMechanism,
     base_t::create_parallel_launch_graph_node((Args &&) args...);
   }
 };
-#endif
 
 // </editor-fold> end CudaParallelLaunch }}}1
 //==============================================================================
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp
index 84d4307cfd549f9567cb2bc5982a882543e19168..b18fda80f06193152b23004468b00a3b806acecb 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -79,8 +51,7 @@ CudaLockArrays g_host_cuda_lock_arrays = {nullptr, 0};
 void initialize_host_cuda_lock_arrays() {
 #ifdef KOKKOS_ENABLE_IMPL_DESUL_ATOMICS
   desul::Impl::init_lock_arrays();
-
-  DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE();
+  desul::ensure_cuda_lock_arrays_on_device();
 #endif
   if (g_host_cuda_lock_arrays.atomic != nullptr) return;
   KOKKOS_IMPL_CUDA_SAFE_CALL(
@@ -88,8 +59,8 @@ void initialize_host_cuda_lock_arrays() {
                  sizeof(int) * (CUDA_SPACE_ATOMIC_MASK + 1)));
   Impl::cuda_device_synchronize(
       "Kokkos::Impl::initialize_host_cuda_lock_arrays: Pre Init Lock Arrays");
-  g_host_cuda_lock_arrays.n = Cuda::concurrency();
-  KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE();
+  g_host_cuda_lock_arrays.n = CudaInternal::concurrency();
+  copy_cuda_lock_arrays_to_device();
   init_lock_array_kernel_atomic<<<(CUDA_SPACE_ATOMIC_MASK + 1 + 255) / 256,
                                   256>>>();
   Impl::cuda_device_synchronize(
@@ -106,7 +77,7 @@ void finalize_host_cuda_lock_arrays() {
   g_host_cuda_lock_arrays.atomic = nullptr;
   g_host_cuda_lock_arrays.n      = 0;
 #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE
-  KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE();
+  copy_cuda_lock_arrays_to_device();
 #endif
 }
 
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp
index bdb7723985e5a3c6c0451ada3d0b6b7303204089..3916ae2c539008bcadb5a3ffacdb16043a89b4e3 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CUDA_LOCKS_HPP
 #define KOKKOS_CUDA_LOCKS_HPP
@@ -54,7 +26,7 @@
 #include <Cuda/Kokkos_Cuda_Error.hpp>
 
 #ifdef KOKKOS_ENABLE_IMPL_DESUL_ATOMICS
-#include <desul/atomics/Lock_Array_Cuda.hpp>
+#include <desul/atomics/Lock_Array_CUDA.hpp>
 #endif
 
 namespace Kokkos {
@@ -67,7 +39,7 @@ struct CudaLockArrays {
 
 /// \brief This global variable in Host space is the central definition
 ///        of these arrays.
-extern Kokkos::Impl::CudaLockArrays g_host_cuda_lock_arrays;
+extern CudaLockArrays g_host_cuda_lock_arrays;
 
 /// \brief After this call, the g_host_cuda_lock_arrays variable has
 ///        valid, initialized arrays.
@@ -105,12 +77,12 @@ namespace Impl {
 /// instances in other translation units, we must update this CUDA global
 /// variable based on the Host global variable prior to running any kernels
 /// that will use it.
-/// That is the purpose of the KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE macro.
+/// That is the purpose of the ensure_cuda_lock_arrays_on_device function.
 __device__
 #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE
     __constant__ extern
 #endif
-    Kokkos::Impl::CudaLockArrays g_device_cuda_lock_arrays;
+    CudaLockArrays g_device_cuda_lock_arrays;
 
 #define CUDA_SPACE_ATOMIC_MASK 0x1FFFF
 
@@ -123,9 +95,7 @@ __device__ inline bool lock_address_cuda_space(void* ptr) {
   size_t offset = size_t(ptr);
   offset        = offset >> 2;
   offset        = offset & CUDA_SPACE_ATOMIC_MASK;
-  return (
-      0 ==
-      atomicCAS(&Kokkos::Impl::g_device_cuda_lock_arrays.atomic[offset], 0, 1));
+  return (0 == atomicCAS(&g_device_cuda_lock_arrays.atomic[offset], 0, 1));
 }
 
 /// \brief Release lock for the address
@@ -138,7 +108,7 @@ __device__ inline void unlock_address_cuda_space(void* ptr) {
   size_t offset = size_t(ptr);
   offset        = offset >> 2;
   offset        = offset & CUDA_SPACE_ATOMIC_MASK;
-  atomicExch(&Kokkos::Impl::g_device_cuda_lock_arrays.atomic[offset], 0);
+  atomicExch(&g_device_cuda_lock_arrays.atomic[offset], 0);
 }
 
 }  // namespace Impl
@@ -151,45 +121,49 @@ namespace {
 static int lock_array_copied = 0;
 inline int eliminate_warning_for_lock_array() { return lock_array_copied; }
 }  // namespace
-}  // namespace Impl
-}  // namespace Kokkos
 
-/* Dan Ibanez: it is critical that this code be a macro, so that it will
-   capture the right address for Kokkos::Impl::g_device_cuda_lock_arrays!
-   putting this in an inline function will NOT do the right thing! */
-#define KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE()                      \
-  {                                                                   \
-    if (::Kokkos::Impl::lock_array_copied == 0) {                     \
-      KOKKOS_IMPL_CUDA_SAFE_CALL(                                     \
-          cudaMemcpyToSymbol(Kokkos::Impl::g_device_cuda_lock_arrays, \
-                             &Kokkos::Impl::g_host_cuda_lock_arrays,  \
-                             sizeof(Kokkos::Impl::CudaLockArrays)));  \
-    }                                                                 \
-    lock_array_copied = 1;                                            \
+#ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE
+inline
+#else
+inline static
+#endif
+    void
+    copy_cuda_lock_arrays_to_device() {
+  if (lock_array_copied == 0) {
+    KOKKOS_IMPL_CUDA_SAFE_CALL(cudaMemcpyToSymbol(g_device_cuda_lock_arrays,
+                                                  &g_host_cuda_lock_arrays,
+                                                  sizeof(CudaLockArrays)));
   }
+  lock_array_copied = 1;
+}
 
 #ifndef KOKKOS_ENABLE_IMPL_DESUL_ATOMICS
 
 #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE
-#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE()
+inline void ensure_cuda_lock_arrays_on_device() {}
 #else
-#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() \
-  KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE()
+inline static void ensure_cuda_lock_arrays_on_device() {
+  copy_cuda_lock_arrays_to_device();
+}
 #endif
 
 #else
 
 #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE
-#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE()
+inline void ensure_cuda_lock_arrays_on_device() {}
 #else
 // Still Need COPY_CUDA_LOCK_ARRAYS for team scratch etc.
-#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() \
-  KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE()         \
-  DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE()
+inline static void ensure_cuda_lock_arrays_on_device() {
+  copy_cuda_lock_arrays_to_device();
+  desul::ensure_cuda_lock_arrays_on_device();
+}
 #endif
 
 #endif /* defined( KOKKOS_ENABLE_IMPL_DESUL_ATOMICS ) */
 
+}  // namespace Impl
+}  // namespace Kokkos
+
 #endif /* defined( KOKKOS_ENABLE_CUDA ) */
 
 #endif /* #ifndef KOKKOS_CUDA_LOCKS_HPP */
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_MDRangePolicy.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_MDRangePolicy.hpp
index 12b7f70a97495fca628580dda12b115cb5c25a12..7492ab49e56b903f5b326c8672c546a5877cdc85 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_MDRangePolicy.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_MDRangePolicy.hpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #ifndef KOKKOS_CUDA_MDRANGEPOLICY_HPP_
 #define KOKKOS_CUDA_MDRANGEPOLICY_HPP_
 
@@ -32,6 +48,11 @@ inline TileSizeProperties get_tile_size_properties<Kokkos::Cuda>(
   return properties;
 }
 
+// Settings for TeamMDRangePolicy
+template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector>
+struct ThreadAndVectorNestLevel<Rank, Cuda, ThreadAndVector>
+    : AcceleratorBasedNestLevel<Rank, ThreadAndVector> {};
+
 }  // Namespace Impl
 }  // Namespace Kokkos
 #endif
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_MDRange.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_MDRange.hpp
index e586bb4cc6c58e41ad3eff95ddf05f6e0a5cb8cf..0015d1ea14d7755cef5f7a93c3c762cfd1f50d90 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_MDRange.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_MDRange.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CUDA_PARALLEL_MD_RANGE_HPP
 #define KOKKOS_CUDA_PARALLEL_MD_RANGE_HPP
@@ -67,6 +39,34 @@
 namespace Kokkos {
 namespace Impl {
 
+template <typename ParallelType, typename Policy, typename LaunchBounds>
+int max_tile_size_product_helper(const Policy& pol, const LaunchBounds&) {
+  cudaFuncAttributes attr =
+      CudaParallelLaunch<ParallelType,
+                         LaunchBounds>::get_cuda_func_attributes();
+  auto const& prop = pol.space().cuda_device_prop();
+
+  // Limits due to registers/SM, MDRange doesn't have
+  // shared memory constraints
+  int const optimal_block_size =
+      cuda_get_opt_block_size_no_shmem(prop, attr, LaunchBounds{});
+
+  // Compute how many blocks of this size we can launch, based on warp
+  // constraints
+  int const max_warps_per_sm_registers =
+      Kokkos::Impl::cuda_max_warps_per_sm_registers(prop, attr);
+  int const max_num_threads_from_warps =
+      max_warps_per_sm_registers * prop.warpSize;
+  int const max_num_blocks = max_num_threads_from_warps / optimal_block_size;
+
+  // Compute the total number of threads
+  int const max_threads_per_sm = optimal_block_size * max_num_blocks;
+
+  return std::min(
+      max_threads_per_sm,
+      static_cast<int>(Kokkos::Impl::CudaTraits::MaxHierarchicalParallelism));
+}
+
 template <class FunctorType, class... Traits>
 class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, Kokkos::Cuda> {
  public:
@@ -85,18 +85,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, Kokkos::Cuda> {
  public:
   template <typename Policy, typename Functor>
   static int max_tile_size_product(const Policy& pol, const Functor&) {
-    cudaFuncAttributes attr =
-        CudaParallelLaunch<ParallelFor,
-                           LaunchBounds>::get_cuda_func_attributes();
-    auto const& prop = pol.space().cuda_device_prop();
-    // Limits due to registers/SM, MDRange doesn't have
-    // shared memory constraints
-    int const regs_per_sm        = prop.regsPerMultiprocessor;
-    int const regs_per_thread    = attr.numRegs;
-    int const max_threads_per_sm = regs_per_sm / regs_per_thread;
-    return std::min(
-        max_threads_per_sm,
-        static_cast<int>(Kokkos::Impl::CudaTraits::MaxHierarchicalParallelism));
+    return max_tile_size_product_helper<ParallelFor>(pol, LaunchBounds{});
   }
   Policy const& get_policy() const { return m_rp; }
   inline __device__ void operator()() const {
@@ -121,8 +110,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, Kokkos::Cuda> {
               maxblocks[1]),
           1);
       CudaParallelLaunch<ParallelFor, LaunchBounds>(
-          *this, grid, block, 0, m_rp.space().impl_internal_space_instance(),
-          false);
+          *this, grid, block, 0, m_rp.space().impl_internal_space_instance());
     } else if (RP::rank == 3) {
       const dim3 block(m_rp.m_tile[0], m_rp.m_tile[1], m_rp.m_tile[2]);
       KOKKOS_ASSERT(block.x > 0);
@@ -139,8 +127,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, Kokkos::Cuda> {
               (m_rp.m_upper[2] - m_rp.m_lower[2] + block.z - 1) / block.z,
               maxblocks[2]));
       CudaParallelLaunch<ParallelFor, LaunchBounds>(
-          *this, grid, block, 0, m_rp.space().impl_internal_space_instance(),
-          false);
+          *this, grid, block, 0, m_rp.space().impl_internal_space_instance());
     } else if (RP::rank == 4) {
       // id0,id1 encoded within threadIdx.x; id2 to threadIdx.y; id3 to
       // threadIdx.z
@@ -158,8 +145,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, Kokkos::Cuda> {
               (m_rp.m_upper[3] - m_rp.m_lower[3] + block.z - 1) / block.z,
               maxblocks[2]));
       CudaParallelLaunch<ParallelFor, LaunchBounds>(
-          *this, grid, block, 0, m_rp.space().impl_internal_space_instance(),
-          false);
+          *this, grid, block, 0, m_rp.space().impl_internal_space_instance());
     } else if (RP::rank == 5) {
       // id0,id1 encoded within threadIdx.x; id2,id3 to threadIdx.y; id4 to
       // threadIdx.z
@@ -175,8 +161,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, Kokkos::Cuda> {
               (m_rp.m_upper[4] - m_rp.m_lower[4] + block.z - 1) / block.z,
               maxblocks[2]));
       CudaParallelLaunch<ParallelFor, LaunchBounds>(
-          *this, grid, block, 0, m_rp.space().impl_internal_space_instance(),
-          false);
+          *this, grid, block, 0, m_rp.space().impl_internal_space_instance());
     } else if (RP::rank == 6) {
       // id0,id1 encoded within threadIdx.x; id2,id3 to threadIdx.y; id4,id5 to
       // threadIdx.z
@@ -191,8 +176,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, Kokkos::Cuda> {
           std::min<array_index_type>(m_rp.m_tile_end[4] * m_rp.m_tile_end[5],
                                      maxblocks[2]));
       CudaParallelLaunch<ParallelFor, LaunchBounds>(
-          *this, grid, block, 0, m_rp.space().impl_internal_space_instance(),
-          false);
+          *this, grid, block, 0, m_rp.space().impl_internal_space_instance());
     } else {
       Kokkos::abort("Kokkos::MDRange Error: Exceeded rank bounds with Cuda\n");
     }
@@ -263,17 +247,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
  public:
   template <typename Policy, typename Functor>
   static int max_tile_size_product(const Policy& pol, const Functor&) {
-    cudaFuncAttributes attr =
-        CudaParallelLaunch<ParallelReduce,
-                           LaunchBounds>::get_cuda_func_attributes();
-    auto const& prop = pol.space().cuda_device_prop();
-    // Limits due do registers/SM
-    int const regs_per_sm        = prop.regsPerMultiprocessor;
-    int const regs_per_thread    = attr.numRegs;
-    int const max_threads_per_sm = regs_per_sm / regs_per_thread;
-    return std::min(
-        max_threads_per_sm,
-        static_cast<int>(Kokkos::Impl::CudaTraits::MaxHierarchicalParallelism));
+    return max_tile_size_product_helper<ParallelReduce>(pol, LaunchBounds{});
   }
   Policy const& get_policy() const { return m_policy; }
   inline __device__ void exec_range(reference_type update) const {
@@ -405,8 +379,8 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
 
       CudaParallelLaunch<ParallelReduce, LaunchBounds>(
           *this, grid, block, shmem,
-          m_policy.space().impl_internal_space_instance(),
-          false);  // copy to device and execute
+          m_policy.space()
+              .impl_internal_space_instance());  // copy to device and execute
 
       if (!m_result_ptr_device_accessible) {
         if (m_result_ptr) {
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Range.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Range.hpp
index ac160f8fe268a42e04eebcee2639160e7edbd512..c5e89fc3da1df33cdd001db579d5eb1d3f4bedfd 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Range.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Range.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CUDA_PARALLEL_RANGE_HPP
 #define KOKKOS_CUDA_PARALLEL_RANGE_HPP
@@ -135,8 +107,7 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::Cuda> {
 #endif
 
     CudaParallelLaunch<ParallelFor, LaunchBounds>(
-        *this, grid, block, 0, m_policy.space().impl_internal_space_instance(),
-        false);
+        *this, grid, block, 0, m_policy.space().impl_internal_space_instance());
   }
 
   ParallelFor(const FunctorType& arg_functor, const Policy& arg_policy)
@@ -326,9 +297,7 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
     const bool need_device_set = Analysis::has_init_member_function ||
                                  Analysis::has_final_member_function ||
                                  !m_result_ptr_host_accessible ||
-#ifdef KOKKOS_CUDA_ENABLE_GRAPHS
                                  Policy::is_graph_kernel::value ||
-#endif
                                  !std::is_same<ReducerType, InvalidType>::value;
     if ((nwork > 0) || need_device_set) {
       const int block_size = local_block_size(m_functor);
@@ -375,8 +344,8 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
 
       CudaParallelLaunch<ParallelReduce, LaunchBounds>(
           *this, grid, block, shmem,
-          m_policy.space().impl_internal_space_instance(),
-          false);  // copy to device and execute
+          m_policy.space()
+              .impl_internal_space_instance());  // copy to device and execute
 
       if (!m_result_ptr_device_accessible) {
         if (m_result_ptr) {
@@ -726,16 +695,16 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::Cuda> {
         m_final = false;
         CudaParallelLaunch<ParallelScan, LaunchBounds>(
             *this, grid, block, shmem,
-            m_policy.space().impl_internal_space_instance(),
-            false);  // copy to device and execute
+            m_policy.space()
+                .impl_internal_space_instance());  // copy to device and execute
 #ifdef KOKKOS_IMPL_DEBUG_CUDA_SERIAL_EXECUTION
       }
 #endif
       m_final = true;
       CudaParallelLaunch<ParallelScan, LaunchBounds>(
           *this, grid, block, shmem,
-          m_policy.space().impl_internal_space_instance(),
-          false);  // copy to device and execute
+          m_policy.space()
+              .impl_internal_space_instance());  // copy to device and execute
     }
   }
 
@@ -803,7 +772,9 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
   word_size_type* m_scratch_space;
   size_type* m_scratch_flags;
   size_type m_final;
-  ReturnType& m_returnvalue;
+  const pointer_type m_result_ptr;
+  const bool m_result_ptr_device_accessible;
+
 #ifdef KOKKOS_IMPL_DEBUG_CUDA_SERIAL_EXECUTION
   bool m_run_serial;
 #endif
@@ -944,6 +915,9 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
                 reinterpret_cast<pointer_type>(shared_prefix)),
             true);
       }
+      if (iwork + 1 == m_policy.end() && m_policy.end() == range.end() &&
+          m_result_ptr_device_accessible)
+        *m_result_ptr = *reinterpret_cast<pointer_type>(shared_prefix);
     }
   }
 
@@ -1032,22 +1006,20 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
       if (m_run_serial) {
         block = dim3(1, 1, 1);
         grid  = dim3(1, 1, 1);
-      } else {
+      } else
 #endif
-
+      {
         m_final = false;
         CudaParallelLaunch<ParallelScanWithTotal, LaunchBounds>(
             *this, grid, block, shmem,
-            m_policy.space().impl_internal_space_instance(),
-            false);  // copy to device and execute
-#ifdef KOKKOS_IMPL_DEBUG_CUDA_SERIAL_EXECUTION
+            m_policy.space()
+                .impl_internal_space_instance());  // copy to device and execute
       }
-#endif
       m_final = true;
       CudaParallelLaunch<ParallelScanWithTotal, LaunchBounds>(
           *this, grid, block, shmem,
-          m_policy.space().impl_internal_space_instance(),
-          false);  // copy to device and execute
+          m_policy.space()
+              .impl_internal_space_instance());  // copy to device and execute
 
       const int size = Analysis::value_size(m_functor);
 #ifdef KOKKOS_IMPL_DEBUG_CUDA_SERIAL_EXECUTION
@@ -1056,21 +1028,29 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
                                              m_scratch_space, size);
       else
 #endif
-        DeepCopy<HostSpace, CudaSpace, Cuda>(
-            m_policy.space(), &m_returnvalue,
-            m_scratch_space + (grid_x - 1) * size / sizeof(word_size_type),
-            size);
+      {
+        if (!m_result_ptr_device_accessible)
+          DeepCopy<HostSpace, CudaSpace, Cuda>(
+              m_policy.space(), m_result_ptr,
+              m_scratch_space + (grid_x - 1) * size / sizeof(word_size_type),
+              size);
+      }
     }
   }
 
+  template <class ViewType>
   ParallelScanWithTotal(const FunctorType& arg_functor,
-                        const Policy& arg_policy, ReturnType& arg_returnvalue)
+                        const Policy& arg_policy,
+                        const ViewType& arg_result_view)
       : m_functor(arg_functor),
         m_policy(arg_policy),
         m_scratch_space(nullptr),
         m_scratch_flags(nullptr),
         m_final(false),
-        m_returnvalue(arg_returnvalue)
+        m_result_ptr(arg_result_view.data()),
+        m_result_ptr_device_accessible(
+            MemorySpaceAccess<Kokkos::CudaSpace,
+                              typename ViewType::memory_space>::accessible)
 #ifdef KOKKOS_IMPL_DEBUG_CUDA_SERIAL_EXECUTION
         ,
         m_run_serial(Kokkos::Impl::CudaInternal::cuda_use_serial_execution())
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Team.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Team.hpp
index cdd16085b352fbbe8177e0d249d85007e58ca945..cdff86ccfc48d54dfc6a8c8c35256787959fed64 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Team.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Team.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CUDA_PARALLEL_TEAM_HPP
 #define KOKKOS_CUDA_PARALLEL_TEAM_HPP
@@ -226,21 +198,25 @@ class TeamPolicyInternal<Kokkos::Cuda, Properties...>
   }
 
   inline static int scratch_size_max(int level) {
-    return (
-        level == 0 ? 1024 * 40 :  // 48kB is the max for CUDA, but we need some
-                                  // for team_member.reduce etc.
-            20 * 1024 *
-                1024);  // arbitrarily setting this to 20MB, for a Volta V100
-                        // that would give us about 3.2GB for 2 teams per SM
+    // Cuda Teams use (team_size + 2)*sizeof(double) shared memory for team
+    // reductions. They also use one int64_t in static shared memory for a
+    // shared ID. Furthermore, they use additional scratch memory in some
+    // reduction scenarios, which depend on the size of the value_type and is
+    // NOT captured here.
+    constexpr size_t max_possible_team_size = 1024;
+    constexpr size_t max_reserved_shared_mem_per_team =
+        (max_possible_team_size + 2) * sizeof(double) + sizeof(int64_t);
+    // arbitrarily setting level 1 scratch limit to 20MB, for a
+    // Volta V100 that would give us about 3.2GB for 2 teams per SM
+    constexpr size_t max_l1_scratch_size = 20 * 1024 * 1024;
+
+    size_t max_shmem = Cuda().cuda_device_prop().sharedMemPerBlock;
+    return (level == 0 ? max_shmem - max_reserved_shared_mem_per_team
+                       : max_l1_scratch_size);
   }
 
   //----------------------------------------
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  KOKKOS_DEPRECATED inline int vector_length() const {
-    return impl_vector_length();
-  }
-#endif
   inline int impl_vector_length() const { return m_vector_length; }
   inline int team_size() const { return m_team_size; }
   inline int league_size() const { return m_league_size; }
@@ -552,8 +528,8 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
 
     CudaParallelLaunch<ParallelFor, LaunchBounds>(
         *this, grid, block, shmem_size_total,
-        m_policy.space().impl_internal_space_instance(),
-        true);  // copy to device and execute
+        m_policy.space()
+            .impl_internal_space_instance());  // copy to device and execute
   }
 
   ParallelFor(const FunctorType& arg_functor, const Policy& arg_policy)
@@ -562,6 +538,8 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
         m_league_size(arg_policy.league_size()),
         m_team_size(arg_policy.team_size()),
         m_vector_size(arg_policy.impl_vector_length()) {
+    auto internal_space_instance =
+        m_policy.space().impl_internal_space_instance();
     cudaFuncAttributes attr =
         CudaParallelLaunch<ParallelFor,
                            LaunchBounds>::get_cuda_func_attributes();
@@ -569,8 +547,8 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
         m_team_size >= 0
             ? m_team_size
             : Kokkos::Impl::cuda_get_opt_block_size<FunctorType, LaunchBounds>(
-                  m_policy.space().impl_internal_space_instance(), attr,
-                  m_functor, m_vector_size, m_policy.team_scratch_size(0),
+                  internal_space_instance, attr, m_functor, m_vector_size,
+                  m_policy.team_scratch_size(0),
                   m_policy.thread_scratch_size(0)) /
                   m_vector_size;
 
@@ -580,8 +558,7 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
          FunctorTeamShmemSize<FunctorType>::value(m_functor, m_team_size));
     m_scratch_size[0] = m_policy.scratch_size(0, m_team_size);
     m_scratch_size[1] = m_policy.scratch_size(1, m_team_size);
-    m_scratch_locks =
-        m_policy.space().impl_internal_space_instance()->m_scratch_locks;
+    m_scratch_locks   = internal_space_instance->m_scratch_locks;
 
     // Functor's reduce memory, team scan memory, and team shared memory depend
     // upon team size.
@@ -589,34 +566,28 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
     if (m_team_size <= 0) {
       m_scratch_ptr[1] = nullptr;
     } else {
-      auto scratch_ptr_id =
-          m_policy.space()
-              .impl_internal_space_instance()
-              ->resize_team_scratch_space(
-                  static_cast<std::int64_t>(m_scratch_size[1]) *
-                  (std::min(
-                      static_cast<std::int64_t>(Cuda::concurrency() /
-                                                (m_team_size * m_vector_size)),
-                      static_cast<std::int64_t>(m_league_size))));
-      m_scratch_ptr[1]  = scratch_ptr_id.first;
-      m_scratch_pool_id = scratch_ptr_id.second;
+      m_scratch_pool_id = internal_space_instance->acquire_team_scratch_space();
+      m_scratch_ptr[1]  = internal_space_instance->resize_team_scratch_space(
+          m_scratch_pool_id,
+          static_cast<std::int64_t>(m_scratch_size[1]) *
+              (std::min(
+                  static_cast<std::int64_t>(Cuda().concurrency() /
+                                            (m_team_size * m_vector_size)),
+                  static_cast<std::int64_t>(m_league_size))));
     }
 
     const int shmem_size_total = m_shmem_begin + m_shmem_size;
-    if (m_policy.space().impl_internal_space_instance()->m_maxShmemPerBlock <
-        shmem_size_total) {
-      printf(
-          "%i %i\n",
-          m_policy.space().impl_internal_space_instance()->m_maxShmemPerBlock,
-          shmem_size_total);
+    if (internal_space_instance->m_maxShmemPerBlock < shmem_size_total) {
+      printf("%i %i\n", internal_space_instance->m_maxShmemPerBlock,
+             shmem_size_total);
       Kokkos::Impl::throw_runtime_exception(std::string(
           "Kokkos::Impl::ParallelFor< Cuda > insufficient shared memory"));
     }
 
     if (int(m_team_size) >
         int(Kokkos::Impl::cuda_get_max_block_size<FunctorType, LaunchBounds>(
-                m_policy.space().impl_internal_space_instance(), attr,
-                arg_functor, arg_policy.impl_vector_length(),
+                internal_space_instance, attr, arg_functor,
+                arg_policy.impl_vector_length(),
                 arg_policy.team_scratch_size(0),
                 arg_policy.thread_scratch_size(0)) /
             arg_policy.impl_vector_length())) {
@@ -629,7 +600,7 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
     if (m_scratch_pool_id >= 0) {
       m_policy.space()
           .impl_internal_space_instance()
-          ->m_team_scratch_pool[m_scratch_pool_id] = 0;
+          ->release_team_scratch_space(m_scratch_pool_id);
     }
   }
 };
@@ -844,9 +815,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
     const bool need_device_set = Analysis::has_init_member_function ||
                                  Analysis::has_final_member_function ||
                                  !m_result_ptr_host_accessible ||
-#ifdef KOKKOS_CUDA_ENABLE_GRAPHS
                                  Policy::is_graph_kernel::value ||
-#endif
                                  !std::is_same<ReducerType, InvalidType>::value;
     if (!is_empty_range || need_device_set) {
       const int block_count = std::max(
@@ -878,8 +847,8 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
 
       CudaParallelLaunch<ParallelReduce, LaunchBounds>(
           *this, grid, block, shmem_size_total,
-          m_policy.space().impl_internal_space_instance(),
-          true);  // copy to device and execute
+          m_policy.space()
+              .impl_internal_space_instance());  // copy to device and execute
 
       if (!m_result_ptr_device_accessible) {
         m_policy.space().fence(
@@ -933,6 +902,8 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
         m_league_size(arg_policy.league_size()),
         m_team_size(arg_policy.team_size()),
         m_vector_size(arg_policy.impl_vector_length()) {
+    auto internal_space_instance =
+        m_policy.space().impl_internal_space_instance();
     cudaFuncAttributes attr =
         CudaParallelLaunch<ParallelReduce,
                            LaunchBounds>::get_cuda_func_attributes();
@@ -940,8 +911,8 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
         m_team_size >= 0
             ? m_team_size
             : Kokkos::Impl::cuda_get_opt_block_size<FunctorType, LaunchBounds>(
-                  m_policy.space().impl_internal_space_instance(), attr,
-                  m_functor, m_vector_size, m_policy.team_scratch_size(0),
+                  internal_space_instance, attr, m_functor, m_vector_size,
+                  m_policy.team_scratch_size(0),
                   m_policy.thread_scratch_size(0)) /
                   m_vector_size;
 
@@ -957,22 +928,18 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
         FunctorTeamShmemSize<FunctorType>::value(arg_functor, m_team_size);
     m_scratch_size[0] = m_shmem_size;
     m_scratch_size[1] = m_policy.scratch_size(1, m_team_size);
-    m_scratch_locks =
-        m_policy.space().impl_internal_space_instance()->m_scratch_locks;
+    m_scratch_locks   = internal_space_instance->m_scratch_locks;
     if (m_team_size <= 0) {
       m_scratch_ptr[1] = nullptr;
     } else {
-      auto scratch_ptr_id =
-          m_policy.space()
-              .impl_internal_space_instance()
-              ->resize_team_scratch_space(
-                  static_cast<std::int64_t>(m_scratch_size[1]) *
-                  (std::min(
-                      static_cast<std::int64_t>(Cuda::concurrency() /
-                                                (m_team_size * m_vector_size)),
-                      static_cast<std::int64_t>(m_league_size))));
-      m_scratch_ptr[1]  = scratch_ptr_id.first;
-      m_scratch_pool_id = scratch_ptr_id.second;
+      m_scratch_pool_id = internal_space_instance->acquire_team_scratch_space();
+      m_scratch_ptr[1]  = internal_space_instance->resize_team_scratch_space(
+          m_scratch_pool_id,
+          static_cast<std::int64_t>(m_scratch_size[1]) *
+              (std::min(
+                  static_cast<std::int64_t>(Cuda().concurrency() /
+                                            (m_team_size * m_vector_size)),
+                  static_cast<std::int64_t>(m_league_size))));
     }
 
     // The global parallel_reduce does not support vector_length other than 1 at
@@ -1000,8 +967,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
           std::string("Kokkos::Impl::ParallelReduce< Cuda > bad team size"));
     }
 
-    if (m_policy.space().impl_internal_space_instance()->m_maxShmemPerBlock <
-        shmem_size_total) {
+    if (internal_space_instance->m_maxShmemPerBlock < shmem_size_total) {
       Kokkos::Impl::throw_runtime_exception(
           std::string("Kokkos::Impl::ParallelReduce< Cuda > requested too much "
                       "L0 scratch memory"));
@@ -1039,6 +1005,8 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
         m_league_size(arg_policy.league_size()),
         m_team_size(arg_policy.team_size()),
         m_vector_size(arg_policy.impl_vector_length()) {
+    auto internal_space_instance =
+        m_policy.space().impl_internal_space_instance();
     cudaFuncAttributes attr =
         CudaParallelLaunch<ParallelReduce,
                            LaunchBounds>::get_cuda_func_attributes();
@@ -1048,8 +1016,8 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
         m_team_size >= 0
             ? m_team_size
             : Kokkos::Impl::cuda_get_opt_block_size<FunctorType, LaunchBounds>(
-                  m_policy.space().impl_internal_space_instance(), attr,
-                  m_functor, m_vector_size, m_policy.team_scratch_size(0),
+                  internal_space_instance, attr, m_functor, m_vector_size,
+                  m_policy.team_scratch_size(0),
                   m_policy.thread_scratch_size(0)) /
                   m_vector_size;
 
@@ -1065,22 +1033,18 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
         FunctorTeamShmemSize<FunctorType>::value(arg_functor, m_team_size);
     m_scratch_size[0] = m_shmem_size;
     m_scratch_size[1] = m_policy.scratch_size(1, m_team_size);
-    m_scratch_locks =
-        m_policy.space().impl_internal_space_instance()->m_scratch_locks;
+    m_scratch_locks   = internal_space_instance->m_scratch_locks;
     if (m_team_size <= 0) {
       m_scratch_ptr[1] = nullptr;
     } else {
-      auto scratch_ptr_id =
-          m_policy.space()
-              .impl_internal_space_instance()
-              ->resize_team_scratch_space(
-                  static_cast<std::int64_t>(m_scratch_size[1]) *
-                  (std::min(
-                      static_cast<std::int64_t>(Cuda::concurrency() /
-                                                (m_team_size * m_vector_size)),
-                      static_cast<std::int64_t>(m_league_size))));
-      m_scratch_ptr[1]  = scratch_ptr_id.first;
-      m_scratch_pool_id = scratch_ptr_id.second;
+      m_scratch_pool_id = internal_space_instance->acquire_team_scratch_space();
+      m_scratch_ptr[1]  = internal_space_instance->resize_team_scratch_space(
+          m_scratch_pool_id,
+          static_cast<std::int64_t>(m_scratch_size[1]) *
+              (std::min(
+                  static_cast<std::int64_t>(Cuda().concurrency() /
+                                            (m_team_size * m_vector_size)),
+                  static_cast<std::int64_t>(m_league_size))));
     }
 
     // The global parallel_reduce does not support vector_length other than 1 at
@@ -1104,17 +1068,15 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
 
     if ((!Kokkos::Impl::is_integral_power_of_two(m_team_size) &&
          !UseShflReduction) ||
-        m_policy.space().impl_internal_space_instance()->m_maxShmemPerBlock <
-            shmem_size_total) {
+        internal_space_instance->m_maxShmemPerBlock < shmem_size_total) {
       Kokkos::Impl::throw_runtime_exception(
           std::string("Kokkos::Impl::ParallelReduce< Cuda > bad team size"));
     }
 
     size_type team_size_max =
         Kokkos::Impl::cuda_get_max_block_size<FunctorType, LaunchBounds>(
-            m_policy.space().impl_internal_space_instance(), attr, m_functor,
-            m_vector_size, m_policy.team_scratch_size(0),
-            m_policy.thread_scratch_size(0)) /
+            internal_space_instance, attr, m_functor, m_vector_size,
+            m_policy.team_scratch_size(0), m_policy.thread_scratch_size(0)) /
         m_vector_size;
 
     if ((int)m_team_size > (int)team_size_max) {
@@ -1128,7 +1090,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
     if (m_scratch_pool_id >= 0) {
       m_policy.space()
           .impl_internal_space_instance()
-          ->m_team_scratch_pool[m_scratch_pool_id] = 0;
+          ->release_team_scratch_space(m_scratch_pool_id);
     }
   }
 };
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_ReduceScan.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_ReduceScan.hpp
index 34d4bef9fdaaf038a2fcdab257d043438a348887..59fdd1351386c705861da0030eedd60a3c31fb0c 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_ReduceScan.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_ReduceScan.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CUDA_REDUCESCAN_HPP
 #define KOKKOS_CUDA_REDUCESCAN_HPP
@@ -90,31 +62,31 @@ template <class ValueType, class ReducerType>
 __device__ inline void cuda_inter_warp_reduction(
     ValueType& value, const ReducerType& reducer,
     const int max_active_thread = blockDim.y) {
-#define STEP_WIDTH 4
-  // Depending on the ValueType _shared__ memory must be aligned up to 8byte
-  // boundaries The reason not to use ValueType directly is that for types with
+  constexpr int step_width = 4;
+  // Depending on the ValueType, __shared__ memory must be aligned up to 8byte
+  // boundaries. The reason not to use ValueType directly is that for types with
   // constructors it could lead to race conditions
   alignas(alignof(ValueType) > alignof(double) ? alignof(ValueType)
                                                : alignof(double))
-      __shared__ double sh_result[(sizeof(ValueType) + 7) / 8 * STEP_WIDTH];
+      __shared__ double sh_result[(sizeof(ValueType) + 7) / 8 * step_width];
   ValueType* result = (ValueType*)&sh_result;
   const int step    = 32 / blockDim.x;
-  int shift         = STEP_WIDTH;
+  int shift         = step_width;
   const int id      = threadIdx.y % step == 0 ? threadIdx.y / step : 65000;
-  if (id < STEP_WIDTH) {
+  if (id < step_width) {
     result[id] = value;
   }
   __syncthreads();
   while (shift <= max_active_thread / step) {
-    if (shift <= id && shift + STEP_WIDTH > id && threadIdx.x == 0) {
-      reducer.join(&result[id % STEP_WIDTH], &value);
+    if (shift <= id && shift + step_width > id && threadIdx.x == 0) {
+      reducer.join(&result[id % step_width], &value);
     }
     __syncthreads();
-    shift += STEP_WIDTH;
+    shift += step_width;
   }
 
   value = result[0];
-  for (int i = 1; (i * step < max_active_thread) && i < STEP_WIDTH; i++)
+  for (int i = 1; (i * step < max_active_thread) && i < step_width; i++)
     reducer.join(&value, &result[i]);
   __syncthreads();
 }
@@ -428,11 +400,6 @@ struct CudaReductionsFunctor<FunctorType, false, false> {
 //   __launch_bounds__(maxThreadsPerBlock,minBlocksPerMultiprocessor)
 // function qualifier which could be used to improve performance.
 //----------------------------------------------------------------------------
-// Maximize shared memory and minimize L1 cache:
-//   cudaFuncSetCacheConfig(MyKernel, cudaFuncCachePreferShared );
-// For 2.0 capability: 48 KB shared and 16 KB L1
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
 /*
  *  Algorithmic constraints:
  *   (a) blockDim.y <= 1024
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.cpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.cpp
index 8f05448b17a6e584f16c4efbc8d3faa0debbcb4c..e401c9f74b1f304fec0fdadd1ccf5810511a7adc 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.cpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.hpp
index 1f2e394f1ebff0af1a89ca1650fef1fdea7fe40b..76e4122af2e0636ede640a96e20f01231dd39bad 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_CUDA_TASK_HPP
 #define KOKKOS_IMPL_CUDA_TASK_HPP
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Team.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Team.hpp
index ffafc47f010fdd667b8a9bad3a71ea0467226897..fc3f46bce6a62e32955b662850fc0b96481d93b2 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Team.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Team.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CUDA_TEAM_HPP
 #define KOKKOS_CUDA_TEAM_HPP
@@ -101,6 +73,7 @@ class CudaTeamMember {
  public:
   using execution_space      = Kokkos::Cuda;
   using scratch_memory_space = execution_space::scratch_memory_space;
+  using team_handle          = CudaTeamMember;
 
  private:
   mutable void* m_team_reduce;
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_UniqueToken.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_UniqueToken.hpp
index 6da2cad011bd8681034cfdfc650b74a5c92febdf..1ade4c34b6e1bc11c1d775c299257adb22b315dd 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_UniqueToken.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_UniqueToken.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CUDA_UNIQUE_TOKEN_HPP
 #define KOKKOS_CUDA_UNIQUE_TOKEN_HPP
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Vectorization.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Vectorization.hpp
index d3d881424c1359f77402519196f083eb7a8a75f4..a3f4f2f4cccf5dbdbb1abd951cd4f515394bc3dc 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Vectorization.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Vectorization.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 #ifndef KOKKOS_CUDA_VECTORIZATION_HPP
 #define KOKKOS_CUDA_VECTORIZATION_HPP
 
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_View.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_View.hpp
index a1758208252c9c1e22aa8d1c1f636b5b2e12278c..a18661f2f28fafe46c5c41af83586412c2c71f95 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_View.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_View.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_EXPERIMENTAL_CUDA_VIEW_HPP
 #define KOKKOS_EXPERIMENTAL_CUDA_VIEW_HPP
@@ -54,89 +26,12 @@
 namespace Kokkos {
 namespace Impl {
 
-// Cuda Texture fetches can be performed for 4, 8 and 16 byte objects
-// (int,int2,int4) Via reinterpret_case this can be used to support all scalar
-// types of those sizes. Any other scalar type falls back to either normal reads
-// out of global memory, or using the __ldg intrinsic on Kepler GPUs or newer
-// (Compute Capability >= 3.0)
-
-template <typename ValueType, typename AliasType>
-struct CudaTextureFetch {
-  ::cudaTextureObject_t m_obj;
-  const ValueType* m_ptr;
-  int m_offset;
-
-  // Deference operator pulls through texture object and returns by value
-  template <typename iType>
-  KOKKOS_INLINE_FUNCTION ValueType operator[](const iType& i) const {
-    KOKKOS_IF_ON_DEVICE(
-        (AliasType v = tex1Dfetch<AliasType>(m_obj, i + m_offset);
-         return *(reinterpret_cast<ValueType*>(&v));))
-    KOKKOS_IF_ON_HOST((return m_ptr[i];))
-  }
-
-  // Pointer to referenced memory
-  KOKKOS_INLINE_FUNCTION
-  operator const ValueType*() const { return m_ptr; }
-
-  KOKKOS_INLINE_FUNCTION
-  CudaTextureFetch() : m_obj(), m_ptr(), m_offset() {}
-
-  KOKKOS_DEFAULTED_FUNCTION
-  ~CudaTextureFetch() = default;
-
-  KOKKOS_INLINE_FUNCTION
-  CudaTextureFetch(const CudaTextureFetch& rhs)
-      : m_obj(rhs.m_obj), m_ptr(rhs.m_ptr), m_offset(rhs.m_offset) {}
-
-  KOKKOS_INLINE_FUNCTION
-  CudaTextureFetch(CudaTextureFetch&& rhs)
-      : m_obj(rhs.m_obj), m_ptr(rhs.m_ptr), m_offset(rhs.m_offset) {}
-
-  KOKKOS_INLINE_FUNCTION
-  CudaTextureFetch& operator=(const CudaTextureFetch& rhs) {
-    m_obj    = rhs.m_obj;
-    m_ptr    = rhs.m_ptr;
-    m_offset = rhs.m_offset;
-    return *this;
-  }
-
-  KOKKOS_INLINE_FUNCTION
-  CudaTextureFetch& operator=(CudaTextureFetch&& rhs) {
-    m_obj    = rhs.m_obj;
-    m_ptr    = rhs.m_ptr;
-    m_offset = rhs.m_offset;
-    return *this;
-  }
-
-  // Texture object spans the entire allocation.
-  // This handle may view a subset of the allocation, so an offset is required.
-  template <class CudaMemorySpace>
-  inline explicit CudaTextureFetch(
-      const ValueType* const arg_ptr,
-      Kokkos::Impl::SharedAllocationRecord<CudaMemorySpace, void>* record)
-      : m_obj(record->template attach_texture_object<AliasType>()),
-        m_ptr(arg_ptr),
-        m_offset(record->attach_texture_object_offset(
-            reinterpret_cast<const AliasType*>(arg_ptr))) {}
-
-  // Texture object spans the entire allocation.
-  // This handle may view a subset of the allocation, so an offset is required.
-  KOKKOS_INLINE_FUNCTION
-  CudaTextureFetch(const CudaTextureFetch& rhs, size_t offset)
-      : m_obj(rhs.m_obj),
-        m_ptr(rhs.m_ptr + offset),
-        m_offset(offset + rhs.m_offset) {}
-};
-
-#if defined(KOKKOS_ENABLE_CUDA_LDG_INTRINSIC)
-
 template <typename ValueType, typename AliasType>
 struct CudaLDGFetch {
   const ValueType* m_ptr;
 
   template <typename iType>
-  KOKKOS_INLINE_FUNCTION ValueType operator[](const iType& i) const {
+  KOKKOS_FUNCTION ValueType operator[](const iType& i) const {
 #if defined(KOKKOS_ARCH_KEPLER30) || defined(KOKKOS_ARCH_KEPLER32)
     return m_ptr[i];
 #else
@@ -147,46 +42,20 @@ struct CudaLDGFetch {
 #endif
   }
 
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   operator const ValueType*() const { return m_ptr; }
 
-  KOKKOS_INLINE_FUNCTION
-  CudaLDGFetch() : m_ptr() {}
-
   KOKKOS_DEFAULTED_FUNCTION
-  ~CudaLDGFetch() = default;
-
-  KOKKOS_INLINE_FUNCTION
-  CudaLDGFetch(const CudaLDGFetch& rhs) : m_ptr(rhs.m_ptr) {}
-
-  KOKKOS_INLINE_FUNCTION
-  CudaLDGFetch(CudaLDGFetch&& rhs) : m_ptr(rhs.m_ptr) {}
-
-  KOKKOS_INLINE_FUNCTION
-  CudaLDGFetch& operator=(const CudaLDGFetch& rhs) {
-    m_ptr = rhs.m_ptr;
-    return *this;
-  }
-
-  KOKKOS_INLINE_FUNCTION
-  CudaLDGFetch& operator=(CudaLDGFetch&& rhs) {
-    m_ptr = rhs.m_ptr;
-    return *this;
-  }
+  CudaLDGFetch() = default;
 
-  template <class CudaMemorySpace>
-  inline explicit CudaLDGFetch(
-      const ValueType* const arg_ptr,
-      Kokkos::Impl::SharedAllocationRecord<CudaMemorySpace, void>*)
-      : m_ptr(arg_ptr) {}
+  KOKKOS_FUNCTION
+  explicit CudaLDGFetch(const ValueType* const arg_ptr) : m_ptr(arg_ptr) {}
 
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   CudaLDGFetch(CudaLDGFetch const rhs, size_t offset)
       : m_ptr(rhs.m_ptr + offset) {}
 };
 
-#endif
-
 }  // namespace Impl
 }  // namespace Kokkos
 
@@ -196,7 +65,7 @@ struct CudaLDGFetch {
 namespace Kokkos {
 namespace Impl {
 
-/** \brief  Replace Default ViewDataHandle with Cuda texture fetch
+/** \brief  Replace Default ViewDataHandle with CudaLDGFetch
  * specialization if 'const' value type, CudaSpace and random access.
  */
 template <class Traits>
@@ -228,11 +97,7 @@ class ViewDataHandle<
           (sizeof(value_type) == 8), ::int2,
           std::conditional_t<(sizeof(value_type) == 16), ::int4, void>>>;
 
-#if defined(KOKKOS_ENABLE_CUDA_LDG_INTRINSIC)
   using handle_type = Kokkos::Impl::CudaLDGFetch<value_type, alias_type>;
-#else
-  using handle_type = Kokkos::Impl::CudaTextureFetch<value_type, alias_type>;
-#endif
 
   KOKKOS_INLINE_FUNCTION
   static handle_type const& assign(handle_type const& arg_handle,
@@ -248,48 +113,9 @@ class ViewDataHandle<
 
   KOKKOS_INLINE_FUNCTION
   static handle_type assign(value_type* arg_data_ptr,
-                            track_type const& arg_tracker) {
+                            track_type const& /*arg_tracker*/) {
     if (arg_data_ptr == nullptr) return handle_type();
-
-#if !defined(KOKKOS_ENABLE_CUDA_LDG_INTRINSIC)
-    KOKKOS_IF_ON_HOST((
-        // Assignment of texture = non-texture requires creation of a texture
-        // object which can only occur on the host.  In addition, 'get_record'
-        // is only valid if called in a host execution space
-
-        using memory_space = typename Traits::memory_space;
-        using record =
-            typename Impl::SharedAllocationRecord<memory_space, void>;
-
-        record* const r = arg_tracker.template get_record<memory_space>();
-
-        if (0 == r) {
-          Kokkos::abort(
-              "Cuda const random access View using Cuda texture memory "
-              "requires "
-              "Kokkos to allocate the View's memory");
-        }
-
-        return handle_type(arg_data_ptr, r);))
-#else
-    KOKKOS_IF_ON_HOST((
-        // Assignment of texture = non-texture requires creation of a texture
-        // object which can only occur on the host.  In addition, 'get_record'
-        // is only valid if called in a host execution space
-
-        using memory_space = typename Traits::memory_space;
-        using record =
-            typename Impl::SharedAllocationRecord<memory_space, void>;
-
-        record* const r = arg_tracker.template get_record<memory_space>();
-
-        return handle_type(arg_data_ptr, r);))
-#endif
-
-    KOKKOS_IF_ON_DEVICE(
-        ((void)arg_tracker; Kokkos::Impl::cuda_abort(
-             "Cannot create Cuda texture object from within a Cuda kernel");
-         return handle_type();))
+    return handle_type(arg_data_ptr);
   }
 };
 
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_WorkGraphPolicy.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_WorkGraphPolicy.hpp
index fb3a6b138fea5bbf48654320b8c787b3f999cdad..d5d11f499a2bc857aa2e26e826eeb3f6b1e7ac01 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_WorkGraphPolicy.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_WorkGraphPolicy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CUDA_WORKGRAPHPOLICY_HPP
 #define KOKKOS_CUDA_WORKGRAPHPOLICY_HPP
@@ -79,7 +51,11 @@ class ParallelFor<FunctorType, Kokkos::WorkGraphPolicy<Traits...>,
   Policy const& get_policy() const { return m_policy; }
 
   __device__ inline void operator()() const noexcept {
-    if (0 == (threadIdx.y % 16)) {
+    // The following makes most threads idle,
+    // which helps significantly with throughput due to reducing conflict rates
+    // on the work acquisition, updated based on perf experiments of the
+    // static Fibonacci experiment on Volta
+    if (0 == (threadIdx.y % 4)) {
       // Spin until COMPLETED_TOKEN.
       // END_TOKEN indicates no work is currently available.
 
@@ -89,6 +65,12 @@ class ParallelFor<FunctorType, Kokkos::WorkGraphPolicy<Traits...>,
           exec_one<typename Policy::work_tag>(w);
           m_policy.completed_work(w);
         }
+// On pre-volta architectures we need a __syncwarp here to prevent
+// infinite loops depending on the scheduling order above
+#if defined(KOKKOS_ARCH_KEPLER) || defined(KOKKOS_ARCH_MAXWELL) || \
+    defined(KOKKOS_ARCH_PASCAL)
+        __syncwarp(__activemask());
+#endif
       }
     }
   }
@@ -100,8 +82,7 @@ class ParallelFor<FunctorType, Kokkos::WorkGraphPolicy<Traits...>,
     const int shared = 0;
 
     Kokkos::Impl::CudaParallelLaunch<Self>(
-        *this, grid, block, shared, Cuda().impl_internal_space_instance(),
-        false);
+        *this, grid, block, shared, Cuda().impl_internal_space_instance());
   }
 
   inline ParallelFor(const FunctorType& arg_functor, const Policy& arg_policy)
diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_abort.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_abort.hpp
index c0daa274f82a62c17dd40515622b7d9c0092d6ef..c8d6641d1ee7ae66899d2a76caaad6d12cbaaeec 100644
--- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_abort.hpp
+++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_abort.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CUDA_ABORT_HPP
 #define KOKKOS_CUDA_ABORT_HPP
@@ -64,7 +36,6 @@ extern __device__ void __assertfail(const void *message, const void *file,
 namespace Kokkos {
 namespace Impl {
 
-#if !defined(__APPLE__)
 // required to workaround failures in random number generator unit tests with
 // pre-volta architectures
 #if defined(KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK)
@@ -87,11 +58,6 @@ __device__ inline void cuda_abort(const char *const message) {
     ;
 #endif
 }
-#else
-__device__ inline void cuda_abort(const char *const message) {
-  // __assertfail is not supported on MAC
-}
-#endif
 
 }  // namespace Impl
 }  // namespace Kokkos
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..766f815c72c97da7ea5e12e069c3940b65669a8e
--- /dev/null
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP.cpp
@@ -0,0 +1,165 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
+#define KOKKOS_IMPL_PUBLIC_INCLUDE
+#endif
+
+#include <HIP/Kokkos_HIP.hpp>
+#include <HIP/Kokkos_HIP_Instance.hpp>
+#include <HIP/Kokkos_HIP_Locks.hpp>
+
+#include <impl/Kokkos_DeviceManagement.hpp>
+#include <impl/Kokkos_ExecSpaceManager.hpp>
+
+#include <hip/hip_runtime_api.h>
+
+namespace Kokkos {
+
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
+int HIP::concurrency() {
+#else
+int HIP::concurrency() const {
+#endif
+  return Impl::HIPInternal::concurrency();
+}
+
+int HIP::impl_is_initialized() {
+  return Impl::HIPInternal::singleton().is_initialized();
+}
+
+void HIP::impl_initialize(InitializationSettings const& settings) {
+  const int hip_device_id = Impl::get_gpu(settings);
+
+  Impl::HIPInternal::m_hipDev = hip_device_id;
+  KOKKOS_IMPL_HIP_SAFE_CALL(
+      hipGetDeviceProperties(&Impl::HIPInternal::m_deviceProp, hip_device_id));
+  const auto& hipProp = Impl::HIPInternal::m_deviceProp;
+  KOKKOS_IMPL_HIP_SAFE_CALL(hipSetDevice(hip_device_id));
+
+  // number of multiprocessors
+  Impl::HIPInternal::m_multiProcCount = hipProp.multiProcessorCount;
+
+  //----------------------------------
+  // Maximum number of warps,
+  // at most one warp per thread in a warp for reduction.
+  Impl::HIPInternal::m_maxWarpCount =
+      hipProp.maxThreadsPerBlock / Impl::HIPTraits::WarpSize;
+  if (Impl::HIPTraits::WarpSize < Impl::HIPInternal::m_maxWarpCount) {
+    Impl::HIPInternal::m_maxWarpCount = Impl::HIPTraits::WarpSize;
+  }
+  int constexpr WordSize              = sizeof(size_type);
+  Impl::HIPInternal::m_maxSharedWords = hipProp.sharedMemPerBlock / WordSize;
+
+  //----------------------------------
+  // Maximum number of blocks
+  Impl::HIPInternal::m_maxBlock[0] = hipProp.maxGridSize[0];
+  Impl::HIPInternal::m_maxBlock[1] = hipProp.maxGridSize[1];
+  Impl::HIPInternal::m_maxBlock[2] = hipProp.maxGridSize[2];
+
+  // theoretically, we can get 40 WF's / CU, but only can sustain 32 see
+  // https://github.com/ROCm-Developer-Tools/HIP/blob/a0b5dfd625d99af7e288629747b40dd057183173/vdi/hip_platform.cpp#L742
+  Impl::HIPInternal::m_maxWavesPerCU = 32;
+  Impl::HIPInternal::m_shmemPerSM    = hipProp.maxSharedMemoryPerMultiProcessor;
+  Impl::HIPInternal::m_maxShmemPerBlock = hipProp.sharedMemPerBlock;
+  Impl::HIPInternal::m_maxThreadsPerSM =
+      Impl::HIPInternal::m_maxWavesPerCU * Impl::HIPTraits::WarpSize;
+
+  // Init the array for used for arbitrarily sized atomics
+  Impl::initialize_host_hip_lock_arrays();
+
+  // Allocate a staging buffer for constant mem in pinned host memory
+  // and an event to avoid overwriting driver for previous kernel launches
+  KOKKOS_IMPL_HIP_SAFE_CALL(
+      hipHostMalloc((void**)&Impl::HIPInternal::constantMemHostStaging,
+                    Impl::HIPTraits::ConstantMemoryUsage));
+
+  KOKKOS_IMPL_HIP_SAFE_CALL(
+      hipEventCreate(&Impl::HIPInternal::constantMemReusable));
+
+  hipStream_t singleton_stream;
+  KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamCreate(&singleton_stream));
+  Impl::HIPInternal::singleton().initialize(singleton_stream, /*manage*/ true);
+}
+
+void HIP::impl_finalize() { Impl::HIPInternal::singleton().finalize(); }
+
+HIP::HIP()
+    : m_space_instance(&Impl::HIPInternal::singleton(),
+                       [](Impl::HIPInternal*) {}) {
+  Impl::HIPInternal::singleton().verify_is_initialized(
+      "HIP instance constructor");
+}
+
+HIP::HIP(hipStream_t const stream, bool manage_stream)
+    : m_space_instance(new Impl::HIPInternal, [](Impl::HIPInternal* ptr) {
+        ptr->finalize();
+        delete ptr;
+      }) {
+  Impl::HIPInternal::singleton().verify_is_initialized(
+      "HIP instance constructor");
+  m_space_instance->initialize(stream, manage_stream);
+}
+
+void HIP::print_configuration(std::ostream& os, bool /*verbose*/) const {
+  os << "Device Execution Space:\n";
+  os << "  KOKKOS_ENABLE_HIP: yes\n";
+
+  os << "HIP Options:\n";
+  os << "  KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE: ";
+#ifdef KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE
+  os << "yes\n";
+#else
+  os << "no\n";
+#endif
+
+  os << "\nRuntime Configuration:\n";
+
+  m_space_instance->print_configuration(os);
+}
+
+uint32_t HIP::impl_instance_id() const noexcept {
+  return m_space_instance->impl_get_instance_id();
+}
+void HIP::impl_static_fence(const std::string& name) {
+  Kokkos::Tools::Experimental::Impl::profile_fence_event<HIP>(
+      name,
+      Kokkos::Tools::Experimental::SpecialSynchronizationCases::
+          GlobalDeviceSynchronization,
+      [&]() { KOKKOS_IMPL_HIP_SAFE_CALL(hipDeviceSynchronize()); });
+}
+
+void HIP::fence(const std::string& name) const {
+  m_space_instance->fence(name);
+}
+
+hipStream_t HIP::hip_stream() const { return m_space_instance->m_stream; }
+
+int HIP::hip_device() const { return impl_internal_space_instance()->m_hipDev; }
+
+hipDeviceProp_t const& HIP::hip_device_prop() {
+  return Impl::HIPInternal::singleton().m_deviceProp;
+}
+
+const char* HIP::name() { return "HIP"; }
+
+namespace Impl {
+
+int g_hip_space_factory_initialized = initialize_space_factory<HIP>("150_HIP");
+
+}  // namespace Impl
+
+}  // namespace Kokkos
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..d48be3228088f63f6c341a99f724d0af2fbcdfca
--- /dev/null
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP.hpp
@@ -0,0 +1,162 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_HIP_HPP
+#define KOKKOS_HIP_HPP
+
+#include <Kokkos_Core_fwd.hpp>
+
+#include <Kokkos_Layout.hpp>
+#include <HIP/Kokkos_HIP_Space.hpp>
+
+#include <hip/hip_runtime_api.h>
+
+namespace Kokkos {
+namespace Impl {
+class HIPInternal;
+}
+/// \class HIP
+/// \brief Kokkos device for multicore processors in the host memory space.
+class HIP {
+ public:
+  //------------------------------------
+  //! \name Type declarations that all Kokkos devices must provide.
+  //@{
+
+  //! Tag this class as a kokkos execution space
+  using execution_space = HIP;
+  using memory_space    = HIPSpace;
+  using device_type     = Kokkos::Device<execution_space, memory_space>;
+
+  using array_layout = LayoutLeft;
+  using size_type    = HIPSpace::size_type;
+
+  using scratch_memory_space = ScratchMemorySpace<HIP>;
+
+  HIP();
+  HIP(hipStream_t stream, bool manage_stream = false);
+
+  //@}
+  //------------------------------------
+  //! \name Functions that all Kokkos devices must implement.
+  //@{
+
+  KOKKOS_INLINE_FUNCTION static int in_parallel() {
+#if defined(__HIP_DEVICE_COMPILE__)
+    return true;
+#else
+    return false;
+#endif
+  }
+
+  /** \brief Wait until all dispatched functors complete.
+   *
+   * The parallel_for or parallel_reduce dispatch of a functor may return
+   * asynchronously, before the functor completes. This method does not return
+   * until all dispatched functors on this device have completed.
+   */
+  static void impl_static_fence(const std::string& name);
+
+  void fence(const std::string& name =
+                 "Kokkos::HIP::fence(): Unnamed Instance Fence") const;
+
+  hipStream_t hip_stream() const;
+
+  /// \brief Print configuration information to the given output stream.
+  void print_configuration(std::ostream& os, bool verbose = false) const;
+
+  /// \brief Free any resources being consumed by the device.
+  static void impl_finalize();
+
+  /** \brief  Initialize the device.
+   *
+   */
+  int hip_device() const;
+  static hipDeviceProp_t const& hip_device_prop();
+
+  static void impl_initialize(InitializationSettings const&);
+
+  static int impl_is_initialized();
+
+  //  static size_type device_arch();
+
+  static size_type detect_device_count();
+
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
+  static int concurrency();
+#else
+  int concurrency() const;
+#endif
+  static const char* name();
+
+  inline Impl::HIPInternal* impl_internal_space_instance() const {
+    return m_space_instance.get();
+  }
+
+  uint32_t impl_instance_id() const noexcept;
+
+ private:
+  friend bool operator==(HIP const& lhs, HIP const& rhs) {
+    return lhs.impl_internal_space_instance() ==
+           rhs.impl_internal_space_instance();
+  }
+  friend bool operator!=(HIP const& lhs, HIP const& rhs) {
+    return !(lhs == rhs);
+  }
+  Kokkos::Impl::HostSharedPtr<Impl::HIPInternal> m_space_instance;
+};
+
+namespace Impl {
+template <>
+struct MemorySpaceAccess<HIPSpace, HIP::scratch_memory_space> {
+  enum : bool { assignable = false };
+  enum : bool { accessible = true };
+  enum : bool { deepcopy = false };
+};
+}  // namespace Impl
+
+namespace Tools {
+namespace Experimental {
+template <>
+struct DeviceTypeTraits<HIP> {
+  static constexpr DeviceType id = DeviceType::HIP;
+  static int device_id(const HIP& exec) { return exec.hip_device(); }
+};
+}  // namespace Experimental
+}  // namespace Tools
+
+namespace Impl {
+template <class DT, class... DP>
+struct ZeroMemset<HIP, DT, DP...> {
+  ZeroMemset(const HIP& exec_space, const View<DT, DP...>& dst,
+             typename View<DT, DP...>::const_value_type&) {
+    KOKKOS_IMPL_HIP_SAFE_CALL(hipMemsetAsync(
+        dst.data(), 0,
+        dst.size() * sizeof(typename View<DT, DP...>::value_type),
+        exec_space.hip_stream()));
+  }
+
+  ZeroMemset(const View<DT, DP...>& dst,
+             typename View<DT, DP...>::const_value_type&) {
+    KOKKOS_IMPL_HIP_SAFE_CALL(
+        hipMemset(dst.data(), 0,
+                  dst.size() * sizeof(typename View<DT, DP...>::value_type)));
+  }
+};
+}  // namespace Impl
+}  // namespace Kokkos
+
+#endif
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Abort.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Abort.hpp
index dcc5863721e9dc364969316f5aef59efd92de48e..fdf688fdad8f817239fb4c6e1f04c8ae9ea236d3 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Abort.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Abort.hpp
@@ -1,67 +1,26 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HIP_ABORT_HPP
 #define KOKKOS_HIP_ABORT_HPP
 
 #include <Kokkos_Macros.hpp>
-#if defined(KOKKOS_ENABLE_HIP)
 
 #include <hip/hip_runtime.h>
 
-// FIXME_HIP ROCm 4.5 version header include would be <rocm/rocm_version.h>
-#if __has_include(<rocm_version.h>)
-#include <rocm_version.h>
-#define KOKKOS_IMPL_ROCM_VERSION \
-  ROCM_VERSION_MAJOR * 10000 + ROCM_VERSION_MINOR * 100 + ROCM_VERSION_PATCH
-#endif
-
-// FIXME_HIP workaround for ROCm version less than 5.0.2
-#if KOKKOS_IMPL_ROCM_VERSION < 50002
-#define KOKKOS_IMPL_HIP_ABORT_DOES_NOT_PRINT_MESSAGE
-#endif
-
 namespace Kokkos {
 namespace Impl {
 
@@ -82,4 +41,3 @@ namespace Impl {
 }  // namespace Kokkos
 
 #endif
-#endif
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Atomic.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Atomic.hpp
index 88bcab62645e651f5dba4d76c832c2d9cb7013d2..49f89ed332e30a587fbd681a84d1f36354d2d0ec 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Atomic.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Atomic.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HIP_ATOMIC_HPP
 #define KOKKOS_HIP_ATOMIC_HPP
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_BlockSize_Deduction.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_BlockSize_Deduction.hpp
index 87551ae50896d0f497ab561babc5890b4d04b3c6..1f084c41e50e64a516e14c4f31b5f75856ca2bbe 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_BlockSize_Deduction.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_BlockSize_Deduction.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HIP_BLOCKSIZE_DEDUCTION_HPP
 #define KOKKOS_HIP_BLOCKSIZE_DEDUCTION_HPP
@@ -54,7 +26,6 @@
 #include <HIP/Kokkos_HIP_KernelLaunch.hpp>
 
 namespace Kokkos {
-namespace Experimental {
 namespace Impl {
 
 enum class BlockType { Max, Preferred };
@@ -63,9 +34,8 @@ template <typename DriverType, typename LaunchBounds = Kokkos::LaunchBounds<>,
           HIPLaunchMechanism LaunchMechanism =
               DeduceHIPLaunchMechanism<DriverType>::launch_mechanism>
 unsigned get_preferred_blocksize_impl() {
-  // FIXME_HIP - could be if constexpr for c++17
-  if (!HIPParallelLaunch<DriverType, LaunchBounds,
-                         LaunchMechanism>::default_launchbounds()) {
+  if constexpr (!HIPParallelLaunch<DriverType, LaunchBounds,
+                                   LaunchMechanism>::default_launchbounds()) {
     // use the user specified value
     return LaunchBounds::maxTperB;
   } else {
@@ -77,14 +47,12 @@ unsigned get_preferred_blocksize_impl() {
   }
 }
 
-// FIXME_HIP - entire function could be constexpr for c++17
 template <typename DriverType, typename LaunchBounds = Kokkos::LaunchBounds<>,
           HIPLaunchMechanism LaunchMechanism =
               DeduceHIPLaunchMechanism<DriverType>::launch_mechanism>
-unsigned get_max_blocksize_impl() {
-  // FIXME_HIP - could be if constexpr for c++17
-  if (!HIPParallelLaunch<DriverType, LaunchBounds,
-                         LaunchMechanism>::default_launchbounds()) {
+constexpr unsigned get_max_blocksize_impl() {
+  if constexpr (!HIPParallelLaunch<DriverType, LaunchBounds,
+                                   LaunchMechanism>::default_launchbounds()) {
     // use the user specified value
     return LaunchBounds::maxTperB;
   } else {
@@ -105,15 +73,13 @@ hipFuncAttributes get_hip_func_attributes_impl() {
   return HIPParallelLaunch<DriverType, LaunchBounds,
                            LaunchMechanism>::get_hip_func_attributes();
 #else
-  // FIXME_HIP - could be if constexpr for c++17
-  if (!HIPParallelLaunch<DriverType, LaunchBounds,
-                         LaunchMechanism>::default_launchbounds()) {
+  if constexpr (!HIPParallelLaunch<DriverType, LaunchBounds,
+                                   LaunchMechanism>::default_launchbounds()) {
     // for user defined, we *always* honor the request
     return HIPParallelLaunch<DriverType, LaunchBounds,
                              LaunchMechanism>::get_hip_func_attributes();
   } else {
-    // FIXME_HIP - could be if constexpr for c++17
-    if (BlockSize == BlockType::Max) {
+    if constexpr (BlockSize == BlockType::Max) {
       return HIPParallelLaunch<
           DriverType, Kokkos::LaunchBounds<HIPTraits::MaxThreadsPerBlock, 1>,
           LaunchMechanism>::get_hip_func_attributes();
@@ -154,8 +120,7 @@ unsigned hip_internal_get_block_size(const HIPInternal *hip_instance,
     // find how many threads we can fit with this blocksize based on LDS usage
     unsigned tperb_shmem = total_shmem > shmem_per_sm ? 0 : block_size;
 
-    // FIXME_HIP - could be if constexpr for c++17
-    if (BlockSize == BlockType::Max) {
+    if constexpr (BlockSize == BlockType::Max) {
       // we want the maximum blocksize possible
       // just wait until we get a case where we can fit the LDS per SM
       if (tperb_shmem) return block_size;
@@ -296,7 +261,6 @@ unsigned hip_get_max_team_blocksize(HIPInternal const *hip_instance,
 }
 
 }  // namespace Impl
-}  // namespace Experimental
 }  // namespace Kokkos
 
 #endif
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d1f3d95adf22666d5e1395ce0d705cd069228f39
--- /dev/null
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.cpp
@@ -0,0 +1,58 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
+#define KOKKOS_IMPL_PUBLIC_INCLUDE
+#endif
+
+#include <HIP/Kokkos_HIP_DeepCopy.hpp>
+#include <HIP/Kokkos_HIP_Error.hpp>  // HIP_SAFE_CALL
+#include <HIP/Kokkos_HIP.hpp>
+
+namespace Kokkos {
+namespace Impl {
+namespace {
+hipStream_t get_deep_copy_stream() {
+  static hipStream_t s = nullptr;
+  if (s == nullptr) {
+    KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamCreate(&s));
+  }
+  return s;
+}
+}  // namespace
+
+void DeepCopyHIP(void* dst, void const* src, size_t n) {
+  KOKKOS_IMPL_HIP_SAFE_CALL(hipMemcpyAsync(dst, src, n, hipMemcpyDefault));
+}
+
+void DeepCopyAsyncHIP(const HIP& instance, void* dst, void const* src,
+                      size_t n) {
+  KOKKOS_IMPL_HIP_SAFE_CALL(
+      hipMemcpyAsync(dst, src, n, hipMemcpyDefault, instance.hip_stream()));
+}
+
+void DeepCopyAsyncHIP(void* dst, void const* src, size_t n) {
+  hipStream_t s = get_deep_copy_stream();
+  KOKKOS_IMPL_HIP_SAFE_CALL(hipMemcpyAsync(dst, src, n, hipMemcpyDefault, s));
+  Kokkos::Tools::Experimental::Impl::profile_fence_event<HIP>(
+      "Kokkos::Impl::DeepCopyAsyncHIP: Post Deep Copy Fence on Deep-Copy "
+      "stream",
+      Kokkos::Tools::Experimental::SpecialSynchronizationCases::
+          DeepCopyResourceSynchronization,
+      [&]() { KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamSynchronize(s)); });
+}
+}  // namespace Impl
+}  // namespace Kokkos
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..206ce4bb67a207050ba7a5670455b4b228fd862f
--- /dev/null
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.hpp
@@ -0,0 +1,134 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_HIP_DEEP_COPY_HPP
+#define KOKKOS_HIP_DEEP_COPY_HPP
+
+#include <HIP/Kokkos_HIP_Space.hpp>
+#include <HIP/Kokkos_HIP_Error.hpp>  // HIP_SAFE_CALL
+
+#include <hip/hip_runtime_api.h>
+
+namespace Kokkos {
+namespace Impl {
+
+void DeepCopyHIP(void* dst, const void* src, size_t n);
+void DeepCopyAsyncHIP(const HIP& instance, void* dst, const void* src,
+                      size_t n);
+void DeepCopyAsyncHIP(void* dst, const void* src, size_t n);
+
+template <class MemSpace>
+struct DeepCopy<MemSpace, HostSpace, HIP,
+                std::enable_if_t<is_hip_type_space<MemSpace>::value>> {
+  DeepCopy(void* dst, const void* src, size_t n) { DeepCopyHIP(dst, src, n); }
+  DeepCopy(const HIP& instance, void* dst, const void* src, size_t n) {
+    DeepCopyAsyncHIP(instance, dst, src, n);
+  }
+};
+
+template <class MemSpace>
+struct DeepCopy<HostSpace, MemSpace, HIP,
+                std::enable_if_t<is_hip_type_space<MemSpace>::value>> {
+  DeepCopy(void* dst, const void* src, size_t n) { DeepCopyHIP(dst, src, n); }
+  DeepCopy(const HIP& instance, void* dst, const void* src, size_t n) {
+    DeepCopyAsyncHIP(instance, dst, src, n);
+  }
+};
+
+template <class MemSpace1, class MemSpace2>
+struct DeepCopy<MemSpace1, MemSpace2, HIP,
+                std::enable_if_t<is_hip_type_space<MemSpace1>::value &&
+                                 is_hip_type_space<MemSpace2>::value>> {
+  DeepCopy(void* dst, const void* src, size_t n) { DeepCopyHIP(dst, src, n); }
+  DeepCopy(const HIP& instance, void* dst, const void* src, size_t n) {
+    DeepCopyAsyncHIP(instance, dst, src, n);
+  }
+};
+
+template <class MemSpace1, class MemSpace2, class ExecutionSpace>
+struct DeepCopy<MemSpace1, MemSpace2, ExecutionSpace,
+                std::enable_if_t<is_hip_type_space<MemSpace1>::value &&
+                                 is_hip_type_space<MemSpace2>::value &&
+                                 !std::is_same<ExecutionSpace, HIP>::value>> {
+  inline DeepCopy(void* dst, const void* src, size_t n) {
+    DeepCopyHIP(dst, src, n);
+  }
+
+  inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src,
+                  size_t n) {
+    exec.fence(fence_string());
+    DeepCopyAsyncHIP(dst, src, n);
+  }
+
+ private:
+  static const std::string& fence_string() {
+    static const std::string string =
+        std::string("Kokkos::Impl::DeepCopy<") + MemSpace1::name() + "Space, " +
+        MemSpace2::name() +
+        "Space, ExecutionSpace>::DeepCopy: fence before copy";
+    return string;
+  }
+};
+
+template <class MemSpace, class ExecutionSpace>
+struct DeepCopy<MemSpace, HostSpace, ExecutionSpace,
+                std::enable_if_t<is_hip_type_space<MemSpace>::value &&
+                                 !std::is_same<ExecutionSpace, HIP>::value>> {
+  inline DeepCopy(void* dst, const void* src, size_t n) {
+    DeepCopyHIP(dst, src, n);
+  }
+
+  inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src,
+                  size_t n) {
+    exec.fence(fence_string());
+    DeepCopyAsyncHIP(dst, src, n);
+  }
+
+ private:
+  static const std::string& fence_string() {
+    static const std::string string =
+        std::string("Kokkos::Impl::DeepCopy<") + MemSpace::name() +
+        "Space, HostSpace, ExecutionSpace>::DeepCopy: fence before copy";
+    return string;
+  }
+};
+
+template <class MemSpace, class ExecutionSpace>
+struct DeepCopy<HostSpace, MemSpace, ExecutionSpace,
+                std::enable_if_t<is_hip_type_space<MemSpace>::value &&
+                                 !std::is_same<ExecutionSpace, HIP>::value>> {
+  inline DeepCopy(void* dst, const void* src, size_t n) {
+    DeepCopyHIP(dst, src, n);
+  }
+
+  inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src,
+                  size_t n) {
+    exec.fence(fence_string());
+    DeepCopyAsyncHIP(dst, src, n);
+  }
+
+ private:
+  static const std::string& fence_string() {
+    static const std::string string =
+        std::string("Kokkos::Impl::DeepCopy<HostSpace, ") + MemSpace::name() +
+        "Space, ExecutionSpace>::DeepCopy: fence before copy";
+    return string;
+  }
+};
+}  // namespace Impl
+}  // namespace Kokkos
+
+#endif
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Error.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Error.hpp
index a75e7a4a6c9351c0d39f7b2f7e8719a1a81c0adf..e09382c7056fb5ffdce8f40e553fd66910484005 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Error.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Error.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HIP_ERROR_HPP
 #define KOKKOS_HIP_ERROR_HPP
@@ -66,30 +38,12 @@ inline void hip_internal_safe_call(hipError_t e, const char* name,
   }
 }
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-
-KOKKOS_DEPRECATED
-inline void hip_internal_safe_call_deprecated(hipError_t e, const char* name,
-                                              const char* file = nullptr,
-                                              const int line   = 0) {
-  hip_internal_safe_call(e, name, file, line);
-}
-
-#endif
-
 }  // namespace Impl
 }  // namespace Kokkos
 
 #define KOKKOS_IMPL_HIP_SAFE_CALL(call) \
   Kokkos::Impl::hip_internal_safe_call(call, #call, __FILE__, __LINE__)
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-#define HIP_SAFE_CALL(call)                                              \
-  Kokkos::Impl::hip_internal_safe_call_deprecated(call, #call, __FILE__, \
-                                                  __LINE__)
-
-#endif
-
 namespace Kokkos {
 namespace Experimental {
 
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Conversion.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Conversion.hpp
index d04fe2051a435df04691d84392b0b460f5ce1747..fa0373a87ea87a1c17439909d419988bc156d6a3 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Conversion.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Conversion.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HIP_HALF_HPP_
 #define KOKKOS_HIP_HALF_HPP_
@@ -48,7 +20,7 @@
 #ifdef KOKKOS_IMPL_HALF_TYPE_DEFINED
 
 #include <Kokkos_Half.hpp>
-#include <Kokkos_NumericTraits.hpp>  // reduction_identity
+#include <Kokkos_ReductionIdentity.hpp>
 
 namespace Kokkos {
 namespace Experimental {
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Impl_Type.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Impl_Type.hpp
index 728a229c1a825a366b012de8f474644108587180..64c7706f94571ab66976f4a1aa79fb13f76ac3a9 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Impl_Type.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Impl_Type.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HIP_HALF_IMPL_TYPE_HPP_
 #define KOKKOS_HIP_HALF_IMPL_TYPE_HPP_
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp
index 3785cfe80b4974a4a0f74d2e0376b116f7641e6a..28c9c1cb6ad19dad002ac1ddae807dba36e6b459 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /*--------------------------------------------------------------------------*/
 /* Kokkos interfaces */
@@ -52,8 +24,8 @@
 #include <Kokkos_Core.hpp>
 
 #include <HIP/Kokkos_HIP_Instance.hpp>
-#include <Kokkos_HIP.hpp>
-#include <Kokkos_HIP_Space.hpp>
+#include <HIP/Kokkos_HIP.hpp>
+#include <HIP/Kokkos_HIP_Space.hpp>
 #include <impl/Kokkos_Error.hpp>
 
 /*--------------------------------------------------------------------------*/
@@ -68,71 +40,37 @@
 
 #ifdef KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE
 __device__ __constant__ unsigned long kokkos_impl_hip_constant_memory_buffer
-    [Kokkos::Experimental::Impl::HIPTraits::ConstantMemoryUsage /
-     sizeof(unsigned long)];
+    [Kokkos::Impl::HIPTraits::ConstantMemoryUsage / sizeof(unsigned long)];
 #endif
 
 namespace Kokkos {
 namespace Impl {
-Kokkos::View<uint32_t *, Kokkos::Experimental::HIPSpace>
-hip_global_unique_token_locks(bool deallocate) {
-  static Kokkos::View<uint32_t *, Kokkos::Experimental::HIPSpace> locks =
-      Kokkos::View<uint32_t *, Kokkos::Experimental::HIPSpace>();
+Kokkos::View<uint32_t *, HIPSpace> hip_global_unique_token_locks(
+    bool deallocate) {
+  static Kokkos::View<uint32_t *, HIPSpace> locks =
+      Kokkos::View<uint32_t *, HIPSpace>();
   if (!deallocate && locks.extent(0) == 0)
-    locks = Kokkos::View<uint32_t *, Kokkos::Experimental::HIPSpace>(
-        "Kokkos::UniqueToken<HIP>::m_locks",
-        Kokkos::Experimental::HIP().concurrency());
-  if (deallocate)
-    locks = Kokkos::View<uint32_t *, Kokkos::Experimental::HIPSpace>();
+    locks = Kokkos::View<uint32_t *, HIPSpace>(
+        "Kokkos::UniqueToken<HIP>::m_locks", HIPInternal::concurrency());
+  if (deallocate) locks = Kokkos::View<uint32_t *, HIPSpace>();
   return locks;
 }
 }  // namespace Impl
 }  // namespace Kokkos
 
 namespace Kokkos {
-namespace Experimental {
-namespace {
-class HIPInternalDevices {
- public:
-  enum { MAXIMUM_DEVICE_COUNT = 64 };
-  struct hipDeviceProp_t m_hipProp[MAXIMUM_DEVICE_COUNT];
-  int m_hipDevCount;
-
-  HIPInternalDevices();
-
-  static HIPInternalDevices const &singleton();
-};
-
-HIPInternalDevices::HIPInternalDevices() {
-  KOKKOS_IMPL_HIP_SAFE_CALL(hipGetDeviceCount(&m_hipDevCount));
-
-  if (m_hipDevCount > MAXIMUM_DEVICE_COUNT) {
-    Kokkos::abort(
-        "Sorry, you have more GPUs per node than we thought anybody would ever "
-        "have. Please report this to github.com/kokkos/kokkos.");
-  }
-  for (int i = 0; i < m_hipDevCount; ++i) {
-    KOKKOS_IMPL_HIP_SAFE_CALL(hipGetDeviceProperties(m_hipProp + i, i));
-  }
-}
-
-const HIPInternalDevices &HIPInternalDevices::singleton() {
-  static HIPInternalDevices self;
-  return self;
-}
-}  // namespace
-
-unsigned long *Impl::HIPInternal::constantMemHostStaging = nullptr;
-hipEvent_t Impl::HIPInternal::constantMemReusable        = nullptr;
-std::mutex Impl::HIPInternal::constantMemMutex;
 
 namespace Impl {
 
 //----------------------------------------------------------------------------
 
-void HIPInternal::print_configuration(std::ostream &s) const {
-  const HIPInternalDevices &dev_info = HIPInternalDevices::singleton();
+int HIPInternal::concurrency() {
+  static int const concurrency = m_deviceProp.maxThreadsPerMultiProcessor *
+                                 m_deviceProp.multiProcessorCount;
+  return concurrency;
+}
 
+void HIPInternal::print_configuration(std::ostream &s) const {
   s << "macro  KOKKOS_ENABLE_HIP : defined" << '\n';
 #if defined(HIP_VERSION)
   s << "macro  HIP_VERSION = " << HIP_VERSION << " = version "
@@ -140,15 +78,18 @@ void HIPInternal::print_configuration(std::ostream &s) const {
     << '\n';
 #endif
 
-  for (int i = 0; i < dev_info.m_hipDevCount; ++i) {
-    s << "Kokkos::Experimental::HIP[ " << i << " ] "
-      << dev_info.m_hipProp[i].name << " version "
-      << (dev_info.m_hipProp[i].major) << "." << dev_info.m_hipProp[i].minor
-      << ", Total Global Memory: "
-      << ::Kokkos::Impl::human_memory_size(dev_info.m_hipProp[i].totalGlobalMem)
+  int hipDevCount;
+  KOKKOS_IMPL_HIP_SAFE_CALL(hipGetDeviceCount(&hipDevCount));
+
+  for (int i = 0; i < hipDevCount; ++i) {
+    hipDeviceProp_t hipProp;
+    KOKKOS_IMPL_HIP_SAFE_CALL(hipGetDeviceProperties(&hipProp, i));
+
+    s << "Kokkos::HIP[ " << i << " ] "
+      << "gcnArch " << hipProp.gcnArch << ", Total Global Memory: "
+      << ::Kokkos::Impl::human_memory_size(hipProp.totalGlobalMem)
       << ", Shared Memory per Block: "
-      << ::Kokkos::Impl::human_memory_size(
-             dev_info.m_hipProp[i].sharedMemPerBlock);
+      << ::Kokkos::Impl::human_memory_size(hipProp.sharedMemPerBlock);
     if (m_hipDev == i) s << " : Selected";
     s << '\n';
   }
@@ -158,18 +99,12 @@ void HIPInternal::print_configuration(std::ostream &s) const {
 
 HIPInternal::~HIPInternal() {
   if (m_scratchSpace || m_scratchFlags) {
-    std::cerr << "Kokkos::Experimental::HIP ERROR: Failed to call "
-                 "Kokkos::Experimental::HIP::finalize()"
+    std::cerr << "Kokkos::HIP ERROR: Failed to call "
+                 "Kokkos::HIP::finalize()"
               << std::endl;
     std::cerr.flush();
   }
 
-  m_hipDev            = -1;
-  m_hipArch           = -1;
-  m_multiProcCount    = 0;
-  m_maxWarpCount      = 0;
-  m_maxSharedWords    = 0;
-  m_maxShmemPerBlock  = 0;
   m_scratchSpaceCount = 0;
   m_scratchFlagsCount = 0;
   m_scratchSpace      = nullptr;
@@ -179,7 +114,7 @@ HIPInternal::~HIPInternal() {
 
 int HIPInternal::verify_is_initialized(const char *const label) const {
   if (m_hipDev < 0) {
-    Kokkos::abort((std::string("Kokkos::Experimental::HIP::") + label +
+    Kokkos::abort((std::string("Kokkos::HIP::") + label +
                    " : ERROR device not initialized\n")
                       .c_str());
   }
@@ -201,27 +136,19 @@ void HIPInternal::fence() const {
   fence("Kokkos::HIPInternal::fence: Unnamed Internal Fence");
 }
 void HIPInternal::fence(const std::string &name) const {
-  Kokkos::Tools::Experimental::Impl::profile_fence_event<
-      Kokkos::Experimental::HIP>(
+  Kokkos::Tools::Experimental::Impl::profile_fence_event<Kokkos::HIP>(
       name,
       Kokkos::Tools::Experimental::Impl::DirectFenceIDHandle{
           impl_get_instance_id()},
-      [&]() {
-        KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamSynchronize(m_stream));
-        // can reset our cycle id now as well
-        m_cycleId = 0;
-      });
+      [&]() { KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamSynchronize(m_stream)); });
 }
 
-void HIPInternal::initialize(int hip_device_id, hipStream_t stream,
-                             bool manage_stream) {
+void HIPInternal::initialize(hipStream_t stream, bool manage_stream) {
   if (was_finalized)
     Kokkos::abort("Calling HIP::initialize after HIP::finalize is illegal\n");
 
   if (is_initialized()) return;
 
-  int constexpr WordSize = sizeof(size_type);
-
   if (!HostSpace::execution_space::impl_is_initialized()) {
     const std::string msg(
         "HIP::initialize ERROR : HostSpace::execution_space "
@@ -229,59 +156,12 @@ void HIPInternal::initialize(int hip_device_id, hipStream_t stream,
     Kokkos::Impl::throw_runtime_exception(msg);
   }
 
-  const HIPInternalDevices &dev_info = HIPInternalDevices::singleton();
-
   const bool ok_init = nullptr == m_scratchSpace || nullptr == m_scratchFlags;
 
-  // Need at least a GPU device
-  const bool ok_id =
-      0 <= hip_device_id && hip_device_id < dev_info.m_hipDevCount;
-
-  if (ok_init && ok_id) {
-    const struct hipDeviceProp_t &hipProp = dev_info.m_hipProp[hip_device_id];
-
-    m_hipDev     = hip_device_id;
-    m_deviceProp = hipProp;
+  if (ok_init) {
+    m_stream        = stream;
+    m_manage_stream = manage_stream;
 
-    KOKKOS_IMPL_HIP_SAFE_CALL(hipSetDevice(m_hipDev));
-
-    m_stream                    = stream;
-    m_manage_stream             = manage_stream;
-    m_team_scratch_current_size = 0;
-    m_team_scratch_ptr          = nullptr;
-
-    // number of multiprocessors
-    m_multiProcCount = hipProp.multiProcessorCount;
-
-    //----------------------------------
-    // Maximum number of warps,
-    // at most one warp per thread in a warp for reduction.
-    m_maxWarpCount = hipProp.maxThreadsPerBlock / Impl::HIPTraits::WarpSize;
-    if (HIPTraits::WarpSize < m_maxWarpCount) {
-      m_maxWarpCount = Impl::HIPTraits::WarpSize;
-    }
-    m_maxSharedWords = hipProp.sharedMemPerBlock / WordSize;
-
-    //----------------------------------
-    // Maximum number of blocks
-    m_maxBlock[0] = hipProp.maxGridSize[0];
-    m_maxBlock[1] = hipProp.maxGridSize[1];
-    m_maxBlock[2] = hipProp.maxGridSize[2];
-
-    // theoretically, we can get 40 WF's / CU, but only can sustain 32
-    // see
-    // https://github.com/ROCm-Developer-Tools/HIP/blob/a0b5dfd625d99af7e288629747b40dd057183173/vdi/hip_platform.cpp#L742
-    m_maxWavesPerCU = 32;
-    // FIXME_HIP - Nick to implement this upstream
-    //             Register count comes from Sec. 2.2. "Data Sharing" of the
-    //             Vega 7nm ISA document (see the diagram)
-    //             https://developer.amd.com/wp-content/resources/Vega_7nm_Shader_ISA.pdf
-    //             VGPRS = 4 (SIMD/CU) * 256 VGPR/SIMD * 64 registers / VGPR =
-    //             65536 VGPR/CU
-    m_regsPerSM        = 65536;
-    m_shmemPerSM       = hipProp.maxSharedMemoryPerMultiProcessor;
-    m_maxShmemPerBlock = hipProp.sharedMemPerBlock;
-    m_maxThreadsPerSM  = m_maxWavesPerCU * HIPTraits::WarpSize;
     //----------------------------------
     // Multiblock reduction uses scratch flags for counters
     // and scratch space for partial reduction values.
@@ -293,81 +173,36 @@ void HIPInternal::initialize(int hip_device_id, hipStream_t stream,
       (void)scratch_flags(reduce_block_count * 2 * sizeof(size_type));
       (void)scratch_space(reduce_block_count * 16 * sizeof(size_type));
     }
-    //----------------------------------
-    // Concurrent bitset for obtaining unique tokens from within
-    // an executing kernel.
-    {
-      const int32_t buffer_bound =
-          Kokkos::Impl::concurrent_bitset::buffer_bound(HIP::concurrency());
-
-      // Allocate and initialize uint32_t[ buffer_bound ]
-
-      using Record =
-          Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::HIPSpace,
-                                               void>;
-
-      Record *const r = Record::allocate(Kokkos::Experimental::HIPSpace(),
-                                         "Kokkos::InternalScratchBitset",
-                                         sizeof(uint32_t) * buffer_bound);
-
-      Record::increment(r);
-    }
-    //----------------------------------
-
   } else {
     std::ostringstream msg;
-    msg << "Kokkos::Experimental::HIP::initialize(" << hip_device_id
-        << ") FAILED";
-
-    if (!ok_init) {
-      msg << " : Already initialized";
-    }
-    if (!ok_id) {
-      msg << " : Device identifier out of range "
-          << "[0.." << dev_info.m_hipDevCount - 1 << "]";
-    }
+    msg << "Kokkos::HIP::initialize(" << m_hipDev
+        << ") FAILED : Already initialized";
     Kokkos::Impl::throw_runtime_exception(msg.str());
   }
 
-  // Init the array for used for arbitrarily sized atomics
-  if (m_stream == nullptr) ::Kokkos::Impl::initialize_host_hip_lock_arrays();
-
-  // Allocate a staging buffer for constant mem in pinned host memory
-  // and an event to avoid overwriting driver for previous kernel launches
-  if (m_stream == nullptr) {
-    KOKKOS_IMPL_HIP_SAFE_CALL(hipHostMalloc((void **)&constantMemHostStaging,
-                                            HIPTraits::ConstantMemoryUsage));
-
-    KOKKOS_IMPL_HIP_SAFE_CALL(hipEventCreate(&constantMemReusable));
-  }
-
   KOKKOS_IMPL_HIP_SAFE_CALL(
-      hipMalloc(&m_scratch_locks, sizeof(int32_t) * HIP::concurrency()));
+      hipMalloc(&m_scratch_locks, sizeof(int32_t) * concurrency()));
   KOKKOS_IMPL_HIP_SAFE_CALL(
-      hipMemset(m_scratch_locks, 0, sizeof(int32_t) * HIP::concurrency()));
+      hipMemset(m_scratch_locks, 0, sizeof(int32_t) * concurrency()));
 }
 
 //----------------------------------------------------------------------------
 
-using ScratchGrain =
-    Kokkos::Experimental::HIP::size_type[Impl::HIPTraits::WarpSize];
+using ScratchGrain = Kokkos::HIP::size_type[Impl::HIPTraits::WarpSize];
 enum { sizeScratchGrain = sizeof(ScratchGrain) };
 
-Kokkos::Experimental::HIP::size_type *HIPInternal::scratch_space(
-    const std::size_t size) {
+Kokkos::HIP::size_type *HIPInternal::scratch_space(const std::size_t size) {
   if (verify_is_initialized("scratch_space") &&
       m_scratchSpaceCount * sizeScratchGrain < size) {
     m_scratchSpaceCount = (size + sizeScratchGrain - 1) / sizeScratchGrain;
 
-    using Record =
-        Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::HIPSpace,
-                                             void>;
+    using Record = Kokkos::Impl::SharedAllocationRecord<Kokkos::HIPSpace, void>;
 
     if (m_scratchSpace) Record::decrement(Record::get_record(m_scratchSpace));
 
-    Record *const r = Record::allocate(
-        Kokkos::Experimental::HIPSpace(), "Kokkos::InternalScratchSpace",
-        (sizeScratchGrain * m_scratchSpaceCount));
+    Record *const r =
+        Record::allocate(Kokkos::HIPSpace(), "Kokkos::InternalScratchSpace",
+                         (sizeScratchGrain * m_scratchSpaceCount));
 
     Record::increment(r);
 
@@ -377,21 +212,18 @@ Kokkos::Experimental::HIP::size_type *HIPInternal::scratch_space(
   return m_scratchSpace;
 }
 
-Kokkos::Experimental::HIP::size_type *HIPInternal::scratch_flags(
-    const std::size_t size) {
+Kokkos::HIP::size_type *HIPInternal::scratch_flags(const std::size_t size) {
   if (verify_is_initialized("scratch_flags") &&
       m_scratchFlagsCount * sizeScratchGrain < size) {
     m_scratchFlagsCount = (size + sizeScratchGrain - 1) / sizeScratchGrain;
 
-    using Record =
-        Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::HIPSpace,
-                                             void>;
+    using Record = Kokkos::Impl::SharedAllocationRecord<Kokkos::HIPSpace, void>;
 
     if (m_scratchFlags) Record::decrement(Record::get_record(m_scratchFlags));
 
-    Record *const r = Record::allocate(
-        Kokkos::Experimental::HIPSpace(), "Kokkos::InternalScratchFlags",
-        (sizeScratchGrain * m_scratchFlagsCount));
+    Record *const r =
+        Record::allocate(Kokkos::HIPSpace(), "Kokkos::InternalScratchFlags",
+                         (sizeScratchGrain * m_scratchFlagsCount));
 
     Record::increment(r);
 
@@ -404,20 +236,86 @@ Kokkos::Experimental::HIP::size_type *HIPInternal::scratch_flags(
   return m_scratchFlags;
 }
 
-void *HIPInternal::resize_team_scratch_space(std::int64_t bytes,
+Kokkos::HIP::size_type *HIPInternal::stage_functor_for_execution(
+    void const *driver, std::size_t const size) const {
+  if (verify_is_initialized("scratch_functor") && m_scratchFunctorSize < size) {
+    m_scratchFunctorSize = size;
+
+    using Record = Kokkos::Impl::SharedAllocationRecord<Kokkos::HIPSpace, void>;
+    using RecordHost =
+        Kokkos::Impl::SharedAllocationRecord<Kokkos::HIPHostPinnedSpace, void>;
+
+    if (m_scratchFunctor) {
+      Record::decrement(Record::get_record(m_scratchFunctor));
+      RecordHost::decrement(RecordHost::get_record(m_scratchFunctorHost));
+    }
+
+    Record *const r =
+        Record::allocate(Kokkos::HIPSpace(), "Kokkos::InternalScratchFunctor",
+                         m_scratchFunctorSize);
+    RecordHost *const r_host = RecordHost::allocate(
+        Kokkos::HIPHostPinnedSpace(), "Kokkos::InternalScratchFunctorHost",
+        m_scratchFunctorSize);
+
+    Record::increment(r);
+    RecordHost::increment(r_host);
+
+    m_scratchFunctor     = reinterpret_cast<size_type *>(r->data());
+    m_scratchFunctorHost = reinterpret_cast<size_type *>(r_host->data());
+  }
+
+  // When using HSA_XNACK=1, it is necessary to copy the driver to the host to
+  // ensure that the driver is not destroyed before the computation is done.
+  // Without this fix, all the atomic tests fail. It is not obvious that this
+  // problem is limited to HSA_XNACK=1 even if all the tests pass when
+  // HSA_XNACK=0. That's why we always copy the driver.
+  KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamSynchronize(m_stream));
+  std::memcpy(m_scratchFunctorHost, driver, size);
+  KOKKOS_IMPL_HIP_SAFE_CALL(hipMemcpyAsync(m_scratchFunctor,
+                                           m_scratchFunctorHost, size,
+                                           hipMemcpyDefault, m_stream));
+
+  return m_scratchFunctor;
+}
+
+int HIPInternal::acquire_team_scratch_space() {
+  int current_team_scratch = 0;
+  int zero                 = 0;
+  while (!m_team_scratch_pool[current_team_scratch].compare_exchange_weak(
+      zero, 1, std::memory_order_release, std::memory_order_relaxed)) {
+    current_team_scratch = (current_team_scratch + 1) % m_n_team_scratch;
+  }
+
+  return current_team_scratch;
+}
+
+void *HIPInternal::resize_team_scratch_space(int scratch_pool_id,
+                                             std::int64_t bytes,
                                              bool force_shrink) {
-  if (m_team_scratch_current_size == 0) {
-    m_team_scratch_current_size = bytes;
-    m_team_scratch_ptr = Kokkos::kokkos_malloc<Kokkos::Experimental::HIPSpace>(
-        "Kokkos::HIPSpace::TeamScratchMemory", m_team_scratch_current_size);
+  // Multiple ParallelFor/Reduce Teams can call this function at the same time
+  // and invalidate the m_team_scratch_ptr. We use a pool to avoid any race
+  // condition.
+  if (m_team_scratch_current_size[scratch_pool_id] == 0) {
+    m_team_scratch_current_size[scratch_pool_id] = bytes;
+    m_team_scratch_ptr[scratch_pool_id] =
+        Kokkos::kokkos_malloc<Kokkos::HIPSpace>(
+            "Kokkos::HIPSpace::TeamScratchMemory",
+            m_team_scratch_current_size[scratch_pool_id]);
   }
-  if ((bytes > m_team_scratch_current_size) ||
-      ((bytes < m_team_scratch_current_size) && (force_shrink))) {
-    m_team_scratch_current_size = bytes;
-    m_team_scratch_ptr = Kokkos::kokkos_realloc<Kokkos::Experimental::HIPSpace>(
-        m_team_scratch_ptr, m_team_scratch_current_size);
+  if ((bytes > m_team_scratch_current_size[scratch_pool_id]) ||
+      ((bytes < m_team_scratch_current_size[scratch_pool_id]) &&
+       (force_shrink))) {
+    m_team_scratch_current_size[scratch_pool_id] = bytes;
+    m_team_scratch_ptr[scratch_pool_id] =
+        Kokkos::kokkos_realloc<Kokkos::HIPSpace>(
+            m_team_scratch_ptr[scratch_pool_id],
+            m_team_scratch_current_size[scratch_pool_id]);
   }
-  return m_team_scratch_ptr;
+  return m_team_scratch_ptr[scratch_pool_id];
+}
+
+void HIPInternal::release_team_scratch_space(int scratch_pool_id) {
+  m_team_scratch_pool[scratch_pool_id] = 0;
 }
 
 //----------------------------------------------------------------------------
@@ -428,108 +326,71 @@ void HIPInternal::finalize() {
 
   if (this == &singleton()) {
     (void)Kokkos::Impl::hip_global_unique_token_locks(true);
+    Impl::finalize_host_hip_lock_arrays();
+
     KOKKOS_IMPL_HIP_SAFE_CALL(hipHostFree(constantMemHostStaging));
     KOKKOS_IMPL_HIP_SAFE_CALL(hipEventDestroy(constantMemReusable));
   }
 
   if (nullptr != m_scratchSpace || nullptr != m_scratchFlags) {
-    using RecordHIP =
-        Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::HIPSpace>;
+    using RecordHIP = Kokkos::Impl::SharedAllocationRecord<Kokkos::HIPSpace>;
 
     RecordHIP::decrement(RecordHIP::get_record(m_scratchFlags));
     RecordHIP::decrement(RecordHIP::get_record(m_scratchSpace));
 
-    if (m_team_scratch_current_size > 0)
-      Kokkos::kokkos_free<Kokkos::Experimental::HIPSpace>(m_team_scratch_ptr);
-
-    if (m_manage_stream && m_stream != nullptr)
-      KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamDestroy(m_stream));
+    if (m_scratchFunctorSize > 0) {
+      RecordHIP::decrement(RecordHIP::get_record(m_scratchFunctor));
+      RecordHIP::decrement(RecordHIP::get_record(m_scratchFunctorHost));
+    }
   }
 
-  m_hipDev                    = -1;
-  m_hipArch                   = -1;
-  m_multiProcCount            = 0;
-  m_maxWarpCount              = 0;
-  m_maxBlock                  = {0, 0, 0};
-  m_maxSharedWords            = 0;
-  m_maxShmemPerBlock          = 0;
-  m_scratchSpaceCount         = 0;
-  m_scratchFlagsCount         = 0;
-  m_scratchSpace              = nullptr;
-  m_scratchFlags              = nullptr;
-  m_stream                    = nullptr;
-  m_team_scratch_current_size = 0;
-  m_team_scratch_ptr          = nullptr;
+  for (int i = 0; i < m_n_team_scratch; ++i) {
+    if (m_team_scratch_current_size[i] > 0)
+      Kokkos::kokkos_free<Kokkos::HIPSpace>(m_team_scratch_ptr[i]);
+  }
 
-  KOKKOS_IMPL_HIP_SAFE_CALL(hipFree(m_scratch_locks));
-  m_scratch_locks = nullptr;
+  if (m_manage_stream && m_stream != nullptr)
+    KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamDestroy(m_stream));
 
-  if (nullptr != d_driverWorkArray) {
-    KOKKOS_IMPL_HIP_SAFE_CALL(hipHostFree(d_driverWorkArray));
-    d_driverWorkArray = nullptr;
+  m_scratchSpaceCount = 0;
+  m_scratchFlagsCount = 0;
+  m_scratchSpace      = nullptr;
+  m_scratchFlags      = nullptr;
+  m_stream            = nullptr;
+  for (int i = 0; i < m_n_team_scratch; ++i) {
+    m_team_scratch_current_size[i] = 0;
+    m_team_scratch_ptr[i]          = nullptr;
   }
-}
 
-char *HIPInternal::get_next_driver(size_t driverTypeSize) const {
-  if (d_driverWorkArray == nullptr) {
-    KOKKOS_IMPL_HIP_SAFE_CALL(
-        hipHostMalloc(&d_driverWorkArray,
-                      m_maxDriverCycles * m_maxDriverTypeSize * sizeof(char),
-                      hipHostMallocNonCoherent));
-  }
-  if (driverTypeSize > m_maxDriverTypeSize) {
-    // fence handles the cycle id reset for us
-    fence(
-        "Kokkos::HIPInternal::get_next_driver: fence before reallocating "
-        "resources");
-    KOKKOS_IMPL_HIP_SAFE_CALL(hipHostFree(d_driverWorkArray));
-    m_maxDriverTypeSize = driverTypeSize;
-    if (m_maxDriverTypeSize % 128 != 0)
-      m_maxDriverTypeSize =
-          m_maxDriverTypeSize + 128 - m_maxDriverTypeSize % 128;
-    KOKKOS_IMPL_HIP_SAFE_CALL(
-        hipHostMalloc(&d_driverWorkArray,
-                      m_maxDriverCycles * m_maxDriverTypeSize * sizeof(char),
-                      hipHostMallocNonCoherent));
-  } else {
-    m_cycleId = (m_cycleId + 1) % m_maxDriverCycles;
-    if (m_cycleId == 0) {
-      // ensure any outstanding kernels are completed before we wrap around
-      fence(
-          "Kokkos::HIPInternal::get_next_driver: fence before reusing first "
-          "driver");
-    }
-  }
-  return &d_driverWorkArray[m_maxDriverTypeSize * m_cycleId];
+  KOKKOS_IMPL_HIP_SAFE_CALL(hipFree(m_scratch_locks));
+  m_scratch_locks = nullptr;
 }
 
 //----------------------------------------------------------------------------
 
-Kokkos::Experimental::HIP::size_type hip_internal_multiprocessor_count() {
+Kokkos::HIP::size_type hip_internal_multiprocessor_count() {
   return HIPInternal::singleton().m_multiProcCount;
 }
 
-Kokkos::Experimental::HIP::size_type hip_internal_maximum_warp_count() {
+Kokkos::HIP::size_type hip_internal_maximum_warp_count() {
   return HIPInternal::singleton().m_maxWarpCount;
 }
 
-std::array<Kokkos::Experimental::HIP::size_type, 3>
-hip_internal_maximum_grid_count() {
+std::array<Kokkos::HIP::size_type, 3> hip_internal_maximum_grid_count() {
   return HIPInternal::singleton().m_maxBlock;
 }
 
-Kokkos::Experimental::HIP::size_type *hip_internal_scratch_space(
-    const HIP &instance, const std::size_t size) {
+Kokkos::HIP::size_type *hip_internal_scratch_space(const HIP &instance,
+                                                   const std::size_t size) {
   return instance.impl_internal_space_instance()->scratch_space(size);
 }
 
-Kokkos::Experimental::HIP::size_type *hip_internal_scratch_flags(
-    const HIP &instance, const std::size_t size) {
+Kokkos::HIP::size_type *hip_internal_scratch_flags(const HIP &instance,
+                                                   const std::size_t size) {
   return instance.impl_internal_space_instance()->scratch_flags(size);
 }
 
 }  // namespace Impl
-}  // namespace Experimental
 }  // namespace Kokkos
 
 //----------------------------------------------------------------------------
@@ -537,8 +398,7 @@ Kokkos::Experimental::HIP::size_type *hip_internal_scratch_flags(
 namespace Kokkos {
 namespace Impl {
 void hip_device_synchronize(const std::string &name) {
-  Kokkos::Tools::Experimental::Impl::profile_fence_event<
-      Kokkos::Experimental::HIP>(
+  Kokkos::Tools::Experimental::Impl::profile_fence_event<Kokkos::HIP>(
       name,
       Kokkos::Tools::Experimental::SpecialSynchronizationCases::
           GlobalDeviceSynchronization,
@@ -561,9 +421,9 @@ void hip_internal_error_throw(hipError_t e, const char *name, const char *file,
 //----------------------------------------------------------------------------
 
 namespace Kokkos {
-namespace Experimental {
 HIP::size_type HIP::detect_device_count() {
-  return HIPInternalDevices::singleton().m_hipDevCount;
+  int hipDevCount;
+  KOKKOS_IMPL_HIP_SAFE_CALL(hipGetDeviceCount(&hipDevCount));
+  return hipDevCount;
 }
-}  // namespace Experimental
 }  // namespace Kokkos
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.hpp
index d8f265834a0e5103b322201a6a5ab8bb86568b7f..06fab84b56d9b3548945c78f7542f7fb6e31556f 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.hpp
@@ -1,65 +1,42 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /*--------------------------------------------------------------------------*/
 
 #ifndef KOKKOS_HIP_INSTANCE_HPP
 #define KOKKOS_HIP_INSTANCE_HPP
 
-#include <Kokkos_HIP_Space.hpp>
+#include <HIP/Kokkos_HIP_Space.hpp>
 #include <HIP/Kokkos_HIP_Error.hpp>
 
 #include <mutex>
 
 namespace Kokkos {
-namespace Experimental {
 namespace Impl {
 
 struct HIPTraits {
+#if defined(KOKKOS_ARCH_VEGA)
   static int constexpr WarpSize       = 64;
   static int constexpr WarpIndexMask  = 0x003f; /* hexadecimal for 63 */
   static int constexpr WarpIndexShift = 6;      /* WarpSize == 1 << WarpShift*/
+#elif defined(KOKKOS_ARCH_NAVI)
+  static int constexpr WarpSize       = 32;
+  static int constexpr WarpIndexMask  = 0x001f; /* hexadecimal for 31 */
+  static int constexpr WarpIndexShift = 5;      /* WarpSize == 1 << WarpShift*/
+#endif
   static int constexpr ConservativeThreadsPerBlock =
       256;  // conservative fallback blocksize in case of spills
   static int constexpr MaxThreadsPerBlock =
@@ -88,70 +65,64 @@ class HIPInternal {
   HIPInternal &operator=(const HIPInternal &);
 
  public:
-  using size_type = ::Kokkos::Experimental::HIP::size_type;
-
-  int m_hipDev                        = -1;
-  int m_hipArch                       = -1;
-  unsigned m_multiProcCount           = 0;
-  unsigned m_maxWarpCount             = 0;
-  std::array<size_type, 3> m_maxBlock = {0, 0, 0};
-  unsigned m_maxWavesPerCU            = 0;
-  unsigned m_maxSharedWords           = 0;
-  int m_regsPerSM;
-  int m_shmemPerSM       = 0;
-  int m_maxShmemPerBlock = 0;
-  int m_maxThreadsPerSM  = 0;
-
-  // array of DriverTypes to be allocated in host-pinned memory for async
-  // kernel launches
-  mutable char *d_driverWorkArray = nullptr;
-  // number of kernel launches that can be in-flight w/o synchronization
-  const int m_maxDriverCycles = 100;
-  // max size of a DriverType [bytes]
-  mutable size_t m_maxDriverTypeSize = 1024 * 10;
-  // the current index in the driverWorkArray
-  mutable int m_cycleId = 0;
-  // mutex to access d_driverWorkArray
-  mutable std::mutex m_mutexWorkArray;
-  // mutex to access shared memory
-  mutable std::mutex m_mutexSharedMemory;
+  using size_type = ::Kokkos::HIP::size_type;
 
-  // Scratch Spaces for Reductions
-  std::size_t m_scratchSpaceCount = 0;
-  std::size_t m_scratchFlagsCount = 0;
+  inline static int m_hipDev                        = -1;
+  inline static int m_hipArch                       = -1;
+  inline static unsigned m_multiProcCount           = 0;
+  inline static unsigned m_maxWarpCount             = 0;
+  inline static std::array<size_type, 3> m_maxBlock = {0, 0, 0};
+  inline static unsigned m_maxWavesPerCU            = 0;
+  inline static unsigned m_maxSharedWords           = 0;
+  inline static int m_shmemPerSM                    = 0;
+  inline static int m_maxShmemPerBlock              = 0;
+  inline static int m_maxThreadsPerSM               = 0;
 
-  size_type *m_scratchSpace = nullptr;
-  size_type *m_scratchFlags = nullptr;
+  inline static hipDeviceProp_t m_deviceProp;
 
-  hipDeviceProp_t m_deviceProp;
+  static int concurrency();
 
-  hipStream_t m_stream   = nullptr;
-  uint32_t m_instance_id = Kokkos::Tools::Experimental::Impl::idForInstance<
-      Kokkos::Experimental::HIP>(reinterpret_cast<uintptr_t>(this));
+  // Scratch Spaces for Reductions
+  std::size_t m_scratchSpaceCount          = 0;
+  std::size_t m_scratchFlagsCount          = 0;
+  mutable std::size_t m_scratchFunctorSize = 0;
+
+  size_type *m_scratchSpace               = nullptr;
+  size_type *m_scratchFlags               = nullptr;
+  mutable size_type *m_scratchFunctor     = nullptr;
+  mutable size_type *m_scratchFunctorHost = nullptr;
+  inline static std::mutex scratchFunctorMutex;
+
+  hipStream_t m_stream = nullptr;
+  uint32_t m_instance_id =
+      Kokkos::Tools::Experimental::Impl::idForInstance<HIP>(
+          reinterpret_cast<uintptr_t>(this));
   bool m_manage_stream = false;
 
   // Team Scratch Level 1 Space
-  mutable int64_t m_team_scratch_current_size = 0;
-  mutable void *m_team_scratch_ptr            = nullptr;
-  mutable std::mutex m_team_scratch_mutex;
+  int m_n_team_scratch                            = 10;
+  mutable int64_t m_team_scratch_current_size[10] = {};
+  mutable void *m_team_scratch_ptr[10]            = {};
+  mutable std::atomic_int m_team_scratch_pool[10] = {};
   std::int32_t *m_scratch_locks;
 
   bool was_finalized = false;
 
   // FIXME_HIP: these want to be per-device, not per-stream...  use of 'static'
   // here will break once there are multiple devices though
-  static unsigned long *constantMemHostStaging;
-  static hipEvent_t constantMemReusable;
-  static std::mutex constantMemMutex;
+  inline static unsigned long *constantMemHostStaging = nullptr;
+  inline static hipEvent_t constantMemReusable        = nullptr;
+  inline static std::mutex constantMemMutex;
 
   static HIPInternal &singleton();
 
   int verify_is_initialized(const char *const label) const;
 
-  int is_initialized() const { return m_hipDev >= 0; }
+  int is_initialized() const {
+    return nullptr != m_scratchSpace && nullptr != m_scratchFlags;
+  }
 
-  void initialize(int hip_device_id, hipStream_t stream = nullptr,
-                  bool manage_stream = false);
+  void initialize(hipStream_t stream, bool manage_stream);
   void finalize();
 
   void print_configuration(std::ostream &) const;
@@ -159,24 +130,26 @@ class HIPInternal {
   void fence() const;
   void fence(const std::string &) const;
 
-  // returns the next driver type pointer in our work array
-  char *get_next_driver(size_t driverTypeSize) const;
-
   ~HIPInternal();
 
   HIPInternal() = default;
 
   // Resizing of reduction related scratch spaces
-  size_type *scratch_space(const std::size_t size);
-  size_type *scratch_flags(const std::size_t size);
+  size_type *scratch_space(std::size_t const size);
+  size_type *scratch_flags(std::size_t const size);
+  size_type *stage_functor_for_execution(void const *driver,
+                                         std::size_t const size) const;
   uint32_t impl_get_instance_id() const noexcept;
+  int acquire_team_scratch_space();
   // Resizing of team level 1 scratch
-  void *resize_team_scratch_space(std::int64_t bytes,
+  void *resize_team_scratch_space(int scratch_pool_id, std::int64_t bytes,
                                   bool force_shrink = false);
+  void release_team_scratch_space(int scratch_pool_id);
 };
 
 }  // namespace Impl
 
+namespace Experimental {
 // Partitioning an Execution Space: expects space and integer arguments for
 // relative weight
 //   Customization point for backends
@@ -194,11 +167,9 @@ inline void create_HIP_instances(std::vector<HIP> &instances) {
 
 template <class... Args>
 std::vector<HIP> partition_space(const HIP &, Args...) {
-#ifdef __cpp_fold_expressions
   static_assert(
       (... && std::is_arithmetic_v<Args>),
       "Kokkos Error: partitioning arguments must be integers or floats");
-#endif
 
   std::vector<HIP> instances(sizeof...(Args));
   Impl::create_HIP_instances(instances);
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_KernelLaunch.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_KernelLaunch.hpp
index 70b979e00abd6775904b900899eb3200a8c00581..8e8895f65a960c000da6941f8d67ac57bd64817a 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_KernelLaunch.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_KernelLaunch.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HIP_KERNEL_LAUNCH_HPP
 #define KOKKOS_HIP_KERNEL_LAUNCH_HPP
@@ -51,7 +23,7 @@
 
 #include <HIP/Kokkos_HIP_Error.hpp>
 #include <HIP/Kokkos_HIP_Instance.hpp>
-#include <Kokkos_HIP_Space.hpp>
+#include <HIP/Kokkos_HIP_Space.hpp>
 #include <HIP/Kokkos_HIP_Locks.hpp>
 
 // Must use global variable on the device with HIP-Clang
@@ -61,23 +33,19 @@ __device__ __constant__ extern unsigned long
     kokkos_impl_hip_constant_memory_buffer[];
 #else
 __device__ __constant__ unsigned long kokkos_impl_hip_constant_memory_buffer
-    [Kokkos::Experimental::Impl::HIPTraits::ConstantMemoryUsage /
-     sizeof(unsigned long)];
+    [Kokkos::Impl::HIPTraits::ConstantMemoryUsage / sizeof(unsigned long)];
 #endif
 #endif
 
 namespace Kokkos {
-namespace Experimental {
 template <typename T>
 inline __device__ T *kokkos_impl_hip_shared_memory() {
-  extern __shared__ Kokkos::Experimental::HIPSpace::size_type sh[];
+  extern __shared__ Kokkos::HIPSpace::size_type sh[];
   return (T *)sh;
 }
-}  // namespace Experimental
 }  // namespace Kokkos
 
 namespace Kokkos {
-namespace Experimental {
 namespace Impl {
 
 // The hip_parallel_launch_*_memory code is identical to the cuda code
@@ -100,18 +68,16 @@ __global__ __launch_bounds__(
 
 template <class DriverType>
 __global__ static void hip_parallel_launch_local_memory(
-    const DriverType *driver) {
-  // FIXME_HIP driver() pass by copy
-  driver->operator()();
+    const DriverType driver) {
+  driver();
 }
 
 template <class DriverType, unsigned int maxTperB, unsigned int minBperSM>
 __global__ __launch_bounds__(
     maxTperB,
     minBperSM) static void hip_parallel_launch_local_memory(const DriverType
-                                                                *driver) {
-  // FIXME_HIP driver() pass by copy
-  driver->operator()();
+                                                                driver) {
+  driver();
 }
 
 template <typename DriverType>
@@ -161,6 +127,9 @@ struct DeduceHIPLaunchMechanism {
       light_weight = Kokkos::Experimental::WorkItemProperty::HintLightWeight;
   static constexpr Kokkos::Experimental::WorkItemProperty::HintHeavyWeight_t
       heavy_weight = Kokkos::Experimental::WorkItemProperty::HintHeavyWeight;
+  static constexpr Kokkos::Experimental::WorkItemProperty::
+      ImplForceGlobalLaunch_t force_global_launch =
+          Kokkos::Experimental::WorkItemProperty::ImplForceGlobalLaunch;
   static constexpr typename DriverType::Policy::work_item_property property =
       typename DriverType::Policy::work_item_property();
 
@@ -194,15 +163,17 @@ struct DeduceHIPLaunchMechanism {
   // Kal<F<CMU     CG  LCG C  C        CG  LG C  G    CG  CG C  C
   // CMU<F          G  LCG G  G         G  LG G  G     G  CG G  G
   static constexpr HIPLaunchMechanism launch_mechanism =
-      ((property & light_weight) == light_weight)
-          ? (sizeof(DriverType) < HIPTraits::KernelArgumentLimit
-                 ? HIPLaunchMechanism::LocalMemory
-                 : HIPLaunchMechanism::GlobalMemory)
-          : (((property & heavy_weight) == heavy_weight)
-                 ? (sizeof(DriverType) < HIPTraits::ConstantMemoryUsage
-                        ? HIPLaunchMechanism::ConstantMemory
-                        : HIPLaunchMechanism::GlobalMemory)
-                 : (default_launch_mechanism));
+      ((property & force_global_launch) == force_global_launch)
+          ? HIPLaunchMechanism::GlobalMemory
+          : ((property & light_weight) == light_weight)
+                ? (sizeof(DriverType) < HIPTraits::KernelArgumentLimit
+                       ? HIPLaunchMechanism::LocalMemory
+                       : HIPLaunchMechanism::GlobalMemory)
+                : (((property & heavy_weight) == heavy_weight)
+                       ? (sizeof(DriverType) < HIPTraits::ConstantMemoryUsage
+                              ? HIPLaunchMechanism::ConstantMemory
+                              : HIPLaunchMechanism::GlobalMemory)
+                       : (default_launch_mechanism));
 };
 
 template <typename DriverType, typename LaunchBounds,
@@ -391,7 +362,7 @@ struct HIPParallelLaunchKernelInvoker<DriverType, LaunchBounds,
   using base_t = HIPParallelLaunchKernelFunc<DriverType, LaunchBounds,
                                              HIPLaunchMechanism::LocalMemory>;
 
-  static void invoke_kernel(DriverType const *driver, dim3 const &grid,
+  static void invoke_kernel(DriverType const &driver, dim3 const &grid,
                             dim3 const &block, int shmem,
                             HIPInternal const *hip_instance) {
     (base_t::get_kernel_func())<<<grid, block, shmem, hip_instance->m_stream>>>(
@@ -408,13 +379,16 @@ struct HIPParallelLaunchKernelInvoker<DriverType, LaunchBounds,
   using base_t = HIPParallelLaunchKernelFunc<DriverType, LaunchBounds,
                                              HIPLaunchMechanism::GlobalMemory>;
 
-  // FIXME_HIP the code is different than cuda because driver cannot be passed
-  // by copy
-  static void invoke_kernel(DriverType const *driver, dim3 const &grid,
+  static void invoke_kernel(DriverType const &driver, dim3 const &grid,
                             dim3 const &block, int shmem,
                             HIPInternal const *hip_instance) {
+    // Wait until the previous kernel that uses m_scratchFuntor is done
+    std::lock_guard<std::mutex> lock(HIPInternal::scratchFunctorMutex);
+    DriverType *driver_ptr = reinterpret_cast<DriverType *>(
+        hip_instance->stage_functor_for_execution(
+            reinterpret_cast<void const *>(&driver), sizeof(DriverType)));
     (base_t::get_kernel_func())<<<grid, block, shmem, hip_instance->m_stream>>>(
-        driver);
+        driver_ptr);
   }
 };
 
@@ -431,7 +405,7 @@ struct HIPParallelLaunchKernelInvoker<DriverType, LaunchBounds,
                 "Kokkos Error: Requested HIPLaunchConstantMemory with a "
                 "Functor larger than 32kB.");
 
-  static void invoke_kernel(DriverType const *driver, dim3 const &grid,
+  static void invoke_kernel(DriverType const &driver, dim3 const &grid,
                             dim3 const &block, int shmem,
                             HIPInternal const *hip_instance) {
     // Wait until the previous kernel that uses the constant buffer is done
@@ -441,7 +415,8 @@ struct HIPParallelLaunchKernelInvoker<DriverType, LaunchBounds,
 
     // Copy functor (synchronously) to staging buffer in pinned host memory
     unsigned long *staging = hip_instance->constantMemHostStaging;
-    std::memcpy((void *)staging, (void *)driver, sizeof(DriverType));
+    std::memcpy(static_cast<void *>(staging),
+                static_cast<const void *>(&driver), sizeof(DriverType));
 
     // Copy functor asynchronously from there to constant memory on the device
     KOKKOS_IMPL_HIP_SAFE_CALL(hipMemcpyToSymbolAsync(
@@ -490,18 +465,13 @@ struct HIPParallelLaunch<
 
       KOKKOS_ENSURE_HIP_LOCK_ARRAYS_ON_DEVICE();
 
-      std::lock_guard<std::mutex> const lock(hip_instance->m_mutexWorkArray);
-
       // Invoke the driver function on the device
-      DriverType *d_driver = reinterpret_cast<DriverType *>(
-          hip_instance->get_next_driver(sizeof(DriverType)));
-      std::memcpy((void *)d_driver, (void *)&driver, sizeof(DriverType));
-      base_t::invoke_kernel(d_driver, grid, block, shmem, hip_instance);
+      base_t::invoke_kernel(driver, grid, block, shmem, hip_instance);
 
 #if defined(KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK)
       KOKKOS_IMPL_HIP_SAFE_CALL(hipGetLastError());
       hip_instance->fence(
-          "Kokkos::Experimental::Impl::HIParallelLaunch: Debug Only Check for "
+          "Kokkos::Impl::HIParallelLaunch: Debug Only Check for "
           "Execution Error");
 #endif
     }
@@ -521,9 +491,8 @@ void hip_parallel_launch(const DriverType &driver, const dim3 &grid,
   HIPParallelLaunch<DriverType, LaunchBounds, LaunchMechanism>(
       driver, grid, block, shmem, hip_instance, prefer_shmem);
 #else
-  // FIXME_HIP - could be if constexpr for c++17
-  if (!HIPParallelLaunch<DriverType, LaunchBounds,
-                         LaunchMechanism>::default_launchbounds()) {
+  if constexpr (!HIPParallelLaunch<DriverType, LaunchBounds,
+                                   LaunchMechanism>::default_launchbounds()) {
     // for user defined, we *always* honor the request
     HIPParallelLaunch<DriverType, LaunchBounds, LaunchMechanism>(
         driver, grid, block, shmem, hip_instance, prefer_shmem);
@@ -547,7 +516,6 @@ void hip_parallel_launch(const DriverType &driver, const dim3 &grid,
 #endif
 }
 }  // namespace Impl
-}  // namespace Experimental
 }  // namespace Kokkos
 
 #endif
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.cpp
index f1ffaf3753a3edef4431f1838d7cbd302f410277..76d3f6f5c8ef4079f2854ee7525f513159fb01a5 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.cpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -50,7 +22,8 @@
 
 #include <HIP/Kokkos_HIP_Locks.hpp>
 #include <HIP/Kokkos_HIP_Error.hpp>
-#include <Kokkos_HIP_Space.hpp>
+#include <HIP/Kokkos_HIP.hpp>
+#include <HIP/Kokkos_HIP_Instance.hpp>
 
 #include <hip/hip_runtime.h>
 
@@ -91,7 +64,7 @@ void initialize_host_hip_lock_arrays() {
       &g_host_hip_lock_arrays.atomic,
       sizeof(std::int32_t) * (KOKKOS_IMPL_HIP_SPACE_ATOMIC_MASK + 1)));
 
-  g_host_hip_lock_arrays.n = ::Kokkos::Experimental::HIP::concurrency();
+  g_host_hip_lock_arrays.n = HIPInternal::concurrency();
 
   KOKKOS_COPY_HIP_LOCK_ARRAYS_TO_DEVICE();
   init_lock_array_kernel_atomic<<<
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.hpp
index c72616dab166ccd0e1f3744eebbc1e2c941bf367..fbed4afd3f434c8f1fdefdb34fb7be4f20a96024 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HIP_LOCKS_HPP
 #define KOKKOS_HIP_LOCKS_HPP
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_MDRangePolicy.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_MDRangePolicy.hpp
index acb538e1cb3970bab9bafc2f44d3568b34c6c31f..58e13cf3e824408984ae559ebc46fc81f2e91cf8 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_MDRangePolicy.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_MDRangePolicy.hpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #ifndef KOKKOS_HIP_MDRANGEPOLICY_HPP_
 #define KOKKOS_HIP_MDRANGEPOLICY_HPP_
 
@@ -6,13 +22,13 @@
 namespace Kokkos {
 
 template <>
-struct default_outer_direction<Kokkos::Experimental::HIP> {
+struct default_outer_direction<HIP> {
   using type                     = Iterate;
   static constexpr Iterate value = Iterate::Left;
 };
 
 template <>
-struct default_inner_direction<Kokkos::Experimental::HIP> {
+struct default_inner_direction<HIP> {
   using type                     = Iterate;
   static constexpr Iterate value = Iterate::Left;
 };
@@ -21,18 +37,21 @@ namespace Impl {
 
 // Settings for MDRangePolicy
 template <>
-inline TileSizeProperties get_tile_size_properties<Kokkos::Experimental::HIP>(
-    const Kokkos::Experimental::HIP& space) {
+inline TileSizeProperties get_tile_size_properties<HIP>(const HIP& space) {
   TileSizeProperties properties;
   properties.max_threads =
       space.impl_internal_space_instance()->m_maxThreadsPerSM;
   properties.default_largest_tile_size = 16;
   properties.default_tile_size         = 4;
-  properties.max_total_tile_size =
-      Kokkos::Experimental::Impl::HIPTraits::MaxThreadsPerBlock;
+  properties.max_total_tile_size       = HIPTraits::MaxThreadsPerBlock;
   return properties;
 }
 
+// Settings for TeamMDRangePolicy
+template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector>
+struct ThreadAndVectorNestLevel<Rank, HIP, ThreadAndVector>
+    : AcceleratorBasedNestLevel<Rank, ThreadAndVector> {};
+
 }  // Namespace Impl
 }  // Namespace Kokkos
 #endif
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_MDRange.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_MDRange.hpp
index 212bbb9ecd8a35f30f0d121d1b368af087d13c8a..10ec301d15d1fcfd735b809a43aad858362f3fad 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_MDRange.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_MDRange.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HIP_PARALLEL_MDRANGE_HPP
 #define KOKKOS_HIP_PARALLEL_MDRANGE_HPP
@@ -56,8 +28,7 @@ namespace Kokkos {
 namespace Impl {
 // ParallelFor
 template <class FunctorType, class... Traits>
-class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
-                  Kokkos::Experimental::HIP> {
+class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, HIP> {
  public:
   using Policy = Kokkos::MDRangePolicy<Traits...>;
 
@@ -81,11 +52,9 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
   }
 
   inline void execute() const {
-    using ClosureType =
-        ParallelFor<FunctorType, Policy, Kokkos::Experimental::HIP>;
+    using ClosureType = ParallelFor<FunctorType, Policy, HIP>;
     if (m_policy.m_num_tiles == 0) return;
-    auto const maxblocks =
-        Kokkos::Experimental::Impl::hip_internal_maximum_grid_count();
+    auto const maxblocks = hip_internal_maximum_grid_count();
     if (Policy::rank == 2) {
       dim3 const block(m_policy.m_tile[0], m_policy.m_tile[1], 1);
       dim3 const grid(
@@ -98,8 +67,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
                   block.y,
               maxblocks[1]),
           1);
-      Kokkos::Experimental::Impl::hip_parallel_launch<ClosureType,
-                                                      LaunchBounds>(
+      hip_parallel_launch<ClosureType, LaunchBounds>(
           *this, grid, block, 0,
           m_policy.space().impl_internal_space_instance(), false);
     } else if (Policy::rank == 3) {
@@ -118,8 +86,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
               (m_policy.m_upper[2] - m_policy.m_lower[2] + block.z - 1) /
                   block.z,
               maxblocks[2]));
-      Kokkos::Experimental::Impl::hip_parallel_launch<ClosureType,
-                                                      LaunchBounds>(
+      hip_parallel_launch<ClosureType, LaunchBounds>(
           *this, grid, block, 0,
           m_policy.space().impl_internal_space_instance(), false);
     } else if (Policy::rank == 4) {
@@ -138,8 +105,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
               (m_policy.m_upper[3] - m_policy.m_lower[3] + block.z - 1) /
                   block.z,
               maxblocks[2]));
-      Kokkos::Experimental::Impl::hip_parallel_launch<ClosureType,
-                                                      LaunchBounds>(
+      hip_parallel_launch<ClosureType, LaunchBounds>(
           *this, grid, block, 0,
           m_policy.space().impl_internal_space_instance(), false);
     } else if (Policy::rank == 5) {
@@ -157,8 +123,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
               (m_policy.m_upper[4] - m_policy.m_lower[4] + block.z - 1) /
                   block.z,
               maxblocks[2]));
-      Kokkos::Experimental::Impl::hip_parallel_launch<ClosureType,
-                                                      LaunchBounds>(
+      hip_parallel_launch<ClosureType, LaunchBounds>(
           *this, grid, block, 0,
           m_policy.space().impl_internal_space_instance(), false);
     } else if (Policy::rank == 6) {
@@ -174,8 +139,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
               m_policy.m_tile_end[2] * m_policy.m_tile_end[3], maxblocks[1]),
           std::min<array_index_type>(
               m_policy.m_tile_end[4] * m_policy.m_tile_end[5], maxblocks[2]));
-      Kokkos::Experimental::Impl::hip_parallel_launch<ClosureType,
-                                                      LaunchBounds>(
+      hip_parallel_launch<ClosureType, LaunchBounds>(
           *this, grid, block, 0,
           m_policy.space().impl_internal_space_instance(), false);
     } else {
@@ -190,11 +154,8 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
   template <typename Policy, typename Functor>
   static int max_tile_size_product(const Policy&, const Functor&) {
     using closure_type =
-        ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
-                    Kokkos::Experimental::HIP>;
-    unsigned block_size =
-        Kokkos::Experimental::Impl::hip_get_max_blocksize<closure_type,
-                                                          LaunchBounds>();
+        ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, HIP>;
+    unsigned block_size = hip_get_max_blocksize<closure_type, LaunchBounds>();
     if (block_size == 0)
       Kokkos::Impl::throw_runtime_exception(
           std::string("Kokkos::Impl::ParallelFor< HIP > could not find a valid "
@@ -206,7 +167,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
 // ParallelReduce
 template <class FunctorType, class ReducerType, class... Traits>
 class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
-                     Kokkos::Experimental::HIP> {
+                     HIP> {
  public:
   using Policy = Kokkos::MDRangePolicy<Traits...>;
 
@@ -235,7 +196,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
   using value_type     = typename Analysis::value_type;
   using reference_type = typename Analysis::reference_type;
   using functor_type   = FunctorType;
-  using size_type      = Experimental::HIP::size_type;
+  using size_type      = HIP::size_type;
 
   // Algorithmic constraints: blockSize is a power of two AND blockDim.y ==
   // blockDim.z == 1
@@ -247,9 +208,6 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
   const bool m_result_ptr_device_accessible;
   size_type* m_scratch_space;
   size_type* m_scratch_flags;
-  // Only let one Parallel/Scan modify the shared memory. The
-  // constructor acquires the mutex which is released in the destructor.
-  std::lock_guard<std::mutex> m_shared_memory_lock;
 
   using DeviceIteratePattern = typename Kokkos::Impl::Reduce::DeviceIterateTile<
       Policy::rank, Policy, FunctorType, WorkTag, reference_type>;
@@ -271,7 +229,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
 
     {
       reference_type value = final_reducer.init(reinterpret_cast<pointer_type>(
-          Experimental::kokkos_impl_hip_shared_memory<size_type>() +
+          kokkos_impl_hip_shared_memory<size_type>() +
           threadIdx.y * word_count.value));
 
       // Number of blocks is bounded so that the reduction can be limited to two
@@ -287,13 +245,12 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
     // Problem: non power-of-two blockDim
     if (::Kokkos::Impl::hip_single_inter_block_reduce_scan<false>(
             final_reducer, blockIdx.x, gridDim.x,
-            Experimental::kokkos_impl_hip_shared_memory<size_type>(),
-            m_scratch_space, m_scratch_flags)) {
+            kokkos_impl_hip_shared_memory<size_type>(), m_scratch_space,
+            m_scratch_flags)) {
       // This is the final block with the final result at the final threads'
       // location
-      size_type* const shared =
-          Experimental::kokkos_impl_hip_shared_memory<size_type>() +
-          (blockDim.y - 1) * word_count.value;
+      size_type* const shared = kokkos_impl_hip_shared_memory<size_type>() +
+                                (blockDim.y - 1) * word_count.value;
       size_type* const global = m_result_ptr_device_accessible
                                     ? reinterpret_cast<size_type*>(m_result_ptr)
                                     : m_scratch_space;
@@ -302,7 +259,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
         final_reducer.final(reinterpret_cast<value_type*>(shared));
       }
 
-      if (Experimental::Impl::HIPTraits::WarpSize < word_count.value) {
+      if (Impl::HIPTraits::WarpSize < word_count.value) {
         __syncthreads();
       }
 
@@ -320,12 +277,10 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
       return hip_single_inter_block_reduce_scan_shmem<false, FunctorType,
                                                       WorkTag>(f, n);
     };
-    using closure_type = ParallelReduce<FunctorType, Policy, ReducerType,
-                                        Kokkos::Experimental::HIP>;
+    using closure_type = ParallelReduce<FunctorType, Policy, ReducerType, HIP>;
 
     unsigned block_size =
-        Kokkos::Experimental::Impl::hip_get_preferred_blocksize<closure_type,
-                                                                LaunchBounds>(
+        Kokkos::Impl::hip_get_preferred_blocksize<closure_type, LaunchBounds>(
             instance, shmem_functor);
     if (block_size == 0) {
       Kokkos::Impl::throw_runtime_exception(
@@ -339,9 +294,9 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
     typename Analysis::Reducer final_reducer(
         &ReducerConditional::select(m_functor, m_reducer));
 
-    using ClosureType = ParallelReduce<FunctorType, Policy, ReducerType,
-                                       Kokkos::Experimental::HIP>;
-    const auto nwork  = m_policy.m_num_tiles;
+    using ClosureType =
+        ParallelReduce<FunctorType, Policy, ReducerType, Kokkos::HIP>;
+    const auto nwork = m_policy.m_num_tiles;
     if (nwork) {
       int block_size = m_policy.m_prod_tile_dims;
       // CONSTRAINT: Algorithm requires block_size >= product of tile dimensions
@@ -355,15 +310,12 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
                        : suggested_blocksize;  // Note: block_size must be less
                                                // than or equal to 512
 
-      m_scratch_space =
-          ::Kokkos::Experimental::Impl::hip_internal_scratch_space(
-              m_policy.space(),
-              Analysis::value_size(
-                  ReducerConditional::select(m_functor, m_reducer)) *
-                  block_size /* block_size == max block_count */);
+      m_scratch_space = hip_internal_scratch_space(
+          m_policy.space(), Analysis::value_size(ReducerConditional::select(
+                                m_functor, m_reducer)) *
+                                block_size /* block_size == max block_count */);
       m_scratch_flags =
-          ::Kokkos::Experimental::Impl::hip_internal_scratch_flags(
-              m_policy.space(), sizeof(size_type));
+          hip_internal_scratch_flags(m_policy.space(), sizeof(size_type));
 
       // REQUIRED ( 1 , N , 1 )
       const dim3 block(1, block_size, 1);
@@ -376,8 +328,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
           ::Kokkos::Impl::hip_single_inter_block_reduce_scan_shmem<
               false, FunctorType, WorkTag>(m_functor, block.y);
 
-      Kokkos::Experimental::Impl::hip_parallel_launch<ClosureType,
-                                                      LaunchBounds>(
+      hip_parallel_launch<ClosureType, LaunchBounds>(
           *this, grid, block, shmem,
           m_policy.space().impl_internal_space_instance(),
           false);  // copy to device and execute
@@ -385,8 +336,8 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
       if (!m_result_ptr_device_accessible && m_result_ptr) {
         const int size = Analysis::value_size(
             ReducerConditional::select(m_functor, m_reducer));
-        DeepCopy<HostSpace, Experimental::HIPSpace, Experimental::HIP>(
-            m_policy.space(), m_result_ptr, m_scratch_space, size);
+        DeepCopy<HostSpace, HIPSpace, HIP>(m_policy.space(), m_result_ptr,
+                                           m_scratch_space, size);
       }
     } else {
       if (m_result_ptr) {
@@ -405,13 +356,10 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
         m_reducer(InvalidType()),
         m_result_ptr(arg_result.data()),
         m_result_ptr_device_accessible(
-            MemorySpaceAccess<Kokkos::Experimental::HIPSpace,
+            MemorySpaceAccess<HIPSpace,
                               typename ViewType::memory_space>::accessible),
         m_scratch_space(nullptr),
-        m_scratch_flags(nullptr),
-        m_shared_memory_lock(m_policy.space()
-                                 .impl_internal_space_instance()
-                                 ->m_mutexSharedMemory) {}
+        m_scratch_flags(nullptr) {}
 
   ParallelReduce(const FunctorType& arg_functor, const Policy& arg_policy,
                  const ReducerType& reducer)
@@ -420,23 +368,17 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
         m_reducer(reducer),
         m_result_ptr(reducer.view().data()),
         m_result_ptr_device_accessible(
-            MemorySpaceAccess<Kokkos::Experimental::HIPSpace,
-                              typename ReducerType::result_view_type::
-                                  memory_space>::accessible),
+            MemorySpaceAccess<HIPSpace, typename ReducerType::result_view_type::
+                                            memory_space>::accessible),
         m_scratch_space(nullptr),
-        m_scratch_flags(nullptr),
-        m_shared_memory_lock(m_policy.space()
-                                 .impl_internal_space_instance()
-                                 ->m_mutexSharedMemory) {}
+        m_scratch_flags(nullptr) {}
 
   template <typename Policy, typename Functor>
   static int max_tile_size_product(const Policy&, const Functor&) {
     using closure_type =
         ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>,
-                       ReducerType, Kokkos::Experimental::HIP>;
-    unsigned block_size =
-        Kokkos::Experimental::Impl::hip_get_max_blocksize<closure_type,
-                                                          LaunchBounds>();
+                       ReducerType, HIP>;
+    unsigned block_size = hip_get_max_blocksize<closure_type, LaunchBounds>();
     if (block_size == 0) {
       Kokkos::Impl::throw_runtime_exception(
           std::string("Kokkos::Impl::ParallelReduce< HIP > could not find a "
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_Range.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_Range.hpp
index dca1fb9073e6de4f5889e0ae61c0f5a5787254de..d8c52aa95f7e991e0c65c250c41d6cd743590604 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_Range.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_Range.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKO_HIP_PARALLEL_RANGE_HPP
 #define KOKKO_HIP_PARALLEL_RANGE_HPP
@@ -59,8 +31,7 @@ namespace Kokkos {
 namespace Impl {
 
 template <class FunctorType, class... Traits>
-class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>,
-                  Kokkos::Experimental::HIP> {
+class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::HIP> {
  public:
   using Policy = Kokkos::RangePolicy<Traits...>;
 
@@ -106,11 +77,9 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>,
   inline void execute() const {
     const typename Policy::index_type nwork = m_policy.end() - m_policy.begin();
 
-    using DriverType =
-        ParallelFor<FunctorType, Policy, Kokkos::Experimental::HIP>;
+    using DriverType = ParallelFor<FunctorType, Policy, Kokkos::HIP>;
     const int block_size =
-        Kokkos::Experimental::Impl::hip_get_preferred_blocksize<DriverType,
-                                                                LaunchBounds>();
+        Kokkos::Impl::hip_get_preferred_blocksize<DriverType, LaunchBounds>();
     const dim3 block(1, block_size, 1);
     const dim3 grid(
         typename Policy::index_type((nwork + block.y - 1) / block.y), 1, 1);
@@ -120,7 +89,7 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>,
           std::string("Kokkos::Impl::ParallelFor< HIP > could not find a "
                       "valid execution configuration."));
     }
-    Kokkos::Experimental::Impl::hip_parallel_launch<DriverType, LaunchBounds>(
+    Kokkos::Impl::hip_parallel_launch<DriverType, LaunchBounds>(
         *this, grid, block, 0, m_policy.space().impl_internal_space_instance(),
         false);
   }
@@ -134,7 +103,7 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>,
 
 template <class FunctorType, class ReducerType, class... Traits>
 class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
-                     Kokkos::Experimental::HIP> {
+                     Kokkos::HIP> {
  public:
   using Policy = Kokkos::RangePolicy<Traits...>;
 
@@ -161,7 +130,7 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
   using value_type     = typename Analysis::value_type;
   using reference_type = typename Analysis::reference_type;
   using functor_type   = FunctorType;
-  using size_type      = Kokkos::Experimental::HIP::size_type;
+  using size_type      = Kokkos::HIP::size_type;
   using index_type     = typename Policy::index_type;
 
   // Algorithmic constraints: blockSize is a power of two AND blockDim.y ==
@@ -175,9 +144,6 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
   const bool m_result_ptr_host_accessible;
   size_type* m_scratch_space = nullptr;
   size_type* m_scratch_flags = nullptr;
-  // Only let one ParallelReduce/Scan modify the shared memory. The
-  // constructor acquires the mutex which is released in the destructor.
-  std::lock_guard<std::mutex> m_shared_memory_lock;
 
   static bool constexpr UseShflReduction =
       static_cast<bool>(Analysis::StaticValueSize);
@@ -217,7 +183,7 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
         &ReducerConditional::select(m_functor, m_reducer));
     {
       reference_type value = final_reducer.init(reinterpret_cast<pointer_type>(
-          ::Kokkos::Experimental::kokkos_impl_hip_shared_memory<size_type>() +
+          ::Kokkos::kokkos_impl_hip_shared_memory<size_type>() +
           threadIdx.y * word_count.value));
 
       // Number of blocks is bounded so that the reduction can be limited to two
@@ -240,14 +206,14 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
     if (!do_final_reduction)
       do_final_reduction = hip_single_inter_block_reduce_scan<false>(
           final_reducer, blockIdx.x, gridDim.x,
-          ::Kokkos::Experimental::kokkos_impl_hip_shared_memory<size_type>(),
-          m_scratch_space, m_scratch_flags);
+          ::Kokkos::kokkos_impl_hip_shared_memory<size_type>(), m_scratch_space,
+          m_scratch_flags);
     if (do_final_reduction) {
       // This is the final block with the final result at the final threads'
       // location
 
       size_type* const shared =
-          ::Kokkos::Experimental::kokkos_impl_hip_shared_memory<size_type>() +
+          ::Kokkos::kokkos_impl_hip_shared_memory<size_type>() +
           (blockDim.y - 1) * word_count.value;
       size_type* const global = m_result_ptr_device_accessible
                                     ? reinterpret_cast<size_type*>(m_result_ptr)
@@ -257,8 +223,7 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
         final_reducer.final(reinterpret_cast<value_type*>(shared));
       }
 
-      if (::Kokkos::Experimental::Impl::HIPTraits::WarpSize <
-          word_count.value) {
+      if (::Kokkos::Impl::HIPTraits::WarpSize < word_count.value) {
         __syncthreads();
       }
 
@@ -323,10 +288,10 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
       return hip_single_inter_block_reduce_scan_shmem<false, FunctorType,
                                                       WorkTag>(f, n);
     };
-    using DriverType = ParallelReduce<FunctorType, Policy, ReducerType,
-                                      Kokkos::Experimental::HIP>;
-    return Kokkos::Experimental::Impl::hip_get_preferred_blocksize<
-        DriverType, LaunchBounds>(instance, shmem_functor);
+    using DriverType =
+        ParallelReduce<FunctorType, Policy, ReducerType, Kokkos::HIP>;
+    return Kokkos::Impl::hip_get_preferred_blocksize<DriverType, LaunchBounds>(
+        instance, shmem_functor);
   }
 
   inline void execute() {
@@ -346,15 +311,12 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
                         "valid execution configuration."));
       }
 
-      m_scratch_space =
-          ::Kokkos::Experimental::Impl::hip_internal_scratch_space(
-              m_policy.space(),
-              Analysis::value_size(
-                  ReducerConditional::select(m_functor, m_reducer)) *
-                  block_size /* block_size == max block_count */);
-      m_scratch_flags =
-          ::Kokkos::Experimental::Impl::hip_internal_scratch_flags(
-              m_policy.space(), sizeof(size_type));
+      m_scratch_space = ::Kokkos::Impl::hip_internal_scratch_space(
+          m_policy.space(), Analysis::value_size(ReducerConditional::select(
+                                m_functor, m_reducer)) *
+                                block_size /* block_size == max block_count */);
+      m_scratch_flags = ::Kokkos::Impl::hip_internal_scratch_flags(
+          m_policy.space(), sizeof(size_type));
 
       // REQUIRED ( 1 , N , 1 )
       dim3 block(1, block_size, 1);
@@ -374,9 +336,9 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
                                                          WorkTag>(m_functor,
                                                                   block.y);
 
-      using DriverType = ParallelReduce<FunctorType, Policy, ReducerType,
-                                        Kokkos::Experimental::HIP>;
-      Kokkos::Experimental::Impl::hip_parallel_launch<DriverType, LaunchBounds>(
+      using DriverType =
+          ParallelReduce<FunctorType, Policy, ReducerType, Kokkos::HIP>;
+      Kokkos::Impl::hip_parallel_launch<DriverType, LaunchBounds>(
           *this, grid, block, shmem,
           m_policy.space().impl_internal_space_instance(),
           false);  // copy to device and execute
@@ -384,9 +346,8 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
       if (!m_result_ptr_device_accessible && m_result_ptr) {
         const int size = Analysis::value_size(
             ReducerConditional::select(m_functor, m_reducer));
-        DeepCopy<HostSpace, ::Kokkos::Experimental::HIPSpace,
-                 ::Kokkos::Experimental::HIP>(m_policy.space(), m_result_ptr,
-                                              m_scratch_space, size);
+        DeepCopy<HostSpace, HIPSpace, HIP>(m_policy.space(), m_result_ptr,
+                                           m_scratch_space, size);
       }
     } else {
       if (m_result_ptr) {
@@ -405,14 +366,11 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
         m_reducer(InvalidType()),
         m_result_ptr(arg_result.data()),
         m_result_ptr_device_accessible(
-            MemorySpaceAccess<Kokkos::Experimental::HIPSpace,
+            MemorySpaceAccess<HIPSpace,
                               typename ViewType::memory_space>::accessible),
         m_result_ptr_host_accessible(
             MemorySpaceAccess<Kokkos::HostSpace,
-                              typename ViewType::memory_space>::accessible),
-        m_shared_memory_lock(m_policy.space()
-                                 .impl_internal_space_instance()
-                                 ->m_mutexSharedMemory) {}
+                              typename ViewType::memory_space>::accessible) {}
 
   ParallelReduce(const FunctorType& arg_functor, const Policy& arg_policy,
                  const ReducerType& reducer)
@@ -421,16 +379,12 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
         m_reducer(reducer),
         m_result_ptr(reducer.view().data()),
         m_result_ptr_device_accessible(
-            MemorySpaceAccess<Kokkos::Experimental::HIPSpace,
-                              typename ReducerType::result_view_type::
-                                  memory_space>::accessible),
+            MemorySpaceAccess<HIPSpace, typename ReducerType::result_view_type::
+                                            memory_space>::accessible),
         m_result_ptr_host_accessible(
             MemorySpaceAccess<Kokkos::HostSpace,
                               typename ReducerType::result_view_type::
-                                  memory_space>::accessible),
-        m_shared_memory_lock(m_policy.space()
-                                 .impl_internal_space_instance()
-                                 ->m_mutexSharedMemory) {}
+                                  memory_space>::accessible) {}
 };
 
 template <class FunctorType, class... Traits>
@@ -452,7 +406,7 @@ class ParallelScanHIPBase {
   using pointer_type   = typename Analysis::pointer_type;
   using reference_type = typename Analysis::reference_type;
   using functor_type   = FunctorType;
-  using size_type      = Kokkos::Experimental::HIP::size_type;
+  using size_type      = HIP::size_type;
   using index_type     = typename Policy::index_type;
   // Conditionally set word_size_type to int16_t or int8_t if value_type is
   // smaller than int32_t (Kokkos::HIP::size_type)
@@ -479,13 +433,12 @@ class ParallelScanHIPBase {
 
   const FunctorType m_functor;
   const Policy m_policy;
+  const pointer_type m_result_ptr;
+  const bool m_result_ptr_device_accessible;
   word_size_type* m_scratch_space = nullptr;
   size_type* m_scratch_flags      = nullptr;
   size_type m_final               = false;
   int m_grid_x                    = 0;
-  // Only let one ParallelReduce/Scan modify the shared memory. The
-  // constructor acquires the mutex which is released in the destructor.
-  std::lock_guard<std::mutex> m_shared_memory_lock;
 
  private:
   template <class TagType>
@@ -510,7 +463,7 @@ class ParallelScanHIPBase {
         word_count(Analysis::value_size(m_functor) / sizeof(word_size_type));
 
     pointer_type const shared_value = reinterpret_cast<pointer_type>(
-        Kokkos::Experimental::kokkos_impl_hip_shared_memory<word_size_type>() +
+        kokkos_impl_hip_shared_memory<word_size_type>() +
         word_count.value * threadIdx.y);
 
     final_reducer.init(shared_value);
@@ -534,8 +487,8 @@ class ParallelScanHIPBase {
     // gridDim.x
     hip_single_inter_block_reduce_scan<true>(
         final_reducer, blockIdx.x, gridDim.x,
-        Kokkos::Experimental::kokkos_impl_hip_shared_memory<word_size_type>(),
-        m_scratch_space, m_scratch_flags);
+        kokkos_impl_hip_shared_memory<word_size_type>(), m_scratch_space,
+        m_scratch_flags);
   }
 
   //----------------------------------------
@@ -550,7 +503,7 @@ class ParallelScanHIPBase {
     // Use shared memory as an exclusive scan: { 0 , value[0] , value[1] ,
     // value[2] , ... }
     word_size_type* const shared_data =
-        Kokkos::Experimental::kokkos_impl_hip_shared_memory<word_size_type>();
+        kokkos_impl_hip_shared_memory<word_size_type>();
     word_size_type* const shared_prefix =
         shared_data + word_count.value * threadIdx.y;
     word_size_type* const shared_accum =
@@ -619,6 +572,9 @@ class ParallelScanHIPBase {
                 reinterpret_cast<pointer_type>(shared_prefix)),
             true);
       }
+      if (iwork + 1 == m_policy.end() && m_policy.end() == range.end() &&
+          m_result_ptr_device_accessible)
+        *m_result_ptr = *reinterpret_cast<pointer_type>(shared_prefix);
     }
   }
 
@@ -633,23 +589,13 @@ class ParallelScanHIPBase {
     }
   }
 
-  // Determine block size constrained by shared memory:
-  virtual inline unsigned local_block_size(const FunctorType& f) = 0;
-
-  inline void impl_execute() {
+  inline void impl_execute(int block_size) {
     const index_type nwork = m_policy.end() - m_policy.begin();
     if (nwork) {
       // FIXME_HIP we cannot choose it larger for large work sizes to work
       // correctly, the unit tests fail with wrong results
       const int gridMaxComputeCapability_2x = 0x01fff;
 
-      const int block_size = static_cast<int>(local_block_size(m_functor));
-      if (block_size == 0) {
-        Kokkos::Impl::throw_runtime_exception(
-            std::string("Kokkos::Impl::ParallelScan< HIP > could not find a "
-                        "valid execution configuration."));
-      }
-
       const int grid_max =
           std::min(block_size * block_size, gridMaxComputeCapability_2x);
 
@@ -663,11 +609,11 @@ class ParallelScanHIPBase {
       // How many block are really needed for this much work:
       m_grid_x = (nwork + work_per_block - 1) / work_per_block;
 
-      m_scratch_space = reinterpret_cast<word_size_type*>(
-          Kokkos::Experimental::Impl::hip_internal_scratch_space(
+      m_scratch_space =
+          reinterpret_cast<word_size_type*>(Impl::hip_internal_scratch_space(
               m_policy.space(), Analysis::value_size(m_functor) * m_grid_x));
-      m_scratch_flags = Kokkos::Experimental::Impl::hip_internal_scratch_flags(
-          m_policy.space(), sizeof(size_type) * 1);
+      m_scratch_flags = Impl::hip_internal_scratch_flags(m_policy.space(),
+                                                         sizeof(size_type) * 1);
 
       dim3 grid(m_grid_x, 1, 1);
       dim3 block(1, block_size, 1);  // REQUIRED DIMENSIONS ( 1 , N , 1 )
@@ -677,40 +623,49 @@ class ParallelScanHIPBase {
       // these ones are OK to be just the base because the specializations
       // do not modify the kernel at all
       using DriverType = ParallelScanHIPBase<FunctorType, Traits...>;
-      Kokkos::Experimental::Impl::hip_parallel_launch<DriverType, LaunchBounds>(
+      Impl::hip_parallel_launch<DriverType, LaunchBounds>(
           *this, grid, block, shmem,
           m_policy.space().impl_internal_space_instance(),
           false);  // copy to device and execute
 
       m_final = true;
-      Kokkos::Experimental::Impl::hip_parallel_launch<DriverType, LaunchBounds>(
+      Impl::hip_parallel_launch<DriverType, LaunchBounds>(
           *this, grid, block, shmem,
           m_policy.space().impl_internal_space_instance(),
           false);  // copy to device and execute
     }
   }
 
-  ParallelScanHIPBase(const FunctorType& arg_functor, const Policy& arg_policy)
+  ParallelScanHIPBase(const FunctorType& arg_functor, const Policy& arg_policy,
+                      pointer_type arg_result_ptr,
+                      bool arg_result_ptr_device_accessible)
       : m_functor(arg_functor),
         m_policy(arg_policy),
-        m_shared_memory_lock(m_policy.space()
-                                 .impl_internal_space_instance()
-                                 ->m_mutexSharedMemory) {}
+        m_result_ptr(arg_result_ptr),
+        m_result_ptr_device_accessible(arg_result_ptr_device_accessible) {}
 };
 
 template <class FunctorType, class... Traits>
-class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>,
-                   Kokkos::Experimental::HIP>
+class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>, HIP>
     : public ParallelScanHIPBase<FunctorType, Traits...> {
  public:
   using Base = ParallelScanHIPBase<FunctorType, Traits...>;
   using Base::operator();
 
-  inline void execute() { Base::impl_execute(); }
+  inline void execute() {
+    const int block_size = static_cast<int>(local_block_size(Base::m_functor));
+    if (block_size == 0) {
+      Kokkos::Impl::throw_runtime_exception(
+          std::string("Kokkos::Impl::ParallelScan< HIP > could not find a "
+                      "valid execution configuration."));
+    }
+
+    Base::impl_execute(block_size);
+  }
 
   ParallelScan(const FunctorType& arg_functor,
                const typename Base::Policy& arg_policy)
-      : Base(arg_functor, arg_policy) {}
+      : Base(arg_functor, arg_policy, nullptr, false) {}
 
   inline unsigned local_block_size(const FunctorType& f) {
     // blockDim.y must be power of two = 128 (2 warps) or 256 (4 warps) or
@@ -723,10 +678,10 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>,
                                                       typename Base::WorkTag>(
           f, n);
     };
-    using DriverType = ParallelScan<FunctorType, typename Base::Policy,
-                                    Kokkos::Experimental::HIP>;
-    return Kokkos::Experimental::Impl::hip_get_preferred_blocksize<
-        DriverType, typename Base::LaunchBounds>(instance, shmem_functor);
+    using DriverType = ParallelScan<FunctorType, typename Base::Policy, HIP>;
+    return Impl::hip_get_preferred_blocksize<DriverType,
+                                             typename Base::LaunchBounds>(
+        instance, shmem_functor);
   }
 };
 
@@ -734,33 +689,40 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>,
 
 template <class FunctorType, class ReturnType, class... Traits>
 class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
-                            ReturnType, Kokkos::Experimental::HIP>
+                            ReturnType, HIP>
     : public ParallelScanHIPBase<FunctorType, Traits...> {
  public:
   using Base = ParallelScanHIPBase<FunctorType, Traits...>;
   using Base::operator();
 
-  ReturnType& m_returnvalue;
-
   inline void execute() {
-    Base::impl_execute();
+    const int block_size = static_cast<int>(local_block_size(Base::m_functor));
+    if (block_size == 0) {
+      Kokkos::Impl::throw_runtime_exception(
+          std::string("Kokkos::Impl::ParallelScan< HIP > could not find a "
+                      "valid execution configuration."));
+    }
+
+    Base::impl_execute(block_size);
 
     const auto nwork = Base::m_policy.end() - Base::m_policy.begin();
-    if (nwork) {
+    if (nwork && !Base::m_result_ptr_device_accessible) {
       const int size = Base::Analysis::value_size(Base::m_functor);
-      DeepCopy<HostSpace, Kokkos::Experimental::HIPSpace,
-               Kokkos::Experimental::HIP>(
-          Base::m_policy.space(), &m_returnvalue,
+      DeepCopy<HostSpace, HIPSpace, HIP>(
+          Base::m_policy.space(), Base::m_result_ptr,
           Base::m_scratch_space + (Base::m_grid_x - 1) * size /
                                       sizeof(typename Base::word_size_type),
           size);
     }
   }
 
+  template <class ViewType>
   ParallelScanWithTotal(const FunctorType& arg_functor,
                         const typename Base::Policy& arg_policy,
-                        ReturnType& arg_returnvalue)
-      : Base(arg_functor, arg_policy), m_returnvalue(arg_returnvalue) {}
+                        const ViewType& arg_result_view)
+      : Base(arg_functor, arg_policy, arg_result_view.data(),
+             MemorySpaceAccess<HIPSpace,
+                               typename ViewType::memory_space>::accessible) {}
 
   inline unsigned local_block_size(const FunctorType& f) {
     // blockDim.y must be power of two = 128 (2 warps) or 256 (4 warps) or
@@ -773,11 +735,10 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
                                                       typename Base::WorkTag>(
           f, n);
     };
-    using DriverType =
-        ParallelScanWithTotal<FunctorType, typename Base::Policy, ReturnType,
-                              Kokkos::Experimental::HIP>;
-    return Kokkos::Experimental::Impl::hip_get_preferred_blocksize<
-        DriverType, typename Base::LaunchBounds>(instance, shmem_functor);
+    using DriverType = ParallelScanWithTotal<FunctorType, typename Base::Policy,
+                                             ReturnType, HIP>;
+    return hip_get_preferred_blocksize<DriverType, typename Base::LaunchBounds>(
+        instance, shmem_functor);
   }
 };
 
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_Team.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_Team.hpp
index 69ced48a9b33f438f382862171cad0e738270f28..442ca8aef290a309a5caa27961b311fdebfb2dfd 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_Team.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_Team.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKO_HIP_PARALLEL_TEAM_HPP
 #define KOKKO_HIP_PARALLEL_TEAM_HPP
@@ -59,13 +31,12 @@ namespace Kokkos {
 namespace Impl {
 
 template <typename... Properties>
-class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...>
+class TeamPolicyInternal<HIP, Properties...>
     : public PolicyTraits<Properties...> {
  public:
   using execution_policy = TeamPolicyInternal;
 
-  using traits    = PolicyTraits<Properties...>;
-  using BlockType = Kokkos::Experimental::Impl::BlockType;
+  using traits = PolicyTraits<Properties...>;
 
   template <typename ExecSpace, typename... OtherProperties>
   friend class TeamPolicyInternal;
@@ -82,7 +53,7 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...>
   bool m_tune_vector_length;
 
  public:
-  using execution_space = Kokkos::Experimental::HIP;
+  using execution_space = HIP;
 
   template <class... OtherProperties>
   TeamPolicyInternal(TeamPolicyInternal<OtherProperties...> const& p) {
@@ -119,7 +90,7 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...>
     using closure_type =
         Impl::ParallelReduce<FunctorType, TeamPolicy<Properties...>,
                              reducer_type>;
-    return internal_team_size_max<closure_type>(f);
+    return internal_team_size_common<BlockType::Max, closure_type>(f);
   }
 
   template <typename FunctorType, typename ReducerType>
@@ -128,7 +99,7 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...>
     using closure_type =
         Impl::ParallelReduce<FunctorType, TeamPolicy<Properties...>,
                              ReducerType>;
-    return internal_team_size_max<closure_type>(f);
+    return internal_team_size_common<BlockType::Max, closure_type>(f);
   }
 
   template <typename FunctorType>
@@ -151,7 +122,7 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...>
     using closure_type =
         Impl::ParallelReduce<FunctorType, TeamPolicy<Properties...>,
                              reducer_type>;
-    return internal_team_size_recommended<closure_type>(f);
+    return internal_team_size_common<BlockType::Preferred, closure_type>(f);
   }
 
   template <typename FunctorType, typename ReducerType>
@@ -160,14 +131,12 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...>
     using closure_type =
         Impl::ParallelReduce<FunctorType, TeamPolicy<Properties...>,
                              ReducerType>;
-    return internal_team_size_recommended<closure_type>(f);
+    return internal_team_size_common<BlockType::Preferred, closure_type>(f);
   }
 
   inline bool impl_auto_vector_length() const { return m_tune_vector_length; }
   inline bool impl_auto_team_size() const { return m_tune_team_size; }
-  static int vector_length_max() {
-    return ::Kokkos::Experimental::Impl::HIPTraits::WarpSize;
-  }
+  static int vector_length_max() { return HIPTraits::WarpSize; }
 
   static int verify_requested_vector_length(int requested_vector_length) {
     int test_vector_length =
@@ -176,7 +145,7 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...>
     // Allow only power-of-two vector_length
     if (!(is_integral_power_of_two(test_vector_length))) {
       int test_pow2           = 1;
-      int constexpr warp_size = Experimental::Impl::HIPTraits::WarpSize;
+      int constexpr warp_size = HIPTraits::WarpSize;
       while (test_pow2 < warp_size) {
         test_pow2 <<= 1;
         if (test_pow2 > test_vector_length) {
@@ -189,19 +158,28 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...>
     return test_vector_length;
   }
 
-  static int scratch_size_max(int level) {
-    return (
-        level == 0 ? 1024 * 40 :  // FIXME_HIP arbitrarily setting this to 48kB
-            20 * 1024 * 1024);    // FIXME_HIP arbitrarily setting this to 20MB
+  inline static int scratch_size_max(int level) {
+    // HIP Teams use (team_size + 2)*sizeof(double) shared memory for team
+    // reductions. They also use one int64_t in static shared memory for a
+    // shared ID. Furthermore, they use additional scratch memory in some
+    // reduction scenarios, which depend on the size of the value_type and is
+    // NOT captured here
+    constexpr size_t max_possible_team_size = 1024;
+    constexpr size_t max_reserved_shared_mem_per_team =
+        (max_possible_team_size + 2) * sizeof(double) + sizeof(int64_t);
+    // arbitrarily setting level 1 scratch limit to 20MB, for a
+    // MI250 that would give us about 4.4GB for 2 teams per CU
+    constexpr size_t max_l1_scratch_size = 20 * 1024 * 1024;
+
+    size_t max_shmem = HIP().hip_device_prop().sharedMemPerBlock;
+    return (level == 0 ? max_shmem - max_reserved_shared_mem_per_team
+                       : max_l1_scratch_size);
   }
+
   inline void impl_set_vector_length(size_t size) { m_vector_length = size; }
   inline void impl_set_team_size(size_t size) { m_team_size = size; }
   int impl_vector_length() const { return m_vector_length; }
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  KOKKOS_DEPRECATED int vector_length() const { return impl_vector_length(); }
-#endif
-
   int team_size() const { return m_team_size; }
 
   int league_size() const { return m_league_size; }
@@ -229,7 +207,7 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...>
         m_vector_length(0),
         m_team_scratch_size{0, 0},
         m_thread_scratch_size{0, 0},
-        m_chunk_size(::Kokkos::Experimental::Impl::HIPTraits::WarpSize),
+        m_chunk_size(HIPTraits::WarpSize),
         m_tune_team_size(false),
         m_tune_vector_length(false) {}
 
@@ -245,20 +223,17 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...>
                 : (verify_requested_vector_length(1))),
         m_team_scratch_size{0, 0},
         m_thread_scratch_size{0, 0},
-        m_chunk_size(::Kokkos::Experimental::Impl::HIPTraits::WarpSize),
+        m_chunk_size(HIPTraits::WarpSize),
         m_tune_team_size(bool(team_size_request <= 0)),
         m_tune_vector_length(bool(vector_length_request <= 0)) {
     // Make sure league size is permissible
-    if (league_size_ >=
-        static_cast<int>(
-            ::Kokkos::Experimental::Impl::hip_internal_maximum_grid_count()[0]))
+    if (league_size_ >= static_cast<int>(hip_internal_maximum_grid_count()[0]))
       Impl::throw_runtime_exception(
           "Requested too large league_size for TeamPolicy on HIP execution "
           "space.");
 
     // Make sure total block size is permissible
-    if (m_team_size * m_vector_length >
-        ::Kokkos::Experimental::Impl::HIPTraits::MaxThreadsPerBlock) {
+    if (m_team_size * m_vector_length > HIPTraits::MaxThreadsPerBlock) {
       Impl::throw_runtime_exception(
           std::string("Kokkos::TeamPolicy< HIP > the team size is too large. "
                       "Team size x vector length must be smaller than 1024."));
@@ -356,57 +331,19 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...>
 
  protected:
   template <BlockType BlockSize, class ClosureType, class FunctorType>
-  int internal_team_size_common(const FunctorType& f) const {
-    // FIXME_HIP: this could be unified with the
-    // internal_team_size_common_reduce
-    //            once we can turn c++17 constexpr on by default.
-    //            The problem right now is that we can't turn off the evaluation
-    //            of the Analysis' valuesize / StaticValueSize
-
-    const unsigned shmem_block  = team_scratch_size(0) + 2 * sizeof(double);
-    const unsigned shmem_thread = thread_scratch_size(0) + sizeof(double);
-    const int vector_length     = impl_vector_length();
-
-    const auto functor = [&f, shmem_block, shmem_thread, vector_length](
-                             const hipFuncAttributes& attr, int block_size) {
-      int functor_shmem =
-          ::Kokkos::Impl::FunctorTeamShmemSize<FunctorType>::value(
-              f, block_size / vector_length);
-      return shmem_block + shmem_thread * (block_size / vector_length) +
-             functor_shmem + attr.sharedSizeBytes;
-    };
-    int block_size;
-    // FIXME_HIP - could be if constexpr for c++17
-    if (BlockSize == BlockType::Max) {
-      block_size = ::Kokkos::Experimental::Impl::hip_get_max_team_blocksize<
-          ClosureType, typename traits::launch_bounds>(
-          space().impl_internal_space_instance(), functor);
-    } else {
-      block_size =
-          ::Kokkos::Experimental::Impl::hip_get_preferred_team_blocksize<
-              ClosureType, typename traits::launch_bounds>(
-              space().impl_internal_space_instance(), functor);
-    }
-    if (block_size == 0) {
-      Kokkos::Impl::throw_runtime_exception(
-          std::string("Kokkos::Impl::ParallelFor< HIP > could not find a valid "
-                      "team size."));
-    }
-    return block_size / impl_vector_length();
-  }
-
-  template <BlockType BlockSize, class ClosureType, class FunctorType>
-  int internal_team_size_common_reduce(const FunctorType& f) const {
-    using Interface =
-        typename Impl::DeduceFunctorPatternInterface<ClosureType>::type;
-    using Analysis =
-        Impl::FunctorAnalysis<Interface, typename ClosureType::Policy,
-                              FunctorType>;
-
+  int internal_team_size_common(FunctorType const& f) const {
     const unsigned shmem_block = team_scratch_size(0) + 2 * sizeof(double);
-    const unsigned shmem_thread =
-        thread_scratch_size(0) + sizeof(double) +
-        ((Analysis::StaticValueSize != 0) ? 0 : Analysis::value_size(f));
+    unsigned shmem_thread      = thread_scratch_size(0) + sizeof(double);
+    using Tag = typename PatternTagFromImplSpecialization<ClosureType>::type;
+    if constexpr (std::is_same_v<Tag, ParallelReduceTag>) {
+      using Interface =
+          typename Impl::DeduceFunctorPatternInterface<ClosureType>::type;
+      using Analysis =
+          Impl::FunctorAnalysis<Interface, typename ClosureType::Policy,
+                                FunctorType>;
+      shmem_thread +=
+          ((Analysis::StaticValueSize != 0) ? 0 : Analysis::value_size(f));
+    }
     const int vector_length = impl_vector_length();
 
     const auto functor = [&f, shmem_block, shmem_thread, vector_length](
@@ -418,44 +355,36 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...>
              functor_shmem + attr.sharedSizeBytes;
     };
     int block_size;
-    // FIXME_HIP - could be if constexpr for c++17
-    if (BlockSize == BlockType::Max) {
-      block_size = ::Kokkos::Experimental::Impl::hip_get_max_team_blocksize<
-          ClosureType, typename traits::launch_bounds>(
+    if constexpr (BlockSize == BlockType::Max) {
+      block_size = hip_get_max_team_blocksize<ClosureType,
+                                              typename traits::launch_bounds>(
           space().impl_internal_space_instance(), functor);
     } else {
       block_size =
-          ::Kokkos::Experimental::Impl::hip_get_preferred_team_blocksize<
-              ClosureType, typename traits::launch_bounds>(
+          hip_get_preferred_team_blocksize<ClosureType,
+                                           typename traits::launch_bounds>(
               space().impl_internal_space_instance(), functor);
     }
 
     if (block_size == 0) {
-      Kokkos::Impl::throw_runtime_exception(
-          std::string("Kokkos::Impl::ParallelReduce< HIP > could not find a "
-                      "valid team size."));
+      Kokkos::Impl::throw_runtime_exception(std::string(
+          "Kokkos::Impl::ParallelFor/Reduce< HIP > could not find a valid "
+          "team size."));
+    }
+    if constexpr (std::is_same_v<Tag, ParallelForTag>) {
+      return block_size / impl_vector_length();
+    } else {
+      // Currently we require Power-of-2 team size for reductions.
+      int p2 = 1;
+      while (p2 <= block_size) p2 *= 2;
+      p2 /= 2;
+      return p2 / impl_vector_length();
     }
-    // Currently we require Power-of-2 team size for reductions.
-    int p2 = 1;
-    while (p2 <= block_size) p2 *= 2;
-    p2 /= 2;
-    return p2 / impl_vector_length();
-  }
-
-  template <class ClosureType, class FunctorType>
-  int internal_team_size_max(const FunctorType& f) const {
-    return internal_team_size_common_reduce<BlockType::Max, ClosureType>(f);
-  }
-
-  template <class ClosureType, class FunctorType>
-  int internal_team_size_recommended(const FunctorType& f) const {
-    return internal_team_size_common_reduce<BlockType::Preferred, ClosureType>(
-        f);
   }
 };
 
-__device__ inline int64_t hip_get_scratch_index(
-    Experimental::HIP::size_type league_size, int32_t* scratch_locks) {
+__device__ inline int64_t hip_get_scratch_index(HIP::size_type league_size,
+                                                int32_t* scratch_locks) {
   int64_t threadid = 0;
   __shared__ int64_t base_thread_id;
   if (threadIdx.x == 0 && threadIdx.y == 0) {
@@ -491,12 +420,11 @@ __device__ inline void hip_release_scratch_index(int32_t* scratch_locks,
 }
 
 template <typename FunctorType, typename... Properties>
-class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
-                  Kokkos::Experimental::HIP> {
+class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, HIP> {
  public:
-  using Policy = TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...>;
+  using Policy       = TeamPolicyInternal<HIP, Properties...>;
   using functor_type = FunctorType;
-  using size_type    = ::Kokkos::Experimental::HIP::size_type;
+  using size_type    = HIP::size_type;
 
  private:
   using member_type   = typename Policy::member_type;
@@ -518,10 +446,8 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
   int m_shmem_size;
   void* m_scratch_ptr[2];
   size_t m_scratch_size[2];
+  int m_scratch_pool_id = -1;
   int32_t* m_scratch_locks;
-  // Only let one ParallelFor/Reduce modify the team scratch memory. The
-  // constructor acquires the mutex which is released in the destructor.
-  std::lock_guard<std::mutex> m_scratch_lock_guard;
 
   template <typename TagType>
   __device__ inline std::enable_if_t<std::is_void<TagType>::value> exec_team(
@@ -547,8 +473,7 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
     for (int league_rank = blockIdx.x; league_rank < int_league_size;
          league_rank += gridDim.x) {
       this->template exec_team<work_tag>(typename Policy::member_type(
-          ::Kokkos::Experimental::kokkos_impl_hip_shared_memory<void>(),
-          m_shmem_begin, m_shmem_size,
+          kokkos_impl_hip_shared_memory<void>(), m_shmem_begin, m_shmem_size,
           static_cast<void*>(static_cast<char*>(m_scratch_ptr[1]) +
                              ptrdiff_t(threadid / (blockDim.x * blockDim.y)) *
                                  m_scratch_size[1]),
@@ -566,10 +491,8 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
                      static_cast<int>(m_team_size), 1);
 
     using closure_type =
-        ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
-                    Kokkos::Experimental::HIP>;
-    ::Kokkos::Experimental::Impl::hip_parallel_launch<closure_type,
-                                                      launch_bounds>(
+        ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, HIP>;
+    Impl::hip_parallel_launch<closure_type, launch_bounds>(
         *this, grid, block, shmem_size_total,
         m_policy.space().impl_internal_space_instance(),
         true);  // copy to device and execute
@@ -580,10 +503,9 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
         m_policy(arg_policy),
         m_league_size(arg_policy.league_size()),
         m_team_size(arg_policy.team_size()),
-        m_vector_size(arg_policy.impl_vector_length()),
-        m_scratch_lock_guard(m_policy.space()
-                                 .impl_internal_space_instance()
-                                 ->m_team_scratch_mutex) {
+        m_vector_size(arg_policy.impl_vector_length()) {
+    auto internal_space_instance =
+        m_policy.space().impl_internal_space_instance();
     m_team_size = m_team_size >= 0 ? m_team_size
                                    : arg_policy.team_size_recommended(
                                          arg_functor, ParallelForTag());
@@ -594,27 +516,26 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
          FunctorTeamShmemSize<FunctorType>::value(m_functor, m_team_size));
     m_scratch_size[0] = m_policy.scratch_size(0, m_team_size);
     m_scratch_size[1] = m_policy.scratch_size(1, m_team_size);
-    m_scratch_locks =
-        m_policy.space().impl_internal_space_instance()->m_scratch_locks;
+    m_scratch_locks   = internal_space_instance->m_scratch_locks;
 
     // Functor's reduce memory, team scan memory, and team shared memory depend
     // upon team size.
     m_scratch_ptr[0] = nullptr;
-    m_scratch_ptr[1] =
-        m_team_size <= 0
-            ? nullptr
-            : m_policy.space()
-                  .impl_internal_space_instance()
-                  ->resize_team_scratch_space(
-                      static_cast<std::int64_t>(m_scratch_size[1]) *
-                      (std::min(static_cast<std::int64_t>(
-                                    Kokkos::Experimental::HIP::concurrency() /
-                                    (m_team_size * m_vector_size)),
-                                static_cast<std::int64_t>(m_league_size))));
+    if (m_team_size <= 0) {
+      m_scratch_ptr[1] = nullptr;
+    } else {
+      m_scratch_pool_id = internal_space_instance->acquire_team_scratch_space();
+      m_scratch_ptr[1]  = internal_space_instance->resize_team_scratch_space(
+          m_scratch_pool_id,
+          static_cast<std::int64_t>(m_scratch_size[1]) *
+              (std::min(
+                  static_cast<std::int64_t>(HIP().concurrency() /
+                                            (m_team_size * m_vector_size)),
+                  static_cast<std::int64_t>(m_league_size))));
+    }
 
     int const shmem_size_total = m_shmem_begin + m_shmem_size;
-    if (m_policy.space().impl_internal_space_instance()->m_maxShmemPerBlock <
-        shmem_size_total) {
+    if (internal_space_instance->m_maxShmemPerBlock < shmem_size_total) {
       Kokkos::Impl::throw_runtime_exception(std::string(
           "Kokkos::Impl::ParallelFor< HIP > insufficient shared memory"));
     }
@@ -625,6 +546,14 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
           "Kokkos::Impl::ParallelFor< HIP > requested too large team size."));
     }
   }
+
+  ~ParallelFor() {
+    if (m_scratch_pool_id >= 0) {
+      m_policy.space()
+          .impl_internal_space_instance()
+          ->release_team_scratch_space(m_scratch_pool_id);
+    }
+  }
 };
 
 //----------------------------------------------------------------------------
@@ -632,9 +561,9 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
 
 template <class FunctorType, class ReducerType, class... Properties>
 class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
-                     ReducerType, Kokkos::Experimental::HIP> {
+                     ReducerType, HIP> {
  public:
-  using Policy = TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...>;
+  using Policy = TeamPolicyInternal<HIP, Properties...>;
 
  private:
   using member_type   = typename Policy::member_type;
@@ -658,7 +587,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
 
  public:
   using functor_type = FunctorType;
-  using size_type    = Kokkos::Experimental::HIP::size_type;
+  using size_type    = HIP::size_type;
 
   static int constexpr UseShflReduction = (analysis::StaticValueSize != 0);
 
@@ -687,13 +616,11 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
   size_type m_shmem_size;
   void* m_scratch_ptr[2];
   size_t m_scratch_size[2];
+  int m_scratch_pool_id = -1;
   int32_t* m_scratch_locks;
   const size_type m_league_size;
   int m_team_size;
   const size_type m_vector_size;
-  // Only let one ParallelFor/Reduce modify the team scratch memory. The
-  // constructor acquires the mutex which is released in the destructor.
-  std::lock_guard<std::mutex> m_scratch_lock_guard;
 
   template <class TagType>
   __device__ inline std::enable_if_t<std::is_void<TagType>::value> exec_team(
@@ -714,8 +641,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
          league_rank += gridDim.x) {
       this->template exec_team<work_tag>(
           member_type(
-              Kokkos::Experimental::kokkos_impl_hip_shared_memory<char>() +
-                  m_team_begin,
+              kokkos_impl_hip_shared_memory<char>() + m_team_begin,
               m_shmem_begin, m_shmem_size,
               reinterpret_cast<void*>(
                   reinterpret_cast<char*>(m_scratch_ptr[1]) +
@@ -752,9 +678,9 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
                        reducer_conditional::select(m_functor, m_reducer)) /
                    sizeof(size_type));
 
-    reference_type value = final_reducer.init(
-        Kokkos::Experimental::kokkos_impl_hip_shared_memory<size_type>() +
-        threadIdx.y * word_count.value);
+    reference_type value =
+        final_reducer.init(kokkos_impl_hip_shared_memory<size_type>() +
+                           threadIdx.y * word_count.value);
 
     // Iterate this block through the league
     iterate_through_league(threadid, value);
@@ -765,16 +691,14 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
       do_final_reduce =
           hip_single_inter_block_reduce_scan<false, FunctorType, work_tag>(
               reducer_conditional::select(m_functor, m_reducer), blockIdx.x,
-              gridDim.x,
-              Kokkos::Experimental::kokkos_impl_hip_shared_memory<size_type>(),
+              gridDim.x, kokkos_impl_hip_shared_memory<size_type>(),
               m_scratch_space, m_scratch_flags);
     if (do_final_reduce) {
       // This is the final block with the final result at the final threads'
       // location
 
-      size_type* const shared =
-          Kokkos::Experimental::kokkos_impl_hip_shared_memory<size_type>() +
-          (blockDim.y - 1) * word_count.value;
+      size_type* const shared = kokkos_impl_hip_shared_memory<size_type>() +
+                                (blockDim.y - 1) * word_count.value;
       size_type* const global = m_result_ptr_device_accessible
                                     ? reinterpret_cast<size_type*>(m_result_ptr)
                                     : m_scratch_space;
@@ -783,7 +707,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
         final_reducer.final(reinterpret_cast<value_type*>(shared));
       }
 
-      if (Kokkos::Experimental::Impl::HIPTraits::WarpSize < word_count.value) {
+      if (HIPTraits::WarpSize < word_count.value) {
         __syncthreads();
       }
 
@@ -836,18 +760,15 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
     if (!is_empty_range || need_device_set) {
       const int block_count =
           UseShflReduction
-              ? std::min(
-                    m_league_size,
-                    size_type(1024 *
-                              Kokkos::Experimental::Impl::HIPTraits::WarpSize))
+              ? std::min(m_league_size, size_type(1024 * HIPTraits::WarpSize))
               : std::min(static_cast<int>(m_league_size), m_team_size);
 
-      m_scratch_space = Kokkos::Experimental::Impl::hip_internal_scratch_space(
+      m_scratch_space = hip_internal_scratch_space(
           m_policy.space(), analysis::value_size(reducer_conditional::select(
                                 m_functor, m_reducer)) *
                                 block_count);
-      m_scratch_flags = Kokkos::Experimental::Impl::hip_internal_scratch_flags(
-          m_policy.space(), sizeof(size_type));
+      m_scratch_flags =
+          hip_internal_scratch_flags(m_policy.space(), sizeof(size_type));
 
       dim3 block(m_vector_size, m_team_size, 1);
       dim3 grid(block_count, 1, 1);
@@ -859,9 +780,8 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
 
       using closure_type =
           ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
-                         ReducerType, Kokkos::Experimental::HIP>;
-      Kokkos::Experimental::Impl::hip_parallel_launch<closure_type,
-                                                      launch_bounds>(
+                         ReducerType, HIP>;
+      Impl::hip_parallel_launch<closure_type, launch_bounds>(
           *this, grid, block, shmem_size_total,
           m_policy.space().impl_internal_space_instance(),
           true);  // copy to device and execute
@@ -872,8 +792,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
         if (m_result_ptr) {
           const int size = analysis::value_size(
               reducer_conditional::select(m_functor, m_reducer));
-          DeepCopy<HostSpace, Kokkos::Experimental::HIPSpace>(
-              m_result_ptr, m_scratch_space, size);
+          DeepCopy<HostSpace, HIPSpace>(m_result_ptr, m_scratch_space, size);
         }
       }
     } else {
@@ -893,7 +812,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
         m_reducer(InvalidType()),
         m_result_ptr(arg_result.data()),
         m_result_ptr_device_accessible(
-            MemorySpaceAccess<Kokkos::Experimental::HIPSpace,
+            MemorySpaceAccess<HIPSpace,
                               typename ViewType::memory_space>::accessible),
         m_result_ptr_host_accessible(
             MemorySpaceAccess<Kokkos::HostSpace,
@@ -906,10 +825,9 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
         m_scratch_ptr{nullptr, nullptr},
         m_league_size(arg_policy.league_size()),
         m_team_size(arg_policy.team_size()),
-        m_vector_size(arg_policy.impl_vector_length()),
-        m_scratch_lock_guard(m_policy.space()
-                                 .impl_internal_space_instance()
-                                 ->m_team_scratch_mutex) {
+        m_vector_size(arg_policy.impl_vector_length()) {
+    auto internal_space_instance =
+        m_policy.space().impl_internal_space_instance();
     m_team_size = m_team_size >= 0 ? m_team_size
                                    : arg_policy.team_size_recommended(
                                          arg_functor, ParallelReduceTag());
@@ -926,19 +844,19 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
         FunctorTeamShmemSize<FunctorType>::value(arg_functor, m_team_size);
     m_scratch_size[0] = m_shmem_size;
     m_scratch_size[1] = m_policy.scratch_size(1, m_team_size);
-    m_scratch_locks =
-        m_policy.space().impl_internal_space_instance()->m_scratch_locks;
-    m_scratch_ptr[1] =
-        m_team_size <= 0
-            ? nullptr
-            : m_policy.space()
-                  .impl_internal_space_instance()
-                  ->resize_team_scratch_space(
-                      static_cast<std::int64_t>(m_scratch_size[1]) *
-                      (std::min(static_cast<std::int64_t>(
-                                    Kokkos::Experimental::HIP::concurrency() /
-                                    (m_team_size * m_vector_size)),
-                                static_cast<std::int64_t>(m_league_size))));
+    m_scratch_locks   = internal_space_instance->m_scratch_locks;
+    if (m_team_size <= 0) {
+      m_scratch_ptr[1] = nullptr;
+    } else {
+      m_scratch_pool_id = internal_space_instance->acquire_team_scratch_space();
+      m_scratch_ptr[1]  = internal_space_instance->resize_team_scratch_space(
+          m_scratch_pool_id,
+          static_cast<std::int64_t>(m_scratch_size[1]) *
+              (std::min(
+                  static_cast<std::int64_t>(HIP().concurrency() /
+                                            (m_team_size * m_vector_size)),
+                  static_cast<std::int64_t>(m_league_size))));
+    }
 
     // The global parallel_reduce does not support vector_length other than 1 at
     // the moment
@@ -948,8 +866,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
           "greater than 1 is not currently supported for HIP for dynamic "
           "sized reduction types.");
 
-    if ((m_team_size < Kokkos::Experimental::Impl::HIPTraits::WarpSize) &&
-        !UseShflReduction)
+    if ((m_team_size < HIPTraits::WarpSize) && !UseShflReduction)
       Impl::throw_runtime_exception(
           "Kokkos::parallel_reduce with a TeamPolicy using a team_size smaller "
           "than 64 is not currently supported with HIP for dynamic sized "
@@ -966,8 +883,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
           std::string("Kokkos::Impl::ParallelReduce< HIP > bad team size"));
     }
 
-    if (m_policy.space().impl_internal_space_instance()->m_maxShmemPerBlock <
-        shmem_size_total) {
+    if (internal_space_instance->m_maxShmemPerBlock < shmem_size_total) {
       Kokkos::Impl::throw_runtime_exception(
           std::string("Kokkos::Impl::ParallelReduce< HIP > requested too much "
                       "L0 scratch memory"));
@@ -989,9 +905,8 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
         m_reducer(reducer),
         m_result_ptr(reducer.view().data()),
         m_result_ptr_device_accessible(
-            MemorySpaceAccess<Kokkos::Experimental::HIPSpace,
-                              typename ReducerType::result_view_type::
-                                  memory_space>::accessible),
+            MemorySpaceAccess<HIPSpace, typename ReducerType::result_view_type::
+                                            memory_space>::accessible),
         m_result_ptr_host_accessible(
             MemorySpaceAccess<Kokkos::HostSpace,
                               typename ReducerType::result_view_type::
@@ -1004,10 +919,9 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
         m_scratch_ptr{nullptr, nullptr},
         m_league_size(arg_policy.league_size()),
         m_team_size(arg_policy.team_size()),
-        m_vector_size(arg_policy.impl_vector_length()),
-        m_scratch_lock_guard(m_policy.space()
-                                 .impl_internal_space_instance()
-                                 ->m_team_scratch_mutex) {
+        m_vector_size(arg_policy.impl_vector_length()) {
+    auto internal_space_instance =
+        m_policy.space().impl_internal_space_instance();
     m_team_size = m_team_size >= 0
                       ? m_team_size
                       : arg_policy.team_size_recommended(arg_functor, reducer,
@@ -1024,19 +938,19 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
         FunctorTeamShmemSize<FunctorType>::value(arg_functor, m_team_size);
     m_scratch_size[0] = m_shmem_size;
     m_scratch_size[1] = m_policy.scratch_size(1, m_team_size);
-    m_scratch_locks =
-        m_policy.space().impl_internal_space_instance()->m_scratch_locks;
-    m_scratch_ptr[1] =
-        m_team_size <= 0
-            ? nullptr
-            : m_policy.space()
-                  .impl_internal_space_instance()
-                  ->resize_team_scratch_space(
-                      static_cast<std::int64_t>(m_scratch_size[1]) *
-                      (std::min(static_cast<std::int64_t>(
-                                    Kokkos::Experimental::HIP::concurrency() /
-                                    (m_team_size * m_vector_size)),
-                                static_cast<std::int64_t>(m_league_size))));
+    m_scratch_locks   = internal_space_instance->m_scratch_locks;
+    if (m_team_size <= 0) {
+      m_scratch_ptr[1] = nullptr;
+    } else {
+      m_scratch_pool_id = internal_space_instance->acquire_team_scratch_space();
+      m_scratch_ptr[1]  = internal_space_instance->resize_team_scratch_space(
+          m_scratch_pool_id,
+          static_cast<std::int64_t>(m_scratch_size[1]) *
+              (std::min(
+                  static_cast<std::int64_t>(HIP().concurrency() /
+                                            (m_team_size * m_vector_size)),
+                  static_cast<std::int64_t>(m_league_size))));
+    }
 
     // The global parallel_reduce does not support vector_length other than 1 at
     // the moment
@@ -1046,8 +960,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
           "greater than 1 is not currently supported for HIP for dynamic "
           "sized reduction types.");
 
-    if ((m_team_size < Kokkos::Experimental::Impl::HIPTraits::WarpSize) &&
-        !UseShflReduction)
+    if ((m_team_size < HIPTraits::WarpSize) && !UseShflReduction)
       Impl::throw_runtime_exception(
           "Kokkos::parallel_reduce with a TeamPolicy using a team_size smaller "
           "than 64 is not currently supported with HIP for dynamic sized "
@@ -1059,8 +972,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
     const int shmem_size_total = m_team_begin + m_shmem_begin + m_shmem_size;
     if ((!Kokkos::Impl::is_integral_power_of_two(m_team_size) &&
          !UseShflReduction) ||
-        m_policy.space().impl_internal_space_instance()->m_maxShmemPerBlock <
-            shmem_size_total) {
+        internal_space_instance->m_maxShmemPerBlock < shmem_size_total) {
       Kokkos::Impl::throw_runtime_exception(
           std::string("Kokkos::Impl::ParallelReduce< HIP > bad team size"));
     }
@@ -1073,6 +985,14 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
                       "large team size."));
     }
   }
+
+  ~ParallelReduce() {
+    if (m_scratch_pool_id >= 0) {
+      m_policy.space()
+          .impl_internal_space_instance()
+          ->release_team_scratch_space(m_scratch_pool_id);
+    }
+  }
 };
 }  // namespace Impl
 }  // namespace Kokkos
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_ReduceScan.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_ReduceScan.hpp
index 9002f695894e987d34fd1437bbcc1f3da7e2a04c..9de26b63a7efd89437eadc87b5195e741fccfae3 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_ReduceScan.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_ReduceScan.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HIP_REDUCESCAN_HPP
 #define KOKKOS_HIP_REDUCESCAN_HPP
@@ -49,6 +21,7 @@
 
 #if defined(__HIPCC__)
 
+#include <HIP/Kokkos_HIP.hpp>
 #include <HIP/Kokkos_HIP_Vectorization.hpp>
 
 namespace Kokkos {
@@ -74,20 +47,19 @@ struct HIPReductionsFunctor<FunctorType, true> {
       int const width,         // How much of the warp participates
       Scalar& result) {
     for (int delta = skip_vector ? blockDim.x : 1; delta < width; delta *= 2) {
-      Scalar tmp = Kokkos::Experimental::shfl_down(value, delta, width);
+      Scalar tmp = shfl_down(value, delta, width);
       functor.join(&value, &tmp);
     }
 
-    Experimental::Impl::in_place_shfl(result, value, 0, width);
+    in_place_shfl(result, value, 0, width);
   }
 
   __device__ static inline void scalar_intra_block_reduction(
       FunctorType const& functor, Scalar value, bool const skip,
       Scalar* my_global_team_buffer_element, int const shared_elements,
       Scalar* shared_team_buffer_element) {
-    unsigned int constexpr warp_size =
-        Kokkos::Experimental::Impl::HIPTraits::WarpSize;
-    int const warp_id = (threadIdx.y * blockDim.x) / warp_size;
+    unsigned int constexpr warp_size = HIPTraits::WarpSize;
+    int const warp_id                = (threadIdx.y * blockDim.x) / warp_size;
     Scalar* const my_shared_team_buffer_element =
         shared_team_buffer_element + warp_id % shared_elements;
 
@@ -122,22 +94,19 @@ struct HIPReductionsFunctor<FunctorType, true> {
   }
 
   __device__ static inline bool scalar_inter_block_reduction(
-      FunctorType const& functor,
-      ::Kokkos::Experimental::HIP::size_type const block_count,
-      ::Kokkos::Experimental::HIP::size_type* const shared_data,
-      ::Kokkos::Experimental::HIP::size_type* const global_data,
-      ::Kokkos::Experimental::HIP::size_type* const global_flags) {
+      FunctorType const& functor, HIP::size_type const block_count,
+      HIP::size_type* const shared_data, HIP::size_type* const global_data,
+      HIP::size_type* const global_flags) {
     Scalar* const global_team_buffer_element =
         reinterpret_cast<Scalar*>(global_data);
     Scalar* const my_global_team_buffer_element =
         global_team_buffer_element + blockIdx.x;
     Scalar* shared_team_buffer_elements =
         reinterpret_cast<Scalar*>(shared_data);
-    Scalar value = shared_team_buffer_elements[threadIdx.y];
-    unsigned int constexpr warp_size =
-        Kokkos::Experimental::Impl::HIPTraits::WarpSize;
-    int shared_elements = blockDim.x * blockDim.y / warp_size;
-    int global_elements = block_count;
+    Scalar value                     = shared_team_buffer_elements[threadIdx.y];
+    unsigned int constexpr warp_size = Impl::HIPTraits::WarpSize;
+    int shared_elements              = blockDim.x * blockDim.y / warp_size;
+    int global_elements              = block_count;
     __syncthreads();
 
     scalar_intra_block_reduction(functor, value, true,
@@ -185,10 +154,10 @@ struct HIPReductionsFunctor<FunctorType, false> {
                                // part of the reduction
       int const width)         // How much of the warp participates
   {
-    int const lane_id = (threadIdx.y * blockDim.x + threadIdx.x) %
-                        ::Kokkos::Experimental::Impl::HIPTraits::WarpSize;
+    int const lane_id =
+        (threadIdx.y * blockDim.x + threadIdx.x) % HIPTraits::WarpSize;
     for (int delta = skip_vector ? blockDim.x : 1; delta < width; delta *= 2) {
-      if (lane_id + delta < ::Kokkos::Experimental::Impl::HIPTraits::WarpSize) {
+      if (lane_id + delta < HIPTraits::WarpSize) {
         functor.join(value, value + delta);
       }
     }
@@ -198,39 +167,34 @@ struct HIPReductionsFunctor<FunctorType, false> {
   __device__ static inline void scalar_intra_block_reduction(
       FunctorType const& functor, Scalar value, bool const skip, Scalar* result,
       int const /*shared_elements*/, Scalar* shared_team_buffer_element) {
-    int const warp_id = (threadIdx.y * blockDim.x) /
-                        ::Kokkos::Experimental::Impl::HIPTraits::WarpSize;
+    int const warp_id = (threadIdx.y * blockDim.x) / HIPTraits::WarpSize;
     Scalar* const my_shared_team_buffer_element =
         shared_team_buffer_element + threadIdx.y * blockDim.x + threadIdx.x;
     *my_shared_team_buffer_element = value;
     // Warp Level Reduction, ignoring Kokkos vector entries
-    scalar_intra_warp_reduction(
-        functor, my_shared_team_buffer_element, skip,
-        ::Kokkos::Experimental::Impl::HIPTraits::WarpSize);
+    scalar_intra_warp_reduction(functor, my_shared_team_buffer_element, skip,
+                                HIPTraits::WarpSize);
     // Wait for every warp to be done before using one warp to do final cross
     // warp reduction
     __syncthreads();
 
     if (warp_id == 0) {
       const unsigned int delta =
-          (threadIdx.y * blockDim.x + threadIdx.x) *
-          ::Kokkos::Experimental::Impl::HIPTraits::WarpSize;
+          (threadIdx.y * blockDim.x + threadIdx.x) * HIPTraits::WarpSize;
       if (delta < blockDim.x * blockDim.y)
         *my_shared_team_buffer_element = shared_team_buffer_element[delta];
       scalar_intra_warp_reduction(
           functor, my_shared_team_buffer_element, false,
-          blockDim.x * blockDim.y /
-              ::Kokkos::Experimental::Impl::HIPTraits::WarpSize);
+          blockDim.x * blockDim.y / HIPTraits::WarpSize);
       if (threadIdx.x + threadIdx.y == 0) *result = *shared_team_buffer_element;
     }
   }
 
   template <typename SizeType>
   __device__ static inline bool scalar_inter_block_reduction(
-      FunctorType const& functor,
-      ::Kokkos::Experimental::HIP::size_type const block_count,
+      FunctorType const& functor, HIP::size_type const block_count,
       SizeType* const shared_data, SizeType* const global_data,
-      ::Kokkos::Experimental::HIP::size_type* const global_flags) {
+      HIP::size_type* const global_flags) {
     Scalar* const global_team_buffer_element =
         reinterpret_cast<Scalar*>(global_data);
     Scalar* const my_global_team_buffer_element =
@@ -238,8 +202,7 @@ struct HIPReductionsFunctor<FunctorType, false> {
     Scalar* shared_team_buffer_elements =
         reinterpret_cast<Scalar*>(shared_data);
     Scalar value        = shared_team_buffer_elements[threadIdx.y];
-    int shared_elements = (blockDim.x * blockDim.y) /
-                          ::Kokkos::Experimental::Impl::HIPTraits::WarpSize;
+    int shared_elements = (blockDim.x * blockDim.y) / HIPTraits::WarpSize;
     int global_elements = block_count;
     __syncthreads();
 
@@ -300,9 +263,8 @@ __device__ void hip_intra_block_reduce_scan(
   // For that warp, we shift all indices logically to the end and ignore join
   // operations with unassigned indices in the warp when performing the intra
   // warp reduction/scan.
-  const bool is_full_warp =
-      (((threadIdx.y >> Experimental::Impl::HIPTraits::WarpIndexShift) + 1)
-       << Experimental::Impl::HIPTraits::WarpIndexShift) <= blockDim.y;
+  const bool is_full_warp = (((threadIdx.y >> HIPTraits::WarpIndexShift) + 1)
+                             << HIPTraits::WarpIndexShift) <= blockDim.y;
 
   auto block_reduce_step = [&functor, value_count](
                                int const R, pointer_type const TD, int const S,
@@ -314,24 +276,19 @@ __device__ void hip_intra_block_reduce_scan(
   };
 
   // Intra-warp reduction:
+  int bit_shift = 0;
   {
     const unsigned mapped_idx =
-        threadIdx.y + (is_full_warp
-                           ? 0
-                           : (not_less_power_of_two - blockDim.y) &
-                                 (Experimental::Impl::HIPTraits::WarpSize - 1));
+        threadIdx.y + (is_full_warp ? 0
+                                    : (not_less_power_of_two - blockDim.y) &
+                                          (HIPTraits::WarpSize - 1));
     const pointer_type tdata_intra = base_data + value_count * threadIdx.y;
     const pointer_type warp_start =
-        base_data +
-        value_count *
-            ((threadIdx.y >> Experimental::Impl::HIPTraits::WarpIndexShift)
-             << Experimental::Impl::HIPTraits::WarpIndexShift);
-    block_reduce_step(mapped_idx, tdata_intra, 0, warp_start, 0);
-    block_reduce_step(mapped_idx, tdata_intra, 1, warp_start, 0);
-    block_reduce_step(mapped_idx, tdata_intra, 2, warp_start, 0);
-    block_reduce_step(mapped_idx, tdata_intra, 3, warp_start, 0);
-    block_reduce_step(mapped_idx, tdata_intra, 4, warp_start, 0);
-    block_reduce_step(mapped_idx, tdata_intra, 5, warp_start, 0);
+        base_data + value_count * ((threadIdx.y >> HIPTraits::WarpIndexShift)
+                                   << HIPTraits::WarpIndexShift);
+    for (; (1 << bit_shift) < HIPTraits::WarpSize; ++bit_shift) {
+      block_reduce_step(mapped_idx, tdata_intra, bit_shift, warp_start, 0);
+    }
   }
 
   __syncthreads();  // Wait for all warps to reduce
@@ -343,42 +300,26 @@ __device__ void hip_intra_block_reduce_scan(
     // following reduction, we shift all indices logically to the end of the
     // next power-of-two to the number of warps.
     const unsigned n_active_warps =
-        ((blockDim.y - 1) >> Experimental::Impl::HIPTraits::WarpIndexShift) + 1;
+        ((blockDim.y - 1) >> HIPTraits::WarpIndexShift) + 1;
     if (threadIdx.y < n_active_warps) {
       const bool is_full_warp_inter =
-          threadIdx.y <
-          (blockDim.y >> Experimental::Impl::HIPTraits::WarpIndexShift);
+          threadIdx.y < (blockDim.y >> HIPTraits::WarpIndexShift);
       pointer_type const tdata_inter =
           base_data +
-          value_count *
-              (is_full_warp_inter
-                   ? (threadIdx.y
-                      << Experimental::Impl::HIPTraits::WarpIndexShift) +
-                         (Experimental::Impl::HIPTraits::WarpSize - 1)
-                   : blockDim.y - 1);
+          value_count * (is_full_warp_inter
+                             ? (threadIdx.y << HIPTraits::WarpIndexShift) +
+                                   (HIPTraits::WarpSize - 1)
+                             : blockDim.y - 1);
       const unsigned index_shift =
           is_full_warp_inter
               ? 0
-              : blockDim.y - (threadIdx.y
-                              << Experimental::Impl::HIPTraits::WarpIndexShift);
-      const int rtid_inter =
-          (threadIdx.y << Experimental::Impl::HIPTraits::WarpIndexShift) +
-          (Experimental::Impl::HIPTraits::WarpSize - 1) - index_shift;
-
-      if ((1 << 6) < BlockSizeMask) {
-        block_reduce_step(rtid_inter, tdata_inter, 6, base_data, index_shift);
-      }
-      if ((1 << 7) < BlockSizeMask) {
-        block_reduce_step(rtid_inter, tdata_inter, 7, base_data, index_shift);
-      }
-      if ((1 << 8) < BlockSizeMask) {
-        block_reduce_step(rtid_inter, tdata_inter, 8, base_data, index_shift);
-      }
-      if ((1 << 9) < BlockSizeMask) {
-        block_reduce_step(rtid_inter, tdata_inter, 9, base_data, index_shift);
-      }
-      if ((1 << 10) < BlockSizeMask) {
-        block_reduce_step(rtid_inter, tdata_inter, 10, base_data, index_shift);
+              : blockDim.y - (threadIdx.y << HIPTraits::WarpIndexShift);
+      const int rtid_inter = (threadIdx.y << HIPTraits::WarpIndexShift) +
+                             (HIPTraits::WarpSize - 1) - index_shift;
+
+      for (; (1 << bit_shift) < BlockSizeMask; ++bit_shift) {
+        block_reduce_step(rtid_inter, tdata_inter, bit_shift, base_data,
+                          index_shift);
       }
     }
   }
@@ -388,13 +329,11 @@ __device__ void hip_intra_block_reduce_scan(
   if (DoScan) {
     // Update all the values for the respective warps (except for the last one)
     // by adding from the last value of the previous warp.
-    const unsigned int WarpMask = Experimental::Impl::HIPTraits::WarpSize - 1;
+    const unsigned int WarpMask = HIPTraits::WarpSize - 1;
     const int is_last_thread_in_warp =
-        is_full_warp ? ((threadIdx.y & WarpMask) ==
-                        Experimental::Impl::HIPTraits::WarpSize - 1)
+        is_full_warp ? ((threadIdx.y & WarpMask) == HIPTraits::WarpSize - 1)
                      : (threadIdx.y == blockDim.y - 1);
-    if (threadIdx.y >= Experimental::Impl::HIPTraits::WarpSize &&
-        !is_last_thread_in_warp) {
+    if (threadIdx.y >= HIPTraits::WarpSize && !is_last_thread_in_warp) {
       const int offset_to_previous_warp_total = (threadIdx.y & (~WarpMask)) - 1;
       functor.join(base_data + value_count * threadIdx.y,
                    base_data + value_count * offset_to_previous_warp_total);
@@ -413,11 +352,9 @@ __device__ void hip_intra_block_reduce_scan(
 
 template <bool DoScan, typename FunctorType, typename SizeType>
 __device__ bool hip_single_inter_block_reduce_scan_impl(
-    FunctorType const& functor,
-    ::Kokkos::Experimental::HIP::size_type const block_id,
-    ::Kokkos::Experimental::HIP::size_type const block_count,
-    SizeType* const shared_data, SizeType* const global_data,
-    ::Kokkos::Experimental::HIP::size_type* const global_flags) {
+    FunctorType const& functor, HIP::size_type const block_id,
+    HIP::size_type const block_count, SizeType* const shared_data,
+    SizeType* const global_data, HIP::size_type* const global_flags) {
   using size_type    = SizeType;
   using value_type   = typename FunctorType::value_type;
   using pointer_type = typename FunctorType::pointer_type;
@@ -518,11 +455,9 @@ __device__ bool hip_single_inter_block_reduce_scan_impl(
 
 template <bool DoScan, typename FunctorType, typename SizeType>
 __device__ bool hip_single_inter_block_reduce_scan(
-    FunctorType const& functor,
-    ::Kokkos::Experimental::HIP::size_type const block_id,
-    ::Kokkos::Experimental::HIP::size_type const block_count,
-    SizeType* const shared_data, SizeType* const global_data,
-    ::Kokkos::Experimental::HIP::size_type* const global_flags) {
+    FunctorType const& functor, HIP::size_type const block_id,
+    HIP::size_type const block_count, SizeType* const shared_data,
+    SizeType* const global_data, HIP::size_type* const global_flags) {
   // If we are doing a reduction and we don't do an array reduction, we use the
   // reduction-only path. Otherwise, we use the common path between reduction
   // and scan.
@@ -547,8 +482,7 @@ inline std::enable_if_t<DoScan, unsigned>
 hip_single_inter_block_reduce_scan_shmem(const FunctorType& functor,
                                          const unsigned BlockSize) {
   using Analysis = Impl::FunctorAnalysis<Impl::FunctorPatternInterface::SCAN,
-                                         RangePolicy<Experimental::HIP, ArgTag>,
-                                         FunctorType>;
+                                         RangePolicy<HIP, ArgTag>, FunctorType>;
 
   return (BlockSize + 2) * Analysis::value_size(functor);
 }
@@ -558,8 +492,7 @@ inline std::enable_if_t<!DoScan, unsigned>
 hip_single_inter_block_reduce_scan_shmem(const FunctorType& functor,
                                          const unsigned BlockSize) {
   using Analysis = Impl::FunctorAnalysis<Impl::FunctorPatternInterface::REDUCE,
-                                         RangePolicy<Experimental::HIP, ArgTag>,
-                                         FunctorType>;
+                                         RangePolicy<HIP, ArgTag>, FunctorType>;
 
   return (BlockSize + 2) * Analysis::value_size(functor);
 }
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..ea599989e7ad9617e30678c0712dee1f95727752
--- /dev/null
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.cpp
@@ -0,0 +1,155 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
+#define KOKKOS_IMPL_PUBLIC_INCLUDE
+#endif
+
+#include <HIP/Kokkos_HIP_SharedAllocationRecord.hpp>
+#include <HIP/Kokkos_HIP_DeepCopy.hpp>
+#include <HIP/Kokkos_HIP.hpp>
+
+namespace Kokkos {
+namespace Impl {
+
+#ifdef KOKKOS_ENABLE_DEBUG
+SharedAllocationRecord<void, void>
+    SharedAllocationRecord<HIPSpace, void>::s_root_record;
+
+SharedAllocationRecord<void, void>
+    SharedAllocationRecord<HIPHostPinnedSpace, void>::s_root_record;
+
+SharedAllocationRecord<void, void>
+    SharedAllocationRecord<HIPManagedSpace, void>::s_root_record;
+#endif
+
+SharedAllocationRecord<HIPSpace, void>::~SharedAllocationRecord() {
+  auto alloc_size = SharedAllocationRecord<void, void>::m_alloc_size;
+  m_space.deallocate(m_label.c_str(),
+                     SharedAllocationRecord<void, void>::m_alloc_ptr,
+                     alloc_size, (alloc_size - sizeof(SharedAllocationHeader)));
+}
+
+SharedAllocationRecord<HIPHostPinnedSpace, void>::~SharedAllocationRecord() {
+  m_space.deallocate(m_label.c_str(),
+                     SharedAllocationRecord<void, void>::m_alloc_ptr,
+                     SharedAllocationRecord<void, void>::m_alloc_size);
+}
+
+SharedAllocationRecord<HIPManagedSpace, void>::~SharedAllocationRecord() {
+  m_space.deallocate(m_label.c_str(),
+                     SharedAllocationRecord<void, void>::m_alloc_ptr,
+                     SharedAllocationRecord<void, void>::m_alloc_size);
+}
+
+SharedAllocationRecord<HIPSpace, void>::SharedAllocationRecord(
+    const HIPSpace& arg_space, const std::string& arg_label,
+    const size_t arg_alloc_size,
+    const SharedAllocationRecord<void, void>::function_type arg_dealloc)
+    // Pass through allocated [ SharedAllocationHeader , user_memory ]
+    // Pass through deallocation function
+    : base_t(
+#ifdef KOKKOS_ENABLE_DEBUG
+          &SharedAllocationRecord<HIPSpace, void>::s_root_record,
+#endif
+          Kokkos::Impl::checked_allocation_with_header(arg_space, arg_label,
+                                                       arg_alloc_size),
+          sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc,
+          arg_label),
+      m_space(arg_space) {
+
+  SharedAllocationHeader header;
+
+  this->base_t::_fill_host_accessible_header_info(header, arg_label);
+
+  // Copy to device memory
+  HIP exec;
+  Kokkos::Impl::DeepCopy<HIPSpace, HostSpace>(
+      exec, RecordBase::m_alloc_ptr, &header, sizeof(SharedAllocationHeader));
+  exec.fence(
+      "SharedAllocationRecord<Kokkos::HIPSpace, "
+      "void>::SharedAllocationRecord(): fence after copying header from "
+      "HostSpace");
+}
+
+SharedAllocationRecord<HIPSpace, void>::SharedAllocationRecord(
+    const HIP& arg_exec_space, const HIPSpace& arg_space,
+    const std::string& arg_label, const size_t arg_alloc_size,
+    const SharedAllocationRecord<void, void>::function_type arg_dealloc)
+    // Pass through allocated [ SharedAllocationHeader , user_memory ]
+    // Pass through deallocation function
+    : base_t(
+#ifdef KOKKOS_ENABLE_DEBUG
+          &SharedAllocationRecord<HIPSpace, void>::s_root_record,
+#endif
+          Kokkos::Impl::checked_allocation_with_header(arg_space, arg_label,
+                                                       arg_alloc_size),
+          sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc,
+          arg_label),
+      m_space(arg_space) {
+
+  SharedAllocationHeader header;
+
+  this->base_t::_fill_host_accessible_header_info(header, arg_label);
+
+  // Copy to device memory
+  Kokkos::Impl::DeepCopy<HIPSpace, HostSpace>(arg_exec_space,
+                                              RecordBase::m_alloc_ptr, &header,
+                                              sizeof(SharedAllocationHeader));
+}
+
+SharedAllocationRecord<HIPHostPinnedSpace, void>::SharedAllocationRecord(
+    const HIPHostPinnedSpace& arg_space, const std::string& arg_label,
+    const size_t arg_alloc_size,
+    const SharedAllocationRecord<void, void>::function_type arg_dealloc)
+    // Pass through allocated [ SharedAllocationHeader , user_memory ]
+    // Pass through deallocation function
+    : base_t(
+#ifdef KOKKOS_ENABLE_DEBUG
+          &SharedAllocationRecord<HIPHostPinnedSpace, void>::s_root_record,
+#endif
+          Kokkos::Impl::checked_allocation_with_header(arg_space, arg_label,
+                                                       arg_alloc_size),
+          sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc,
+          arg_label),
+      m_space(arg_space) {
+  // Fill in the Header information, directly accessible via host pinned memory
+  this->base_t::_fill_host_accessible_header_info(*RecordBase::m_alloc_ptr,
+                                                  arg_label);
+}
+
+SharedAllocationRecord<HIPManagedSpace, void>::SharedAllocationRecord(
+    const HIPManagedSpace& arg_space, const std::string& arg_label,
+    const size_t arg_alloc_size,
+    const SharedAllocationRecord<void, void>::function_type arg_dealloc)
+    // Pass through allocated [ SharedAllocationHeader , user_memory ]
+    // Pass through deallocation function
+    : base_t(
+#ifdef KOKKOS_ENABLE_DEBUG
+          &SharedAllocationRecord<HIPManagedSpace, void>::s_root_record,
+#endif
+          Kokkos::Impl::checked_allocation_with_header(arg_space, arg_label,
+                                                       arg_alloc_size),
+          sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc,
+          arg_label),
+      m_space(arg_space) {
+  // Fill in the Header information, directly accessible via managed memory
+  this->base_t::_fill_host_accessible_header_info(*RecordBase::m_alloc_ptr,
+                                                  arg_label);
+}
+
+}  // namespace Impl
+}  // namespace Kokkos
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..e68bad9723079fcbf0666fa2945391db446f64c8
--- /dev/null
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.hpp
@@ -0,0 +1,137 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_HIP_SHARED_ALLOCATION_RECORD_HPP
+#define KOKKOS_HIP_SHARED_ALLOCATION_RECORD_HPP
+
+#include <HIP/Kokkos_HIP_Space.hpp>
+
+namespace Kokkos {
+namespace Impl {
+
+template <>
+class SharedAllocationRecord<HIPSpace, void>
+    : public HostInaccessibleSharedAllocationRecordCommon<HIPSpace> {
+ private:
+  friend class SharedAllocationRecordCommon<HIPSpace>;
+  friend class HostInaccessibleSharedAllocationRecordCommon<HIPSpace>;
+  using base_t     = HostInaccessibleSharedAllocationRecordCommon<HIPSpace>;
+  using RecordBase = SharedAllocationRecord<void, void>;
+
+  SharedAllocationRecord(const SharedAllocationRecord&) = delete;
+  SharedAllocationRecord& operator=(const SharedAllocationRecord&) = delete;
+
+#ifdef KOKKOS_ENABLE_DEBUG
+  static RecordBase s_root_record;
+#endif
+
+  const HIPSpace m_space;
+
+ protected:
+  ~SharedAllocationRecord();
+
+  template <typename ExecutionSpace>
+  SharedAllocationRecord(
+      const ExecutionSpace& /*exec*/, const HIPSpace& arg_space,
+      const std::string& arg_label, const size_t arg_alloc_size,
+      const RecordBase::function_type arg_dealloc = &base_t::deallocate)
+      : SharedAllocationRecord(arg_space, arg_label, arg_alloc_size,
+                               arg_dealloc) {}
+
+  SharedAllocationRecord(
+      const HIP& exec_space, const HIPSpace& arg_space,
+      const std::string& arg_label, const size_t arg_alloc_size,
+      const RecordBase::function_type arg_dealloc = &base_t::deallocate);
+
+  SharedAllocationRecord(
+      const HIPSpace& arg_space, const std::string& arg_label,
+      const size_t arg_alloc_size,
+      const RecordBase::function_type arg_dealloc = &base_t::deallocate);
+};
+
+template <>
+class SharedAllocationRecord<HIPHostPinnedSpace, void>
+    : public SharedAllocationRecordCommon<HIPHostPinnedSpace> {
+ private:
+  friend class SharedAllocationRecordCommon<HIPHostPinnedSpace>;
+  using base_t     = SharedAllocationRecordCommon<HIPHostPinnedSpace>;
+  using RecordBase = SharedAllocationRecord<void, void>;
+
+  SharedAllocationRecord(const SharedAllocationRecord&) = delete;
+  SharedAllocationRecord& operator=(const SharedAllocationRecord&) = delete;
+
+#ifdef KOKKOS_ENABLE_DEBUG
+  static RecordBase s_root_record;
+#endif
+
+  const HIPHostPinnedSpace m_space;
+
+ protected:
+  ~SharedAllocationRecord();
+  SharedAllocationRecord() = default;
+
+  template <typename ExecutionSpace>
+  SharedAllocationRecord(
+      const ExecutionSpace& /*exec_space*/, const HIPHostPinnedSpace& arg_space,
+      const std::string& arg_label, const size_t arg_alloc_size,
+      const RecordBase::function_type arg_dealloc = &base_t::deallocate)
+      : SharedAllocationRecord(arg_space, arg_label, arg_alloc_size,
+                               arg_dealloc) {}
+
+  SharedAllocationRecord(
+      const HIPHostPinnedSpace& arg_space, const std::string& arg_label,
+      const size_t arg_alloc_size,
+      const RecordBase::function_type arg_dealloc = &base_t::deallocate);
+};
+
+template <>
+class SharedAllocationRecord<HIPManagedSpace, void>
+    : public SharedAllocationRecordCommon<HIPManagedSpace> {
+ private:
+  friend class SharedAllocationRecordCommon<HIPManagedSpace>;
+  using base_t     = SharedAllocationRecordCommon<HIPManagedSpace>;
+  using RecordBase = SharedAllocationRecord<void, void>;
+
+  SharedAllocationRecord(const SharedAllocationRecord&) = delete;
+  SharedAllocationRecord& operator=(const SharedAllocationRecord&) = delete;
+
+#ifdef KOKKOS_ENABLE_DEBUG
+  static RecordBase s_root_record;
+#endif
+
+  const HIPManagedSpace m_space;
+
+ protected:
+  ~SharedAllocationRecord();
+  SharedAllocationRecord() = default;
+
+  template <typename ExecutionSpace>
+  SharedAllocationRecord(
+      const ExecutionSpace& /*exec_space*/, const HIPManagedSpace& arg_space,
+      const std::string& arg_label, const size_t arg_alloc_size,
+      const RecordBase::function_type arg_dealloc = &base_t::deallocate)
+      : SharedAllocationRecord(arg_space, arg_label, arg_alloc_size,
+                               arg_dealloc) {}
+
+  SharedAllocationRecord(
+      const HIPManagedSpace& arg_space, const std::string& arg_label,
+      const size_t arg_alloc_size,
+      const RecordBase::function_type arg_dealloc = &base_t::deallocate);
+};
+}  // namespace Impl
+}  // namespace Kokkos
+
+#endif
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Shuffle_Reduce.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Shuffle_Reduce.hpp
index d0bbc18da8a1c64839444f5abb8c4d507a01a30b..cca5e9ff26e4f6b05686d764affefdd0343dd932 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Shuffle_Reduce.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Shuffle_Reduce.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HIP_SHUFFLE_REDUCE_HPP
 #define KOKKOS_HIP_SHUFFLE_REDUCE_HPP
@@ -68,11 +40,9 @@ __device__ inline void hip_intra_warp_shuffle_reduction(
   unsigned int shift = 1;
 
   // Reduce over values from threads with different threadIdx.y
-  unsigned int constexpr warp_size =
-      Kokkos::Experimental::Impl::HIPTraits::WarpSize;
+  unsigned int constexpr warp_size = HIPTraits::WarpSize;
   while (blockDim.x * shift < warp_size) {
-    ValueType const tmp =
-        Kokkos::Experimental::shfl_down(result, blockDim.x * shift, warp_size);
+    ValueType const tmp = shfl_down(result, blockDim.x * shift, warp_size);
     // Only join if upper thread is active (this allows non power of two for
     // blockDim.y)
     if (threadIdx.y + shift < max_active_thread) {
@@ -82,16 +52,15 @@ __device__ inline void hip_intra_warp_shuffle_reduction(
   }
 
   // Broadcast the result to all the threads in the warp
-  result = Kokkos::Experimental::shfl(result, 0, warp_size);
+  result = shfl(result, 0, warp_size);
 }
 
 template <typename ValueType, typename ReducerType>
 __device__ inline void hip_inter_warp_shuffle_reduction(
     ValueType& value, const ReducerType& reducer,
     const int max_active_thread = blockDim.y) {
-  unsigned int constexpr warp_size =
-      Kokkos::Experimental::Impl::HIPTraits::WarpSize;
-  int constexpr step_width = 8;
+  unsigned int constexpr warp_size = HIPTraits::WarpSize;
+  int constexpr step_width         = 8;
   // Depending on the ValueType __shared__ memory must be aligned up to 8 byte
   // boundaries. The reason not to use ValueType directly is that for types with
   // constructors it could lead to race conditions.
@@ -131,9 +100,9 @@ template <class FunctorType>
 __device__ inline bool hip_inter_block_shuffle_reduction(
     typename FunctorType::reference_type value,
     typename FunctorType::reference_type neutral, FunctorType const& reducer,
-    Kokkos::Experimental::HIP::size_type* const m_scratch_space,
+    HIP::size_type* const m_scratch_space,
     typename FunctorType::pointer_type const /*result*/,
-    Kokkos::Experimental::HIP::size_type* const m_scratch_flags,
+    HIP::size_type* const m_scratch_flags,
     int const max_active_thread = blockDim.y) {
   using pointer_type = typename FunctorType::pointer_type;
   using value_type   = typename FunctorType::value_type;
@@ -155,13 +124,13 @@ __device__ inline bool hip_inter_block_shuffle_reduction(
   // block values from global scratch_memory
   bool last_block = false;
   __syncthreads();
-  int constexpr warp_size = Kokkos::Experimental::Impl::HIPTraits::WarpSize;
+  int constexpr warp_size = HIPTraits::WarpSize;
   if (id < warp_size) {
-    Kokkos::Experimental::HIP::size_type count;
+    HIP::size_type count;
 
     // Figure out whether this is the last block
     if (id == 0) count = Kokkos::atomic_fetch_add(m_scratch_flags, 1);
-    count = Kokkos::Experimental::shfl(count, 0, warp_size);
+    count = shfl(count, 0, warp_size);
 
     // Last block does the inter block reduction
     if (count == gridDim.x - 1) {
@@ -186,7 +155,7 @@ __device__ inline bool hip_inter_block_shuffle_reduction(
       // valid (allows gridDim.x non power of two and <warp_size)
       for (unsigned int i = 1; i < warp_size; i *= 2) {
         if ((blockDim.x * blockDim.y) > i) {
-          value_type tmp = Kokkos::Experimental::shfl_down(value, i, warp_size);
+          value_type tmp = shfl_down(value, i, warp_size);
           if (id + i < gridDim.x) reducer.join(&value, &tmp);
         }
       }
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp
index aee9756af0d166c113ee7f8c986b53cba4872981..07b9382ab7658d87ea1dcb226181164cf379c533 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -49,14 +21,18 @@
 #include <Kokkos_Macros.hpp>
 
 #include <Kokkos_Core.hpp>
-#include <Kokkos_HIP.hpp>
-#include <Kokkos_HIP_Space.hpp>
+#include <HIP/Kokkos_HIP_Space.hpp>
+
+#include <HIP/Kokkos_HIP_DeepCopy.hpp>
+#include <HIP/Kokkos_HIP_SharedAllocationRecord.hpp>
 
 #include <impl/Kokkos_Error.hpp>
 #include <impl/Kokkos_MemorySpace.hpp>
 #include <impl/Kokkos_DeviceManagement.hpp>
 #include <impl/Kokkos_ExecSpaceManager.hpp>
 
+#include <hip/hip_runtime_api.h>
+
 #include <stdlib.h>
 #include <iostream>
 #include <sstream>
@@ -78,73 +54,12 @@ bool hip_driver_check_page_migration(int deviceId) {
   return static_cast<bool>(hasManagedMemory);
 }
 }  // namespace
-namespace Kokkos {
-namespace Impl {
-
-namespace {
-hipStream_t get_deep_copy_stream() {
-  static hipStream_t s = nullptr;
-  if (s == nullptr) {
-    KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamCreate(&s));
-  }
-  return s;
-}
-}  // namespace
-
-void DeepCopyHIP(void* dst, void const* src, size_t n) {
-  KOKKOS_IMPL_HIP_SAFE_CALL(hipMemcpyAsync(dst, src, n, hipMemcpyDefault));
-}
-
-void DeepCopyAsyncHIP(const Kokkos::Experimental::HIP& instance, void* dst,
-                      void const* src, size_t n) {
-  KOKKOS_IMPL_HIP_SAFE_CALL(
-      hipMemcpyAsync(dst, src, n, hipMemcpyDefault, instance.hip_stream()));
-}
-
-void DeepCopyAsyncHIP(void* dst, void const* src, size_t n) {
-  hipStream_t s = get_deep_copy_stream();
-  KOKKOS_IMPL_HIP_SAFE_CALL(hipMemcpyAsync(dst, src, n, hipMemcpyDefault, s));
-  Kokkos::Tools::Experimental::Impl::profile_fence_event<
-      Kokkos::Experimental::HIP>(
-      "Kokkos::Impl::DeepCopyAsyncHIP: Post Deep Copy Fence on Deep-Copy "
-      "stream",
-      Kokkos::Tools::Experimental::SpecialSynchronizationCases::
-          DeepCopyResourceSynchronization,
-      [&]() { KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamSynchronize(s)); });
-}
-
-}  // namespace Impl
-}  // namespace Kokkos
 
 /*--------------------------------------------------------------------------*/
 /*--------------------------------------------------------------------------*/
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
 namespace Kokkos {
 
-KOKKOS_DEPRECATED void Experimental::HIPSpace::access_error() {
-  const std::string msg(
-      "Kokkos::Experimental::HIPSpace::access_error attempt to execute "
-      "Experimental::HIP function from non-HIP space");
-  Kokkos::Impl::throw_runtime_exception(msg);
-}
-
-KOKKOS_DEPRECATED void Experimental::HIPSpace::access_error(const void* const) {
-  const std::string msg(
-      "Kokkos::Experimental::HIPSpace::access_error attempt to execute "
-      "Experimental::HIP function from non-HIP space");
-  Kokkos::Impl::throw_runtime_exception(msg);
-}
-
-}  // namespace Kokkos
-#endif
-
-/*--------------------------------------------------------------------------*/
-/*--------------------------------------------------------------------------*/
-
-namespace Kokkos {
-namespace Experimental {
-
 HIPSpace::HIPSpace() : m_device(HIP().hip_device()) {}
 
 HIPHostPinnedSpace::HIPHostPinnedSpace() {}
@@ -172,9 +87,10 @@ void* HIPSpace::impl_allocate(
     // This is the only way to clear the last error, which we should do here
     // since we're turning it into an exception here
     (void)hipGetLastError();
-    throw HIPRawMemoryAllocationFailure(
+    throw Experimental::HIPRawMemoryAllocationFailure(
         arg_alloc_size, error_code,
-        RawMemoryAllocationFailure::AllocationMechanism::HIPMalloc);
+        Experimental::RawMemoryAllocationFailure::AllocationMechanism::
+            HIPMalloc);
   }
   if (Kokkos::Profiling::profileLibraryLoaded()) {
     const size_t reported_size =
@@ -205,9 +121,10 @@ void* HIPHostPinnedSpace::impl_allocate(
     // This is the only way to clear the last error, which we should do here
     // since we're turning it into an exception here
     (void)hipGetLastError();
-    throw HIPRawMemoryAllocationFailure(
+    throw Experimental::HIPRawMemoryAllocationFailure(
         arg_alloc_size, error_code,
-        RawMemoryAllocationFailure::AllocationMechanism::HIPHostMalloc);
+        Experimental::RawMemoryAllocationFailure::AllocationMechanism::
+            HIPHostMalloc);
   }
   if (Kokkos::Profiling::profileLibraryLoaded()) {
     const size_t reported_size =
@@ -235,41 +152,46 @@ void* HIPManagedSpace::impl_allocate(
   if (arg_alloc_size > 0) {
     if (is_first_hip_managed_allocation.exchange(false) &&
         Kokkos::show_warnings()) {
-      if (!hip_driver_check_page_migration(m_device)) {
-        std::cerr << R"warning(
+      do {  // hack to avoid spamming users with too many warnings
+        if (!hip_driver_check_page_migration(m_device)) {
+          std::cerr << R"warning(
 Kokkos::HIP::allocation WARNING: The combination of device and system configuration
                                  does not support page migration between device and host.
                                  HIPManagedSpace might not work as expected.
                                  Please refer to the ROCm documentation on unified/managed memory.)warning"
-                  << std::endl;
-      }
-
-      // check for correct runtime environment
-      const char* hsa_xnack = std::getenv("HSA_XNACK");
-      if (!hsa_xnack)
-        std::cerr << R"warning(
+                    << std::endl;
+          break;  // do not warn about HSA_XNACK environement variable
+        }
+
+        // check for correct runtime environment
+        const char* hsa_xnack = std::getenv("HSA_XNACK");
+        if (!hsa_xnack)
+          std::cerr << R"warning(
 Kokkos::HIP::runtime WARNING: Kokkos did not find an environment variable 'HSA_XNACK'
                               for the current process.
                               Nevertheless, xnack is enabled for all processes if
                               amdgpu.noretry=0 was set in the Linux kernel boot line.
                               Without xnack enabled, Kokkos::HIPManaged might not behave
                               as expected.)warning"
-                  << std::endl;
-      else if (Kokkos::Impl::strcmp(hsa_xnack, "1") != 0)
-        std::cerr << "Kokkos::HIP::runtime WARNING: Kokkos detected the "
-                     "environement variable "
-                  << "'HSA_XNACK=" << hsa_xnack << "\n"
-                  << "Kokkos advises to set it to '1' to enable it per process."
-                  << std::endl;
+                    << std::endl;
+        else if (Kokkos::Impl::strcmp(hsa_xnack, "1") != 0)
+          std::cerr
+              << "Kokkos::HIP::runtime WARNING: Kokkos detected the "
+                 "environement variable "
+              << "'HSA_XNACK'=" << hsa_xnack << "\n"
+              << "Kokkos advises to set it to '1' to enable it per process."
+              << std::endl;
+      } while (false);
     }
     auto const error_code = hipMallocManaged(&ptr, arg_alloc_size);
     if (error_code != hipSuccess) {
       // This is the only way to clear the last error, which we should do here
       // since we're turning it into an exception here
       (void)hipGetLastError();
-      throw HIPRawMemoryAllocationFailure(
+      throw Experimental::HIPRawMemoryAllocationFailure(
           arg_alloc_size, error_code,
-          RawMemoryAllocationFailure::AllocationMechanism::HIPMallocManaged);
+          Experimental::RawMemoryAllocationFailure::AllocationMechanism::
+              HIPMallocManaged);
     }
     KOKKOS_IMPL_HIP_SAFE_CALL(hipMemAdvise(
         ptr, arg_alloc_size, hipMemAdviseSetCoarseGrain, m_device));
@@ -359,257 +281,10 @@ void HIPManagedSpace::impl_deallocate(
   KOKKOS_IMPL_HIP_SAFE_CALL(hipFree(arg_alloc_ptr));
 }
 
-}  // namespace Experimental
-}  // namespace Kokkos
-
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
-
-namespace Kokkos {
-namespace Impl {
-
-#ifdef KOKKOS_ENABLE_DEBUG
-SharedAllocationRecord<void, void>
-    SharedAllocationRecord<Kokkos::Experimental::HIPSpace, void>::s_root_record;
-
-SharedAllocationRecord<void, void> SharedAllocationRecord<
-    Kokkos::Experimental::HIPHostPinnedSpace, void>::s_root_record;
-
-SharedAllocationRecord<void, void> SharedAllocationRecord<
-    Kokkos::Experimental::HIPManagedSpace, void>::s_root_record;
-#endif
-
-SharedAllocationRecord<Kokkos::Experimental::HIPSpace,
-                       void>::~SharedAllocationRecord() {
-  auto alloc_size = SharedAllocationRecord<void, void>::m_alloc_size;
-  m_space.deallocate(m_label.c_str(),
-                     SharedAllocationRecord<void, void>::m_alloc_ptr,
-                     alloc_size, (alloc_size - sizeof(SharedAllocationHeader)));
-}
-
-SharedAllocationRecord<Kokkos::Experimental::HIPHostPinnedSpace,
-                       void>::~SharedAllocationRecord() {
-  m_space.deallocate(m_label.c_str(),
-                     SharedAllocationRecord<void, void>::m_alloc_ptr,
-                     SharedAllocationRecord<void, void>::m_alloc_size);
-}
-
-SharedAllocationRecord<Kokkos::Experimental::HIPManagedSpace,
-                       void>::~SharedAllocationRecord() {
-  m_space.deallocate(m_label.c_str(),
-                     SharedAllocationRecord<void, void>::m_alloc_ptr,
-                     SharedAllocationRecord<void, void>::m_alloc_size);
-}
-
-SharedAllocationRecord<Kokkos::Experimental::HIPSpace, void>::
-    SharedAllocationRecord(
-        const Kokkos::Experimental::HIPSpace& arg_space,
-        const std::string& arg_label, const size_t arg_alloc_size,
-        const SharedAllocationRecord<void, void>::function_type arg_dealloc)
-    // Pass through allocated [ SharedAllocationHeader , user_memory ]
-    // Pass through deallocation function
-    : base_t(
-#ifdef KOKKOS_ENABLE_DEBUG
-          &SharedAllocationRecord<Kokkos::Experimental::HIPSpace,
-                                  void>::s_root_record,
-#endif
-          Kokkos::Impl::checked_allocation_with_header(arg_space, arg_label,
-                                                       arg_alloc_size),
-          sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc,
-          arg_label),
-      m_space(arg_space) {
-
-  SharedAllocationHeader header;
-
-  this->base_t::_fill_host_accessible_header_info(header, arg_label);
-
-  // Copy to device memory
-  Kokkos::Experimental::HIP exec;
-  Kokkos::Impl::DeepCopy<Kokkos::Experimental::HIPSpace, HostSpace>(
-      exec, RecordBase::m_alloc_ptr, &header, sizeof(SharedAllocationHeader));
-  exec.fence(
-      "SharedAllocationRecord<Kokkos::Experimental::HIPSpace, "
-      "void>::SharedAllocationRecord(): fence after copying header from "
-      "HostSpace");
-}
-
-SharedAllocationRecord<Kokkos::Experimental::HIPSpace, void>::
-    SharedAllocationRecord(
-        const Kokkos::Experimental::HIP& arg_exec_space,
-        const Kokkos::Experimental::HIPSpace& arg_space,
-        const std::string& arg_label, const size_t arg_alloc_size,
-        const SharedAllocationRecord<void, void>::function_type arg_dealloc)
-    // Pass through allocated [ SharedAllocationHeader , user_memory ]
-    // Pass through deallocation function
-    : base_t(
-#ifdef KOKKOS_ENABLE_DEBUG
-          &SharedAllocationRecord<Kokkos::Experimental::HIPSpace,
-                                  void>::s_root_record,
-#endif
-          Kokkos::Impl::checked_allocation_with_header(arg_space, arg_label,
-                                                       arg_alloc_size),
-          sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc,
-          arg_label),
-      m_space(arg_space) {
-
-  SharedAllocationHeader header;
-
-  this->base_t::_fill_host_accessible_header_info(header, arg_label);
-
-  // Copy to device memory
-  Kokkos::Impl::DeepCopy<Kokkos::Experimental::HIPSpace, HostSpace>(
-      arg_exec_space, RecordBase::m_alloc_ptr, &header,
-      sizeof(SharedAllocationHeader));
-}
-
-SharedAllocationRecord<Kokkos::Experimental::HIPHostPinnedSpace, void>::
-    SharedAllocationRecord(
-        const Kokkos::Experimental::HIPHostPinnedSpace& arg_space,
-        const std::string& arg_label, const size_t arg_alloc_size,
-        const SharedAllocationRecord<void, void>::function_type arg_dealloc)
-    // Pass through allocated [ SharedAllocationHeader , user_memory ]
-    // Pass through deallocation function
-    : base_t(
-#ifdef KOKKOS_ENABLE_DEBUG
-          &SharedAllocationRecord<Kokkos::Experimental::HIPHostPinnedSpace,
-                                  void>::s_root_record,
-#endif
-          Kokkos::Impl::checked_allocation_with_header(arg_space, arg_label,
-                                                       arg_alloc_size),
-          sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc,
-          arg_label),
-      m_space(arg_space) {
-  // Fill in the Header information, directly accessible via host pinned memory
-  this->base_t::_fill_host_accessible_header_info(*RecordBase::m_alloc_ptr,
-                                                  arg_label);
-}
-
-SharedAllocationRecord<Kokkos::Experimental::HIPManagedSpace, void>::
-    SharedAllocationRecord(
-        const Kokkos::Experimental::HIPManagedSpace& arg_space,
-        const std::string& arg_label, const size_t arg_alloc_size,
-        const SharedAllocationRecord<void, void>::function_type arg_dealloc)
-    // Pass through allocated [ SharedAllocationHeader , user_memory ]
-    // Pass through deallocation function
-    : base_t(
-#ifdef KOKKOS_ENABLE_DEBUG
-          &SharedAllocationRecord<Kokkos::Experimental::HIPManagedSpace,
-                                  void>::s_root_record,
-#endif
-          Kokkos::Impl::checked_allocation_with_header(arg_space, arg_label,
-                                                       arg_alloc_size),
-          sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc,
-          arg_label),
-      m_space(arg_space) {
-  // Fill in the Header information, directly accessible via managed memory
-  this->base_t::_fill_host_accessible_header_info(*RecordBase::m_alloc_ptr,
-                                                  arg_label);
-}
-
-}  // namespace Impl
 }  // namespace Kokkos
 
 /*--------------------------------------------------------------------------*/
 /*--------------------------------------------------------------------------*/
-namespace Kokkos {
-namespace Experimental {
-
-int HIP::concurrency() {
-  auto const& prop = hip_device_prop();
-  return prop.maxThreadsPerMultiProcessor * prop.multiProcessorCount;
-}
-int HIP::impl_is_initialized() {
-  return Impl::HIPInternal::singleton().is_initialized();
-}
-
-void HIP::impl_initialize(InitializationSettings const& settings) {
-  Impl::HIPInternal::singleton().initialize(::Kokkos::Impl::get_gpu(settings));
-}
-
-void HIP::impl_finalize() { Impl::HIPInternal::singleton().finalize(); }
-
-HIP::HIP()
-    : m_space_instance(&Impl::HIPInternal::singleton(),
-                       [](Impl::HIPInternal*) {}) {
-  Impl::HIPInternal::singleton().verify_is_initialized(
-      "HIP instance constructor");
-}
-
-HIP::HIP(hipStream_t const stream, bool manage_stream)
-    : m_space_instance(new Impl::HIPInternal, [](Impl::HIPInternal* ptr) {
-        ptr->finalize();
-        delete ptr;
-      }) {
-  Impl::HIPInternal::singleton().verify_is_initialized(
-      "HIP instance constructor");
-  m_space_instance->initialize(Impl::HIPInternal::singleton().m_hipDev, stream,
-                               manage_stream);
-}
-
-void HIP::print_configuration(std::ostream& os, bool /*verbose*/) const {
-  os << "Device Execution Space:\n";
-  os << "  KOKKOS_ENABLE_HIP: yes\n";
-
-  os << "HIP Options:\n";
-  os << "  KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE: ";
-#ifdef KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE
-  os << "yes\n";
-#else
-  os << "no\n";
-#endif
-
-  os << "\nRuntime Configuration:\n";
-
-  m_space_instance->print_configuration(os);
-}
-
-uint32_t HIP::impl_instance_id() const noexcept {
-  return m_space_instance->impl_get_instance_id();
-}
-void HIP::impl_static_fence(const std::string& name) {
-  Kokkos::Tools::Experimental::Impl::profile_fence_event<
-      Kokkos::Experimental::HIP>(
-      name,
-      Kokkos::Tools::Experimental::SpecialSynchronizationCases::
-          GlobalDeviceSynchronization,
-      [&]() { KOKKOS_IMPL_HIP_SAFE_CALL(hipDeviceSynchronize()); });
-}
-
-void HIP::fence(const std::string& name) const {
-  m_space_instance->fence(name);
-}
-
-hipStream_t HIP::hip_stream() const { return m_space_instance->m_stream; }
-
-int HIP::hip_device() const { return impl_internal_space_instance()->m_hipDev; }
-
-hipDeviceProp_t const& HIP::hip_device_prop() {
-  return Impl::HIPInternal::singleton().m_deviceProp;
-}
-
-const char* HIP::name() { return "HIP"; }
-
-}  // namespace Experimental
-
-namespace Impl {
-
-int g_hip_space_factory_initialized =
-    initialize_space_factory<::Kokkos::Experimental::HIP>("150_HIP");
-
-}  // namespace Impl
-
-#ifdef KOKKOS_ENABLE_CXX14
-namespace Tools {
-namespace Experimental {
-constexpr DeviceType DeviceTypeTraits<Kokkos::Experimental::HIP>::id;
-}
-}  // namespace Tools
-#endif
-
-}  // namespace Kokkos
-
-//==============================================================================
-// <editor-fold desc="Explicit instantiations of CRTP Base classes"> {{{1
 
 #include <impl/Kokkos_SharedAlloc_timpl.hpp>
 
@@ -619,16 +294,10 @@ namespace Impl {
 // To avoid additional compilation cost for something that's (mostly?) not
 // performance sensitive, we explicity instantiate these CRTP base classes here,
 // where we have access to the associated *_timpl.hpp header files.
-template class HostInaccessibleSharedAllocationRecordCommon<
-    Kokkos::Experimental::HIPSpace>;
-template class SharedAllocationRecordCommon<Kokkos::Experimental::HIPSpace>;
-template class SharedAllocationRecordCommon<
-    Kokkos::Experimental::HIPHostPinnedSpace>;
-template class SharedAllocationRecordCommon<
-    Kokkos::Experimental::HIPManagedSpace>;
+template class HostInaccessibleSharedAllocationRecordCommon<HIPSpace>;
+template class SharedAllocationRecordCommon<HIPSpace>;
+template class SharedAllocationRecordCommon<HIPHostPinnedSpace>;
+template class SharedAllocationRecordCommon<HIPManagedSpace>;
 
 }  // end namespace Impl
 }  // end namespace Kokkos
-
-// </editor-fold> end Explicit instantiations of CRTP Base classes }}}1
-//==============================================================================
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..902b6f05527b1a10ae30da1a82ac1c2de41eb421
--- /dev/null
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.hpp
@@ -0,0 +1,345 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_HIPSPACE_HPP
+#define KOKKOS_HIPSPACE_HPP
+
+#include <Kokkos_Core_fwd.hpp>
+
+#include <iosfwd>
+#include <typeinfo>
+#include <string>
+#include <cstddef>
+#include <iosfwd>
+
+#include <Kokkos_HostSpace.hpp>
+#include <Kokkos_ScratchSpace.hpp>
+#include <HIP/Kokkos_HIP_Error.hpp>  // HIP_SAFE_CALL
+
+#include <impl/Kokkos_Profiling_Interface.hpp>
+#include <impl/Kokkos_HostSharedPtr.hpp>
+
+#include <hip/hip_runtime_api.h>
+
+/*--------------------------------------------------------------------------*/
+
+namespace Kokkos {
+namespace Impl {
+
+template <typename T>
+struct is_hip_type_space : public std::false_type {};
+
+}  // namespace Impl
+
+/** \brief  HIP on-device memory management */
+
+class HIPSpace {
+ public:
+  //! Tag this class as a kokkos memory space
+  using memory_space    = HIPSpace;
+  using execution_space = HIP;
+  using device_type     = Kokkos::Device<execution_space, memory_space>;
+
+  using size_type = unsigned int;
+
+  /*--------------------------------*/
+
+  HIPSpace();
+  HIPSpace(HIPSpace&& rhs)      = default;
+  HIPSpace(const HIPSpace& rhs) = default;
+  HIPSpace& operator=(HIPSpace&& rhs) = default;
+  HIPSpace& operator=(const HIPSpace& rhs) = default;
+  ~HIPSpace()                              = default;
+
+  /**\brief  Allocate untracked memory in the hip space */
+  void* allocate(const size_t arg_alloc_size) const;
+  void* allocate(const char* arg_label, const size_t arg_alloc_size,
+                 const size_t arg_logical_size = 0) const;
+
+  /**\brief  Deallocate untracked memory in the hip space */
+  void deallocate(void* const arg_alloc_ptr, const size_t arg_alloc_size) const;
+  void deallocate(const char* arg_label, void* const arg_alloc_ptr,
+                  const size_t arg_alloc_size,
+                  const size_t arg_logical_size = 0) const;
+
+ private:
+  template <class, class, class, class>
+  friend class LogicalMemorySpace;
+  void* impl_allocate(const char* arg_label, const size_t arg_alloc_size,
+                      const size_t arg_logical_size = 0,
+                      const Kokkos::Tools::SpaceHandle =
+                          Kokkos::Tools::make_space_handle(name())) const;
+  void impl_deallocate(const char* arg_label, void* const arg_alloc_ptr,
+                       const size_t arg_alloc_size,
+                       const size_t arg_logical_size = 0,
+                       const Kokkos::Tools::SpaceHandle =
+                           Kokkos::Tools::make_space_handle(name())) const;
+
+ public:
+  /**\brief Return Name of the MemorySpace */
+  static constexpr const char* name() { return "HIP"; }
+
+ private:
+  int m_device;  ///< Which HIP device
+
+  friend class Kokkos::Impl::SharedAllocationRecord<HIPSpace, void>;
+};
+
+template <>
+struct Impl::is_hip_type_space<HIPSpace> : public std::true_type {};
+
+}  // namespace Kokkos
+
+/*--------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------*/
+
+namespace Kokkos {
+/** \brief  Host memory that is accessible to HIP execution space
+ *          through HIP's host-pinned memory allocation.
+ */
+class HIPHostPinnedSpace {
+ public:
+  //! Tag this class as a kokkos memory space
+  /** \brief  Memory is in HostSpace so use the HostSpace::execution_space */
+  using execution_space = HostSpace::execution_space;
+  using memory_space    = HIPHostPinnedSpace;
+  using device_type     = Kokkos::Device<execution_space, memory_space>;
+  using size_type       = unsigned int;
+
+  /*--------------------------------*/
+
+  HIPHostPinnedSpace();
+  HIPHostPinnedSpace(HIPHostPinnedSpace&& rhs)      = default;
+  HIPHostPinnedSpace(const HIPHostPinnedSpace& rhs) = default;
+  HIPHostPinnedSpace& operator=(HIPHostPinnedSpace&& rhs) = default;
+  HIPHostPinnedSpace& operator=(const HIPHostPinnedSpace& rhs) = default;
+  ~HIPHostPinnedSpace()                                        = default;
+
+  /**\brief  Allocate untracked memory in the space */
+  void* allocate(const size_t arg_alloc_size) const;
+  void* allocate(const char* arg_label, const size_t arg_alloc_size,
+                 const size_t arg_logical_size = 0) const;
+
+  /**\brief  Deallocate untracked memory in the space */
+  void deallocate(void* const arg_alloc_ptr, const size_t arg_alloc_size) const;
+  void deallocate(const char* arg_label, void* const arg_alloc_ptr,
+                  const size_t arg_alloc_size,
+                  const size_t arg_logical_size = 0) const;
+
+ private:
+  template <class, class, class, class>
+  friend class LogicalMemorySpace;
+  void* impl_allocate(const char* arg_label, const size_t arg_alloc_size,
+                      const size_t arg_logical_size = 0,
+                      const Kokkos::Tools::SpaceHandle =
+                          Kokkos::Tools::make_space_handle(name())) const;
+  void impl_deallocate(const char* arg_label, void* const arg_alloc_ptr,
+                       const size_t arg_alloc_size,
+                       const size_t arg_logical_size = 0,
+                       const Kokkos::Tools::SpaceHandle =
+                           Kokkos::Tools::make_space_handle(name())) const;
+
+ public:
+  /**\brief Return Name of the MemorySpace */
+  static constexpr const char* name() { return "HIPHostPinned"; }
+
+  /*--------------------------------*/
+};
+
+template <>
+struct Impl::is_hip_type_space<HIPHostPinnedSpace> : public std::true_type {};
+
+}  // namespace Kokkos
+
+/*--------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------*/
+
+namespace Kokkos {
+/** \brief  Memory that is accessible to HIP execution space
+ *          and host through HIP's memory page migration.
+ */
+class HIPManagedSpace {
+ public:
+  //! Tag this class as a kokkos memory space
+  /** \brief  Memory is unified to both device and host via page migration
+   *  and therefore able to be used by HostSpace::execution_space and
+   *  DeviceSpace::execution_space.
+   */
+  //! tag this class as a kokkos memory space
+  using memory_space    = HIPManagedSpace;
+  using execution_space = HIP;
+  using device_type     = Kokkos::Device<execution_space, memory_space>;
+  using size_type       = unsigned int;
+
+  /*--------------------------------*/
+
+  HIPManagedSpace();
+  HIPManagedSpace(HIPManagedSpace&& rhs)      = default;
+  HIPManagedSpace(const HIPManagedSpace& rhs) = default;
+  HIPManagedSpace& operator=(HIPManagedSpace&& rhs) = default;
+  HIPManagedSpace& operator=(const HIPManagedSpace& rhs) = default;
+  ~HIPManagedSpace()                                     = default;
+
+  /**\brief  Allocate untracked memory in the space */
+  void* allocate(const size_t arg_alloc_size) const;
+  void* allocate(const char* arg_label, const size_t arg_alloc_size,
+                 const size_t arg_logical_size = 0) const;
+
+  /**\brief  Deallocate untracked memory in the space */
+  void deallocate(void* const arg_alloc_ptr, const size_t arg_alloc_size) const;
+  void deallocate(const char* arg_label, void* const arg_alloc_ptr,
+                  const size_t arg_alloc_size,
+                  const size_t arg_logical_size = 0) const;
+
+ private:
+  int m_device;  ///< Which HIP device
+  template <class, class, class, class>
+  friend class LogicalMemorySpace;
+  void* impl_allocate(const char* arg_label, const size_t arg_alloc_size,
+                      const size_t arg_logical_size = 0,
+                      const Kokkos::Tools::SpaceHandle =
+                          Kokkos::Tools::make_space_handle(name())) const;
+  void impl_deallocate(const char* arg_label, void* const arg_alloc_ptr,
+                       const size_t arg_alloc_size,
+                       const size_t arg_logical_size = 0,
+                       const Kokkos::Tools::SpaceHandle =
+                           Kokkos::Tools::make_space_handle(name())) const;
+
+ public:
+  /**\brief Return Name of the MemorySpace */
+  static constexpr const char* name() { return "HIPManaged"; }
+
+  /*--------------------------------*/
+};
+
+template <>
+struct Impl::is_hip_type_space<HIPManagedSpace> : public std::true_type {};
+
+}  // namespace Kokkos
+
+/*--------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------*/
+
+namespace Kokkos {
+namespace Impl {
+
+static_assert(Kokkos::Impl::MemorySpaceAccess<HIPSpace, HIPSpace>::assignable,
+              "");
+
+//----------------------------------------
+
+template <>
+struct MemorySpaceAccess<HostSpace, HIPSpace> {
+  enum : bool { assignable = false };
+  enum : bool { accessible = false };
+  enum : bool { deepcopy = true };
+};
+
+template <>
+struct MemorySpaceAccess<HostSpace, HIPHostPinnedSpace> {
+  // HostSpace::execution_space == HIPHostPinnedSpace::execution_space
+  enum : bool { assignable = true };
+  enum : bool { accessible = true };
+  enum : bool { deepcopy = true };
+};
+
+template <>
+struct MemorySpaceAccess<HostSpace, HIPManagedSpace> {
+  // HostSpace::execution_space != HIPManagedSpace::execution_space
+  enum : bool { assignable = false };
+  enum : bool { accessible = true };
+  enum : bool { deepcopy = true };
+};
+
+//----------------------------------------
+
+template <>
+struct MemorySpaceAccess<HIPSpace, HostSpace> {
+  enum : bool { assignable = false };
+  enum : bool { accessible = false };
+  enum : bool { deepcopy = true };
+};
+
+template <>
+struct MemorySpaceAccess<HIPSpace, HIPHostPinnedSpace> {
+  // HIPSpace::execution_space != HIPHostPinnedSpace::execution_space
+  enum : bool { assignable = false };
+  enum : bool { accessible = true };  // HIPSpace::execution_space
+  enum : bool { deepcopy = true };
+};
+
+template <>
+struct MemorySpaceAccess<HIPSpace, HIPManagedSpace> {
+  // HIPSpace::execution_space == HIPManagedSpace::execution_space
+  enum : bool { assignable = true };
+  enum : bool { accessible = true };
+  enum : bool { deepcopy = true };
+};
+
+//----------------------------------------
+// HIPHostPinnedSpace::execution_space == HostSpace::execution_space
+// HIPHostPinnedSpace accessible to both HIP and Host
+
+template <>
+struct MemorySpaceAccess<HIPHostPinnedSpace, HostSpace> {
+  enum : bool { assignable = false };  // Cannot access from HIP
+  enum : bool { accessible = true };   // HIPHostPinnedSpace::execution_space
+  enum : bool { deepcopy = true };
+};
+
+template <>
+struct MemorySpaceAccess<HIPHostPinnedSpace, HIPSpace> {
+  enum : bool { assignable = false };  // Cannot access from Host
+  enum : bool { accessible = false };
+  enum : bool { deepcopy = true };
+};
+
+template <>
+struct MemorySpaceAccess<HIPHostPinnedSpace, HIPManagedSpace> {
+  enum : bool { assignable = false };  // different exec_space
+  enum : bool { accessible = true };
+  enum : bool { deepcopy = true };
+};
+
+//----------------------------------------
+// HIPManagedSpace::execution_space != HostSpace::execution_space
+// HIPManagedSpace accessible to both HIP and Host
+
+template <>
+struct MemorySpaceAccess<HIPManagedSpace, HostSpace> {
+  enum : bool { assignable = false };
+  enum : bool { accessible = false };  // HIPHostPinnedSpace::execution_space
+  enum : bool { deepcopy = true };
+};
+
+template <>
+struct MemorySpaceAccess<HIPManagedSpace, HIPSpace> {
+  enum : bool { assignable = false };
+  enum : bool { accessible = true };
+  enum : bool { deepcopy = true };
+};
+
+template <>
+struct MemorySpaceAccess<HIPManagedSpace, HIPHostPinnedSpace> {
+  enum : bool { assignable = false };  // different exec_space
+  enum : bool { accessible = true };
+  enum : bool { deepcopy = true };
+};
+
+}  // namespace Impl
+}  // namespace Kokkos
+
+#endif /* #define KOKKOS_HIPSPACE_HPP */
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Team.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Team.hpp
index 9ddfa5f65106dd6409d4502c27d0599bb4ba5c61..5b9faba786f77e7fda2c92aa122d8bb3cc19884d 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Team.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Team.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HIP_TEAM_HPP
 #define KOKKOS_HIP_TEAM_HPP
@@ -94,8 +66,9 @@ struct HIPJoinFunctor {
  */
 class HIPTeamMember {
  public:
-  using execution_space      = Kokkos::Experimental::HIP;
+  using execution_space      = HIP;
   using scratch_memory_space = execution_space::scratch_memory_space;
+  using team_handle          = HIPTeamMember;
 
  private:
   mutable void* m_team_reduce;
@@ -166,8 +139,7 @@ class HIPTeamMember {
       val = *(reinterpret_cast<ValueType*>(m_team_reduce));
     } else {               // team <= warp
       ValueType tmp(val);  // input might not be a register variable
-      ::Kokkos::Experimental::Impl::in_place_shfl(
-          val, tmp, blockDim.x * thread_id, blockDim.x * blockDim.y);
+      in_place_shfl(val, tmp, blockDim.x * thread_id, blockDim.x * blockDim.y);
     }
 #else
     (void)val;
@@ -209,8 +181,8 @@ class HIPTeamMember {
               typename ReducerType::value_type& value) const noexcept {
 #ifdef __HIP_DEVICE_COMPILE__
     typename Kokkos::Impl::FunctorAnalysis<
-        FunctorPatternInterface::REDUCE, TeamPolicy<Experimental::HIP>,
-        ReducerType>::Reducer wrapped_reducer(&reducer);
+        FunctorPatternInterface::REDUCE, TeamPolicy<HIP>, ReducerType>::Reducer
+        wrapped_reducer(&reducer);
     hip_intra_block_shuffle_reduction(value, wrapped_reducer, blockDim.y);
     reducer.reference() = value;
 #else
@@ -246,7 +218,7 @@ class HIPTeamMember {
 
     Impl::HIPJoinFunctor<Type> hip_join_functor;
     typename Kokkos::Impl::FunctorAnalysis<
-        FunctorPatternInterface::REDUCE, TeamPolicy<Experimental::HIP>,
+        FunctorPatternInterface::REDUCE, TeamPolicy<HIP>,
         Impl::HIPJoinFunctor<Type>>::Reducer reducer(&hip_join_functor);
     Impl::hip_intra_block_reduce_scan<true>(reducer, base_data + 1);
 
@@ -297,8 +269,7 @@ class HIPTeamMember {
     typename ReducerType::value_type tmp2 = tmp;
 
     for (int i = blockDim.x; (i >>= 1);) {
-      ::Kokkos::Experimental::Impl::in_place_shfl_down(tmp2, tmp, i,
-                                                       blockDim.x);
+      in_place_shfl_down(tmp2, tmp, i, blockDim.x);
       if (static_cast<int>(threadIdx.x) < i) {
         reducer.join(tmp, tmp2);
       }
@@ -309,7 +280,7 @@ class HIPTeamMember {
     // because floating point summation is not associative
     // and thus different threads could have different results.
 
-    ::Kokkos::Experimental::Impl::in_place_shfl(tmp2, tmp, 0, blockDim.x);
+    in_place_shfl(tmp2, tmp, 0, blockDim.x);
     value               = tmp2;
     reducer.reference() = tmp2;
 #else
@@ -824,7 +795,7 @@ parallel_scan(const Impl::ThreadVectorRangeBoundariesStruct<
     //  inversion.
     for (int j = 1; j < static_cast<int>(blockDim.x); j <<= 1) {
       value_type tmp = identity;
-      ::Kokkos::Experimental::Impl::in_place_shfl_up(tmp, val, j, blockDim.x);
+      Impl::in_place_shfl_up(tmp, val, j, blockDim.x);
       if (j <= static_cast<int>(threadIdx.x)) {
         reducer.join(val, tmp);
       }
@@ -836,8 +807,7 @@ parallel_scan(const Impl::ThreadVectorRangeBoundariesStruct<
     // Update i's contribution into the val
     // and add it to accum for next round
     if (i < loop_boundaries.end) closure(i, val, true);
-    ::Kokkos::Experimental::Impl::in_place_shfl(accum, val, blockDim.x - 1,
-                                                blockDim.x);
+    Impl::in_place_shfl(accum, val, blockDim.x - 1, blockDim.x);
   }
 #else
   (void)loop_boundaries;
@@ -899,7 +869,7 @@ KOKKOS_INLINE_FUNCTION void single(
     const FunctorType& lambda, ValueType& val) {
 #ifdef __HIP_DEVICE_COMPILE__
   if (threadIdx.x == 0) lambda(val);
-  ::Kokkos::Experimental::Impl::in_place_shfl(val, val, 0, blockDim.x);
+  Impl::in_place_shfl(val, val, 0, blockDim.x);
 #else
   (void)lambda;
   (void)val;
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_UniqueToken.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_UniqueToken.hpp
index a0722f618b4559b759e538b9676ea0d4661a6f6f..13fc6216d6b06482026810fa2fd43507617bf602 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_UniqueToken.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_UniqueToken.hpp
@@ -1,59 +1,31 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HIP_UNIQUE_TOKEN_HPP
 #define KOKKOS_HIP_UNIQUE_TOKEN_HPP
 
-#include <Kokkos_HIP_Space.hpp>
+#include <HIP/Kokkos_HIP_Space.hpp>
 #include <Kokkos_UniqueToken.hpp>
 #include <impl/Kokkos_SharedAlloc.hpp>
 
 namespace Kokkos {
 
 namespace Impl {
-Kokkos::View<uint32_t*, Kokkos::Experimental::HIPSpace>
-hip_global_unique_token_locks(bool deallocate = false);
+Kokkos::View<uint32_t*, HIPSpace> hip_global_unique_token_locks(
+    bool deallocate = false);
 }
 
 namespace Experimental {
@@ -164,11 +136,9 @@ class UniqueToken<HIP, UniqueTokenScope::Instance>
   // The instance version will forward to protected constructor which creates
   // a lock array per instance
   UniqueToken()
-      : UniqueToken<HIP, UniqueTokenScope::Global>(
-            Kokkos::Experimental::HIP().concurrency()) {}
+      : UniqueToken<HIP, UniqueTokenScope::Global>(HIP().concurrency()) {}
   explicit UniqueToken(execution_space const& arg)
-      : UniqueToken<HIP, UniqueTokenScope::Global>(
-            Kokkos::Experimental::HIP().concurrency(), arg) {}
+      : UniqueToken<HIP, UniqueTokenScope::Global>(HIP().concurrency(), arg) {}
   explicit UniqueToken(size_type max_size)
       : UniqueToken<HIP, UniqueTokenScope::Global>(max_size) {}
   UniqueToken(size_type max_size, execution_space const& arg)
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Vectorization.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Vectorization.hpp
index 18b5f57c2254e3791b9100fdb9640e5713b61cbd..e14b722f37378668b92fd04939770def45f0a4d8 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Vectorization.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Vectorization.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HIP_VECTORIZATION_HPP
 #define KOKKOS_HIP_VECTORIZATION_HPP
@@ -48,7 +20,6 @@
 #include <Kokkos_Macros.hpp>
 
 namespace Kokkos {
-namespace Experimental {
 namespace Impl {
 
 //----------------------------------------------------------------------------
@@ -196,7 +167,6 @@ __device__ inline T shfl_up(const T& val, int delta, int width) {
   return rv;
 }
 
-}  // namespace Experimental
 }  // namespace Kokkos
 
 #endif
diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_WorkGraphPolicy.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_WorkGraphPolicy.hpp
index 081f6f4047ea3a4ae34f4f027133f100f2752783..136dca120887a63964a4fc0dc3caf389dbb151fb 100644
--- a/packages/kokkos/core/src/HIP/Kokkos_HIP_WorkGraphPolicy.hpp
+++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_WorkGraphPolicy.hpp
@@ -1,61 +1,34 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HIP_WORKGRAPHPOLICY_HPP
 #define KOKKOS_HIP_WORKGRAPHPOLICY_HPP
 
-#include <Kokkos_HIP.hpp>
+#include <HIP/Kokkos_HIP.hpp>
+#include <HIP/Kokkos_HIP_Instance.hpp>
+#include <HIP/Kokkos_HIP_KernelLaunch.hpp>
 
 namespace Kokkos {
 namespace Impl {
 
 template <class FunctorType, class... Traits>
-class ParallelFor<FunctorType, Kokkos::WorkGraphPolicy<Traits...>,
-                  Kokkos::Experimental::HIP> {
+class ParallelFor<FunctorType, Kokkos::WorkGraphPolicy<Traits...>, HIP> {
  public:
   using Policy = Kokkos::WorkGraphPolicy<Traits...>;
-  using Self   = ParallelFor<FunctorType, Policy, Kokkos::Experimental::HIP>;
+  using Self   = ParallelFor<FunctorType, Policy, HIP>;
 
  private:
   Policy m_policy;
@@ -89,15 +62,12 @@ class ParallelFor<FunctorType, Kokkos::WorkGraphPolicy<Traits...>,
 
   inline void execute() {
     const int warps_per_block = 4;
-    const dim3 grid(
-        Kokkos::Experimental::Impl::hip_internal_multiprocessor_count(), 1, 1);
-    const dim3 block(1, Kokkos::Experimental::Impl::HIPTraits::WarpSize,
-                     warps_per_block);
+    const dim3 grid(hip_internal_multiprocessor_count(), 1, 1);
+    const dim3 block(1, HIPTraits::WarpSize, warps_per_block);
     const int shared = 0;
 
-    Kokkos::Experimental::Impl::HIPParallelLaunch<Self>(
-        *this, grid, block, shared,
-        Experimental::HIP().impl_internal_space_instance(), false);
+    HIPParallelLaunch<Self>(*this, grid, block, shared,
+                            HIP().impl_internal_space_instance(), false);
   }
 
   inline ParallelFor(const FunctorType& arg_functor, const Policy& arg_policy)
diff --git a/packages/kokkos/core/src/HPX/Kokkos_HPX.cpp b/packages/kokkos/core/src/HPX/Kokkos_HPX.cpp
index 6027ead01bda8194d8d0ea95b9f6e82d4ce0d0dd..2074123a15fd4acbea86f4b8f753aa2628991d7d 100644
--- a/packages/kokkos/core/src/HPX/Kokkos_HPX.cpp
+++ b/packages/kokkos/core/src/HPX/Kokkos_HPX.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -143,14 +115,6 @@ int g_hpx_space_factory_initialized =
 
 }  // namespace Impl
 
-#ifdef KOKKOS_ENABLE_CXX14
-namespace Tools {
-namespace Experimental {
-constexpr DeviceType DeviceTypeTraits<Kokkos::Experimental::HPX>::id;
-}
-}  // namespace Tools
-#endif
-
 }  // namespace Kokkos
 
 #else
diff --git a/packages/kokkos/core/src/HPX/Kokkos_HPX_MDRangePolicy.hpp b/packages/kokkos/core/src/HPX/Kokkos_HPX_MDRangePolicy.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..cf0d1add1268eea58e6a635bc6892626e7d77d11
--- /dev/null
+++ b/packages/kokkos/core/src/HPX/Kokkos_HPX_MDRangePolicy.hpp
@@ -0,0 +1,33 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_HPX_MDRANGEPOLICY_HPP_
+#define KOKKOS_HPX_MDRANGEPOLICY_HPP_
+
+#include <KokkosExp_MDRangePolicy.hpp>
+
+namespace Kokkos {
+namespace Impl {
+
+// Settings for TeamMDRangePolicy
+template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector>
+struct ThreadAndVectorNestLevel<Rank, Kokkos::Experimental::HPX,
+                                ThreadAndVector>
+    : HostBasedNestLevel<Rank, ThreadAndVector> {};
+
+}  // namespace Impl
+}  // namespace Kokkos
+#endif
diff --git a/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.cpp b/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.cpp
index e61ac728a90dd86eee5b7fb4965349b2307a680f..ad540a203d5b4f2825b51dafdee6d182b27d536e 100644
--- a/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.cpp
+++ b/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
diff --git a/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.hpp b/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.hpp
index 67765a6ae0f6c3482e6410cad15e2c7571dde658..e75b7be49dc28f64f3fa818b6c51a2a41e3a5154 100644
--- a/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.hpp
+++ b/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HPX_TASK_HPP
 #define KOKKOS_HPX_TASK_HPP
diff --git a/packages/kokkos/core/src/HPX/Kokkos_HPX_WorkGraphPolicy.hpp b/packages/kokkos/core/src/HPX/Kokkos_HPX_WorkGraphPolicy.hpp
index 5f2eff5774c0a5a73b323c2eb6a936aea1796db3..72a80199355b09d742168882939d344831bd6fb8 100644
--- a/packages/kokkos/core/src/HPX/Kokkos_HPX_WorkGraphPolicy.hpp
+++ b/packages/kokkos/core/src/HPX/Kokkos_HPX_WorkGraphPolicy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HPX_WORKGRAPHPOLICY_HPP
 #define KOKKOS_HPX_WORKGRAPHPOLICY_HPP
diff --git a/packages/kokkos/core/src/KokkosExp_InterOp.hpp b/packages/kokkos/core/src/KokkosExp_InterOp.hpp
index 0522ad7e8da8990c4378dc0830a5f4be3d0e5e1f..c46ba0de13975f90a3f3e194df7aadd72bf8a9bd 100644
--- a/packages/kokkos/core/src/KokkosExp_InterOp.hpp
+++ b/packages/kokkos/core/src/KokkosExp_InterOp.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CORE_EXP_INTEROP_HPP
 #define KOKKOS_CORE_EXP_INTEROP_HPP
diff --git a/packages/kokkos/core/src/KokkosExp_MDRangePolicy.hpp b/packages/kokkos/core/src/KokkosExp_MDRangePolicy.hpp
index 64b31c7fea5d5cdefd5a91369c9144b3973be050..c9080db01cafc799d9da5c36516fddb7f52e861f 100644
--- a/packages/kokkos/core/src/KokkosExp_MDRangePolicy.hpp
+++ b/packages/kokkos/core/src/KokkosExp_MDRangePolicy.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_CORE_EXP_MD_RANGE_POLICY_HPP
 #define KOKKOS_CORE_EXP_MD_RANGE_POLICY_HPP
@@ -208,6 +176,7 @@ struct MDRangePolicy : public Kokkos::Impl::PolicyTraits<Properties...> {
   using member_type       = typename range_policy::member_type;
 
   static constexpr int rank = iteration_pattern::rank;
+  static_assert(rank < 7, "Kokkos MDRangePolicy Error: Unsupported rank...");
 
   using index_type       = typename traits::index_type;
   using array_index_type = std::int64_t;
@@ -391,18 +360,4 @@ struct MDRangePolicy : public Kokkos::Impl::PolicyTraits<Properties...> {
 
 }  // namespace Kokkos
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-// For backward compatibility
-namespace Kokkos {
-namespace Experimental {
-using Iterate KOKKOS_DEPRECATED = Kokkos::Iterate;
-template <typename... Properties>
-using MDRangePolicy KOKKOS_DEPRECATED = Kokkos::MDRangePolicy<Properties...>;
-template <unsigned N, Kokkos::Iterate OuterDir = Kokkos::Iterate::Default,
-          Kokkos::Iterate InnerDir = Kokkos::Iterate::Default>
-using Rank KOKKOS_DEPRECATED = Kokkos::Rank<N, OuterDir, InnerDir>;
-}  // namespace Experimental
-}  // namespace Kokkos
-#endif
-
 #endif  // KOKKOS_CORE_EXP_MD_RANGE_POLICY_HPP
diff --git a/packages/kokkos/core/src/Kokkos_AcquireUniqueTokenImpl.hpp b/packages/kokkos/core/src/Kokkos_AcquireUniqueTokenImpl.hpp
index 4a22aedd8c1c6a7dad41eb9810bc5ef3f9f8afef..660ee30b7d5e3d6d935be759c0ac3ea7ed6232c5 100644
--- a/packages/kokkos/core/src/Kokkos_AcquireUniqueTokenImpl.hpp
+++ b/packages/kokkos/core/src/Kokkos_AcquireUniqueTokenImpl.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_ACQUIRE_UNIQUE_TOKEN_IMPL_HPP
 #define KOKKOS_ACQUIRE_UNIQUE_TOKEN_IMPL_HPP
diff --git a/packages/kokkos/core/src/Kokkos_AnonymousSpace.hpp b/packages/kokkos/core/src/Kokkos_AnonymousSpace.hpp
index 6eed92be0480d0974d5433ab8383bbcb347d774f..9f5deed5d66f974fefee183748f36289331c06e7 100644
--- a/packages/kokkos/core/src/Kokkos_AnonymousSpace.hpp
+++ b/packages/kokkos/core/src/Kokkos_AnonymousSpace.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_ANONYMOUSSPACE_HPP
 #define KOKKOS_ANONYMOUSSPACE_HPP
diff --git a/packages/kokkos/core/src/Kokkos_Array.hpp b/packages/kokkos/core/src/Kokkos_Array.hpp
index e7fec4c449787b0018061120ee37387637e5eee1..1e3ab4741cd45601c5730cad45519ddb84fb6105 100644
--- a/packages/kokkos/core/src/Kokkos_Array.hpp
+++ b/packages/kokkos/core/src/Kokkos_Array.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_ARRAY_HPP
 #define KOKKOS_ARRAY_HPP
@@ -351,13 +323,6 @@ struct Array<T, KOKKOS_INVALID_INDEX, Array<>::strided> {
 }  // namespace Kokkos
 
 //<editor-fold desc="Support for structured binding">
-// guarding against bogus error 'specialization in different namespace' with
-// older GCC that do not support C++17 anyway
-#if !defined(KOKKOS_COMPILER_GNU) || (KOKKOS_COMPILER_GNU >= 710)
-#if defined(KOKKOS_COMPILER_CLANG) && KOKKOS_COMPILER_CLANG < 800
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wmismatched-tags"
-#endif
 template <class T, std::size_t N>
 struct std::tuple_size<Kokkos::Array<T, N>>
     : std::integral_constant<std::size_t, N> {};
@@ -366,10 +331,6 @@ template <std::size_t I, class T, std::size_t N>
 struct std::tuple_element<I, Kokkos::Array<T, N>> {
   using type = T;
 };
-#if defined(KOKKOS_COMPILER_CLANG) && KOKKOS_COMPILER_CLANG < 800
-#pragma clang diagnostic pop
-#endif
-#endif
 
 namespace Kokkos {
 
diff --git a/packages/kokkos/core/src/Kokkos_Atomic.hpp b/packages/kokkos/core/src/Kokkos_Atomic.hpp
index 7a2d1c662c62a25a6c50853e6c2212e7f7b8211a..1347e09ebd6a488278ac59c364aeff6309f0517e 100644
--- a/packages/kokkos/core/src/Kokkos_Atomic.hpp
+++ b/packages/kokkos/core/src/Kokkos_Atomic.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /// \file Kokkos_Atomic.hpp
 /// \brief Atomic functions
@@ -103,7 +75,7 @@ KOKKOS_INLINE_FUNCTION void desul_atomic_inc(T* dest, MemoryOrderSeqCst,
 
 template <class T>
 KOKKOS_INLINE_FUNCTION T
-desul_atomic_exchange(T* dest, const Kokkos::Impl::identity_t<T> val,
+desul_atomic_exchange(T* dest, const Kokkos::Impl::type_identity_t<T> val,
                       MemoryOrderSeqCst, MemoryScopeDevice) {
   return desul::atomic_exchange(const_cast<T*>(dest), val,
                                 desul::MemoryOrderSeqCst(),
@@ -112,8 +84,8 @@ desul_atomic_exchange(T* dest, const Kokkos::Impl::identity_t<T> val,
 
 template <class T>
 KOKKOS_INLINE_FUNCTION T desul_atomic_compare_exchange(
-    T* dest, Kokkos::Impl::identity_t<const T> compare,
-    Kokkos::Impl::identity_t<const T> val, MemoryOrderSeqCst,
+    T* dest, Kokkos::Impl::type_identity_t<const T> compare,
+    Kokkos::Impl::type_identity_t<const T> val, MemoryOrderSeqCst,
     MemoryScopeDevice) {
   return desul::atomic_compare_exchange(dest, compare, val,
                                         desul::MemoryOrderSeqCst(),
@@ -168,7 +140,7 @@ KOKKOS_INLINE_FUNCTION T desul_atomic_compare_exchange(
 #define KOKKOS_ENABLE_SERIAL_ATOMICS
 
 #elif defined(KOKKOS_COMPILER_GNU) || defined(KOKKOS_COMPILER_CLANG) || \
-    (defined(KOKKOS_COMPILER_NVCC) || defined(KOKKOS_COMPILER_IBM))
+    defined(KOKKOS_COMPILER_NVCC)
 
 #define KOKKOS_ENABLE_GNU_ATOMICS
 
@@ -401,15 +373,15 @@ KOKKOS_INLINE_FUNCTION void desul_atomic_inc(T* dest, MemoryOrderSeqCst,
 
 template <class T>
 KOKKOS_INLINE_FUNCTION T
-desul_atomic_exchange(T* dest, Kokkos::Impl::identity_t<const T> val,
+desul_atomic_exchange(T* dest, Kokkos::Impl::type_identity_t<const T> val,
                       MemoryOrderSeqCst, MemoryScopeDevice) {
   return Kokkos::atomic_exchange(dest, val);
 }
 
 template <class T>
 KOKKOS_INLINE_FUNCTION T desul_atomic_compare_exchange(
-    T* dest, Kokkos::Impl::identity_t<const T> compare,
-    Kokkos::Impl::identity_t<const T> val, MemoryOrderSeqCst,
+    T* dest, Kokkos::Impl::type_identity_t<const T> compare,
+    Kokkos::Impl::type_identity_t<const T> val, MemoryOrderSeqCst,
     MemoryScopeDevice) {
   return Kokkos::atomic_compare_exchange(dest, compare, val);
 }
diff --git a/packages/kokkos/core/src/Kokkos_Atomics_Desul_Config.hpp b/packages/kokkos/core/src/Kokkos_Atomics_Desul_Config.hpp
index ef576d74c3cdfa8d75c564454ff6697a59cdf049..4cf170f5f1317e380a91196a9aaa36ec519c45df 100644
--- a/packages/kokkos/core/src/Kokkos_Atomics_Desul_Config.hpp
+++ b/packages/kokkos/core/src/Kokkos_Atomics_Desul_Config.hpp
@@ -1,62 +1,30 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_ATOMICS_DESUL_CONFIG_HPP
 #define KOKKOS_ATOMICS_DESUL_CONFIG_HPP
 
 #include <Kokkos_Macros.hpp>
 
-#ifdef KOKKOS_ENABLE_OPENMPTARGET
-#define DESUL_HAVE_OPENMP_ATOMICS
+#if defined(KOKKOS_ARCH_KEPLER) || defined(KOKKOS_ARCH_MAXWELL)
+#define DESUL_CUDA_ARCH_IS_PRE_PASCAL
 #endif
 
 #if defined(KOKKOS_ARCH_KEPLER) || defined(KOKKOS_ARCH_MAXWELL) || \
diff --git a/packages/kokkos/core/src/Kokkos_Atomics_Desul_Volatile_Wrapper.hpp b/packages/kokkos/core/src/Kokkos_Atomics_Desul_Volatile_Wrapper.hpp
index b202ab8f83d49447e82d5bc673e80da6ca88080a..9da4b061102132f8613352975d3cebf7e190161f 100644
--- a/packages/kokkos/core/src/Kokkos_Atomics_Desul_Volatile_Wrapper.hpp
+++ b/packages/kokkos/core/src/Kokkos_Atomics_Desul_Volatile_Wrapper.hpp
@@ -1,12 +1,23 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_DESUL_ATOMICS_VOLATILE_WRAPPER_HPP_
 #define KOKKOS_DESUL_ATOMICS_VOLATILE_WRAPPER_HPP_
@@ -34,26 +45,6 @@ void atomic_store(volatile T* const dest, desul::Impl::dont_deduce_this_paramete
 template<class T> KOKKOS_INLINE_FUNCTION
 T atomic_fetch_add (volatile T* const dest, desul::Impl::dont_deduce_this_parameter_t<const T> val) { return desul::atomic_fetch_add (const_cast<T*>(dest), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); }
 
-#ifdef DESUL_IMPL_ATOMIC_CUDA_USE_DOUBLE_ATOMICADD
-KOKKOS_INLINE_FUNCTION
-double atomic_fetch_add(volatile double* const dest, double val) {
-  #ifdef __CUDA_ARCH__
-  return atomicAdd(const_cast<double*>(dest),val);
-  #else
-  return desul::atomic_fetch_add (const_cast<double*>(dest), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE);
-  #endif
-};
-
-KOKKOS_INLINE_FUNCTION
-double atomic_fetch_sub(volatile double* const dest, double val) {
-  #ifdef __CUDA_ARCH__
-  return atomicAdd(const_cast<double*>(dest),-val);
-  #else
-  return desul::atomic_fetch_sub (const_cast<double*>(dest), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE);
-  #endif
-};
-#endif
-
 template<class T> KOKKOS_INLINE_FUNCTION
 T atomic_fetch_sub (volatile T* const dest, desul::Impl::dont_deduce_this_parameter_t<const T> val) { return desul::atomic_fetch_sub (const_cast<T*>(dest), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); }
 
diff --git a/packages/kokkos/core/src/Kokkos_Atomics_Desul_Wrapper.hpp b/packages/kokkos/core/src/Kokkos_Atomics_Desul_Wrapper.hpp
index ed7e8d9ede8508f3ed19682e5843945c85770e48..fdc5e123f687f1a8444c6196a5ba8260c1689212 100644
--- a/packages/kokkos/core/src/Kokkos_Atomics_Desul_Wrapper.hpp
+++ b/packages/kokkos/core/src/Kokkos_Atomics_Desul_Wrapper.hpp
@@ -1,12 +1,23 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_DESUL_ATOMICS_WRAPPER_HPP_
 #define KOKKOS_DESUL_ATOMICS_WRAPPER_HPP_
@@ -70,26 +81,6 @@ void store_fence() { return desul::atomic_thread_fence(desul::MemoryOrderRelease
 template<class T> KOKKOS_INLINE_FUNCTION
 T atomic_fetch_add (T* const dest, desul::Impl::dont_deduce_this_parameter_t<const T> val) { return desul::atomic_fetch_add (dest, val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); }
 
-#ifdef DESUL_IMPL_ATOMIC_CUDA_USE_DOUBLE_ATOMICADD
-KOKKOS_INLINE_FUNCTION
-double atomic_fetch_add(double* const dest, double val) {
-  #ifdef __CUDA_ARCH__
-  return atomicAdd(dest,val);
-  #else
-  return desul::atomic_fetch_add (dest, val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE);
-  #endif
-};
-
-KOKKOS_INLINE_FUNCTION
-double atomic_fetch_sub(double* const dest, double val) {
-  #ifdef __CUDA_ARCH__
-  return atomicAdd(dest,-val);
-  #else
-  return desul::atomic_fetch_sub (dest, val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE);
-  #endif
-};
-#endif
-
 template<class T> KOKKOS_INLINE_FUNCTION
 T atomic_fetch_sub (T* const dest, desul::Impl::dont_deduce_this_parameter_t<const T> val) { return desul::atomic_fetch_sub (dest, val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); }
 
diff --git a/packages/kokkos/core/src/Kokkos_Complex.hpp b/packages/kokkos/core/src/Kokkos_Complex.hpp
index 009c73c900c41ccf506a0d0988e49fd9e303cbb2..4cecbe4cfe59655c7b90205c279d689e2833043e 100644
--- a/packages/kokkos/core/src/Kokkos_Complex.hpp
+++ b/packages/kokkos/core/src/Kokkos_Complex.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 #ifndef KOKKOS_COMPLEX_HPP
 #define KOKKOS_COMPLEX_HPP
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -51,6 +23,7 @@
 #include <Kokkos_Atomic.hpp>
 #include <Kokkos_MathematicalFunctions.hpp>
 #include <Kokkos_NumericTraits.hpp>
+#include <Kokkos_ReductionIdentity.hpp>
 #include <impl/Kokkos_Error.hpp>
 #include <complex>
 #include <type_traits>
@@ -278,16 +251,13 @@ class
     return *this;
   }
 
-  //---------------------------------------------------------------------------
-  // TODO: refactor Kokkos reductions to remove dependency on
-  // volatile member overloads since they are being deprecated in c++20
-  //---------------------------------------------------------------------------
-
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
   //! Copy constructor from volatile.
   template <
       class RType,
       std::enable_if_t<std::is_convertible<RType, RealType>::value, int> = 0>
-  KOKKOS_INLINE_FUNCTION complex(const volatile complex<RType>& src) noexcept
+  KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION
+  complex(const volatile complex<RType>& src) noexcept
       // Intentionally do the conversions implicitly here so that users don't
       // get any warnings about narrowing, etc., that they would expect to get
       // otherwise.
@@ -315,7 +285,8 @@ class
   //    vl = cr;
   template <class Complex,
             std::enable_if_t<std::is_same<Complex, complex>::value, int> = 0>
-  KOKKOS_INLINE_FUNCTION void operator=(const Complex& src) volatile noexcept {
+  KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION void operator=(
+      const Complex& src) volatile noexcept {
     re_ = src.re_;
     im_ = src.im_;
     // We deliberately do not return anything here.  See explanation
@@ -337,7 +308,7 @@ class
   //    vl = cvr;
   template <class Complex,
             std::enable_if_t<std::is_same<Complex, complex>::value, int> = 0>
-  KOKKOS_INLINE_FUNCTION volatile complex& operator=(
+  KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION volatile complex& operator=(
       const volatile Complex& src) volatile noexcept {
     re_ = src.re_;
     im_ = src.im_;
@@ -359,7 +330,7 @@ class
   //
   template <class Complex,
             std::enable_if_t<std::is_same<Complex, complex>::value, int> = 0>
-  KOKKOS_INLINE_FUNCTION complex& operator=(
+  KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION complex& operator=(
       const volatile Complex& src) noexcept {
     re_ = src.re_;
     im_ = src.im_;
@@ -370,7 +341,8 @@ class
   // RealType RHS versions.
 
   //! Assignment operator (from a volatile real number).
-  KOKKOS_INLINE_FUNCTION void operator=(const volatile RealType& val) noexcept {
+  KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION void operator=(
+      const volatile RealType& val) noexcept {
     re_ = val;
     im_ = RealType(0);
     // We deliberately do not return anything here.  See explanation
@@ -378,7 +350,7 @@ class
   }
 
   //! Assignment operator volatile LHS and non-volatile RHS
-  KOKKOS_INLINE_FUNCTION complex& operator=(
+  KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION complex& operator=(
       const RealType& val) volatile noexcept {
     re_ = val;
     im_ = RealType(0);
@@ -387,7 +359,7 @@ class
 
   //! Assignment operator volatile LHS and volatile RHS
   // TODO Should this return void like the other volatile assignment operators?
-  KOKKOS_INLINE_FUNCTION complex& operator=(
+  KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION complex& operator=(
       const volatile RealType& val) volatile noexcept {
     re_ = val;
     im_ = RealType(0);
@@ -395,33 +367,41 @@ class
   }
 
   //! The imaginary part of this complex number (volatile overload).
-  KOKKOS_INLINE_FUNCTION
-  volatile RealType& imag() volatile noexcept { return im_; }
+  KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION volatile RealType&
+  imag() volatile noexcept {
+    return im_;
+  }
 
   //! The real part of this complex number (volatile overload).
-  KOKKOS_INLINE_FUNCTION
-  volatile RealType& real() volatile noexcept { return re_; }
+  KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION volatile RealType&
+  real() volatile noexcept {
+    return re_;
+  }
 
   //! The imaginary part of this complex number (volatile overload).
-  KOKKOS_INLINE_FUNCTION
-  RealType imag() const volatile noexcept { return im_; }
+  KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION RealType imag() const
+      volatile noexcept {
+    return im_;
+  }
 
   //! The real part of this complex number (volatile overload).
-  KOKKOS_INLINE_FUNCTION
-  RealType real() const volatile noexcept { return re_; }
+  KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION RealType real() const
+      volatile noexcept {
+    return re_;
+  }
 
-  KOKKOS_INLINE_FUNCTION void operator+=(
+  KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION void operator+=(
       const volatile complex<RealType>& src) volatile noexcept {
     re_ += src.re_;
     im_ += src.im_;
   }
 
-  KOKKOS_INLINE_FUNCTION void operator+=(
+  KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION void operator+=(
       const volatile RealType& src) volatile noexcept {
     re_ += src;
   }
 
-  KOKKOS_INLINE_FUNCTION void operator*=(
+  KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION void operator*=(
       const volatile complex<RealType>& src) volatile noexcept {
     const RealType realPart = re_ * src.re_ - im_ * src.im_;
     const RealType imagPart = re_ * src.im_ + im_ * src.re_;
@@ -430,13 +410,12 @@ class
     im_ = imagPart;
   }
 
-  KOKKOS_INLINE_FUNCTION void operator*=(
+  KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION void operator*=(
       const volatile RealType& src) volatile noexcept {
     re_ *= src;
     im_ *= src;
   }
-
-  // TODO DSH 2019-10-7 why are there no volatile /= and friends?
+#endif  // KOKKOS_ENABLE_DEPRECATED_CODE_4
 };
 
 //==============================================================================
diff --git a/packages/kokkos/core/src/Kokkos_Concepts.hpp b/packages/kokkos/core/src/Kokkos_Concepts.hpp
index 63f2b896b5d123cb50d1019a4a8ed871d57b11f4..2448efab046457e4ce9784418aeefaa62a2958b4 100644
--- a/packages/kokkos/core/src/Kokkos_Concepts.hpp
+++ b/packages/kokkos/core/src/Kokkos_Concepts.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_CORE_CONCEPTS_HPP
 #define KOKKOS_CORE_CONCEPTS_HPP
@@ -106,11 +74,14 @@ struct WorkItemProperty {
       ImplWorkItemProperty<4>();
   constexpr static const ImplWorkItemProperty<8> HintIrregular =
       ImplWorkItemProperty<8>();
-  using None_t            = ImplWorkItemProperty<0>;
-  using HintLightWeight_t = ImplWorkItemProperty<1>;
-  using HintHeavyWeight_t = ImplWorkItemProperty<2>;
-  using HintRegular_t     = ImplWorkItemProperty<4>;
-  using HintIrregular_t   = ImplWorkItemProperty<8>;
+  constexpr static const ImplWorkItemProperty<16> ImplForceGlobalLaunch =
+      ImplWorkItemProperty<16>();
+  using None_t                  = ImplWorkItemProperty<0>;
+  using HintLightWeight_t       = ImplWorkItemProperty<1>;
+  using HintHeavyWeight_t       = ImplWorkItemProperty<2>;
+  using HintRegular_t           = ImplWorkItemProperty<4>;
+  using HintIrregular_t         = ImplWorkItemProperty<8>;
+  using ImplForceGlobalLaunch_t = ImplWorkItemProperty<16>;
 };
 
 template <unsigned long pv1, unsigned long pv2>
@@ -171,7 +142,9 @@ namespace Kokkos {
         std::is_base_of<detected_t<have_t, T>, T>::value ||    \
         std::is_base_of<detected_t<have_type_t, T>, T>::value; \
     constexpr operator bool() const noexcept { return value; } \
-  };
+  };                                                           \
+  template <typename T>                                        \
+  inline constexpr bool is_##CONCEPT##_v = is_##CONCEPT<T>::value;
 
 // Public concept:
 
@@ -181,6 +154,7 @@ KOKKOS_IMPL_IS_CONCEPT(execution_space)
 KOKKOS_IMPL_IS_CONCEPT(execution_policy)
 KOKKOS_IMPL_IS_CONCEPT(array_layout)
 KOKKOS_IMPL_IS_CONCEPT(reducer)
+KOKKOS_IMPL_IS_CONCEPT(team_handle)
 namespace Experimental {
 KOKKOS_IMPL_IS_CONCEPT(work_item_property)
 KOKKOS_IMPL_IS_CONCEPT(hooks_policy)
@@ -188,21 +162,6 @@ KOKKOS_IMPL_IS_CONCEPT(hooks_policy)
 
 namespace Impl {
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-// For backward compatibility:
-
-template <typename T>
-using is_array_layout KOKKOS_DEPRECATED = Kokkos::is_array_layout<T>;
-template <typename T>
-using is_execution_policy KOKKOS_DEPRECATED = Kokkos::is_execution_policy<T>;
-template <typename T>
-using is_execution_space KOKKOS_DEPRECATED = Kokkos::is_execution_space<T>;
-template <typename T>
-using is_memory_space KOKKOS_DEPRECATED = Kokkos::is_memory_space<T>;
-template <typename T>
-using is_memory_traits KOKKOS_DEPRECATED = Kokkos::is_memory_traits<T>;
-#endif
-
 // Implementation concept:
 
 KOKKOS_IMPL_IS_CONCEPT(thread_team_member)
@@ -281,6 +240,9 @@ struct is_device_helper<Device<ExecutionSpace, MemorySpace>> : std::true_type {
 template <typename T>
 using is_device = typename Impl::is_device_helper<std::remove_cv_t<T>>::type;
 
+template <typename T>
+inline constexpr bool is_device_v = is_device<T>::value;
+
 //----------------------------------------------------------------------------
 
 template <typename T>
@@ -344,10 +306,8 @@ struct is_space {
           || std::is_same<memory_space, Kokkos::CudaUVMSpace>::value ||
           std::is_same<memory_space, Kokkos::CudaHostPinnedSpace>::value
 #elif defined(KOKKOS_ENABLE_HIP)
-          || std::is_same<memory_space,
-                          Kokkos::Experimental::HIPHostPinnedSpace>::value ||
-          std::is_same<memory_space,
-                       Kokkos::Experimental::HIPManagedSpace>::value
+          || std::is_same<memory_space, Kokkos::HIPHostPinnedSpace>::value ||
+          std::is_same<memory_space, Kokkos::HIPManagedSpace>::value
 #elif defined(KOKKOS_ENABLE_SYCL)
           || std::is_same<memory_space,
                           Kokkos::Experimental::SYCLSharedUSMSpace>::value ||
@@ -361,7 +321,7 @@ struct is_space {
 #if defined(KOKKOS_ENABLE_CUDA)
       std::is_same<execution_space, Kokkos::Cuda>::value ||
 #elif defined(KOKKOS_ENABLE_HIP)
-      std::is_same<execution_space, Kokkos::Experimental::HIP>::value ||
+      std::is_same<execution_space, Kokkos::HIP>::value ||
 #elif defined(KOKKOS_ENABLE_SYCL)
       std::is_same<execution_space, Kokkos::Experimental::SYCL>::value ||
 #elif defined(KOKKOS_ENABLE_OPENMPTARGET)
@@ -370,32 +330,8 @@ struct is_space {
 #endif
           false,
       Kokkos::DefaultHostExecutionSpace, execution_space>;
-
- public:
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  using host_memory_space KOKKOS_DEPRECATED = do_not_use_host_memory_space;
-  using host_execution_space KOKKOS_DEPRECATED =
-      do_not_use_host_execution_space;
-  using host_mirror_space KOKKOS_DEPRECATED = std::conditional_t<
-      std::is_same<execution_space, do_not_use_host_execution_space>::value &&
-          std::is_same<memory_space, do_not_use_host_memory_space>::value,
-      T,
-      Kokkos::Device<do_not_use_host_execution_space,
-                     do_not_use_host_memory_space>>;
-#endif
 };
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-// For backward compatibility
-
-namespace Impl {
-
-template <typename T>
-using is_space KOKKOS_DEPRECATED = Kokkos::is_space<T>;
-
-}
-#endif
-
 }  // namespace Kokkos
 
 //----------------------------------------------------------------------------
@@ -514,19 +450,6 @@ struct SpaceAccessibility {
 
 }  // namespace Kokkos
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-namespace Kokkos {
-namespace Impl {
-
-// For backward compatibility
-template <typename AccessSpace, typename MemorySpace>
-using SpaceAccessibility KOKKOS_DEPRECATED =
-    Kokkos::SpaceAccessibility<AccessSpace, MemorySpace>;
-
-}  // namespace Impl
-}  // namespace Kokkos
-#endif
-
 //----------------------------------------------------------------------------
 
 #endif  // KOKKOS_CORE_CONCEPTS_HPP
diff --git a/packages/kokkos/core/src/Kokkos_CopyViews.hpp b/packages/kokkos/core/src/Kokkos_CopyViews.hpp
index d859a5d8ae0f1908b35c4dc31aa9229cfd578bf6..6d5d9548c7998a51969f09d9c2d2f17d523017f3 100644
--- a/packages/kokkos/core/src/Kokkos_CopyViews.hpp
+++ b/packages/kokkos/core/src/Kokkos_CopyViews.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_COPYVIEWS_HPP_
 #define KOKKOS_COPYVIEWS_HPP_
@@ -3032,24 +3000,14 @@ impl_resize(const Impl::ViewCtorProp<ViewCtorArgs...>& arg_prop,
   const bool sizeMismatch = Impl::size_mismatch(v, v.rank_dynamic, new_extents);
 
   if (sizeMismatch) {
-    // Add execution space here to avoid the need for if constexpr below
-    using alloc_prop = Impl::ViewCtorProp<
-        ViewCtorArgs..., std::string,
-        std::conditional_t<alloc_prop_input::has_execution_space,
-                           std::integral_constant<unsigned int, 10>,
-                           typename view_type::execution_space>>;
-    alloc_prop prop_copy(arg_prop);
-    static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value =
-        v.label();
+    auto prop_copy = Impl::with_properties_if_unset(
+        arg_prop, typename view_type::execution_space{}, v.label());
 
     view_type v_resized(prop_copy, n0, n1, n2, n3, n4, n5, n6, n7);
 
-    if (alloc_prop_input::has_execution_space)
+    if constexpr (alloc_prop_input::has_execution_space)
       Kokkos::Impl::ViewRemap<view_type, view_type>(
-          v_resized, v,
-          static_cast<const Impl::ViewCtorProp<
-              void, typename alloc_prop::execution_space>&>(prop_copy)
-              .value);
+          v_resized, v, Impl::get_property<Impl::ExecutionSpaceTag>(prop_copy));
     else {
       Kokkos::Impl::ViewRemap<view_type, view_type>(v_resized, v);
       Kokkos::fence("Kokkos::resize(View)");
@@ -3142,24 +3100,13 @@ impl_resize(const Impl::ViewCtorProp<ViewCtorArgs...>& arg_prop,
                 "not include a memory space instance!");
 
   if (v.layout() != layout) {
-    // Add execution space here to avoid the need for if constexpr below
-    using alloc_prop = Impl::ViewCtorProp<
-        ViewCtorArgs..., std::string,
-        std::conditional_t<alloc_prop_input::has_execution_space,
-                           std::integral_constant<unsigned int, 10>,
-                           typename view_type::execution_space>>;
-    alloc_prop prop_copy(arg_prop);
-    static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value =
-        v.label();
+    auto prop_copy = Impl::with_properties_if_unset(arg_prop, v.label());
 
     view_type v_resized(prop_copy, layout);
 
-    if (alloc_prop::has_execution_space)
+    if constexpr (alloc_prop_input::has_execution_space)
       Kokkos::Impl::ViewRemap<view_type, view_type>(
-          v_resized, v,
-          static_cast<const Impl::ViewCtorProp<
-              void, typename alloc_prop::execution_space>&>(prop_copy)
-              .value);
+          v_resized, v, Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop));
     else {
       Kokkos::Impl::ViewRemap<view_type, view_type>(v_resized, v);
       Kokkos::fence("Kokkos::resize(View)");
@@ -3199,24 +3146,13 @@ impl_resize(const Impl::ViewCtorProp<ViewCtorArgs...>& arg_prop,
                 "The view constructor arguments passed to Kokkos::resize must "
                 "not include a memory space instance!");
 
-  // Add execution space here to avoid the need for if constexpr below
-  using alloc_prop = Impl::ViewCtorProp<
-      ViewCtorArgs..., std::string,
-      std::conditional_t<alloc_prop_input::has_execution_space,
-                         std::integral_constant<unsigned int, 10>,
-                         typename view_type::execution_space>>;
-  alloc_prop prop_copy(arg_prop);
-  static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value =
-      v.label();
+  auto prop_copy = Impl::with_properties_if_unset(arg_prop, v.label());
 
   view_type v_resized(prop_copy, layout);
 
-  if (alloc_prop::has_execution_space)
+  if constexpr (alloc_prop_input::has_execution_space)
     Kokkos::Impl::ViewRemap<view_type, view_type>(
-        v_resized, v,
-        static_cast<const Impl::ViewCtorProp<
-            void, typename alloc_prop::execution_space>&>(prop_copy)
-            .value);
+        v_resized, v, Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop));
   else {
     Kokkos::Impl::ViewRemap<view_type, view_type>(v_resized, v);
     Kokkos::fence("Kokkos::resize(View)");
@@ -3282,24 +3218,14 @@ impl_realloc(Kokkos::View<T, P...>& v, const size_t n0, const size_t n1,
   const bool sizeMismatch = Impl::size_mismatch(v, v.rank_dynamic, new_extents);
 
   if (sizeMismatch) {
-    using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>;
-    alloc_prop arg_prop_copy(arg_prop);
-    static_cast<Kokkos::Impl::ViewCtorProp<void, std::string>&>(arg_prop_copy)
-        .value = v.label();
+    auto arg_prop_copy = Impl::with_properties_if_unset(arg_prop, v.label());
     v = view_type();  // Best effort to deallocate in case no other view refers
                       // to the shared allocation
     v = view_type(arg_prop_copy, n0, n1, n2, n3, n4, n5, n6, n7);
   } else if (alloc_prop_input::initialize) {
-    if (alloc_prop_input::has_execution_space) {
-      using alloc_prop = Impl::ViewCtorProp<
-          ViewCtorArgs...,
-          std::conditional_t<alloc_prop_input::has_execution_space,
-                             std::integral_constant<unsigned int, 2>,
-                             typename view_type::execution_space>>;
-      alloc_prop arg_prop_copy(arg_prop);
-      auto const& exec_space = static_cast<Kokkos::Impl::ViewCtorProp<
-          void, typename alloc_prop::execution_space> const&>(arg_prop_copy)
-                                   .value;
+    if constexpr (alloc_prop_input::has_execution_space) {
+      const auto& exec_space =
+          Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop);
       Kokkos::deep_copy(exec_space, v, typename view_type::value_type{});
     } else
       Kokkos::deep_copy(v, typename view_type::value_type{});
@@ -3393,23 +3319,9 @@ impl_realloc(Kokkos::View<T, P...>& v,
     v = view_type();  // Deallocate first, if the only view to allocation
     v = view_type(arg_prop, layout);
   } else if (alloc_prop_input::initialize) {
-    if (alloc_prop_input::has_execution_space) {
-      // Add execution_space if not provided to avoid need for if constexpr
-      using alloc_prop = Impl::ViewCtorProp<
-          ViewCtorArgs...,
-          std::conditional_t<alloc_prop_input::has_execution_space,
-                             std::integral_constant<unsigned int, 2>,
-                             typename view_type::execution_space>,
-          std::string>;
-      alloc_prop arg_prop_copy(arg_prop);
-      static_cast<Kokkos::Impl::ViewCtorProp<void, std::string>&>(arg_prop_copy)
-          .value                 = v.label();
-      using execution_space_type = typename alloc_prop::execution_space;
-      const execution_space_type& exec_space =
-          static_cast<
-              Kokkos::Impl::ViewCtorProp<void, execution_space_type> const&>(
-              arg_prop_copy)
-              .value;
+    if constexpr (alloc_prop_input::has_execution_space) {
+      const auto& exec_space =
+          Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop);
       Kokkos::deep_copy(exec_space, v, typename view_type::value_type{});
     } else
       Kokkos::deep_copy(v, typename view_type::value_type{});
@@ -3446,13 +3358,10 @@ impl_realloc(Kokkos::View<T, P...>& v,
                 "The view constructor arguments passed to Kokkos::realloc must "
                 "not include a memory space instance!");
 
-  v = view_type();  // Deallocate first, if the only view to allocation
+  auto arg_prop_copy = Impl::with_properties_if_unset(arg_prop, v.label());
 
-  using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>;
-  alloc_prop arg_prop_copy(arg_prop);
-  static_cast<Kokkos::Impl::ViewCtorProp<void, std::string>&>(arg_prop_copy)
-      .value = v.label();
-  v          = view_type(arg_prop_copy, layout);
+  v = view_type();  // Deallocate first, if the only view to allocation
+  v = view_type(arg_prop_copy, layout);
 }
 
 template <class T, class... P, class... ViewCtorArgs>
@@ -3531,11 +3440,8 @@ struct MirrorType {
 };
 
 template <class T, class... P, class... ViewCtorArgs>
-inline std::enable_if_t<
-    !std::is_same<typename Kokkos::ViewTraits<T, P...>::array_layout,
-                  Kokkos::LayoutStride>::value &&
-        !Impl::ViewCtorProp<ViewCtorArgs...>::has_memory_space,
-    typename Kokkos::View<T, P...>::HostMirror>
+inline std::enable_if_t<!Impl::ViewCtorProp<ViewCtorArgs...>::has_memory_space,
+                        typename Kokkos::View<T, P...>::HostMirror>
 create_mirror(const Kokkos::View<T, P...>& src,
               const Impl::ViewCtorProp<ViewCtorArgs...>& arg_prop) {
   using src_type         = View<T, P...>;
@@ -3555,74 +3461,10 @@ create_mirror(const Kokkos::View<T, P...>& src,
       "The view constructor arguments passed to Kokkos::create_mirror must "
       "not explicitly allow padding!");
 
-  using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>;
-  alloc_prop prop_copy(arg_prop);
-  static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value =
-      std::string(src.label()).append("_mirror");
+  auto prop_copy = Impl::with_properties_if_unset(
+      arg_prop, std::string(src.label()).append("_mirror"));
 
-  return dst_type(
-      prop_copy,
-      src.rank_dynamic > 0 ? src.extent(0) : KOKKOS_IMPL_CTOR_DEFAULT_ARG,
-      src.rank_dynamic > 1 ? src.extent(1) : KOKKOS_IMPL_CTOR_DEFAULT_ARG,
-      src.rank_dynamic > 2 ? src.extent(2) : KOKKOS_IMPL_CTOR_DEFAULT_ARG,
-      src.rank_dynamic > 3 ? src.extent(3) : KOKKOS_IMPL_CTOR_DEFAULT_ARG,
-      src.rank_dynamic > 4 ? src.extent(4) : KOKKOS_IMPL_CTOR_DEFAULT_ARG,
-      src.rank_dynamic > 5 ? src.extent(5) : KOKKOS_IMPL_CTOR_DEFAULT_ARG,
-      src.rank_dynamic > 6 ? src.extent(6) : KOKKOS_IMPL_CTOR_DEFAULT_ARG,
-      src.rank_dynamic > 7 ? src.extent(7) : KOKKOS_IMPL_CTOR_DEFAULT_ARG);
-}
-
-template <class T, class... P, class... ViewCtorArgs>
-inline std::enable_if_t<
-    std::is_same<typename Kokkos::ViewTraits<T, P...>::array_layout,
-                 Kokkos::LayoutStride>::value &&
-        !Impl::ViewCtorProp<ViewCtorArgs...>::has_memory_space,
-    typename Kokkos::View<T, P...>::HostMirror>
-create_mirror(const Kokkos::View<T, P...>& src,
-              const Impl::ViewCtorProp<ViewCtorArgs...>& arg_prop) {
-  using src_type         = View<T, P...>;
-  using dst_type         = typename src_type::HostMirror;
-  using alloc_prop_input = Impl::ViewCtorProp<ViewCtorArgs...>;
-
-  static_assert(
-      !alloc_prop_input::has_label,
-      "The view constructor arguments passed to Kokkos::create_mirror "
-      "must not include a label!");
-  static_assert(
-      !alloc_prop_input::has_pointer,
-      "The view constructor arguments passed to Kokkos::create_mirror must "
-      "not include a pointer!");
-  static_assert(
-      !alloc_prop_input::allow_padding,
-      "The view constructor arguments passed to Kokkos::create_mirror must "
-      "not explicitly allow padding!");
-
-  Kokkos::LayoutStride layout;
-
-  layout.dimension[0] = src.extent(0);
-  layout.dimension[1] = src.extent(1);
-  layout.dimension[2] = src.extent(2);
-  layout.dimension[3] = src.extent(3);
-  layout.dimension[4] = src.extent(4);
-  layout.dimension[5] = src.extent(5);
-  layout.dimension[6] = src.extent(6);
-  layout.dimension[7] = src.extent(7);
-
-  layout.stride[0] = src.stride_0();
-  layout.stride[1] = src.stride_1();
-  layout.stride[2] = src.stride_2();
-  layout.stride[3] = src.stride_3();
-  layout.stride[4] = src.stride_4();
-  layout.stride[5] = src.stride_5();
-  layout.stride[6] = src.stride_6();
-  layout.stride[7] = src.stride_7();
-
-  using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>;
-  alloc_prop prop_copy(arg_prop);
-  static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value =
-      std::string(src.label()).append("_mirror");
-
-  return dst_type(prop_copy, layout);
+  return dst_type(prop_copy, src.layout());
 }
 
 // Create a mirror in a new space (specialization for different space)
@@ -3646,10 +3488,9 @@ auto create_mirror(const Kokkos::View<T, P...>& src,
       "The view constructor arguments passed to Kokkos::create_mirror must "
       "not explicitly allow padding!");
 
-  using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>;
-  alloc_prop prop_copy(arg_prop);
-  static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value =
-      std::string(src.label()).append("_mirror");
+  auto prop_copy = Impl::with_properties_if_unset(
+      arg_prop, std::string(src.label()).append("_mirror"));
+  using alloc_prop = decltype(prop_copy);
 
   return typename Impl::MirrorType<typename alloc_prop::memory_space, T,
                                    P...>::view_type(prop_copy, src.layout());
@@ -3892,29 +3733,16 @@ auto create_mirror_view_and_copy(
   using Space  = typename alloc_prop_input::memory_space;
   using Mirror = typename Impl::MirrorViewType<Space, T, P...>::view_type;
 
-  // Add some properties if not provided to avoid need for if constexpr
-  using alloc_prop = Impl::ViewCtorProp<
-      ViewCtorArgs...,
-      std::conditional_t<alloc_prop_input::has_label,
-                         std::integral_constant<unsigned int, 12>, std::string>,
-      std::conditional_t<!alloc_prop_input::initialize,
-                         std::integral_constant<unsigned int, 13>,
-                         Impl::WithoutInitializing_t>,
-      std::conditional_t<alloc_prop_input::has_execution_space,
-                         std::integral_constant<unsigned int, 14>,
-                         typename Space::execution_space>>;
-  alloc_prop arg_prop_copy(arg_prop);
-
-  std::string& label =
-      static_cast<Impl::ViewCtorProp<void, std::string>&>(arg_prop_copy).value;
+  auto arg_prop_copy = Impl::with_properties_if_unset(
+      arg_prop, std::string{}, WithoutInitializing,
+      typename Space::execution_space{});
+
+  std::string& label = Impl::get_property<Impl::LabelTag>(arg_prop_copy);
   if (label.empty()) label = src.label();
   auto mirror = typename Mirror::non_const_type{arg_prop_copy, src.layout()};
-  if (alloc_prop_input::has_execution_space) {
-    using ExecutionSpace = typename alloc_prop::execution_space;
-    deep_copy(
-        static_cast<Impl::ViewCtorProp<void, ExecutionSpace>&>(arg_prop_copy)
-            .value,
-        mirror, src);
+  if constexpr (alloc_prop_input::has_execution_space) {
+    deep_copy(Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop_copy),
+              mirror, src);
   } else
     deep_copy(mirror, src);
   return mirror;
@@ -3936,35 +3764,6 @@ create_mirror_view_and_copy(
       Kokkos::view_alloc(typename Space::memory_space{}, name), src);
 }
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-// Create a mirror view in a new space without initializing (specialization for
-// same space)
-template <class Space, class T, class... P>
-KOKKOS_DEPRECATED_WITH_COMMENT(
-    "Use the version taking WithoutInitializing as first argument")
-typename Impl::MirrorViewType<Space, T, P...>::view_type create_mirror_view(
-    const Space&, const Kokkos::View<T, P...>& src,
-    Kokkos::Impl::WithoutInitializing_t,
-    std::enable_if_t<Impl::MirrorViewType<Space, T, P...>::is_same_memspace>* =
-        nullptr) {
-  return src;
-}
-
-// Create a mirror view in a new space without initializing (specialization for
-// different space)
-template <class Space, class T, class... P>
-KOKKOS_DEPRECATED_WITH_COMMENT(
-    "Use the version taking WithoutInitializing as first argument")
-typename Impl::MirrorViewType<Space, T, P...>::view_type create_mirror_view(
-    const Space&, const Kokkos::View<T, P...>& src,
-    Kokkos::Impl::WithoutInitializing_t,
-    std::enable_if_t<!Impl::MirrorViewType<Space, T, P...>::is_same_memspace>* =
-        nullptr) {
-  using Mirror = typename Impl::MirrorViewType<Space, T, P...>::view_type;
-  return Mirror(view_alloc(WithoutInitializing, src.label()), src.layout());
-}
-#endif
-
 } /* namespace Kokkos */
 
 //----------------------------------------------------------------------------
diff --git a/packages/kokkos/core/src/Kokkos_Core.hpp b/packages/kokkos/core/src/Kokkos_Core.hpp
index 3a9aaafbc300242efe20e7edb7b5cb51b0e5db45..cf898a71e7ad2ebf2154f08d11d3d31d1a494968 100644
--- a/packages/kokkos/core/src/Kokkos_Core.hpp
+++ b/packages/kokkos/core/src/Kokkos_Core.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CORE_HPP
 #define KOKKOS_CORE_HPP
@@ -49,6 +21,22 @@
 #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
 #endif
 
+//----------------------------------------------------------------------------
+// In the case windows.h is included before Kokkos_Core.hpp there might be
+// errors due to the potentially defined macros with name "min" and "max" in
+// windows.h. These collide with the use of "min" and "max" in names inside
+// Kokkos. The macros will be redefined at the end of Kokkos_Core.hpp
+#if defined(min)
+#pragma push_macro("min")
+#undef min
+#define KOKKOS_IMPL_PUSH_MACRO_MIN
+#endif
+#if defined(max)
+#pragma push_macro("max")
+#undef max
+#define KOKKOS_IMPL_PUSH_MACRO_MAX
+#endif
+
 //----------------------------------------------------------------------------
 // Include the execution space header files for the enabled execution spaces.
 
@@ -64,6 +52,7 @@
 #include <Kokkos_MathematicalConstants.hpp>
 #include <Kokkos_MathematicalFunctions.hpp>
 #include <Kokkos_MathematicalSpecialFunctions.hpp>
+#include <Kokkos_NumericTraits.hpp>
 #include <Kokkos_MemoryPool.hpp>
 #include <Kokkos_Array.hpp>
 #include <Kokkos_View.hpp>
@@ -75,6 +64,7 @@
 #include <Kokkos_TaskScheduler.hpp>
 #include <Kokkos_Complex.hpp>
 #include <Kokkos_CopyViews.hpp>
+#include <impl/Kokkos_TeamMDPolicy.hpp>
 #include <impl/Kokkos_InitializationSettings.hpp>
 #include <functional>
 #include <iosfwd>
@@ -96,14 +86,18 @@ void pre_initialize(const InitializationSettings& settings);
 
 void post_initialize(const InitializationSettings& settings);
 
+void pre_finalize();
+
+void post_finalize();
+
 void declare_configuration_metadata(const std::string& category,
                                     const std::string& key,
                                     const std::string& value);
 
 }  // namespace Impl
 
-KOKKOS_ATTRIBUTE_NODISCARD bool is_initialized() noexcept;
-KOKKOS_ATTRIBUTE_NODISCARD bool is_finalized() noexcept;
+[[nodiscard]] bool is_initialized() noexcept;
+[[nodiscard]] bool is_finalized() noexcept;
 
 bool show_warnings() noexcept;
 bool tune_internals() noexcept;
@@ -133,10 +127,7 @@ void finalize();
  */
 void push_finalize_hook(std::function<void()> f);
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-/** \brief  Finalize all known execution spaces */
-KOKKOS_DEPRECATED void finalize_all();
-#endif
+void fence(const std::string& name /*= "Kokkos::fence: Unnamed Global Fence"*/);
 
 /** \brief Print "Bill of Materials" */
 void print_configuration(std::ostream& os, bool verbose = false);
@@ -226,82 +217,13 @@ inline std::string scopeguard_destruct_after_finalize_warning() {
 
 }  // namespace Impl
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-class KOKKOS_ATTRIBUTE_NODISCARD ScopeGuard {
- public:
-#if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard) >= 201907
-  KOKKOS_ATTRIBUTE_NODISCARD
-#endif
-  ScopeGuard(int& argc, char* argv[]) {
-    sg_init = false;
-#ifdef KOKKOS_ENABLE_DEPRECATION_WARNINGS
-    if (is_initialized()) {
-      std::cerr << Impl::scopeguard_create_while_initialized_warning()
-                << std::endl;
-    }
-    if (is_finalized()) {
-      std::cerr << Impl::scopeguard_create_after_finalize_warning()
-                << std::endl;
-    }
-#endif
-    if (!is_initialized()) {
-      initialize(argc, argv);
-      sg_init = true;
-    }
-  }
-
-#if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard) >= 201907
-  KOKKOS_ATTRIBUTE_NODISCARD
-#endif
-  explicit ScopeGuard(
-      const InitializationSettings& settings = InitializationSettings()) {
-    sg_init = false;
-#ifdef KOKKOS_ENABLE_DEPRECATION_WARNINGS
-    if (is_initialized()) {
-      std::cerr << Impl::scopeguard_create_while_initialized_warning()
-                << std::endl;
-    }
-    if (is_finalized()) {
-      std::cerr << Impl::scopeguard_create_after_finalize_warning()
-                << std::endl;
-    }
-#endif
-    if (!is_initialized()) {
-      initialize(settings);
-      sg_init = true;
-    }
-  }
-
-  ~ScopeGuard() {
-#ifdef KOKKOS_ENABLE_DEPRECATION_WARNINGS
-    if (is_finalized()) {
-      std::cerr << Impl::scopeguard_destruct_after_finalize_warning()
-                << std::endl;
-    }
-#endif
-    if (is_initialized() && sg_init) {
-      finalize();
-    }
-  }
-
- private:
-  bool sg_init;
-
- public:
-  ScopeGuard& operator=(const ScopeGuard&) = delete;
-  ScopeGuard& operator=(ScopeGuard&&) = delete;
-  ScopeGuard(const ScopeGuard&)       = delete;
-  ScopeGuard(ScopeGuard&&)            = delete;
-};
-
-#else  // ifndef KOKKOS_ENABLE_DEPRECATED_CODE3
-
 class KOKKOS_ATTRIBUTE_NODISCARD ScopeGuard {
  public:
+  template <class... Args>
 #if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard) >= 201907
-  KOKKOS_ATTRIBUTE_NODISCARD
+  [[nodiscard]]
 #endif
-  ScopeGuard(int& argc, char* argv[]) {
+  ScopeGuard(Args&&... args) {
     if (is_initialized()) {
       Kokkos::abort(
           Impl::scopeguard_create_while_initialized_warning().c_str());
@@ -309,22 +231,7 @@ class KOKKOS_ATTRIBUTE_NODISCARD ScopeGuard {
     if (is_finalized()) {
       Kokkos::abort(Impl::scopeguard_create_after_finalize_warning().c_str());
     }
-    initialize(argc, argv);
-  }
-
-#if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard) >= 201907
-  KOKKOS_ATTRIBUTE_NODISCARD
-#endif
-  ScopeGuard(
-      const InitializationSettings& settings = InitializationSettings()) {
-    if (is_initialized()) {
-      Kokkos::abort(
-          Impl::scopeguard_create_while_initialized_warning().c_str());
-    }
-    if (is_finalized()) {
-      Kokkos::abort(Impl::scopeguard_create_after_finalize_warning().c_str());
-    }
-    initialize(settings);
+    initialize(static_cast<Args&&>(args)...);
   }
 
   ~ScopeGuard() {
@@ -339,7 +246,6 @@ class KOKKOS_ATTRIBUTE_NODISCARD ScopeGuard {
   ScopeGuard(const ScopeGuard&)       = delete;
   ScopeGuard(ScopeGuard&&)            = delete;
 };
-#endif
 
 }  // namespace Kokkos
 
@@ -350,22 +256,20 @@ namespace Experimental {
 //   Customization point for backends
 //   Default behavior is to return the passed in instance
 template <class ExecSpace, class... Args>
-std::vector<ExecSpace> partition_space(ExecSpace space, Args...) {
+std::vector<ExecSpace> partition_space(ExecSpace const& space, Args...) {
   static_assert(is_execution_space<ExecSpace>::value,
                 "Kokkos Error: partition_space expects an Execution Space as "
                 "first argument");
-#ifdef __cpp_fold_expressions
   static_assert(
       (... && std::is_arithmetic_v<Args>),
       "Kokkos Error: partitioning arguments must be integers or floats");
-#endif
   std::vector<ExecSpace> instances(sizeof...(Args));
   for (int s = 0; s < int(sizeof...(Args)); s++) instances[s] = space;
   return instances;
 }
 
 template <class ExecSpace, class T>
-std::vector<ExecSpace> partition_space(ExecSpace space,
+std::vector<ExecSpace> partition_space(ExecSpace const& space,
                                        std::vector<T>& weights) {
   static_assert(is_execution_space<ExecSpace>::value,
                 "Kokkos Error: partition_space expects an Execution Space as "
@@ -395,6 +299,18 @@ std::vector<ExecSpace> partition_space(ExecSpace space,
 // Specializations required after core definitions
 #include <KokkosCore_Config_PostInclude.hpp>
 
+//----------------------------------------------------------------------------
+// Redefinition of the macros min and max if we pushed them at entry of
+// Kokkos_Core.hpp
+#if defined(KOKKOS_IMPL_PUSH_MACRO_MIN)
+#pragma pop_macro("min")
+#undef KOKKOS_IMPL_PUSH_MACRO_MIN
+#endif
+#if defined(KOKKOS_IMPL_PUSH_MACRO_MAX)
+#pragma pop_macro("max")
+#undef KOKKOS_IMPL_PUSH_MACRO_MAX
+#endif
+
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 
diff --git a/packages/kokkos/core/src/Kokkos_Core_fwd.hpp b/packages/kokkos/core/src/Kokkos_Core_fwd.hpp
index 2bb323b4a6a9f10511ebc47f271d0bee6cbc9c55..a0b4df0c4bd09cf6726f5badf087f061573eb31a 100644
--- a/packages/kokkos/core/src/Kokkos_Core_fwd.hpp
+++ b/packages/kokkos/core/src/Kokkos_Core_fwd.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CORE_FWD_HPP
 #define KOKKOS_CORE_FWD_HPP
@@ -134,8 +106,7 @@ using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Cuda;
 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
     Experimental::OpenMPTarget;
 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HIP)
-using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
-    Experimental::HIP;
+using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = HIP;
 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SYCL)
 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
     Experimental::SYCL;
@@ -153,7 +124,7 @@ using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Serial;
 #else
 #error \
-    "At least one of the following execution spaces must be defined in order to use Kokkos: Kokkos::Cuda, Kokkos::Experimental::HIP, Kokkos::Experimental::SYCL, Kokkos::Experimental::OpenMPTarget, Kokkos::Experimental::OpenACC, Kokkos::OpenMP, Kokkos::Threads, Kokkos::Experimental::HPX, or Kokkos::Serial."
+    "At least one of the following execution spaces must be defined in order to use Kokkos: Kokkos::Cuda, Kokkos::HIP, Kokkos::Experimental::SYCL, Kokkos::Experimental::OpenMPTarget, Kokkos::Experimental::OpenACC, Kokkos::OpenMP, Kokkos::Threads, Kokkos::Experimental::HPX, or Kokkos::Serial."
 #endif
 
 #if defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP)
@@ -185,6 +156,50 @@ using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
     "At least one of the following execution spaces must be defined in order to use Kokkos: Kokkos::OpenMP, Kokkos::Threads, Kokkos::Experimental::HPX, or Kokkos::Serial."
 #endif
 
+// check for devices that support sharedSpace
+#if defined(KOKKOS_ENABLE_CUDA)
+using SharedSpace = CudaUVMSpace;
+#define KOKKOS_HAS_SHARED_SPACE
+#elif defined(KOKKOS_ENABLE_HIP)
+using SharedSpace = HIPManagedSpace;
+#define KOKKOS_HAS_SHARED_SPACE
+#elif defined(KOKKOS_ENABLE_SYCL)
+using SharedSpace = Experimental::SYCLSharedUSMSpace;
+#define KOKKOS_HAS_SHARED_SPACE
+// if only host compile point to HostSpace
+#elif !defined(KOKKOS_ENABLE_OPENACC) && !defined(KOKKOS_ENABLE_OPENMPTARGET)
+using SharedSpace               = HostSpace;
+#define KOKKOS_HAS_SHARED_SPACE
+#endif
+
+inline constexpr bool has_shared_space =
+#if defined KOKKOS_HAS_SHARED_SPACE
+    true;
+#else
+    false;
+#endif
+
+#if defined(KOKKOS_ENABLE_CUDA)
+using SharedHostPinnedSpace = CudaHostPinnedSpace;
+#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
+#elif defined(KOKKOS_ENABLE_HIP)
+using SharedHostPinnedSpace = HIPHostPinnedSpace;
+#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
+#elif defined(KOKKOS_ENABLE_SYCL)
+    using SharedHostPinnedSpace = Experimental::SYCLHostUSMSpace;
+#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
+#elif !defined(KOKKOS_ENABLE_OPENACC) && !defined(KOKKOS_ENABLE_OPENMPTARGET)
+    using SharedHostPinnedSpace = HostSpace;
+#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
+#endif
+
+inline constexpr bool has_shared_host_pinned_space =
+#if defined KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
+    true;
+#else
+    false;
+#endif
+
 }  // namespace Kokkos
 
 //----------------------------------------------------------------------------
@@ -241,42 +256,6 @@ KOKKOS_FUNCTION void runtime_check_memory_access_violation(
               msg);))
 }
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-
-#if defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_CUDA) && \
-    defined(KOKKOS_ENABLE_CUDA)
-using ActiveExecutionMemorySpace KOKKOS_DEPRECATED = Kokkos::CudaSpace;
-#elif defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_SYCL)
-using ActiveExecutionMemorySpace KOKKOS_DEPRECATED =
-    Kokkos::Experimental::SYCLDeviceUSMSpace;
-#elif defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HIP_GPU)
-using ActiveExecutionMemorySpace KOKKOS_DEPRECATED =
-    Kokkos::Experimental::HIPSpace;
-#elif defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST)
-using ActiveExecutionMemorySpace KOKKOS_DEPRECATED = Kokkos::HostSpace;
-#else
-using ActiveExecutionMemorySpace KOKKOS_DEPRECATED = void;
-#endif
-
-template <typename DstMemorySpace, typename SrcMemorySpace>
-struct MemorySpaceAccess;
-
-template <typename DstMemorySpace, typename SrcMemorySpace,
-          bool = Kokkos::Impl::MemorySpaceAccess<DstMemorySpace,
-                                                 SrcMemorySpace>::accessible>
-struct verify_space {
-  KOKKOS_DEPRECATED KOKKOS_FUNCTION static void check() {}
-};
-
-template <typename DstMemorySpace, typename SrcMemorySpace>
-struct verify_space<DstMemorySpace, SrcMemorySpace, false> {
-  KOKKOS_DEPRECATED KOKKOS_FUNCTION static void check() {
-    Kokkos::abort(
-        "Kokkos::View ERROR: attempt to access inaccessible memory space");
-  };
-};
-#endif
-
 }  // namespace Impl
 
 namespace Experimental {
@@ -286,16 +265,6 @@ class LogicalMemorySpace;
 
 }  // namespace Kokkos
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-#define KOKKOS_RESTRICT_EXECUTION_TO_DATA(DATA_SPACE, DATA_PTR)        \
-  Kokkos::Impl::verify_space<Kokkos::Impl::ActiveExecutionMemorySpace, \
-                             DATA_SPACE>::check();
-
-#define KOKKOS_RESTRICT_EXECUTION_TO_(DATA_SPACE)                      \
-  Kokkos::Impl::verify_space<Kokkos::Impl::ActiveExecutionMemorySpace, \
-                             DATA_SPACE>::check();
-#endif
-
 //----------------------------------------------------------------------------
 
 namespace Kokkos {
diff --git a/packages/kokkos/core/src/Kokkos_Crs.hpp b/packages/kokkos/core/src/Kokkos_Crs.hpp
index 9c0d1f68212ecea38797f832b65dae8b9175ba69..92931b584952b24eb2a5904dc2fcb97bf1ac770a 100644
--- a/packages/kokkos/core/src/Kokkos_Crs.hpp
+++ b/packages/kokkos/core/src/Kokkos_Crs.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_CRS_HPP
 #define KOKKOS_CRS_HPP
@@ -336,11 +304,11 @@ struct CountAndFillBase {
   Functor m_functor;
   counts_type m_counts;
   struct Count {};
-  inline void operator()(Count, size_type i) const {
+  KOKKOS_FUNCTION void operator()(Count, size_type i) const {
     m_counts(i) = m_functor(i, nullptr);
   }
   struct Fill {};
-  inline void operator()(Fill, size_type i) const {
+  KOKKOS_FUNCTION void operator()(Fill, size_type i) const {
     auto j = m_crs.row_map(i);
     /* we don't want to access entries(entries.size()), even if its just to get
        its address and never use it. this can happen when row (i) is empty and
@@ -355,42 +323,6 @@ struct CountAndFillBase {
   CountAndFillBase(CrsType& crs, Functor const& f) : m_crs(crs), m_functor(f) {}
 };
 
-#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP)
-#if defined(KOKKOS_ENABLE_CUDA)
-#define EXEC_SPACE Kokkos::Cuda
-#elif defined(KOKKOS_ENABLE_HIP)
-#define EXEC_SPACE Kokkos::Experimental::HIP
-#endif
-template <class CrsType, class Functor>
-struct CountAndFillBase<CrsType, Functor, EXEC_SPACE> {
-  using data_type    = typename CrsType::data_type;
-  using size_type    = typename CrsType::size_type;
-  using row_map_type = typename CrsType::row_map_type;
-  using counts_type  = row_map_type;
-  CrsType m_crs;
-  Functor m_functor;
-  counts_type m_counts;
-  struct Count {};
-  __device__ inline void operator()(Count, size_type i) const {
-    m_counts(i) = m_functor(i, nullptr);
-  }
-  struct Fill {};
-  __device__ inline void operator()(Fill, size_type i) const {
-    auto j = m_crs.row_map(i);
-    /* we don't want to access entries(entries.size()), even if its just to get
-       its address and never use it. this can happen when row (i) is empty and
-       all rows after it are also empty. we could compare to row_map(i + 1), but
-       that is a read from global memory, whereas dimension_0() should be part
-       of the View in registers (or constant memory) */
-    data_type* fill = (j == static_cast<decltype(j)>(m_crs.entries.extent(0)))
-                          ? nullptr
-                          : (&(m_crs.entries(j)));
-    m_functor(i, fill);
-  }
-  CountAndFillBase(CrsType& crs, Functor const& f) : m_crs(crs), m_functor(f) {}
-};
-#endif
-
 template <class CrsType, class Functor>
 struct CountAndFill : public CountAndFillBase<CrsType, Functor> {
   using base_type = CountAndFillBase<CrsType, Functor>;
diff --git a/packages/kokkos/core/src/Kokkos_Cuda.hpp b/packages/kokkos/core/src/Kokkos_Cuda.hpp
index 72a00f41b7a239dd4af09f736815978284a13c5e..fce7351b3286ab74ab96635a94e5bc5ef84bbb9a 100644
--- a/packages/kokkos/core/src/Kokkos_Cuda.hpp
+++ b/packages/kokkos/core/src/Kokkos_Cuda.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_CUDA_HPP
 #define KOKKOS_CUDA_HPP
@@ -198,7 +166,11 @@ class Cuda {
                  "Kokkos::Cuda::fence(): Unnamed Instance Fence") const;
 
   /** \brief  Return the maximum amount of concurrency.  */
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
   static int concurrency();
+#else
+  int concurrency() const;
+#endif
 
   //! Print configuration information to the given output stream.
   void print_configuration(std::ostream& os, bool verbose = false) const;
@@ -249,6 +221,13 @@ class Cuda {
   uint32_t impl_instance_id() const noexcept;
 
  private:
+  friend bool operator==(Cuda const& lhs, Cuda const& rhs) {
+    return lhs.impl_internal_space_instance() ==
+           rhs.impl_internal_space_instance();
+  }
+  friend bool operator!=(Cuda const& lhs, Cuda const& rhs) {
+    return !(lhs == rhs);
+  }
   Kokkos::Impl::HostSharedPtr<Impl::CudaInternal> m_space_instance;
 };
 
diff --git a/packages/kokkos/core/src/Kokkos_CudaSpace.hpp b/packages/kokkos/core/src/Kokkos_CudaSpace.hpp
index 7ec78c0211c3af1dd32615901af643d066c8cde2..eec9999f616c9c32171c60f169c5e2042547b9a0 100644
--- a/packages/kokkos/core/src/Kokkos_CudaSpace.hpp
+++ b/packages/kokkos/core/src/Kokkos_CudaSpace.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_CUDASPACE_HPP
 #define KOKKOS_CUDASPACE_HPP
@@ -143,13 +111,6 @@ class CudaSpace {
   /**\brief Return Name of the MemorySpace */
   static constexpr const char* name() { return m_name; }
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  /*--------------------------------*/
-  /** \brief  Error reporting for HostSpace attempt to access CudaSpace */
-  KOKKOS_DEPRECATED static void access_error();
-  KOKKOS_DEPRECATED static void access_error(const void* const);
-#endif
-
  private:
   int m_device;  ///< Which Cuda device
 
@@ -178,13 +139,9 @@ class CudaUVMSpace {
   using device_type     = Kokkos::Device<execution_space, memory_space>;
   using size_type       = unsigned int;
 
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
   /** \brief  If UVM capability is available */
-  static bool available();
-
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  /*--------------------------------*/
-  /** \brief  CudaUVMSpace specific routine */
-  KOKKOS_DEPRECATED static int number_of_allocations();
+  KOKKOS_DEPRECATED static bool available();
 #endif
 
   /*--------------------------------*/
diff --git a/packages/kokkos/core/src/Kokkos_DetectionIdiom.hpp b/packages/kokkos/core/src/Kokkos_DetectionIdiom.hpp
index d45693819147e2eafdb04e80cd90aec08b4d9cc2..ae28805a42ee1acaad768f2cc634c48107465c2d 100644
--- a/packages/kokkos/core/src/Kokkos_DetectionIdiom.hpp
+++ b/packages/kokkos/core/src/Kokkos_DetectionIdiom.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 #ifndef KOKKOS_DETECTION_IDIOM_HPP
 #define KOKKOS_DETECTION_IDIOM_HPP
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -48,7 +20,9 @@
 #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_DETECTIONIDIOM
 #endif
 
-#include <impl/Kokkos_Utilities.hpp>  // void_t
+#include <Kokkos_Macros.hpp>  // FIXME doesn't actually need it if it wasn't
+                              // for the header self-containment test
+
 #include <type_traits>
 
 // NOTE This header implements the detection idiom from Version 2 of the C++
@@ -73,7 +47,7 @@ struct detector {
 
 // specialization recognizes and handles only types supporting Op
 template <class Default, template <class...> class Op, class... Args>
-struct detector<Default, void_t<Op<Args...>>, Op, Args...> {
+struct detector<Default, std::void_t<Op<Args...>>, Op, Args...> {
   using value_t = std::true_type;
   using type    = Op<Args...>;
 };
@@ -102,7 +76,6 @@ template <class To, template <class...> class Op, class... Args>
 using is_detected_convertible =
     std::is_convertible<detected_t<Op, Args...>, To>;
 
-#ifdef KOKKOS_ENABLE_CXX17
 template <template <class...> class Op, class... Args>
 inline constexpr bool is_detected_v = is_detected<Op, Args...>::value;
 
@@ -113,7 +86,6 @@ inline constexpr bool is_detected_exact_v =
 template <class Expected, template <class...> class Op, class... Args>
 inline constexpr bool is_detected_convertible_v =
     is_detected_convertible<Expected, Op, Args...>::value;
-#endif
 
 }  // namespace Kokkos
 
diff --git a/packages/kokkos/core/src/Kokkos_ExecPolicy.hpp b/packages/kokkos/core/src/Kokkos_ExecPolicy.hpp
index 4cd57bae10a1f588bb1a84b1f7256d62704bcd67..357c2572a5c66880e068cdc72bae3a61fa45dcf9 100644
--- a/packages/kokkos/core/src/Kokkos_ExecPolicy.hpp
+++ b/packages/kokkos/core/src/Kokkos_ExecPolicy.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_EXECPOLICY_HPP
 #define KOKKOS_EXECPOLICY_HPP
@@ -217,8 +185,17 @@ class RangePolicy : public Impl::PolicyTraits<Properties...> {
  private:
   /** \brief finalize chunk_size if it was set to AUTO*/
   inline void set_auto_chunk_size() {
-    int64_t concurrency =
-        static_cast<int64_t>(traits::execution_space::concurrency());
+#ifdef KOKKOS_ENABLE_SYCL
+    if (std::is_same_v<typename traits::execution_space,
+                       Kokkos::Experimental::SYCL>) {
+      // chunk_size <=1 lets the compiler choose the workgroup size when
+      // launching kernels
+      m_granularity      = 1;
+      m_granularity_mask = 0;
+      return;
+    }
+#endif
+    auto concurrency = static_cast<int64_t>(m_space.concurrency());
     if (concurrency == 0) concurrency = 1;
 
     if (m_granularity > 0) {
@@ -868,6 +845,192 @@ ThreadVectorRange(const TeamMemberType&, const iType1& arg_begin,
 
 namespace Impl {
 
+enum class TeamMDRangeLastNestLevel : bool { NotLastNestLevel, LastNestLevel };
+enum class TeamMDRangeParThread : bool { NotParThread, ParThread };
+enum class TeamMDRangeParVector : bool { NotParVector, ParVector };
+enum class TeamMDRangeThreadAndVector : bool { NotBoth, Both };
+
+template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector>
+struct HostBasedNestLevel;
+
+template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector>
+struct AcceleratorBasedNestLevel;
+
+// ThreadAndVectorNestLevel determines on which nested level parallelization
+// happens.
+//   - Rank is Kokkos::Rank<TotalNestLevel, Iter>
+//     - TotalNestLevel is the total number of loop nests
+//     - Iter is whether to go forward or backward through ranks (i.e. the
+//       iteration order for MDRangePolicy)
+//   - ThreadAndVector determines whether both vector and thread parallelism is
+//     in use
+template <typename Rank, typename ExecSpace,
+          TeamMDRangeThreadAndVector ThreadAndVector>
+struct ThreadAndVectorNestLevel;
+
+struct NoReductionTag {};
+
+template <typename Rank, typename TeamMDPolicy, typename Lambda,
+          typename ReductionValueType>
+KOKKOS_INLINE_FUNCTION void md_parallel_impl(TeamMDPolicy const& policy,
+                                             Lambda const& lambda,
+                                             ReductionValueType&& val);
+}  // namespace Impl
+
+template <typename Rank, typename TeamHandle>
+struct TeamThreadMDRange;
+
+template <unsigned N, Iterate OuterDir, Iterate InnerDir, typename TeamHandle>
+struct TeamThreadMDRange<Rank<N, OuterDir, InnerDir>, TeamHandle> {
+  using NestLevelType  = int;
+  using BoundaryType   = int;
+  using TeamHandleType = TeamHandle;
+  using ExecutionSpace = typename TeamHandleType::execution_space;
+  using ArrayLayout    = typename ExecutionSpace::array_layout;
+
+  static constexpr NestLevelType total_nest_level =
+      Rank<N, OuterDir, InnerDir>::rank;
+  static constexpr Iterate iter    = OuterDir;
+  static constexpr auto par_thread = Impl::TeamMDRangeParThread::ParThread;
+  static constexpr auto par_vector = Impl::TeamMDRangeParVector::NotParVector;
+
+  static constexpr Iterate direction =
+      OuterDir == Iterate::Default
+          ? layout_iterate_type_selector<ArrayLayout>::outer_iteration_pattern
+          : iter;
+
+  template <class... Args>
+  KOKKOS_FUNCTION TeamThreadMDRange(TeamHandleType const& team_, Args&&... args)
+      : team(team_), boundaries{static_cast<BoundaryType>(args)...} {
+    static_assert(sizeof...(Args) == total_nest_level);
+  }
+
+  TeamHandleType const& team;
+  BoundaryType boundaries[total_nest_level];
+};
+
+template <typename TeamHandle, typename... Args>
+TeamThreadMDRange(TeamHandle const&, Args&&...)
+    ->TeamThreadMDRange<Rank<sizeof...(Args), Iterate::Default>, TeamHandle>;
+
+template <typename Rank, typename TeamHandle>
+struct ThreadVectorMDRange;
+
+template <unsigned N, Iterate OuterDir, Iterate InnerDir, typename TeamHandle>
+struct ThreadVectorMDRange<Rank<N, OuterDir, InnerDir>, TeamHandle> {
+  using NestLevelType  = int;
+  using BoundaryType   = int;
+  using TeamHandleType = TeamHandle;
+  using ExecutionSpace = typename TeamHandleType::execution_space;
+  using ArrayLayout    = typename ExecutionSpace::array_layout;
+
+  static constexpr NestLevelType total_nest_level =
+      Rank<N, OuterDir, InnerDir>::rank;
+  static constexpr Iterate iter    = OuterDir;
+  static constexpr auto par_thread = Impl::TeamMDRangeParThread::NotParThread;
+  static constexpr auto par_vector = Impl::TeamMDRangeParVector::ParVector;
+
+  static constexpr Iterate direction =
+      OuterDir == Iterate::Default
+          ? layout_iterate_type_selector<ArrayLayout>::outer_iteration_pattern
+          : iter;
+
+  template <class... Args>
+  KOKKOS_INLINE_FUNCTION ThreadVectorMDRange(TeamHandleType const& team_,
+                                             Args&&... args)
+      : team(team_), boundaries{static_cast<BoundaryType>(args)...} {
+    static_assert(sizeof...(Args) == total_nest_level);
+  }
+
+  TeamHandleType const& team;
+  BoundaryType boundaries[total_nest_level];
+};
+
+template <typename TeamHandle, typename... Args>
+ThreadVectorMDRange(TeamHandle const&, Args&&...)
+    ->ThreadVectorMDRange<Rank<sizeof...(Args), Iterate::Default>, TeamHandle>;
+
+template <typename Rank, typename TeamHandle>
+struct TeamVectorMDRange;
+
+template <unsigned N, Iterate OuterDir, Iterate InnerDir, typename TeamHandle>
+struct TeamVectorMDRange<Rank<N, OuterDir, InnerDir>, TeamHandle> {
+  using NestLevelType  = int;
+  using BoundaryType   = int;
+  using TeamHandleType = TeamHandle;
+  using ExecutionSpace = typename TeamHandleType::execution_space;
+  using ArrayLayout    = typename ExecutionSpace::array_layout;
+
+  static constexpr NestLevelType total_nest_level =
+      Rank<N, OuterDir, InnerDir>::rank;
+  static constexpr Iterate iter    = OuterDir;
+  static constexpr auto par_thread = Impl::TeamMDRangeParThread::ParThread;
+  static constexpr auto par_vector = Impl::TeamMDRangeParVector::ParVector;
+
+  static constexpr Iterate direction =
+      iter == Iterate::Default
+          ? layout_iterate_type_selector<ArrayLayout>::outer_iteration_pattern
+          : iter;
+
+  template <class... Args>
+  KOKKOS_INLINE_FUNCTION TeamVectorMDRange(TeamHandleType const& team_,
+                                           Args&&... args)
+      : team(team_), boundaries{static_cast<BoundaryType>(args)...} {
+    static_assert(sizeof...(Args) == total_nest_level);
+  }
+
+  TeamHandleType const& team;
+  BoundaryType boundaries[total_nest_level];
+};
+
+template <typename TeamHandle, typename... Args>
+TeamVectorMDRange(TeamHandle const&, Args&&...)
+    ->TeamVectorMDRange<Rank<sizeof...(Args), Iterate::Default>, TeamHandle>;
+
+template <typename Rank, typename TeamHandle, typename Lambda,
+          typename ReducerValueType>
+KOKKOS_INLINE_FUNCTION void parallel_reduce(
+    TeamThreadMDRange<Rank, TeamHandle> const& policy, Lambda const& lambda,
+    ReducerValueType& val) {
+  Impl::md_parallel_impl<Rank>(policy, lambda, val);
+}
+
+template <typename Rank, typename TeamHandle, typename Lambda>
+KOKKOS_INLINE_FUNCTION void parallel_for(
+    TeamThreadMDRange<Rank, TeamHandle> const& policy, Lambda const& lambda) {
+  Impl::md_parallel_impl<Rank>(policy, lambda, Impl::NoReductionTag());
+}
+
+template <typename Rank, typename TeamHandle, typename Lambda,
+          typename ReducerValueType>
+KOKKOS_INLINE_FUNCTION void parallel_reduce(
+    ThreadVectorMDRange<Rank, TeamHandle> const& policy, Lambda const& lambda,
+    ReducerValueType& val) {
+  Impl::md_parallel_impl<Rank>(policy, lambda, val);
+}
+
+template <typename Rank, typename TeamHandle, typename Lambda>
+KOKKOS_INLINE_FUNCTION void parallel_for(
+    ThreadVectorMDRange<Rank, TeamHandle> const& policy, Lambda const& lambda) {
+  Impl::md_parallel_impl<Rank>(policy, lambda, Impl::NoReductionTag());
+}
+
+template <typename Rank, typename TeamHandle, typename Lambda,
+          typename ReducerValueType>
+KOKKOS_INLINE_FUNCTION void parallel_reduce(
+    TeamVectorMDRange<Rank, TeamHandle> const& policy, Lambda const& lambda,
+    ReducerValueType& val) {
+  Impl::md_parallel_impl<Rank>(policy, lambda, val);
+}
+
+template <typename Rank, typename TeamHandle, typename Lambda>
+KOKKOS_INLINE_FUNCTION void parallel_for(
+    TeamVectorMDRange<Rank, TeamHandle> const& policy, Lambda const& lambda) {
+  Impl::md_parallel_impl<Rank>(policy, lambda, Impl::NoReductionTag());
+}
+
+namespace Impl {
+
 template <typename FunctorType, typename TagType,
           bool HasTag = !std::is_void<TagType>::value>
 struct ParallelConstructName;
@@ -914,30 +1077,30 @@ struct PatternImplSpecializationFromTag;
 
 template <class... Args>
 struct PatternImplSpecializationFromTag<Kokkos::ParallelForTag, Args...>
-    : identity<ParallelFor<Args...>> {};
+    : type_identity<ParallelFor<Args...>> {};
 
 template <class... Args>
 struct PatternImplSpecializationFromTag<Kokkos::ParallelReduceTag, Args...>
-    : identity<ParallelReduce<Args...>> {};
+    : type_identity<ParallelReduce<Args...>> {};
 
 template <class... Args>
 struct PatternImplSpecializationFromTag<Kokkos::ParallelScanTag, Args...>
-    : identity<ParallelScan<Args...>> {};
+    : type_identity<ParallelScan<Args...>> {};
 
 template <class PatternImpl>
 struct PatternTagFromImplSpecialization;
 
 template <class... Args>
 struct PatternTagFromImplSpecialization<ParallelFor<Args...>>
-    : identity<ParallelForTag> {};
+    : type_identity<ParallelForTag> {};
 
 template <class... Args>
 struct PatternTagFromImplSpecialization<ParallelReduce<Args...>>
-    : identity<ParallelReduceTag> {};
+    : type_identity<ParallelReduceTag> {};
 
 template <class... Args>
 struct PatternTagFromImplSpecialization<ParallelScan<Args...>>
-    : identity<ParallelScanTag> {};
+    : type_identity<ParallelScanTag> {};
 
 }  // end namespace Impl
 
diff --git a/packages/kokkos/core/src/Kokkos_Extents.hpp b/packages/kokkos/core/src/Kokkos_Extents.hpp
index c51d663ce9bb10b074cb3378d4d8ef30f95e95da..7968fab3aaa829b7f5618fe59ff8b2062b3d8710 100644
--- a/packages/kokkos/core/src/Kokkos_Extents.hpp
+++ b/packages/kokkos/core/src/Kokkos_Extents.hpp
@@ -1,54 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//              Copyright (2019) Sandia Corporation
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_KOKKOS_EXTENTS_HPP
 #define KOKKOS_KOKKOS_EXTENTS_HPP
diff --git a/packages/kokkos/core/src/Kokkos_Future.hpp b/packages/kokkos/core/src/Kokkos_Future.hpp
index 4da6c2b5d94a1b26497316c2c14ce1355d088578..0b3a153de8c4a450377415c05f221064b0feb55b 100644
--- a/packages/kokkos/core/src/Kokkos_Future.hpp
+++ b/packages/kokkos/core/src/Kokkos_Future.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_FUTURE_HPP
 #define KOKKOS_FUTURE_HPP
@@ -449,10 +417,9 @@ struct is_future : public std::false_type {};
 
 template <typename ValueType, typename Scheduler, typename ExecSpace>
 struct is_future<BasicFuture<ValueType, Scheduler>, ExecSpace>
-    : std::integral_constant<
-          bool,
+    : std::bool_constant<
           std::is_same<ExecSpace, typename Scheduler::execution_space>::value ||
-              std::is_void<ExecSpace>::value> {};
+          std::is_void<ExecSpace>::value> {};
 
 ////////////////////////////////////////////////////////////////////////////////
 // END OLD CODE
diff --git a/packages/kokkos/core/src/Kokkos_Graph.hpp b/packages/kokkos/core/src/Kokkos_Graph.hpp
index 1f71665fbbe5668bfbf1bdae1f757a06886e2ac0..7f77c00b2d7b8f03c5d3abfa26628b51e314f884 100644
--- a/packages/kokkos/core/src/Kokkos_Graph.hpp
+++ b/packages/kokkos/core/src/Kokkos_Graph.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_GRAPH_HPP
 #define KOKKOS_GRAPH_HPP
@@ -58,8 +30,6 @@
 // GraphAccess needs to be defined, not just declared
 #include <impl/Kokkos_GraphImpl.hpp>
 
-#include <impl/Kokkos_Utilities.hpp>  // fold emulation
-
 #include <functional>
 #include <memory>
 
@@ -70,7 +40,7 @@ namespace Experimental {
 // <editor-fold desc="Graph"> {{{1
 
 template <class ExecutionSpace>
-struct KOKKOS_ATTRIBUTE_NODISCARD Graph {
+struct [[nodiscard]] Graph {
  public:
   //----------------------------------------------------------------------------
   // <editor-fold desc="public member types"> {{{2
@@ -145,8 +115,7 @@ auto when_all(PredecessorRefs&&... arg_pred_refs) {
           .lock();
   auto node_ptr_impl = graph_ptr_impl->create_aggregate_ptr(arg_pred_refs...);
   graph_ptr_impl->add_node(node_ptr_impl);
-  KOKKOS_IMPL_FOLD_COMMA_OPERATOR(
-      graph_ptr_impl->add_predecessor(node_ptr_impl, arg_pred_refs) /* ... */);
+  (graph_ptr_impl->add_predecessor(node_ptr_impl, arg_pred_refs), ...);
   return Kokkos::Impl::GraphAccess::make_graph_node_ref(
       std::move(graph_ptr_impl), std::move(node_ptr_impl));
 }
diff --git a/packages/kokkos/core/src/Kokkos_GraphNode.hpp b/packages/kokkos/core/src/Kokkos_GraphNode.hpp
index 6eab5ec8c7b285018619b0350bbb76d7623ea257..1cfd2b382b2e7b409e39ce3b921f66c99d9be106 100644
--- a/packages/kokkos/core/src/Kokkos_GraphNode.hpp
+++ b/packages/kokkos/core/src/Kokkos_GraphNode.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_KOKKOS_GRAPHNODE_HPP
 #define KOKKOS_KOKKOS_GRAPHNODE_HPP
@@ -79,13 +47,10 @@ class GraphNodeRef {
   // Note: because of these assertions, instantiating this class template is not
   //       intended to be SFINAE-safe, so do validation before you instantiate.
 
-// WORKAROUND Could not get it to compile with IBM XL V16.1.1
-#ifndef KOKKOS_COMPILER_IBM
   static_assert(
       std::is_same<Predecessor, TypeErasedTag>::value ||
           Kokkos::Impl::is_specialization_of<Predecessor, GraphNodeRef>::value,
       "Invalid predecessor template parameter given to GraphNodeRef");
-#endif
 
   static_assert(
       Kokkos::is_execution_space<ExecutionSpace>::value,
diff --git a/packages/kokkos/core/src/Kokkos_Graph_fwd.hpp b/packages/kokkos/core/src/Kokkos_Graph_fwd.hpp
index 6f639658e1d72cd4d1166a3189428b05f6b082d7..fd0caba907382d2c0674fc365fac1f5dcab3b3c4 100644
--- a/packages/kokkos/core/src/Kokkos_Graph_fwd.hpp
+++ b/packages/kokkos/core/src/Kokkos_Graph_fwd.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_GRAPH_FWD_HPP
 #define KOKKOS_KOKKOS_GRAPH_FWD_HPP
diff --git a/packages/kokkos/core/src/Kokkos_HBWSpace.hpp b/packages/kokkos/core/src/Kokkos_HBWSpace.hpp
index 0c5dbbdc22b60fccbb159837a37b4e5a7229a290..d9064a298339e6e611c90dd5c9b60336cc7e2527 100644
--- a/packages/kokkos/core/src/Kokkos_HBWSpace.hpp
+++ b/packages/kokkos/core/src/Kokkos_HBWSpace.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_HBWSPACE_HPP
 #define KOKKOS_HBWSPACE_HPP
@@ -204,12 +172,7 @@ class SharedAllocationRecord<Kokkos::Experimental::HBWSpace, void>
   const Kokkos::Experimental::HBWSpace m_space;
 
  protected:
-  ~SharedAllocationRecord()
-#if defined( \
-    KOKKOS_IMPL_INTEL_WORKAROUND_NOEXCEPT_SPECIFICATION_VIRTUAL_FUNCTION)
-      noexcept
-#endif
-      ;
+  ~SharedAllocationRecord();
   SharedAllocationRecord() = default;
 
   SharedAllocationRecord(
diff --git a/packages/kokkos/core/src/Kokkos_HIP_Space.hpp b/packages/kokkos/core/src/Kokkos_HIP_Space.hpp
deleted file mode 100644
index 8c195a0f398f13107ffded35b14677e25db6e23d..0000000000000000000000000000000000000000
--- a/packages/kokkos/core/src/Kokkos_HIP_Space.hpp
+++ /dev/null
@@ -1,806 +0,0 @@
-/*
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
-//               Solutions of Sandia, LLC (NTESS).
-//
-// Under the terms of Contract DE-NA0003525 with NTESS,
-// the U.S. Government retains certain rights in this software.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
-//@HEADER
-*/
-
-#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
-#include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
-static_assert(false,
-              "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
-#endif
-#ifndef KOKKOS_HIPSPACE_HPP
-#define KOKKOS_HIPSPACE_HPP
-
-#include <Kokkos_Core_fwd.hpp>
-
-#if defined(KOKKOS_ENABLE_HIP)
-
-#include <iosfwd>
-#include <typeinfo>
-#include <string>
-#include <cstddef>
-#include <iosfwd>
-
-#include <Kokkos_HostSpace.hpp>
-#include <Kokkos_Layout.hpp>
-#include <Kokkos_ScratchSpace.hpp>
-#include <HIP/Kokkos_HIP_Error.hpp>  // HIP_SAFE_CALL
-
-#include <impl/Kokkos_Profiling_Interface.hpp>
-#include <impl/Kokkos_HostSharedPtr.hpp>
-#include <impl/Kokkos_InitializationSettings.hpp>
-
-#include <hip/hip_runtime_api.h>
-/*--------------------------------------------------------------------------*/
-
-namespace Kokkos {
-namespace Impl {
-
-template <typename T>
-struct is_hip_type_space : public std::false_type {};
-
-}  // namespace Impl
-
-namespace Experimental {
-/** \brief  HIP on-device memory management */
-
-class HIPSpace {
- public:
-  //! Tag this class as a kokkos memory space
-  using memory_space    = HIPSpace;
-  using execution_space = Kokkos::Experimental::HIP;
-  using device_type     = Kokkos::Device<execution_space, memory_space>;
-
-  using size_type = unsigned int;
-
-  /*--------------------------------*/
-
-  HIPSpace();
-  HIPSpace(HIPSpace&& rhs)      = default;
-  HIPSpace(const HIPSpace& rhs) = default;
-  HIPSpace& operator=(HIPSpace&& rhs) = default;
-  HIPSpace& operator=(const HIPSpace& rhs) = default;
-  ~HIPSpace()                              = default;
-
-  /**\brief  Allocate untracked memory in the hip space */
-  void* allocate(const size_t arg_alloc_size) const;
-  void* allocate(const char* arg_label, const size_t arg_alloc_size,
-                 const size_t arg_logical_size = 0) const;
-
-  /**\brief  Deallocate untracked memory in the hip space */
-  void deallocate(void* const arg_alloc_ptr, const size_t arg_alloc_size) const;
-  void deallocate(const char* arg_label, void* const arg_alloc_ptr,
-                  const size_t arg_alloc_size,
-                  const size_t arg_logical_size = 0) const;
-
- private:
-  template <class, class, class, class>
-  friend class LogicalMemorySpace;
-  void* impl_allocate(const char* arg_label, const size_t arg_alloc_size,
-                      const size_t arg_logical_size = 0,
-                      const Kokkos::Tools::SpaceHandle =
-                          Kokkos::Tools::make_space_handle(name())) const;
-  void impl_deallocate(const char* arg_label, void* const arg_alloc_ptr,
-                       const size_t arg_alloc_size,
-                       const size_t arg_logical_size = 0,
-                       const Kokkos::Tools::SpaceHandle =
-                           Kokkos::Tools::make_space_handle(name())) const;
-
- public:
-  /**\brief Return Name of the MemorySpace */
-  static constexpr const char* name() { return "HIP"; }
-
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  /*--------------------------------*/
-  /** \brief  Error reporting for HostSpace attempt to access HIPSpace */
-  KOKKOS_DEPRECATED static void access_error();
-  KOKKOS_DEPRECATED static void access_error(const void* const);
-#endif
-
- private:
-  int m_device;  ///< Which HIP device
-
-  friend class Kokkos::Impl::SharedAllocationRecord<
-      Kokkos::Experimental::HIPSpace, void>;
-};
-
-}  // namespace Experimental
-
-template <>
-struct Impl::is_hip_type_space<Experimental::HIPSpace> : public std::true_type {
-};
-
-}  // namespace Kokkos
-
-/*--------------------------------------------------------------------------*/
-/*--------------------------------------------------------------------------*/
-
-namespace Kokkos {
-namespace Experimental {
-/** \brief  Host memory that is accessible to HIP execution space
- *          through HIP's host-pinned memory allocation.
- */
-class HIPHostPinnedSpace {
- public:
-  //! Tag this class as a kokkos memory space
-  /** \brief  Memory is in HostSpace so use the HostSpace::execution_space */
-  using execution_space = HostSpace::execution_space;
-  using memory_space    = HIPHostPinnedSpace;
-  using device_type     = Kokkos::Device<execution_space, memory_space>;
-  using size_type       = unsigned int;
-
-  /*--------------------------------*/
-
-  HIPHostPinnedSpace();
-  HIPHostPinnedSpace(HIPHostPinnedSpace&& rhs)      = default;
-  HIPHostPinnedSpace(const HIPHostPinnedSpace& rhs) = default;
-  HIPHostPinnedSpace& operator=(HIPHostPinnedSpace&& rhs) = default;
-  HIPHostPinnedSpace& operator=(const HIPHostPinnedSpace& rhs) = default;
-  ~HIPHostPinnedSpace()                                        = default;
-
-  /**\brief  Allocate untracked memory in the space */
-  void* allocate(const size_t arg_alloc_size) const;
-  void* allocate(const char* arg_label, const size_t arg_alloc_size,
-                 const size_t arg_logical_size = 0) const;
-
-  /**\brief  Deallocate untracked memory in the space */
-  void deallocate(void* const arg_alloc_ptr, const size_t arg_alloc_size) const;
-  void deallocate(const char* arg_label, void* const arg_alloc_ptr,
-                  const size_t arg_alloc_size,
-                  const size_t arg_logical_size = 0) const;
-
- private:
-  template <class, class, class, class>
-  friend class LogicalMemorySpace;
-  void* impl_allocate(const char* arg_label, const size_t arg_alloc_size,
-                      const size_t arg_logical_size = 0,
-                      const Kokkos::Tools::SpaceHandle =
-                          Kokkos::Tools::make_space_handle(name())) const;
-  void impl_deallocate(const char* arg_label, void* const arg_alloc_ptr,
-                       const size_t arg_alloc_size,
-                       const size_t arg_logical_size = 0,
-                       const Kokkos::Tools::SpaceHandle =
-                           Kokkos::Tools::make_space_handle(name())) const;
-
- public:
-  /**\brief Return Name of the MemorySpace */
-  static constexpr const char* name() { return "HIPHostPinned"; }
-
-  /*--------------------------------*/
-};
-}  // namespace Experimental
-
-template <>
-struct Impl::is_hip_type_space<Experimental::HIPHostPinnedSpace>
-    : public std::true_type {};
-
-}  // namespace Kokkos
-
-/*--------------------------------------------------------------------------*/
-/*--------------------------------------------------------------------------*/
-
-namespace Kokkos {
-namespace Experimental {
-/** \brief  Memory that is accessible to HIP execution space
- *          and host through HIP's memory page migration.
- */
-class HIPManagedSpace {
- public:
-  //! Tag this class as a kokkos memory space
-  /** \brief  Memory is unified to both device and host via page migration
-   *  and therefore able to be used by HostSpace::execution_space and
-   *  DeviceSpace::execution_space.
-   */
-  //! tag this class as a kokkos memory space
-  using memory_space    = HIPManagedSpace;
-  using execution_space = Kokkos::Experimental::HIP;
-  using device_type     = Kokkos::Device<execution_space, memory_space>;
-  using size_type       = unsigned int;
-
-  /*--------------------------------*/
-
-  HIPManagedSpace();
-  HIPManagedSpace(HIPManagedSpace&& rhs)      = default;
-  HIPManagedSpace(const HIPManagedSpace& rhs) = default;
-  HIPManagedSpace& operator=(HIPManagedSpace&& rhs) = default;
-  HIPManagedSpace& operator=(const HIPManagedSpace& rhs) = default;
-  ~HIPManagedSpace()                                     = default;
-
-  /**\brief  Allocate untracked memory in the space */
-  void* allocate(const size_t arg_alloc_size) const;
-  void* allocate(const char* arg_label, const size_t arg_alloc_size,
-                 const size_t arg_logical_size = 0) const;
-
-  /**\brief  Deallocate untracked memory in the space */
-  void deallocate(void* const arg_alloc_ptr, const size_t arg_alloc_size) const;
-  void deallocate(const char* arg_label, void* const arg_alloc_ptr,
-                  const size_t arg_alloc_size,
-                  const size_t arg_logical_size = 0) const;
-
- private:
-  int m_device;  ///< Which HIP device
-  template <class, class, class, class>
-  friend class LogicalMemorySpace;
-  void* impl_allocate(const char* arg_label, const size_t arg_alloc_size,
-                      const size_t arg_logical_size = 0,
-                      const Kokkos::Tools::SpaceHandle =
-                          Kokkos::Tools::make_space_handle(name())) const;
-  void impl_deallocate(const char* arg_label, void* const arg_alloc_ptr,
-                       const size_t arg_alloc_size,
-                       const size_t arg_logical_size = 0,
-                       const Kokkos::Tools::SpaceHandle =
-                           Kokkos::Tools::make_space_handle(name())) const;
-
- public:
-  /**\brief Return Name of the MemorySpace */
-  static constexpr const char* name() { return "HIPManaged"; }
-
-  /*--------------------------------*/
-};
-}  // namespace Experimental
-
-template <>
-struct Impl::is_hip_type_space<Experimental::HIPManagedSpace>
-    : public std::true_type {};
-
-}  // namespace Kokkos
-
-/*--------------------------------------------------------------------------*/
-/*--------------------------------------------------------------------------*/
-
-namespace Kokkos {
-namespace Impl {
-
-static_assert(
-    Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::HIPSpace,
-                                    Kokkos::Experimental::HIPSpace>::assignable,
-    "");
-
-//----------------------------------------
-
-template <>
-struct MemorySpaceAccess<Kokkos::HostSpace, Kokkos::Experimental::HIPSpace> {
-  enum : bool { assignable = false };
-  enum : bool { accessible = false };
-  enum : bool { deepcopy = true };
-};
-
-template <>
-struct MemorySpaceAccess<Kokkos::HostSpace,
-                         Kokkos::Experimental::HIPHostPinnedSpace> {
-  // HostSpace::execution_space == HIPHostPinnedSpace::execution_space
-  enum : bool { assignable = true };
-  enum : bool { accessible = true };
-  enum : bool { deepcopy = true };
-};
-
-template <>
-struct MemorySpaceAccess<Kokkos::HostSpace,
-                         Kokkos::Experimental::HIPManagedSpace> {
-  // HostSpace::execution_space != HIPManagedSpace::execution_space
-  enum : bool { assignable = false };
-  enum : bool { accessible = true };
-  enum : bool { deepcopy = true };
-};
-
-//----------------------------------------
-
-template <>
-struct MemorySpaceAccess<Kokkos::Experimental::HIPSpace, Kokkos::HostSpace> {
-  enum : bool { assignable = false };
-  enum : bool { accessible = false };
-  enum : bool { deepcopy = true };
-};
-
-template <>
-struct MemorySpaceAccess<Kokkos::Experimental::HIPSpace,
-                         Kokkos::Experimental::HIPHostPinnedSpace> {
-  // HIPSpace::execution_space != HIPHostPinnedSpace::execution_space
-  enum : bool { assignable = false };
-  enum : bool { accessible = true };  // HIPSpace::execution_space
-  enum : bool { deepcopy = true };
-};
-
-template <>
-struct MemorySpaceAccess<Kokkos::Experimental::HIPSpace,
-                         Kokkos::Experimental::HIPManagedSpace> {
-  // HIPSpace::execution_space == HIPManagedSpace::execution_space
-  enum : bool { assignable = true };
-  enum : bool { accessible = true };
-  enum : bool { deepcopy = true };
-};
-
-//----------------------------------------
-// HIPHostPinnedSpace::execution_space == HostSpace::execution_space
-// HIPHostPinnedSpace accessible to both HIP and Host
-
-template <>
-struct MemorySpaceAccess<Kokkos::Experimental::HIPHostPinnedSpace,
-                         Kokkos::HostSpace> {
-  enum : bool { assignable = false };  // Cannot access from HIP
-  enum : bool { accessible = true };   // HIPHostPinnedSpace::execution_space
-  enum : bool { deepcopy = true };
-};
-
-template <>
-struct MemorySpaceAccess<Kokkos::Experimental::HIPHostPinnedSpace,
-                         Kokkos::Experimental::HIPSpace> {
-  enum : bool { assignable = false };  // Cannot access from Host
-  enum : bool { accessible = false };
-  enum : bool { deepcopy = true };
-};
-
-template <>
-struct MemorySpaceAccess<Kokkos::Experimental::HIPHostPinnedSpace,
-                         Kokkos::Experimental::HIPManagedSpace> {
-  enum : bool { assignable = false };  // different exec_space
-  enum : bool { accessible = true };
-  enum : bool { deepcopy = true };
-};
-
-//----------------------------------------
-// HIPManagedSpace::execution_space != HostSpace::execution_space
-// HIPManagedSpace accessible to both HIP and Host
-
-template <>
-struct MemorySpaceAccess<Kokkos::Experimental::HIPManagedSpace,
-                         Kokkos::HostSpace> {
-  enum : bool { assignable = false };
-  enum : bool { accessible = false };  // HIPHostPinnedSpace::execution_space
-  enum : bool { deepcopy = true };
-};
-
-template <>
-struct MemorySpaceAccess<Kokkos::Experimental::HIPManagedSpace,
-                         Kokkos::Experimental::HIPSpace> {
-  enum : bool { assignable = false };
-  enum : bool { accessible = true };
-  enum : bool { deepcopy = true };
-};
-
-template <>
-struct MemorySpaceAccess<Kokkos::Experimental::HIPManagedSpace,
-                         Kokkos::Experimental::HIPHostPinnedSpace> {
-  enum : bool { assignable = false };  // different exec_space
-  enum : bool { accessible = true };
-  enum : bool { deepcopy = true };
-};
-
-};  // namespace Impl
-//----------------------------------------
-
-}  // namespace Kokkos
-
-/*--------------------------------------------------------------------------*/
-/*--------------------------------------------------------------------------*/
-
-namespace Kokkos {
-namespace Impl {
-
-void DeepCopyHIP(void* dst, const void* src, size_t n);
-void DeepCopyAsyncHIP(const Kokkos::Experimental::HIP& instance, void* dst,
-                      const void* src, size_t n);
-void DeepCopyAsyncHIP(void* dst, const void* src, size_t n);
-
-template <class MemSpace>
-struct DeepCopy<MemSpace, HostSpace, Kokkos::Experimental::HIP,
-                std::enable_if_t<is_hip_type_space<MemSpace>::value>> {
-  DeepCopy(void* dst, const void* src, size_t n) { DeepCopyHIP(dst, src, n); }
-  DeepCopy(const Kokkos::Experimental::HIP& instance, void* dst,
-           const void* src, size_t n) {
-    DeepCopyAsyncHIP(instance, dst, src, n);
-  }
-};
-
-template <class MemSpace>
-struct DeepCopy<HostSpace, MemSpace, Kokkos::Experimental::HIP,
-                std::enable_if_t<is_hip_type_space<MemSpace>::value>> {
-  DeepCopy(void* dst, const void* src, size_t n) { DeepCopyHIP(dst, src, n); }
-  DeepCopy(const Kokkos::Experimental::HIP& instance, void* dst,
-           const void* src, size_t n) {
-    DeepCopyAsyncHIP(instance, dst, src, n);
-  }
-};
-
-template <class MemSpace1, class MemSpace2>
-struct DeepCopy<MemSpace1, MemSpace2, Kokkos::Experimental::HIP,
-                std::enable_if_t<is_hip_type_space<MemSpace1>::value &&
-                                 is_hip_type_space<MemSpace2>::value>> {
-  DeepCopy(void* dst, const void* src, size_t n) { DeepCopyHIP(dst, src, n); }
-  DeepCopy(const Kokkos::Experimental::HIP& instance, void* dst,
-           const void* src, size_t n) {
-    DeepCopyAsyncHIP(instance, dst, src, n);
-  }
-};
-
-template <class MemSpace1, class MemSpace2, class ExecutionSpace>
-struct DeepCopy<
-    MemSpace1, MemSpace2, ExecutionSpace,
-    std::enable_if_t<
-        is_hip_type_space<MemSpace1>::value &&
-        is_hip_type_space<MemSpace2>::value &&
-        !std::is_same<ExecutionSpace, Kokkos::Experimental::HIP>::value>> {
-  inline DeepCopy(void* dst, const void* src, size_t n) {
-    DeepCopyHIP(dst, src, n);
-  }
-
-  inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src,
-                  size_t n) {
-    exec.fence(fence_string());
-    DeepCopyAsyncHIP(dst, src, n);
-  }
-
- private:
-  static const std::string& fence_string() {
-    static const std::string string =
-        std::string("Kokkos::Impl::DeepCopy<") + MemSpace1::name() + "Space, " +
-        MemSpace2::name() +
-        "Space, ExecutionSpace>::DeepCopy: fence before copy";
-    return string;
-  }
-};
-
-template <class MemSpace, class ExecutionSpace>
-struct DeepCopy<
-    MemSpace, HostSpace, ExecutionSpace,
-    std::enable_if_t<
-        is_hip_type_space<MemSpace>::value &&
-        !std::is_same<ExecutionSpace, Kokkos::Experimental::HIP>::value>> {
-  inline DeepCopy(void* dst, const void* src, size_t n) {
-    DeepCopyHIP(dst, src, n);
-  }
-
-  inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src,
-                  size_t n) {
-    exec.fence(fence_string());
-    DeepCopyAsyncHIP(dst, src, n);
-  }
-
- private:
-  static const std::string& fence_string() {
-    static const std::string string =
-        std::string("Kokkos::Impl::DeepCopy<") + MemSpace::name() +
-        "Space, HostSpace, ExecutionSpace>::DeepCopy: fence before copy";
-    return string;
-  }
-};
-
-template <class MemSpace, class ExecutionSpace>
-struct DeepCopy<
-    HostSpace, MemSpace, ExecutionSpace,
-    std::enable_if_t<
-        is_hip_type_space<MemSpace>::value &&
-        !std::is_same<ExecutionSpace, Kokkos::Experimental::HIP>::value>> {
-  inline DeepCopy(void* dst, const void* src, size_t n) {
-    DeepCopyHIP(dst, src, n);
-  }
-
-  inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src,
-                  size_t n) {
-    exec.fence(fence_string());
-    DeepCopyAsyncHIP(dst, src, n);
-  }
-
- private:
-  static const std::string& fence_string() {
-    static const std::string string =
-        std::string("Kokkos::Impl::DeepCopy<HostSpace, ") + MemSpace::name() +
-        "Space, ExecutionSpace>::DeepCopy: fence before copy";
-    return string;
-  }
-};
-}  // namespace Impl
-}  // namespace Kokkos
-
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
-
-namespace Kokkos {
-namespace Impl {
-
-template <>
-class SharedAllocationRecord<Kokkos::Experimental::HIPSpace, void>
-    : public HostInaccessibleSharedAllocationRecordCommon<
-          Kokkos::Experimental::HIPSpace> {
- private:
-  friend class SharedAllocationRecordCommon<Kokkos::Experimental::HIPSpace>;
-  friend class HostInaccessibleSharedAllocationRecordCommon<
-      Kokkos::Experimental::HIPSpace>;
-  using base_t = HostInaccessibleSharedAllocationRecordCommon<
-      Kokkos::Experimental::HIPSpace>;
-  using RecordBase = SharedAllocationRecord<void, void>;
-
-  SharedAllocationRecord(const SharedAllocationRecord&) = delete;
-  SharedAllocationRecord& operator=(const SharedAllocationRecord&) = delete;
-
-#ifdef KOKKOS_ENABLE_DEBUG
-  static RecordBase s_root_record;
-#endif
-
-  const Kokkos::Experimental::HIPSpace m_space;
-
- protected:
-  ~SharedAllocationRecord();
-
-  template <typename ExecutionSpace>
-  SharedAllocationRecord(
-      const ExecutionSpace& /*exec*/,
-      const Kokkos::Experimental::HIPSpace& arg_space,
-      const std::string& arg_label, const size_t arg_alloc_size,
-      const RecordBase::function_type arg_dealloc = &base_t::deallocate)
-      : SharedAllocationRecord(arg_space, arg_label, arg_alloc_size,
-                               arg_dealloc) {}
-
-  SharedAllocationRecord(
-      const Kokkos::Experimental::HIP& exec_space,
-      const Kokkos::Experimental::HIPSpace& arg_space,
-      const std::string& arg_label, const size_t arg_alloc_size,
-      const RecordBase::function_type arg_dealloc = &base_t::deallocate);
-
-  SharedAllocationRecord(
-      const Kokkos::Experimental::HIPSpace& arg_space,
-      const std::string& arg_label, const size_t arg_alloc_size,
-      const RecordBase::function_type arg_dealloc = &base_t::deallocate);
-};
-
-template <>
-class SharedAllocationRecord<Kokkos::Experimental::HIPHostPinnedSpace, void>
-    : public SharedAllocationRecordCommon<
-          Kokkos::Experimental::HIPHostPinnedSpace> {
- private:
-  friend class SharedAllocationRecordCommon<
-      Kokkos::Experimental::HIPHostPinnedSpace>;
-  using base_t =
-      SharedAllocationRecordCommon<Kokkos::Experimental::HIPHostPinnedSpace>;
-  using RecordBase = SharedAllocationRecord<void, void>;
-
-  SharedAllocationRecord(const SharedAllocationRecord&) = delete;
-  SharedAllocationRecord& operator=(const SharedAllocationRecord&) = delete;
-
-#ifdef KOKKOS_ENABLE_DEBUG
-  static RecordBase s_root_record;
-#endif
-
-  const Kokkos::Experimental::HIPHostPinnedSpace m_space;
-
- protected:
-  ~SharedAllocationRecord();
-  SharedAllocationRecord() = default;
-
-  template <typename ExecutionSpace>
-  SharedAllocationRecord(
-      const ExecutionSpace& /*exec_space*/,
-      const Kokkos::Experimental::HIPHostPinnedSpace& arg_space,
-      const std::string& arg_label, const size_t arg_alloc_size,
-      const RecordBase::function_type arg_dealloc = &base_t::deallocate)
-      : SharedAllocationRecord(arg_space, arg_label, arg_alloc_size,
-                               arg_dealloc) {}
-
-  SharedAllocationRecord(
-      const Kokkos::Experimental::HIPHostPinnedSpace& arg_space,
-      const std::string& arg_label, const size_t arg_alloc_size,
-      const RecordBase::function_type arg_dealloc = &base_t::deallocate);
-};
-
-template <>
-class SharedAllocationRecord<Kokkos::Experimental::HIPManagedSpace, void>
-    : public SharedAllocationRecordCommon<
-          Kokkos::Experimental::HIPManagedSpace> {
- private:
-  friend class SharedAllocationRecordCommon<
-      Kokkos::Experimental::HIPManagedSpace>;
-  using base_t =
-      SharedAllocationRecordCommon<Kokkos::Experimental::HIPManagedSpace>;
-  using RecordBase = SharedAllocationRecord<void, void>;
-
-  SharedAllocationRecord(const SharedAllocationRecord&) = delete;
-  SharedAllocationRecord& operator=(const SharedAllocationRecord&) = delete;
-
-#ifdef KOKKOS_ENABLE_DEBUG
-  static RecordBase s_root_record;
-#endif
-
-  const Kokkos::Experimental::HIPManagedSpace m_space;
-
- protected:
-  ~SharedAllocationRecord();
-  SharedAllocationRecord() = default;
-
-  template <typename ExecutionSpace>
-  SharedAllocationRecord(
-      const ExecutionSpace& /*exec_space*/,
-      const Kokkos::Experimental::HIPManagedSpace& arg_space,
-      const std::string& arg_label, const size_t arg_alloc_size,
-      const RecordBase::function_type arg_dealloc = &base_t::deallocate)
-      : SharedAllocationRecord(arg_space, arg_label, arg_alloc_size,
-                               arg_dealloc) {}
-
-  SharedAllocationRecord(
-      const Kokkos::Experimental::HIPManagedSpace& arg_space,
-      const std::string& arg_label, const size_t arg_alloc_size,
-      const RecordBase::function_type arg_dealloc = &base_t::deallocate);
-};
-}  // namespace Impl
-}  // namespace Kokkos
-
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
-
-namespace Kokkos {
-namespace Experimental {
-namespace Impl {
-class HIPInternal;
-}
-/// \class HIP
-/// \brief Kokkos device for multicore processors in the host memory space.
-class HIP {
- public:
-  //------------------------------------
-  //! \name Type declarations that all Kokkos devices must provide.
-  //@{
-
-  //! Tag this class as a kokkos execution space
-  using execution_space = HIP;
-  using memory_space    = HIPSpace;
-  using device_type     = Kokkos::Device<execution_space, memory_space>;
-
-  using array_layout = LayoutLeft;
-  using size_type    = HIPSpace::size_type;
-
-  using scratch_memory_space = ScratchMemorySpace<HIP>;
-
-  HIP();
-  HIP(hipStream_t stream, bool manage_stream = false);
-
-  //@}
-  //------------------------------------
-  //! \name Functions that all Kokkos devices must implement.
-  //@{
-
-  KOKKOS_INLINE_FUNCTION static int in_parallel() {
-#if defined(__HIP_DEVICE_COMPILE__)
-    return true;
-#else
-    return false;
-#endif
-  }
-
-  /** \brief Wait until all dispatched functors complete.
-   *
-   * The parallel_for or parallel_reduce dispatch of a functor may return
-   * asynchronously, before the functor completes. This method does not return
-   * until all dispatched functors on this device have completed.
-   */
-  static void impl_static_fence(const std::string& name);
-
-  void fence(const std::string& name =
-                 "Kokkos::HIP::fence(): Unnamed Instance Fence") const;
-
-  hipStream_t hip_stream() const;
-
-  /// \brief Print configuration information to the given output stream.
-  void print_configuration(std::ostream& os, bool verbose = false) const;
-
-  /// \brief Free any resources being consumed by the device.
-  static void impl_finalize();
-
-  /** \brief  Initialize the device.
-   *
-   */
-  int hip_device() const;
-  static hipDeviceProp_t const& hip_device_prop();
-
-  static void impl_initialize(InitializationSettings const&);
-
-  static int impl_is_initialized();
-
-  //  static size_type device_arch();
-
-  static size_type detect_device_count();
-
-  static int concurrency();
-  static const char* name();
-
-  inline Impl::HIPInternal* impl_internal_space_instance() const {
-    return m_space_instance.get();
-  }
-
-  uint32_t impl_instance_id() const noexcept;
-
- private:
-  Kokkos::Impl::HostSharedPtr<Impl::HIPInternal> m_space_instance;
-};
-}  // namespace Experimental
-namespace Tools {
-namespace Experimental {
-template <>
-struct DeviceTypeTraits<Kokkos::Experimental::HIP> {
-  static constexpr DeviceType id = DeviceType::HIP;
-  static int device_id(const Kokkos::Experimental::HIP& exec) {
-    return exec.hip_device();
-  }
-};
-}  // namespace Experimental
-}  // namespace Tools
-
-namespace Impl {
-template <class DT, class... DP>
-struct ZeroMemset<Kokkos::Experimental::HIP, DT, DP...> {
-  ZeroMemset(const Kokkos::Experimental::HIP& exec_space,
-             const View<DT, DP...>& dst,
-             typename View<DT, DP...>::const_value_type&) {
-    KOKKOS_IMPL_HIP_SAFE_CALL(hipMemsetAsync(
-        dst.data(), 0,
-        dst.size() * sizeof(typename View<DT, DP...>::value_type),
-        exec_space.hip_stream()));
-  }
-
-  ZeroMemset(const View<DT, DP...>& dst,
-             typename View<DT, DP...>::const_value_type&) {
-    KOKKOS_IMPL_HIP_SAFE_CALL(
-        hipMemset(dst.data(), 0,
-                  dst.size() * sizeof(typename View<DT, DP...>::value_type)));
-  }
-};
-}  // namespace Impl
-}  // namespace Kokkos
-
-namespace Kokkos {
-namespace Impl {
-
-template <>
-struct MemorySpaceAccess<Kokkos::Experimental::HIPSpace,
-                         Kokkos::Experimental::HIP::scratch_memory_space> {
-  enum : bool { assignable = false };
-  enum : bool { accessible = true };
-  enum : bool { deepcopy = false };
-};
-
-}  // namespace Impl
-}  // namespace Kokkos
-
-#endif /* #if defined( KOKKOS_ENABLE_HIP ) */
-#endif /* #define KOKKOS_HIPSPACE_HPP */
diff --git a/packages/kokkos/core/src/Kokkos_HPX.hpp b/packages/kokkos/core/src/Kokkos_HPX.hpp
index 044e54fb29f6b1c9d96c84b55d1bfaaf79ea6f56..06693852622df02fb747228f7e1a4aa1ad0625a3 100644
--- a/packages/kokkos/core/src/Kokkos_HPX.hpp
+++ b/packages/kokkos/core/src/Kokkos_HPX.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_HPX_HPP
 #define KOKKOS_HPX_HPP
@@ -371,13 +339,6 @@ class HPX {
   }
 
 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  static std::vector<HPX> partition(...) {
-    Kokkos::abort(
-        "Kokkos::Experimental::HPX::partition_master: can't partition an HPX "
-        "instance\n");
-    return std::vector<HPX>();
-  }
-
   template <typename F>
   KOKKOS_DEPRECATED static void partition_master(
       F const &, int requested_num_partitions = 0, int = 0) {
@@ -455,7 +416,7 @@ class HPX {
 #endif
 
 #if defined(KOKKOS_ENABLE_HPX_ASYNC_DISPATCH)
-  struct KOKKOS_ATTRIBUTE_NODISCARD reset_on_exit_parallel {
+  struct [[nodiscard]] reset_on_exit_parallel {
     HPX const &m_space;
     reset_on_exit_parallel(HPX const &space) : m_space(space) {}
     ~reset_on_exit_parallel() {
@@ -471,25 +432,33 @@ class HPX {
   // data. It does, however, still decrement the parallel region count. It is
   // meant for use in parallel regions which do not capture the execution space
   // instance.
-  struct KOKKOS_ATTRIBUTE_NODISCARD reset_count_on_exit_parallel {
-    reset_count_on_exit_parallel() {}
+  struct [[nodiscard]] reset_count_on_exit_parallel {
+    reset_count_on_exit_parallel() = default;
     ~reset_count_on_exit_parallel() {
       HPX::impl_decrement_active_parallel_region_count();
     }
   };
 #else
-  struct KOKKOS_ATTRIBUTE_NODISCARD reset_on_exit_parallel {
-    reset_on_exit_parallel(HPX const &) {}
-    ~reset_on_exit_parallel() {}
+  struct [[nodiscard]] reset_on_exit_parallel {
+    reset_on_exit_parallel(HPX const &) = default;
+    ~reset_on_exit_parallel()           = default;
   };
 
-  struct KOKKOS_ATTRIBUTE_NODISCARD reset_count_on_exit_parallel {
-    reset_count_on_exit_parallel() {}
-    ~reset_count_on_exit_parallel() {}
+  struct [[nodiscard]] reset_count_on_exit_parallel {
+    reset_count_on_exit_parallel()  = default;
+    ~reset_count_on_exit_parallel() = default;
   };
 #endif
 
   static constexpr const char *name() noexcept { return "HPX"; }
+
+ private:
+  friend bool operator==(HPX const &lhs, HPX const &rhs) {
+    return lhs.m_instance_id == rhs.m_instance_id;
+  }
+  friend bool operator!=(HPX const &lhs, HPX const &rhs) {
+    return !(lhs == rhs);
+  }
 };
 }  // namespace Experimental
 
@@ -652,6 +621,7 @@ struct HPXTeamMember {
   using execution_space = Kokkos::Experimental::HPX;
   using scratch_memory_space =
       Kokkos::ScratchMemorySpace<Kokkos::Experimental::HPX>;
+  using team_handle = HPXTeamMember;
 
  private:
   scratch_memory_space m_team_shared;
@@ -1095,17 +1065,16 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
       typename Kokkos::Impl::HostIterateTile<MDRangePolicy, FunctorType,
                                              WorkTag, void>;
 
-  const FunctorType m_functor;
-  const MDRangePolicy m_mdr_policy;
+  const iterate_type m_iter;
   const Policy m_policy;
 
  public:
-  void execute() const { dispatch_execute_task(this, m_mdr_policy.space()); }
+  void execute() const { dispatch_execute_task(this, m_iter.m_rp.space()); }
 
   inline void execute_task() const {
     // See [note 1] for an explanation.
     Kokkos::Experimental::HPX::reset_on_exit_parallel reset_on_exit(
-        m_mdr_policy.space());
+        m_iter.m_rp.space());
 
     auto exec = Kokkos::Experimental::HPX::impl_get_executor();
 
@@ -1117,9 +1086,8 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
 
     for_loop(par.on(exec).with(
                  static_chunk_size(get_hpx_adjusted_chunk_size(m_policy))),
-             m_policy.begin(), m_policy.end(), [this](const Member i) {
-               iterate_type(m_mdr_policy, m_functor)(i);
-             });
+             m_policy.begin(), m_policy.end(),
+             [this](const Member i) { iterate_type(i); });
 
 #elif KOKKOS_HPX_IMPLEMENTATION == 1
     using hpx::for_loop_strided;
@@ -1131,15 +1099,14 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
                        const Member i_end =
                            (std::min)(i_begin + chunk_size, m_policy.end());
                        for (Member i = i_begin; i < i_end; ++i) {
-                         iterate_type(m_mdr_policy, m_functor)(i);
+                         m_iter(i);
                        }
                      });
 #endif
   }
 
   inline ParallelFor(const FunctorType &arg_functor, MDRangePolicy arg_policy)
-      : m_functor(arg_functor),
-        m_mdr_policy(arg_policy),
+      : m_iter(arg_policy, arg_functor),
         m_policy(Policy(0, arg_policy.m_num_tiles).set_chunk_size(1)) {}
   template <typename Policy, typename Functor>
   static int max_tile_size_product(const Policy &, const Functor &) {
@@ -1436,8 +1403,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
       typename Kokkos::Impl::HostIterateTile<MDRangePolicy, FunctorType,
                                              WorkTag, reference_type>;
 
-  const FunctorType m_functor;
-  const MDRangePolicy m_mdr_policy;
+  const iterate_type m_iter;
   const Policy m_policy;
   const ReducerType m_reducer;
   const pointer_type m_result_ptr;
@@ -1446,19 +1412,19 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
 
  public:
   void execute() const {
-    dispatch_execute_task(this, m_mdr_policy.space(), m_force_synchronous);
+    dispatch_execute_task(this, m_iter.m_rp.space(), m_force_synchronous);
   }
 
   inline void execute_task() const {
     // See [note 1] for an explanation.
     Kokkos::Experimental::HPX::reset_on_exit_parallel reset_on_exit(
-        m_mdr_policy.space());
+        m_iter.m_rp.space());
 
     const int num_worker_threads = Kokkos::Experimental::HPX::concurrency();
-    const std::size_t value_size =
-        Analysis::value_size(ReducerConditional::select(m_functor, m_reducer));
+    const std::size_t value_size = Analysis::value_size(
+        ReducerConditional::select(m_iter.m_func, m_reducer));
 
-    thread_buffer &buffer = m_mdr_policy.space().impl_get_buffer();
+    thread_buffer &buffer = m_iter.m_rp.space().impl_get_buffer();
     buffer.resize(num_worker_threads, value_size);
 
     using hpx::for_loop;
@@ -1468,7 +1434,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
     auto exec = Kokkos::Experimental::HPX::impl_get_executor();
 
     typename Analysis::Reducer final_reducer(
-        &ReducerConditional::select(m_functor, m_reducer));
+        &ReducerConditional::select(m_iter.m_func, m_reducer));
 
 #if KOKKOS_HPX_IMPLEMENTATION == 0
 
@@ -1484,7 +1450,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
                reference_type update = Analysis::Reducer::reference(
                    reinterpret_cast<pointer_type>(buffer.get(
                        Kokkos::Experimental::HPX::impl_hardware_thread_id())));
-               iterate_type(m_mdr_policy, m_functor, update)(i);
+               m_iter(i, update);
              });
 
 #elif KOKKOS_HPX_IMPLEMENTATION == 1
@@ -1507,7 +1473,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
           const Member i_end = (std::min)(i_begin + chunk_size, m_policy.end());
 
           for (Member i = i_begin; i < i_end; ++i) {
-            iterate_type(m_mdr_policy, m_functor, update)(i);
+            m_iter(i, update);
           }
         });
 #endif
@@ -1521,7 +1487,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
 
     if (m_result_ptr != nullptr) {
       const int n = Analysis::value_count(
-          ReducerConditional::select(m_functor, m_reducer));
+          ReducerConditional::select(m_iter.m_func, m_reducer));
 
       for (int j = 0; j < n; ++j) {
         m_result_ptr[j] = reinterpret_cast<pointer_type>(buffer.get(0))[j];
@@ -1536,8 +1502,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
       std::enable_if_t<Kokkos::is_view<ViewType>::value &&
                            !Kokkos::is_reducer<ReducerType>::value,
                        void *> = nullptr)
-      : m_functor(arg_functor),
-        m_mdr_policy(arg_policy),
+      : m_iter(arg_policy, arg_functor),
         m_policy(Policy(0, arg_policy.m_num_tiles).set_chunk_size(1)),
         m_reducer(InvalidType()),
         m_result_ptr(arg_view.data()),
@@ -1545,9 +1510,8 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
 
   inline ParallelReduce(const FunctorType &arg_functor,
                         MDRangePolicy arg_policy, const ReducerType &reducer)
-      : m_functor(arg_functor),
-        m_mdr_policy(arg_policy),
-        m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)),
+      : m_iter(arg_policy, arg_functor),
+        m_policy(Policy(0, arg_policy.m_num_tiles).set_chunk_size(1)),
         m_reducer(reducer),
         m_result_ptr(reducer.view().data()),
         m_force_synchronous(!reducer.view().impl_track().has_record()) {}
@@ -1693,7 +1657,7 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
 
   const FunctorType m_functor;
   const Policy m_policy;
-  ReturnType &m_returnvalue;
+  pointer_type m_result_ptr;
 
   template <class TagType>
   inline static std::enable_if_t<std::is_void<TagType>::value>
@@ -1783,17 +1747,23 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
                                          update_base, true);
 
           if (t == num_worker_threads - 1) {
-            m_returnvalue = update_base;
+            *m_result_ptr = update_base;
           }
         });
   }
 
-  inline ParallelScanWithTotal(const FunctorType &arg_functor,
-                               const Policy &arg_policy,
-                               ReturnType &arg_returnvalue)
+  template <class ViewType>
+  ParallelScanWithTotal(const FunctorType &arg_functor,
+                        const Policy &arg_policy,
+                        const ViewType &arg_result_view)
       : m_functor(arg_functor),
         m_policy(arg_policy),
-        m_returnvalue(arg_returnvalue) {}
+        m_result_ptr(arg_result_view.data()) {
+    static_assert(
+        Kokkos::Impl::MemorySpaceAccess<typename ViewType::memory_space,
+                                        Kokkos::HostSpace>::accessible,
+        "Kokkos::HPX parallel_scan result must be host-accessible!");
+  }
 };
 }  // namespace Impl
 }  // namespace Kokkos
diff --git a/packages/kokkos/core/src/Kokkos_Half.hpp b/packages/kokkos/core/src/Kokkos_Half.hpp
index c1085876c51f2ed5ee54da1caa81a88bce27195a..9231fac5ff72f740f7a8362d8938b3d7c3d0efa5 100644
--- a/packages/kokkos/core/src/Kokkos_Half.hpp
+++ b/packages/kokkos/core/src/Kokkos_Half.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HALF_HPP_
 #define KOKKOS_HALF_HPP_
diff --git a/packages/kokkos/core/src/Kokkos_HostSpace.hpp b/packages/kokkos/core/src/Kokkos_HostSpace.hpp
index 1d67e2f9cd2081e701ef44a893739cc739cf0823..4b839aca0568931f8d1fafc705ea7fad8de67c4b 100644
--- a/packages/kokkos/core/src/Kokkos_HostSpace.hpp
+++ b/packages/kokkos/core/src/Kokkos_HostSpace.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_HOSTSPACE_HPP
 #define KOKKOS_HOSTSPACE_HPP
@@ -253,12 +221,7 @@ class SharedAllocationRecord<Kokkos::HostSpace, void>
   const Kokkos::HostSpace m_space;
 
  protected:
-  ~SharedAllocationRecord()
-#if defined( \
-    KOKKOS_IMPL_INTEL_WORKAROUND_NOEXCEPT_SPECIFICATION_VIRTUAL_FUNCTION)
-      noexcept
-#endif
-      ;
+  ~SharedAllocationRecord();
   SharedAllocationRecord() = default;
 
   // This constructor does not forward to the one without exec_space arg
diff --git a/packages/kokkos/core/src/Kokkos_Layout.hpp b/packages/kokkos/core/src/Kokkos_Layout.hpp
index 78173c083e6300e3b3aa533038bef54f2ca8947f..ca4d956784c914ac049d64576996e7f69fbd0e6b 100644
--- a/packages/kokkos/core/src/Kokkos_Layout.hpp
+++ b/packages/kokkos/core/src/Kokkos_Layout.hpp
@@ -1,58 +1,26 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /// \file Kokkos_Layout.hpp
 /// \brief Declaration of various \c MemoryLayout options.
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_LAYOUT_HPP
 #define KOKKOS_LAYOUT_HPP
diff --git a/packages/kokkos/core/src/Kokkos_LogicalSpaces.hpp b/packages/kokkos/core/src/Kokkos_LogicalSpaces.hpp
index d3ce354c2a61a20fd511ab0d569533feb2ea5565..1ee1d2c81fe58a04308fb488afe3f8f19fd7da89 100644
--- a/packages/kokkos/core/src/Kokkos_LogicalSpaces.hpp
+++ b/packages/kokkos/core/src/Kokkos_LogicalSpaces.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_LOGICALSPACES_HPP
 #define KOKKOS_LOGICALSPACES_HPP
diff --git a/packages/kokkos/core/src/Kokkos_Macros.hpp b/packages/kokkos/core/src/Kokkos_Macros.hpp
index 9dbd2de0c80b56eb67ac4c23eda2796d60a1d954..289bfd7ddaebe9aa246d49f1db15e55b3a0e0a69 100644
--- a/packages/kokkos/core/src/Kokkos_Macros.hpp
+++ b/packages/kokkos/core/src/Kokkos_Macros.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_MACROS_HPP
 #define KOKKOS_MACROS_HPP
@@ -54,13 +26,33 @@
  *  KOKKOS_ENABLE_OPENMP              Kokkos::OpenMP execution space
  *  KOKKOS_ENABLE_OPENMPTARGET        Kokkos::Experimental::OpenMPTarget
  *                                    execution space
- *  KOKKOS_ENABLE_HIP                 Kokkos::Experimental::HIP execution space
+ *  KOKKOS_ENABLE_HIP                 Kokkos::HIP execution space
  *  KOKKOS_ENABLE_SYCL                Kokkos::Experimental::SYCL execution space
  *  KOKKOS_ENABLE_HWLOC               HWLOC library is available.
  *  KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK  Insert array bounds checks, is expensive!
  *  KOKKOS_ENABLE_CUDA_UVM            Use CUDA UVM for Cuda memory space.
  */
 
+#define KOKKOS_VERSION_LESS(MAJOR, MINOR, PATCH) \
+  (KOKKOS_VERSION < ((MAJOR)*10000 + (MINOR)*100 + (PATCH)))
+
+#define KOKKOS_VERSION_LESS_EQUAL(MAJOR, MINOR, PATCH) \
+  (KOKKOS_VERSION <= ((MAJOR)*10000 + (MINOR)*100 + (PATCH)))
+
+#define KOKKOS_VERSION_GREATER(MAJOR, MINOR, PATCH) \
+  (KOKKOS_VERSION > ((MAJOR)*10000 + (MINOR)*100 + (PATCH)))
+
+#define KOKKOS_VERSION_GREATER_EQUAL(MAJOR, MINOR, PATCH) \
+  (KOKKOS_VERSION >= ((MAJOR)*10000 + (MINOR)*100 + (PATCH)))
+
+#define KOKKOS_VERSION_EQUAL(MAJOR, MINOR, PATCH) \
+  (KOKKOS_VERSION == ((MAJOR)*10000 + (MINOR)*100 + (PATCH)))
+
+#if !KOKKOS_VERSION_EQUAL(KOKKOS_VERSION_MAJOR, KOKKOS_VERSION_MINOR, \
+                          KOKKOS_VERSION_PATCH)
+#error implementation bug
+#endif
+
 #ifndef KOKKOS_DONT_INCLUDE_CORE_CONFIG_H
 #include <KokkosCore_config.h>
 #endif
@@ -73,11 +65,10 @@
  *  KOKKOS_COMPILER_NVCC
  *  KOKKOS_COMPILER_GNU
  *  KOKKOS_COMPILER_INTEL
- *  KOKKOS_COMPILER_IBM
  *  KOKKOS_COMPILER_CRAYC
  *  KOKKOS_COMPILER_APPLECC
  *  KOKKOS_COMPILER_CLANG
- *  KOKKOS_COMPILER_PGI
+ *  KOKKOS_COMPILER_NVHPC
  *  KOKKOS_COMPILER_MSVC
  *
  *  Macros for which compiler extension to use for atomics on intrinsic types
@@ -117,15 +108,18 @@
 // Code is parsed and separated into host and device code.
 // Host code is compiled again with another compiler.
 // Device code is compile to 'ptx'.
-#define KOKKOS_COMPILER_NVCC __NVCC__
+// NOTE: There is no __CUDACC_VER_PATCH__ officially, its __CUDACC_VER_BUILD__
+// which does have more than one digit (potentially undefined number of them).
+// This macro definition is in line with our other compiler defs
+#define KOKKOS_COMPILER_NVCC \
+  __CUDACC_VER_MAJOR__ * 100 + __CUDACC_VER_MINOR__ * 10
 #endif  // #if defined( __NVCC__ )
 
 #if !defined(KOKKOS_LAMBDA)
 #define KOKKOS_LAMBDA [=]
 #endif
 
-#if (defined(KOKKOS_ENABLE_CXX17) || defined(KOKKOS_ENABLE_CXX20)) && \
-    !defined(KOKKOS_CLASS_LAMBDA)
+#if !defined(KOKKOS_CLASS_LAMBDA)
 #define KOKKOS_CLASS_LAMBDA [ =, *this ]
 #endif
 
@@ -150,21 +144,11 @@
 #define KOKKOS_COMPILER_CRAYC _CRAYC
 #endif
 
-#if defined(__IBMCPP__)
-// IBM C++
-#define KOKKOS_COMPILER_IBM __IBMCPP__
-#elif defined(__IBMC__)
-#define KOKKOS_COMPILER_IBM __IBMC__
-#elif defined(__ibmxl_vrm__)  // xlclang++
-#define KOKKOS_COMPILER_IBM __ibmxl_vrm__
-#endif
-
 #if defined(__APPLE_CC__)
 #define KOKKOS_COMPILER_APPLECC __APPLE_CC__
 #endif
 
-#if defined(__clang__) && !defined(KOKKOS_COMPILER_INTEL) && \
-    !defined(KOKKOS_COMPILER_IBM)
+#if defined(__clang__) && !defined(KOKKOS_COMPILER_INTEL)
 #define KOKKOS_COMPILER_CLANG \
   __clang_major__ * 100 + __clang_minor__ * 10 + __clang_patchlevel__
 #endif
@@ -178,15 +162,6 @@
 #endif
 #endif
 
-#if defined(__PGIC__)
-#define KOKKOS_COMPILER_PGI \
-  __PGIC__ * 100 + __PGIC_MINOR__ * 10 + __PGIC_PATCHLEVEL__
-
-#if (1740 > KOKKOS_COMPILER_PGI)
-#error "Compiling with PGI version earlier than 17.4 is not supported."
-#endif
-#endif
-
 #if defined(__NVCOMPILER)
 #define KOKKOS_COMPILER_NVHPC                              \
   __NVCOMPILER_MAJOR__ * 100 + __NVCOMPILER_MINOR__ * 10 + \
@@ -204,16 +179,6 @@
 //  of the supported OpenMP API version.
 #endif  // #if defined( _OPENMP )
 
-#if defined(KOKKOS_ENABLE_CXX17)
-#define KOKKOS_IMPL_FALLTHROUGH [[fallthrough]];
-#elif defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU >= 710)
-#define KOKKOS_IMPL_FALLTHROUGH [[gnu::fallthrough]];
-#elif defined(KOKKOS_COMPILER_CLANG)
-#define KOKKOS_IMPL_FALLTHROUGH [[clang::fallthrough]];
-#else
-#define KOKKOS_IMPL_FALLTHROUGH
-#endif
-
 //----------------------------------------------------------------------------
 // Intel compiler macros
 
@@ -224,14 +189,6 @@
 #define KOKKOS_ENABLE_PRAGMA_LOOPCOUNT 1
 #define KOKKOS_ENABLE_PRAGMA_VECTOR 1
 #endif
-#if (1800 > KOKKOS_COMPILER_INTEL)
-#define KOKKOS_ENABLE_PRAGMA_SIMD 1
-#endif
-
-// FIXME Workaround for ICE with intel 17,18,19,20,21 in Trilinos
-#if (KOKKOS_COMPILER_INTEL <= 2100)
-#define KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS
-#endif
 
 // FIXME_SYCL
 #if !defined(KOKKOS_ENABLE_SYCL)
@@ -256,8 +213,8 @@
 #endif
 #endif
 
-#if (1700 > KOKKOS_COMPILER_INTEL)
-#error "Compiling with Intel version earlier than 17.0 is not supported."
+#if (1900 > KOKKOS_COMPILER_INTEL)
+#error "Compiling with Intel version earlier than 19.0.5 is not supported."
 #endif
 
 #if !defined(KOKKOS_ENABLE_ASM) && !defined(_WIN32)
@@ -276,13 +233,6 @@
 
 #if defined(KOKKOS_ARCH_AVX512MIC)
 #define KOKKOS_ENABLE_RFO_PREFETCH 1
-#if (KOKKOS_COMPILER_INTEL < 1800) && !defined(KOKKOS_KNL_USE_ASM_WORKAROUND)
-#define KOKKOS_KNL_USE_ASM_WORKAROUND 1
-#endif
-#endif
-
-#if (1800 > KOKKOS_COMPILER_INTEL)
-#define KOKKOS_IMPL_INTEL_WORKAROUND_NOEXCEPT_SPECIFICATION_VIRTUAL_FUNCTION
 #endif
 
 #if defined(__MIC__)
@@ -296,21 +246,6 @@
 #if defined(KOKKOS_COMPILER_CRAYC)
 #endif
 
-//----------------------------------------------------------------------------
-// IBM Compiler macros
-
-#if defined(KOKKOS_COMPILER_IBM)
-#define KOKKOS_ENABLE_PRAGMA_UNROLL 1
-//#define KOKKOS_ENABLE_PRAGMA_IVDEP 1
-//#define KOKKOS_ENABLE_PRAGMA_LOOPCOUNT 1
-//#define KOKKOS_ENABLE_PRAGMA_VECTOR 1
-//#define KOKKOS_ENABLE_PRAGMA_SIMD 1
-
-#if !defined(KOKKOS_ENABLE_ASM)
-#define KOKKOS_ENABLE_ASM 1
-#endif
-#endif
-
 //----------------------------------------------------------------------------
 // CLANG compiler macros
 
@@ -319,7 +254,6 @@
 //#define KOKKOS_ENABLE_PRAGMA_IVDEP 1
 //#define KOKKOS_ENABLE_PRAGMA_LOOPCOUNT 1
 //#define KOKKOS_ENABLE_PRAGMA_VECTOR 1
-//#define KOKKOS_ENABLE_PRAGMA_SIMD 1
 
 #if !defined(KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION)
 #define KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION \
@@ -341,7 +275,6 @@
 //#define KOKKOS_ENABLE_PRAGMA_IVDEP 1
 //#define KOKKOS_ENABLE_PRAGMA_LOOPCOUNT 1
 //#define KOKKOS_ENABLE_PRAGMA_VECTOR 1
-//#define KOKKOS_ENABLE_PRAGMA_SIMD 1
 
 #if defined(KOKKOS_ARCH_AVX512MIC)
 #define KOKKOS_ENABLE_RFO_PREFETCH 1
@@ -369,7 +302,6 @@
 #define KOKKOS_ENABLE_PRAGMA_IVDEP 1
 //#define KOKKOS_ENABLE_PRAGMA_LOOPCOUNT 1
 #define KOKKOS_ENABLE_PRAGMA_VECTOR 1
-//#define KOKKOS_ENABLE_PRAGMA_SIMD 1
 #endif
 
 //----------------------------------------------------------------------------
@@ -408,11 +340,11 @@
 #endif
 
 #if !defined(KOKKOS_INLINE_FUNCTION_DELETED)
-#define KOKKOS_INLINE_FUNCTION_DELETED inline
+#define KOKKOS_INLINE_FUNCTION_DELETED
 #endif
 
 #if !defined(KOKKOS_DEFAULTED_FUNCTION)
-#define KOKKOS_DEFAULTED_FUNCTION inline
+#define KOKKOS_DEFAULTED_FUNCTION
 #endif
 
 #if !defined(KOKKOS_IMPL_HOST_FUNCTION)
@@ -476,6 +408,7 @@
 #if 1 < ((defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_CUDA) ? 1 : 0) +         \
          (defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HIP) ? 1 : 0) +          \
          (defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SYCL) ? 1 : 0) +         \
+         (defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENACC) ? 1 : 0) +      \
          (defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET) ? 1 : 0) + \
          (defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP) ? 1 : 0) +       \
          (defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS) ? 1 : 0) +      \
@@ -485,10 +418,12 @@
 #endif
 
 // If default is not specified then chose from enabled execution spaces.
-// Priority: CUDA, HIP, SYCL, OPENMPTARGET, OPENMP, THREADS, HPX, SERIAL
+// Priority: CUDA, HIP, SYCL, OPENACC, OPENMPTARGET, OPENMP, THREADS, HPX,
+// SERIAL
 #if defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_CUDA)
 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HIP)
 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SYCL)
+#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENACC)
 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET)
 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP)
 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS)
@@ -500,6 +435,8 @@
 #define KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HIP
 #elif defined(KOKKOS_ENABLE_SYCL)
 #define KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SYCL
+#elif defined(KOKKOS_ENABLE_OPENACC)
+#define KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENACC
 #elif defined(KOKKOS_ENABLE_OPENMPTARGET)
 #define KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET
 #elif defined(KOKKOS_ENABLE_OPENMP)
@@ -514,6 +451,7 @@
 
 //----------------------------------------------------------------------------
 // Determine for what space the code is being compiled:
+#if defined(KOKKOS_ENABLE_DEPRECATED_CODE_3)
 
 #if defined(__CUDACC__) && defined(__CUDA_ARCH__) && defined(KOKKOS_ENABLE_CUDA)
 #define KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_CUDA
@@ -526,6 +464,7 @@
 #define KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
 #endif
 
+#endif
 //----------------------------------------------------------------------------
 
 // Remove surrounding parentheses if present
@@ -574,6 +513,29 @@ static constexpr bool kokkos_omp_on_host() { return false; }
 #endif
 #endif
 
+#ifdef KOKKOS_ENABLE_OPENACC
+#ifdef KOKKOS_COMPILER_NVHPC
+#define KOKKOS_IF_ON_DEVICE(CODE)   \
+  if (__builtin_is_device_code()) { \
+    KOKKOS_IMPL_STRIP_PARENS(CODE)  \
+  }
+#define KOKKOS_IF_ON_HOST(CODE)      \
+  if (!__builtin_is_device_code()) { \
+    KOKKOS_IMPL_STRIP_PARENS(CODE)   \
+  }
+#else
+// FIXME_OPENACC acc_on_device is a non-constexpr function
+#define KOKKOS_IF_ON_DEVICE(CODE)                     \
+  if constexpr (acc_on_device(acc_device_not_host)) { \
+    KOKKOS_IMPL_STRIP_PARENS(CODE)                    \
+  }
+#define KOKKOS_IF_ON_HOST(CODE)                   \
+  if constexpr (acc_on_device(acc_device_host)) { \
+    KOKKOS_IMPL_STRIP_PARENS(CODE)                \
+  }
+#endif
+#endif
+
 #if !defined(KOKKOS_IF_ON_HOST) && !defined(KOKKOS_IF_ON_DEVICE)
 #if (defined(KOKKOS_ENABLE_CUDA) && defined(__CUDA_ARCH__)) ||         \
     (defined(KOKKOS_ENABLE_HIP) && defined(__HIP_DEVICE_COMPILE__)) || \
@@ -603,15 +565,14 @@ static constexpr bool kokkos_omp_on_host() { return false; }
 #define KOKKOS_ENABLE_TASKDAG
 #endif
 
+#if defined(KOKKOS_ENABLE_CUDA) && defined(KOKKOS_ENABLE_DEPRECATED_CODE_4)
+#define KOKKOS_ENABLE_CUDA_LDG_INTRINSIC
+#endif
+
 #define KOKKOS_INVALID_INDEX (~std::size_t(0))
 
 #define KOKKOS_IMPL_CTOR_DEFAULT_ARG KOKKOS_INVALID_INDEX
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-#define KOKKOS_CONSTEXPR_14 constexpr
-#define KOKKOS_DEPRECATED_TRAILING_ATTRIBUTE
-#endif
-
 // Guard intel compiler version 19 and older
 // intel error #2651: attribute does not apply to any entity
 // using <deprecated_type> KOKKOS_DEPRECATED = ...
@@ -637,23 +598,14 @@ static constexpr bool kokkos_omp_on_host() { return false; }
 #define KOKKOS_IMPL_WARNING(desc) KOKKOS_IMPL_DO_PRAGMA(message(#desc))
 #endif
 
-// DJS 05/28/2019: Bugfix: Issue 2155
-// Use KOKKOS_ENABLE_CUDA_LDG_INTRINSIC to avoid memory leak in RandomAccess
-// View
-#if defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_CUDA_LDG_INTRINSIC)
-#define KOKKOS_ENABLE_CUDA_LDG_INTRINSIC
-#endif
-
-#if defined(KOKKOS_ENABLE_CXX17) || defined(KOKKOS_ENABLE_CXX20)
 #define KOKKOS_ATTRIBUTE_NODISCARD [[nodiscard]]
-#else
-#define KOKKOS_ATTRIBUTE_NODISCARD
-#endif
 
 #if (defined(KOKKOS_COMPILER_GNU) || defined(KOKKOS_COMPILER_CLANG) ||  \
      defined(KOKKOS_COMPILER_INTEL) || defined(KOKKOS_COMPILER_PGI)) && \
-    !defined(_WIN32)
+    !defined(_WIN32) && !defined(__ANDROID__)
+#if __has_include(<execinfo.h>)
 #define KOKKOS_IMPL_ENABLE_STACKTRACE
+#endif
 #define KOKKOS_IMPL_ENABLE_CXXABI
 #endif
 
@@ -664,11 +616,6 @@ static constexpr bool kokkos_omp_on_host() { return false; }
 #undef __CUDA_ARCH__
 #endif
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-#define KOKKOS_THREAD_LOCAL \
-  KOKKOS_DEPRECATED_WITH_COMMENT("Use thread_local instead!") thread_local
-#endif
-
 #if (defined(KOKKOS_IMPL_WINDOWS_CUDA) || defined(KOKKOS_COMPILER_MSVC)) && \
     !defined(KOKKOS_COMPILER_CLANG)
 // MSVC (as of 16.5.5 at least) does not do empty base class optimization by
diff --git a/packages/kokkos/core/src/Kokkos_MasterLock.hpp b/packages/kokkos/core/src/Kokkos_MasterLock.hpp
index 5e48595bf0da7d0b1ad3de9d58f714b050961606..1d09617371a62c19f63705e40984646c7584056b 100644
--- a/packages/kokkos/core/src/Kokkos_MasterLock.hpp
+++ b/packages/kokkos/core/src/Kokkos_MasterLock.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_MASTER_LOCK_HPP
 #define KOKKOS_MASTER_LOCK_HPP
diff --git a/packages/kokkos/core/src/Kokkos_MathematicalConstants.hpp b/packages/kokkos/core/src/Kokkos_MathematicalConstants.hpp
index 8f7b559e786ecdd1841407835c02ffb31e16cdee..51a50d347dee3579ddb1008f1d3cb5cda52650e6 100644
--- a/packages/kokkos/core/src/Kokkos_MathematicalConstants.hpp
+++ b/packages/kokkos/core/src/Kokkos_MathematicalConstants.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 #ifndef KOKKOS_MATHEMATICAL_CONSTANTS_HPP
 #define KOKKOS_MATHEMATICAL_CONSTANTS_HPP
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -51,20 +23,13 @@
 #include <Kokkos_Macros.hpp>
 #include <type_traits>
 
-namespace Kokkos {
-namespace Experimental {
+namespace Kokkos::numbers {
 
-#if defined(KOKKOS_ENABLE_CXX17)
-#define KOKKOS_IMPL_MATH_CONSTANT(TRAIT, VALUE) \
-  template <class T>                            \
-  inline constexpr auto TRAIT##_v =             \
-      std::enable_if_t<std::is_floating_point_v<T>, T>(VALUE)
-#else
-#define KOKKOS_IMPL_MATH_CONSTANT(TRAIT, VALUE) \
-  template <class T>                            \
-  constexpr auto TRAIT##_v =                    \
-      std::enable_if_t<std::is_floating_point<T>::value, T>(VALUE)
-#endif
+#define KOKKOS_IMPL_MATH_CONSTANT(TRAIT, VALUE)                \
+  template <class T>                                           \
+  inline constexpr auto TRAIT##_v =                            \
+      std::enable_if_t<std::is_floating_point_v<T>, T>(VALUE); \
+  inline constexpr auto TRAIT = TRAIT##_v<double>
 
 // clang-format off
 KOKKOS_IMPL_MATH_CONSTANT(e,          2.718281828459045235360287471352662498L);
@@ -84,8 +49,26 @@ KOKKOS_IMPL_MATH_CONSTANT(phi,        1.618033988749894848204586834365638118L);
 
 #undef KOKKOS_IMPL_MATH_CONSTANT
 
-}  // namespace Experimental
-}  // namespace Kokkos
+}  // namespace Kokkos::numbers
+
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
+namespace Kokkos::Experimental {
+using Kokkos::numbers::e_v;
+using Kokkos::numbers::egamma_v;
+using Kokkos::numbers::inv_pi_v;
+using Kokkos::numbers::inv_sqrt3_v;
+using Kokkos::numbers::inv_sqrtpi_v;
+using Kokkos::numbers::ln10_v;
+using Kokkos::numbers::ln2_v;
+using Kokkos::numbers::log10e_v;
+using Kokkos::numbers::log2e_v;
+using Kokkos::numbers::phi_v;
+using Kokkos::numbers::pi_v;
+using Kokkos::numbers::sqrt2_v;
+using Kokkos::numbers::sqrt3_v;
+}  // namespace Kokkos::Experimental
+#endif
+
 #ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_MATHCONSTANTS
 #undef KOKKOS_IMPL_PUBLIC_INCLUDE
 #undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_MATHCONSTANTS
diff --git a/packages/kokkos/core/src/Kokkos_MathematicalFunctions.hpp b/packages/kokkos/core/src/Kokkos_MathematicalFunctions.hpp
index 6942f8495877368727fe9d55a063844260cd63d5..5016249edcca8b0952e01a82f55e376773e11ab7 100644
--- a/packages/kokkos/core/src/Kokkos_MathematicalFunctions.hpp
+++ b/packages/kokkos/core/src/Kokkos_MathematicalFunctions.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_MATHEMATICAL_FUNCTIONS_HPP
 #define KOKKOS_MATHEMATICAL_FUNCTIONS_HPP
@@ -55,13 +27,18 @@
 #include <type_traits>
 
 #ifdef KOKKOS_ENABLE_SYCL
+// FIXME_SYCL
+#if __has_include(<sycl/sycl.hpp>)
+#include <sycl/sycl.hpp>
+#else
 #include <CL/sycl.hpp>
 #endif
+#endif
 
 namespace Kokkos {
 
 namespace Impl {
-template <class T, bool = std::is_integral<T>::value>
+template <class T, bool = std::is_integral_v<T>>
 struct promote {
   using type = double;
 };
@@ -82,7 +59,7 @@ struct promote<float> {
 template <class T>
 using promote_t = typename promote<T>::type;
 template <class T, class U,
-          bool = std::is_arithmetic<T>::value&& std::is_arithmetic<U>::value>
+          bool = std::is_arithmetic_v<T>&& std::is_arithmetic_v<U>>
 struct promote_2 {
   using type = decltype(promote_t<T>() + promote_t<U>());
 };
@@ -90,6 +67,16 @@ template <class T, class U>
 struct promote_2<T, U, false> {};
 template <class T, class U>
 using promote_2_t = typename promote_2<T, U>::type;
+template <class T, class U, class V,
+          bool = std::is_arithmetic_v<T>&& std::is_arithmetic_v<U>&&
+              std::is_arithmetic_v<V>>
+struct promote_3 {
+  using type = decltype(promote_t<T>() + promote_t<U>() + promote_t<V>());
+};
+template <class T, class U, class V>
+struct promote_3<T, U, V, false> {};
+template <class T, class U, class V>
+using promote_3_t = typename promote_3<T, U, V>::type;
 }  // namespace Impl
 
 // NOTE long double overloads are not available on the device
@@ -115,132 +102,183 @@ using promote_2_t = typename promote_2<T, U>::type;
   /* nothing */
 #endif
 
-#define KOKKOS_IMPL_MATH_UNARY_FUNCTION(FUNC)                                 \
-  KOKKOS_INLINE_FUNCTION float FUNC(float x) {                                \
-    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                         \
-    return FUNC(x);                                                           \
-  }                                                                           \
-  KOKKOS_INLINE_FUNCTION double FUNC(double x) {                              \
-    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                         \
-    return FUNC(x);                                                           \
-  }                                                                           \
-  inline long double FUNC(long double x) {                                    \
-    using std::FUNC;                                                          \
-    return FUNC(x);                                                           \
-  }                                                                           \
-  KOKKOS_INLINE_FUNCTION float FUNC##f(float x) {                             \
-    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                         \
-    return FUNC(x);                                                           \
-  }                                                                           \
-  inline long double FUNC##l(long double x) {                                 \
-    using std::FUNC;                                                          \
-    return FUNC(x);                                                           \
-  }                                                                           \
-  template <class T>                                                          \
-  KOKKOS_INLINE_FUNCTION std::enable_if_t<std::is_integral<T>::value, double> \
-  FUNC(T x) {                                                                 \
-    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                         \
-    return FUNC(static_cast<double>(x));                                      \
-  }                                                                           \
-  KOKKOS_IMPL_MATH_FUNCTIONS_DEFINED_IF_DEPRECATED_CODE_ENABLED(              \
-      namespace Experimental {                                                \
-        using ::Kokkos::FUNC;                                                 \
-        using ::Kokkos::FUNC##f;                                              \
-        using ::Kokkos::FUNC##l;                                              \
+#define KOKKOS_IMPL_MATH_UNARY_FUNCTION(FUNC)                                  \
+  KOKKOS_INLINE_FUNCTION float FUNC(float x) {                                 \
+    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                          \
+    return FUNC(x);                                                            \
+  }                                                                            \
+  KOKKOS_INLINE_FUNCTION double FUNC(double x) {                               \
+    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                          \
+    return FUNC(x);                                                            \
+  }                                                                            \
+  inline long double FUNC(long double x) {                                     \
+    using std::FUNC;                                                           \
+    return FUNC(x);                                                            \
+  }                                                                            \
+  KOKKOS_INLINE_FUNCTION float FUNC##f(float x) {                              \
+    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                          \
+    return FUNC(x);                                                            \
+  }                                                                            \
+  inline long double FUNC##l(long double x) {                                  \
+    using std::FUNC;                                                           \
+    return FUNC(x);                                                            \
+  }                                                                            \
+  template <class T>                                                           \
+  KOKKOS_INLINE_FUNCTION std::enable_if_t<std::is_integral_v<T>, double> FUNC( \
+      T x) {                                                                   \
+    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                          \
+    return FUNC(static_cast<double>(x));                                       \
+  }                                                                            \
+  KOKKOS_IMPL_MATH_FUNCTIONS_DEFINED_IF_DEPRECATED_CODE_ENABLED(               \
+      namespace Experimental {                                                 \
+        using ::Kokkos::FUNC;                                                  \
+        using ::Kokkos::FUNC##f;                                               \
+        using ::Kokkos::FUNC##l;                                               \
       })
 
 // isinf, isnan, and isinfinite do not work on Windows with CUDA with std::
 // getting warnings about calling host function in device function then
 // runtime test fails
 #if defined(_WIN32) && defined(KOKKOS_ENABLE_CUDA)
-#define KOKKOS_IMPL_MATH_UNARY_PREDICATE(FUNC)                              \
-  KOKKOS_INLINE_FUNCTION bool FUNC(float x) { return ::FUNC(x); }           \
-  KOKKOS_INLINE_FUNCTION bool FUNC(double x) { return ::FUNC(x); }          \
-  inline bool FUNC(long double x) {                                         \
-    using std::FUNC;                                                        \
-    return FUNC(x);                                                         \
-  }                                                                         \
-  template <class T>                                                        \
-  KOKKOS_INLINE_FUNCTION std::enable_if_t<std::is_integral<T>::value, bool> \
-  FUNC(T x) {                                                               \
-    return ::FUNC(static_cast<double>(x));                                  \
-  }                                                                         \
-  KOKKOS_IMPL_MATH_FUNCTIONS_DEFINED_IF_DEPRECATED_CODE_ENABLED(            \
+#define KOKKOS_IMPL_MATH_UNARY_PREDICATE(FUNC)                               \
+  KOKKOS_INLINE_FUNCTION bool FUNC(float x) { return ::FUNC(x); }            \
+  KOKKOS_INLINE_FUNCTION bool FUNC(double x) { return ::FUNC(x); }           \
+  inline bool FUNC(long double x) {                                          \
+    using std::FUNC;                                                         \
+    return FUNC(x);                                                          \
+  }                                                                          \
+  template <class T>                                                         \
+  KOKKOS_INLINE_FUNCTION std::enable_if_t<std::is_integral_v<T>, bool> FUNC( \
+      T x) {                                                                 \
+    return ::FUNC(static_cast<double>(x));                                   \
+  }                                                                          \
+  KOKKOS_IMPL_MATH_FUNCTIONS_DEFINED_IF_DEPRECATED_CODE_ENABLED(             \
       namespace Experimental { using ::Kokkos::FUNC; })
 #else
-#define KOKKOS_IMPL_MATH_UNARY_PREDICATE(FUNC)                              \
-  KOKKOS_INLINE_FUNCTION bool FUNC(float x) {                               \
+#define KOKKOS_IMPL_MATH_UNARY_PREDICATE(FUNC)                               \
+  KOKKOS_INLINE_FUNCTION bool FUNC(float x) {                                \
+    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                        \
+    return FUNC(x);                                                          \
+  }                                                                          \
+  KOKKOS_INLINE_FUNCTION bool FUNC(double x) {                               \
+    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                        \
+    return FUNC(x);                                                          \
+  }                                                                          \
+  inline bool FUNC(long double x) {                                          \
+    using std::FUNC;                                                         \
+    return FUNC(x);                                                          \
+  }                                                                          \
+  template <class T>                                                         \
+  KOKKOS_INLINE_FUNCTION std::enable_if_t<std::is_integral_v<T>, bool> FUNC( \
+      T x) {                                                                 \
+    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                        \
+    return FUNC(static_cast<double>(x));                                     \
+  }                                                                          \
+  KOKKOS_IMPL_MATH_FUNCTIONS_DEFINED_IF_DEPRECATED_CODE_ENABLED(             \
+      namespace Experimental { using ::Kokkos::FUNC; })
+#endif
+
+#define KOKKOS_IMPL_MATH_BINARY_FUNCTION(FUNC)                                 \
+  KOKKOS_INLINE_FUNCTION float FUNC(float x, float y) {                        \
+    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                          \
+    return FUNC(x, y);                                                         \
+  }                                                                            \
+  KOKKOS_INLINE_FUNCTION double FUNC(double x, double y) {                     \
+    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                          \
+    return FUNC(x, y);                                                         \
+  }                                                                            \
+  inline long double FUNC(long double x, long double y) {                      \
+    using std::FUNC;                                                           \
+    return FUNC(x, y);                                                         \
+  }                                                                            \
+  KOKKOS_INLINE_FUNCTION float FUNC##f(float x, float y) {                     \
+    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                          \
+    return FUNC(x, y);                                                         \
+  }                                                                            \
+  inline long double FUNC##l(long double x, long double y) {                   \
+    using std::FUNC;                                                           \
+    return FUNC(x, y);                                                         \
+  }                                                                            \
+  template <class T1, class T2>                                                \
+  KOKKOS_INLINE_FUNCTION                                                       \
+      std::enable_if_t<std::is_arithmetic_v<T1> && std::is_arithmetic_v<T2> && \
+                           !std::is_same_v<T1, long double> &&                 \
+                           !std::is_same_v<T2, long double>,                   \
+                       Kokkos::Impl::promote_2_t<T1, T2>>                      \
+      FUNC(T1 x, T2 y) {                                                       \
+    using Promoted = Kokkos::Impl::promote_2_t<T1, T2>;                        \
+    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                          \
+    return FUNC(static_cast<Promoted>(x), static_cast<Promoted>(y));           \
+  }                                                                            \
+  template <class T1, class T2>                                                \
+  inline std::enable_if_t<std::is_arithmetic_v<T1> &&                          \
+                              std::is_arithmetic_v<T2> &&                      \
+                              (std::is_same_v<T1, long double> ||              \
+                               std::is_same_v<T2, long double>),               \
+                          long double>                                         \
+  FUNC(T1 x, T2 y) {                                                           \
+    using Promoted = Kokkos::Impl::promote_2_t<T1, T2>;                        \
+    static_assert(std::is_same_v<Promoted, long double>, "");                  \
+    using std::FUNC;                                                           \
+    return FUNC(static_cast<Promoted>(x), static_cast<Promoted>(y));           \
+  }                                                                            \
+  KOKKOS_IMPL_MATH_FUNCTIONS_DEFINED_IF_DEPRECATED_CODE_ENABLED(               \
+      namespace Experimental {                                                 \
+        using ::Kokkos::FUNC;                                                  \
+        using ::Kokkos::FUNC##f;                                               \
+        using ::Kokkos::FUNC##l;                                               \
+      })
+
+#define KOKKOS_IMPL_MATH_TERNARY_FUNCTION(FUNC)                             \
+  KOKKOS_INLINE_FUNCTION float FUNC(float x, float y, float z) {            \
     using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                       \
-    return FUNC(x);                                                         \
+    return FUNC(x, y, z);                                                   \
   }                                                                         \
-  KOKKOS_INLINE_FUNCTION bool FUNC(double x) {                              \
+  KOKKOS_INLINE_FUNCTION double FUNC(double x, double y, double z) {        \
     using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                       \
-    return FUNC(x);                                                         \
+    return FUNC(x, y, z);                                                   \
   }                                                                         \
-  inline bool FUNC(long double x) {                                         \
+  inline long double FUNC(long double x, long double y, long double z) {    \
     using std::FUNC;                                                        \
-    return FUNC(x);                                                         \
+    return FUNC(x, y, z);                                                   \
   }                                                                         \
-  template <class T>                                                        \
-  KOKKOS_INLINE_FUNCTION std::enable_if_t<std::is_integral<T>::value, bool> \
-  FUNC(T x) {                                                               \
+  KOKKOS_INLINE_FUNCTION float FUNC##f(float x, float y, float z) {         \
     using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                       \
-    return FUNC(static_cast<double>(x));                                    \
+    return FUNC(x, y, z);                                                   \
   }                                                                         \
-  KOKKOS_IMPL_MATH_FUNCTIONS_DEFINED_IF_DEPRECATED_CODE_ENABLED(            \
-      namespace Experimental { using ::Kokkos::FUNC; })
-#endif
+  inline long double FUNC##l(long double x, long double y, long double z) { \
+    using std::FUNC;                                                        \
+    return FUNC(x, y, z);                                                   \
+  }                                                                         \
+  template <class T1, class T2, class T3>                                   \
+  KOKKOS_INLINE_FUNCTION std::enable_if_t<                                  \
+      std::is_arithmetic_v<T1> && std::is_arithmetic_v<T2> &&               \
+          std::is_arithmetic_v<T3> && !std::is_same_v<T1, long double> &&   \
+          !std::is_same_v<T2, long double> &&                               \
+          !std::is_same_v<T3, long double>,                                 \
+      Kokkos::Impl::promote_3_t<T1, T2, T3>>                                \
+  FUNC(T1 x, T2 y, T3 z) {                                                  \
+    using Promoted = Kokkos::Impl::promote_3_t<T1, T2, T3>;                 \
+    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                       \
+    return FUNC(static_cast<Promoted>(x), static_cast<Promoted>(y),         \
+                static_cast<Promoted>(z));                                  \
+  }                                                                         \
+  template <class T1, class T2, class T3>                                   \
+  inline std::enable_if_t<std::is_arithmetic_v<T1> &&                       \
+                              std::is_arithmetic_v<T2> &&                   \
+                              std::is_arithmetic_v<T3> &&                   \
+                              (std::is_same_v<T1, long double> ||           \
+                               std::is_same_v<T2, long double> ||           \
+                               std::is_same_v<T3, long double>),            \
+                          long double>                                      \
+  FUNC(T1 x, T2 y, T3 z) {                                                  \
+    using Promoted = Kokkos::Impl::promote_3_t<T1, T2, T3>;                 \
+    static_assert(std::is_same_v<Promoted, long double>);                   \
+    using std::FUNC;                                                        \
+    return FUNC(static_cast<Promoted>(x), static_cast<Promoted>(y),         \
+                static_cast<Promoted>(z));                                  \
+  }
 
-#define KOKKOS_IMPL_MATH_BINARY_FUNCTION(FUNC)                          \
-  KOKKOS_INLINE_FUNCTION float FUNC(float x, float y) {                 \
-    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                   \
-    return FUNC(x, y);                                                  \
-  }                                                                     \
-  KOKKOS_INLINE_FUNCTION double FUNC(double x, double y) {              \
-    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                   \
-    return FUNC(x, y);                                                  \
-  }                                                                     \
-  inline long double FUNC(long double x, long double y) {               \
-    using std::FUNC;                                                    \
-    return FUNC(x, y);                                                  \
-  }                                                                     \
-  KOKKOS_INLINE_FUNCTION float FUNC##f(float x, float y) {              \
-    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                   \
-    return FUNC(x, y);                                                  \
-  }                                                                     \
-  inline long double FUNC##l(long double x, long double y) {            \
-    using std::FUNC;                                                    \
-    return FUNC(x, y);                                                  \
-  }                                                                     \
-  template <class T1, class T2>                                         \
-  KOKKOS_INLINE_FUNCTION std::enable_if_t<                              \
-      std::is_arithmetic<T1>::value && std::is_arithmetic<T2>::value && \
-          !std::is_same<T1, long double>::value &&                      \
-          !std::is_same<T2, long double>::value,                        \
-      Kokkos::Impl::promote_2_t<T1, T2>>                                \
-  FUNC(T1 x, T2 y) {                                                    \
-    using Promoted = Kokkos::Impl::promote_2_t<T1, T2>;                 \
-    using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC;                   \
-    return FUNC(static_cast<Promoted>(x), static_cast<Promoted>(y));    \
-  }                                                                     \
-  template <class T1, class T2>                                         \
-  inline std::enable_if_t<std::is_arithmetic<T1>::value &&              \
-                              std::is_arithmetic<T2>::value &&          \
-                              (std::is_same<T1, long double>::value ||  \
-                               std::is_same<T2, long double>::value),   \
-                          long double>                                  \
-  FUNC(T1 x, T2 y) {                                                    \
-    using Promoted = Kokkos::Impl::promote_2_t<T1, T2>;                 \
-    static_assert(std::is_same<Promoted, long double>::value, "");      \
-    using std::FUNC;                                                    \
-    return FUNC(static_cast<Promoted>(x), static_cast<Promoted>(y));    \
-  }                                                                     \
-  KOKKOS_IMPL_MATH_FUNCTIONS_DEFINED_IF_DEPRECATED_CODE_ENABLED(        \
-      namespace Experimental {                                          \
-        using ::Kokkos::FUNC;                                           \
-        using ::Kokkos::FUNC##f;                                        \
-        using ::Kokkos::FUNC##l;                                        \
-      })
 // Basic operations
 KOKKOS_INLINE_FUNCTION int abs(int n) {
   using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::abs;
@@ -282,7 +320,7 @@ KOKKOS_IMPL_MATH_UNARY_FUNCTION(fabs)
 KOKKOS_IMPL_MATH_BINARY_FUNCTION(fmod)
 KOKKOS_IMPL_MATH_BINARY_FUNCTION(remainder)
 // remquo
-// fma
+KOKKOS_IMPL_MATH_TERNARY_FUNCTION(fma)
 KOKKOS_IMPL_MATH_BINARY_FUNCTION(fmax)
 KOKKOS_IMPL_MATH_BINARY_FUNCTION(fmin)
 KOKKOS_IMPL_MATH_BINARY_FUNCTION(fdim)
@@ -338,6 +376,49 @@ KOKKOS_IMPL_MATH_BINARY_FUNCTION(pow)
 KOKKOS_IMPL_MATH_UNARY_FUNCTION(sqrt)
 KOKKOS_IMPL_MATH_UNARY_FUNCTION(cbrt)
 KOKKOS_IMPL_MATH_BINARY_FUNCTION(hypot)
+#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \
+    defined(KOKKOS_ENABLE_SYCL)
+KOKKOS_INLINE_FUNCTION float hypot(float x, float y, float z) {
+  return sqrt(x * x + y * y + z * z);
+}
+KOKKOS_INLINE_FUNCTION double hypot(double x, double y, double z) {
+  return sqrt(x * x + y * y + z * z);
+}
+inline long double hypot(long double x, long double y, long double z) {
+  return sqrt(x * x + y * y + z * z);
+}
+KOKKOS_INLINE_FUNCTION float hypotf(float x, float y, float z) {
+  return sqrt(x * x + y * y + z * z);
+}
+inline long double hypotl(long double x, long double y, long double z) {
+  return sqrt(x * x + y * y + z * z);
+}
+template <
+    class T1, class T2, class T3,
+    class Promoted = std::enable_if_t<
+        std::is_arithmetic_v<T1> && std::is_arithmetic_v<T2> &&
+            std::is_arithmetic_v<T3> && !std::is_same_v<T1, long double> &&
+            !std::is_same_v<T2, long double> &&
+            !std::is_same_v<T3, long double>,
+        Impl::promote_3_t<T1, T2, T3>>>
+KOKKOS_INLINE_FUNCTION Promoted hypot(T1 x, T2 y, T3 z) {
+  return hypot(static_cast<Promoted>(x), static_cast<Promoted>(y),
+               static_cast<Promoted>(z));
+}
+template <
+    class T1, class T2, class T3,
+    class = std::enable_if_t<
+        std::is_arithmetic_v<T1> && std::is_arithmetic_v<T2> &&
+        std::is_arithmetic_v<T3> &&
+        (std::is_same_v<T1, long double> || std::is_same_v<T2, long double> ||
+         std::is_same_v<T3, long double>)>>
+inline long double hypot(T1 x, T2 y, T3 z) {
+  return hypot(static_cast<long double>(x), static_cast<long double>(y),
+               static_cast<long double>(z));
+}
+#else
+KOKKOS_IMPL_MATH_TERNARY_FUNCTION(hypot)
+#endif
 // Trigonometric functions
 KOKKOS_IMPL_MATH_UNARY_FUNCTION(sin)
 KOKKOS_IMPL_MATH_UNARY_FUNCTION(cos)
@@ -402,6 +483,7 @@ KOKKOS_IMPL_MATH_UNARY_PREDICATE(signbit)
 #undef KOKKOS_IMPL_MATH_UNARY_FUNCTION
 #undef KOKKOS_IMPL_MATH_UNARY_PREDICATE
 #undef KOKKOS_IMPL_MATH_BINARY_FUNCTION
+#undef KOKKOS_IMPL_MATH_TERNARY_FUNCTION
 
 }  // namespace Kokkos
 
diff --git a/packages/kokkos/core/src/Kokkos_MathematicalSpecialFunctions.hpp b/packages/kokkos/core/src/Kokkos_MathematicalSpecialFunctions.hpp
index 07da1dbd7e4965b231242a0359d8baa05ade98da..63c2b58ef59ad00031be9d69c12cab303ec0ad17 100644
--- a/packages/kokkos/core/src/Kokkos_MathematicalSpecialFunctions.hpp
+++ b/packages/kokkos/core/src/Kokkos_MathematicalSpecialFunctions.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_MATHEMATICAL_SPECIAL_FUNCTIONS_HPP
 #define KOKKOS_MATHEMATICAL_SPECIAL_FUNCTIONS_HPP
@@ -124,20 +96,21 @@ KOKKOS_INLINE_FUNCTION Kokkos::complex<RealType> erf(
   using Kokkos::exp;
   using Kokkos::fabs;
   using Kokkos::sin;
-  using Kokkos::Experimental::epsilon;
-  using Kokkos::Experimental::infinity;
+  using Kokkos::Experimental::epsilon_v;
+  using Kokkos::Experimental::infinity_v;
+  using Kokkos::numbers::pi_v;
 
   using CmplxType = Kokkos::complex<RealType>;
 
-  constexpr auto inf = infinity<RealType>::value;
-  constexpr auto tol = epsilon<RealType>::value;
+  constexpr auto inf = infinity_v<RealType>;
+  constexpr auto tol = epsilon_v<RealType>;
 
   const RealType fnorm = 1.12837916709551;
   const RealType gnorm = 0.564189583547756;
   const RealType eh    = 0.606530659712633;
   const RealType ef    = 0.778800783071405;
   // const RealType tol   = 1.0e-13;
-  constexpr auto pi = Kokkos::Experimental::pi_v<RealType>;
+  constexpr auto pi = pi_v<RealType>;
 
   CmplxType cans;
 
@@ -302,20 +275,22 @@ KOKKOS_INLINE_FUNCTION Kokkos::complex<RealType> erfcx(
   using Kokkos::fabs;
   using Kokkos::isinf;
   using Kokkos::sin;
-  using Kokkos::Experimental::epsilon;
-  using Kokkos::Experimental::infinity;
+  using Kokkos::Experimental::epsilon_v;
+  using Kokkos::Experimental::infinity_v;
+  using Kokkos::numbers::inv_sqrtpi_v;
+  using Kokkos::numbers::pi_v;
 
   using CmplxType = Kokkos::complex<RealType>;
 
-  constexpr auto inf = infinity<RealType>::value;
-  constexpr auto tol = epsilon<RealType>::value;
+  constexpr auto inf = infinity_v<RealType>;
+  constexpr auto tol = epsilon_v<RealType>;
 
   const RealType fnorm = 1.12837916709551;
-  constexpr auto gnorm = Kokkos::Experimental::inv_sqrtpi_v<RealType>;
+  constexpr auto gnorm = inv_sqrtpi_v<RealType>;
   const RealType eh    = 0.606530659712633;
   const RealType ef    = 0.778800783071405;
   // const RealType tol   = 1.0e-13;
-  constexpr auto pi = Kokkos::Experimental::pi_v<RealType>;
+  constexpr auto pi = pi_v<RealType>;
 
   CmplxType cans;
 
@@ -492,9 +467,10 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_j0(const CmplxType& z,
   // Output:  cbj0      --- J0(z)
   using Kokkos::fabs;
   using Kokkos::pow;
+  using Kokkos::numbers::pi_v;
 
   CmplxType cbj0;
-  constexpr auto pi    = Kokkos::Experimental::pi_v<RealType>;
+  constexpr auto pi    = pi_v<RealType>;
   const RealType a[12] = {
       -0.703125e-01,           0.112152099609375e+00,   -0.5725014209747314e+00,
       0.6074042001273483e+01,  -0.1100171402692467e+03, 0.3038090510922384e+04,
@@ -580,13 +556,15 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_y0(const CmplxType& z,
   //    Output:  cby0      --- Y0(z)
   using Kokkos::fabs;
   using Kokkos::pow;
-  using Kokkos::Experimental::infinity;
+  using Kokkos::Experimental::infinity_v;
+  using Kokkos::numbers::egamma_v;
+  using Kokkos::numbers::pi_v;
 
-  constexpr auto inf = infinity<RealType>::value;
+  constexpr auto inf = infinity_v<RealType>;
 
   CmplxType cby0, cbj0;
-  constexpr auto pi    = Kokkos::Experimental::pi_v<RealType>;
-  constexpr auto el    = Kokkos::Experimental::egamma_v<RealType>;
+  constexpr auto pi    = pi_v<RealType>;
+  constexpr auto el    = egamma_v<RealType>;
   const RealType a[12] = {
       -0.703125e-01,           0.112152099609375e+00,   -0.5725014209747314e+00,
       0.6074042001273483e+01,  -0.1100171402692467e+03, 0.3038090510922384e+04,
@@ -681,9 +659,10 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_j1(const CmplxType& z,
   //    Output:  cbj1      --- J1(z)
   using Kokkos::fabs;
   using Kokkos::pow;
+  using Kokkos::numbers::pi_v;
 
   CmplxType cbj1;
-  constexpr auto pi     = Kokkos::Experimental::pi_v<RealType>;
+  constexpr auto pi     = pi_v<RealType>;
   const RealType a1[12] = {0.1171875e+00,          -0.144195556640625e+00,
                            0.6765925884246826e+00, -0.6883914268109947e+01,
                            0.1215978918765359e+03, -0.3302272294480852e+04,
@@ -773,13 +752,15 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_y1(const CmplxType& z,
   //    Output:  cby1      --- Y1(z)
   using Kokkos::fabs;
   using Kokkos::pow;
-  using Kokkos::Experimental::infinity;
+  using Kokkos::Experimental::infinity_v;
+  using Kokkos::numbers::egamma_v;
+  using Kokkos::numbers::pi_v;
 
-  constexpr auto inf = infinity<RealType>::value;
+  constexpr auto inf = infinity_v<RealType>;
 
   CmplxType cby1, cbj0, cbj1, cby0;
-  constexpr auto pi     = Kokkos::Experimental::pi_v<RealType>;
-  constexpr auto el     = Kokkos::Experimental::egamma_v<RealType>;
+  constexpr auto pi     = pi_v<RealType>;
+  constexpr auto el     = egamma_v<RealType>;
   const RealType a1[12] = {0.1171875e+00,          -0.144195556640625e+00,
                            0.6765925884246826e+00, -0.6883914268109947e+01,
                            0.1215978918765359e+03, -0.3302272294480852e+04,
@@ -875,8 +856,10 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_i0(const CmplxType& z,
   //                           argument regions
   //             bw_start  --- Starting point for backward recurrence
   //    Output:  cbi0      --- I0(z)
+  using Kokkos::numbers::pi_v;
+
   CmplxType cbi0;
-  constexpr auto pi    = Kokkos::Experimental::pi_v<RealType>;
+  constexpr auto pi    = pi_v<RealType>;
   const RealType a[12] = {0.125,
                           7.03125e-2,
                           7.32421875e-2,
@@ -948,13 +931,15 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_k0(const CmplxType& z,
   //             bw_start  --- Starting point for backward recurrence
   //    Output:  cbk0      --- K0(z)
   using Kokkos::pow;
-  using Kokkos::Experimental::infinity;
+  using Kokkos::Experimental::infinity_v;
+  using Kokkos::numbers::egamma_v;
+  using Kokkos::numbers::pi_v;
 
-  constexpr auto inf = infinity<RealType>::value;
+  constexpr auto inf = infinity_v<RealType>;
 
   CmplxType cbk0, cbi0;
-  constexpr auto pi = Kokkos::Experimental::pi_v<RealType>;
-  constexpr auto el = Kokkos::Experimental::egamma_v<RealType>;
+  constexpr auto pi = pi_v<RealType>;
+  constexpr auto el = egamma_v<RealType>;
 
   RealType a0  = Kokkos::abs(z);
   CmplxType ci = CmplxType(0.0, 1.0);
@@ -1020,8 +1005,10 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_i1(const CmplxType& z,
   //                           argument regions
   //             bw_start  --- Starting point for backward recurrence
   //    Output:  cbi1      --- I1(z)
+  using Kokkos::numbers::pi_v;
+
   CmplxType cbi1;
-  constexpr auto pi    = Kokkos::Experimental::pi_v<RealType>;
+  constexpr auto pi    = pi_v<RealType>;
   const RealType b[12] = {-0.375,
                           -1.171875e-1,
                           -1.025390625e-1,
@@ -1094,13 +1081,15 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_k1(const CmplxType& z,
   //             bw_start  --- Starting point for backward recurrence
   //    Output:  cbk1      --- K1(z)
   using Kokkos::pow;
-  using Kokkos::Experimental::infinity;
+  using Kokkos::Experimental::infinity_v;
+  using Kokkos::numbers::egamma_v;
+  using Kokkos::numbers::pi_v;
 
-  constexpr auto inf = infinity<RealType>::value;
+  constexpr auto inf = infinity_v<RealType>;
 
   CmplxType cbk0, cbi0, cbk1, cbi1;
-  constexpr auto pi = Kokkos::Experimental::pi_v<RealType>;
-  constexpr auto el = Kokkos::Experimental::egamma_v<RealType>;
+  constexpr auto pi = pi_v<RealType>;
+  constexpr auto el = egamma_v<RealType>;
 
   RealType a0  = Kokkos::abs(z);
   CmplxType ci = CmplxType(0.0, 1.0);
@@ -1163,12 +1152,13 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_h10(const CmplxType& z) {
   // programs CH12N in S. Zhang & J. Jin "Computation of Special Functions"
   //(Wiley, 1996).
   using RealType = typename CmplxType::value_type;
-  using Kokkos::Experimental::infinity;
+  using Kokkos::Experimental::infinity_v;
+  using Kokkos::numbers::pi_v;
 
-  constexpr auto inf = infinity<RealType>::value;
+  constexpr auto inf = infinity_v<RealType>;
 
   CmplxType ch10, cbk0, cbj0, cby0;
-  constexpr auto pi = Kokkos::Experimental::pi_v<RealType>;
+  constexpr auto pi = pi_v<RealType>;
   CmplxType ci      = CmplxType(0.0, 1.0);
 
   if ((z.real() == 0.0) && (z.imag() == 0.0)) {
@@ -1193,12 +1183,13 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_h11(const CmplxType& z) {
   // programs CH12N in S. Zhang & J. Jin "Computation of Special Functions"
   //(Wiley, 1996).
   using RealType = typename CmplxType::value_type;
-  using Kokkos::Experimental::infinity;
+  using Kokkos::Experimental::infinity_v;
+  using Kokkos::numbers::pi_v;
 
-  constexpr auto inf = infinity<RealType>::value;
+  constexpr auto inf = infinity_v<RealType>;
 
   CmplxType ch11, cbk1, cbj1, cby1;
-  constexpr auto pi = Kokkos::Experimental::pi_v<RealType>;
+  constexpr auto pi = pi_v<RealType>;
   CmplxType ci      = CmplxType(0.0, 1.0);
 
   if ((z.real() == 0.0) && (z.imag() == 0.0)) {
@@ -1223,12 +1214,13 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_h20(const CmplxType& z) {
   // programs CH12N in S. Zhang & J. Jin "Computation of Special Functions"
   //(Wiley, 1996).
   using RealType = typename CmplxType::value_type;
-  using Kokkos::Experimental::infinity;
+  using Kokkos::Experimental::infinity_v;
+  using Kokkos::numbers::pi_v;
 
-  constexpr auto inf = infinity<RealType>::value;
+  constexpr auto inf = infinity_v<RealType>;
 
   CmplxType ch20, cbk0, cbj0, cby0;
-  constexpr auto pi = Kokkos::Experimental::pi_v<RealType>;
+  constexpr auto pi = pi_v<RealType>;
   CmplxType ci      = CmplxType(0.0, 1.0);
 
   if ((z.real() == 0.0) && (z.imag() == 0.0)) {
@@ -1253,12 +1245,13 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_h21(const CmplxType& z) {
   // programs CH12N in S. Zhang & J. Jin "Computation of Special Functions"
   //(Wiley, 1996).
   using RealType = typename CmplxType::value_type;
-  using Kokkos::Experimental::infinity;
+  using Kokkos::Experimental::infinity_v;
+  using Kokkos::numbers::pi_v;
 
-  constexpr auto inf = infinity<RealType>::value;
+  constexpr auto inf = infinity_v<RealType>;
 
   CmplxType ch21, cbk1, cbj1, cby1;
-  constexpr auto pi = Kokkos::Experimental::pi_v<RealType>;
+  constexpr auto pi = pi_v<RealType>;
   CmplxType ci      = CmplxType(0.0, 1.0);
 
   if ((z.real() == 0.0) && (z.imag() == 0.0)) {
diff --git a/packages/kokkos/core/src/Kokkos_MemoryPool.hpp b/packages/kokkos/core/src/Kokkos_MemoryPool.hpp
index 368d4901806792258618bcb77c5fdf7759ed1888..6b47c43727675783d1ee22c54e143dac5abdc5f6 100644
--- a/packages/kokkos/core/src/Kokkos_MemoryPool.hpp
+++ b/packages/kokkos/core/src/Kokkos_MemoryPool.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_MEMORYPOOL_HPP
 #define KOKKOS_MEMORYPOOL_HPP
diff --git a/packages/kokkos/core/src/Kokkos_MemoryTraits.hpp b/packages/kokkos/core/src/Kokkos_MemoryTraits.hpp
index 079384f153c743b9ec96f5bdc1cef42f3f547ef4..762e1a4a5dc82a65a27436855703605161a3cfd5 100644
--- a/packages/kokkos/core/src/Kokkos_MemoryTraits.hpp
+++ b/packages/kokkos/core/src/Kokkos_MemoryTraits.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_MEMORYTRAITS_HPP
 #define KOKKOS_MEMORYTRAITS_HPP
diff --git a/packages/kokkos/core/src/Kokkos_MinMaxClamp.hpp b/packages/kokkos/core/src/Kokkos_MinMaxClamp.hpp
index 6cb8d1669b96c3ad215e3fdc3cde9563f76036e7..37a28a80b68e08dd154cf046804416aa581fffdd 100644
--- a/packages/kokkos/core/src/Kokkos_MinMaxClamp.hpp
+++ b/packages/kokkos/core/src/Kokkos_MinMaxClamp.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_MIN_MAX_CLAMP_HPP
 #define KOKKOS_MIN_MAX_CLAMP_HPP
diff --git a/packages/kokkos/core/src/Kokkos_NumericTraits.hpp b/packages/kokkos/core/src/Kokkos_NumericTraits.hpp
index e529aba8533229c42fe95f884b115a291945bcd0..118bf52c05fa027cb26f53e844b8708e5c723ff2 100644
--- a/packages/kokkos/core/src/Kokkos_NumericTraits.hpp
+++ b/packages/kokkos/core/src/Kokkos_NumericTraits.hpp
@@ -1,63 +1,37 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_NUMERIC_TRAITS_HPP
 #define KOKKOS_NUMERIC_TRAITS_HPP
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
-#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_NUMERICTRAITS
+#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_NUMERIC_TRAITS
 #endif
 
 #include <Kokkos_Macros.hpp>
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
+#include <Kokkos_ReductionIdentity.hpp>
+#endif
 #include <cfloat>
 #include <climits>
 #include <cmath>
 #include <cstdint>
 #include <type_traits>
 
-namespace Kokkos {
-namespace Experimental {
+namespace Kokkos::Experimental {
 namespace Impl {
 // clang-format off
 template <class> struct infinity_helper {};
@@ -97,27 +71,10 @@ template <> struct finite_max_helper<float> { static constexpr float value = FLT
 template <> struct finite_max_helper<double> { static constexpr double value = DBL_MAX; };
 template <> struct finite_max_helper<long double> { static constexpr long double value = LDBL_MAX; };
 template <class> struct epsilon_helper {};
-namespace{
-  // FIXME workaround for LDL_EPSILON with XL
-  template<typename T>
-  constexpr T machineeps() {
-    T epsilon = 1, prev = 1, expression = 1;
-    do {
-      prev = epsilon;
-      epsilon /= 2;
-      expression = 1 + epsilon;
-    } while (expression > 1);
-    return prev;
-  }
-}
 template <> struct epsilon_helper<float> { static constexpr float value = FLT_EPSILON; };
 template <> struct epsilon_helper<double> { static constexpr double value = DBL_EPSILON; };
 template <> struct epsilon_helper<long double> {
-#ifdef KOKKOS_COMPILER_IBM
-  static constexpr long double value = machineeps<long double>();
-#else
   static constexpr long double value = LDBL_EPSILON;
-#endif
 };
 template <class> struct round_error_helper {};
 template <> struct round_error_helper<float> { static constexpr float value = 0.5F; };
@@ -130,7 +87,7 @@ template <> struct norm_min_helper<long double> { static constexpr long double v
 template <class> struct denorm_min_helper {};
 //                               Workaround for GCC <9.2, Clang <9, Intel
 //                               vvvvvvvvvvvvvvvvvvvvvvvvv
-#if defined(KOKKOS_ENABLE_CXX17) && defined (FLT_TRUE_MIN) || defined(_MSC_VER)
+#if defined (FLT_TRUE_MIN) || defined(_MSC_VER)
 template <> struct denorm_min_helper<float> { static constexpr float value = FLT_TRUE_MIN; };
 template <> struct denorm_min_helper<double> { static constexpr double value = DBL_TRUE_MIN; };
 template <> struct denorm_min_helper<long double> { static constexpr long double value = LDBL_TRUE_MIN; };
@@ -139,32 +96,6 @@ template <> struct denorm_min_helper<float> { static constexpr float value = __F
 template <> struct denorm_min_helper<double> { static constexpr double value = __DBL_DENORM_MIN__; };
 template <> struct denorm_min_helper<long double> { static constexpr long double value = __LDBL_DENORM_MIN__; };
 #endif
-// GCC <10.3 is not able to evaluate T(1) / finite_max_v<T> at compile time when passing -frounding-math
-// https://godbolt.org/z/zj9svb1T7
-// Similar issue was reported on IBM Power without the compiler option
-#define KOKKOS_IMPL_WORKAROUND_CONSTANT_EXPRESSION_COMPILER_BUG
-#ifndef KOKKOS_IMPL_WORKAROUND_CONSTANT_EXPRESSION_COMPILER_BUG
-// NOTE see ?lamch routine from LAPACK that determines machine parameters for floating-point arithmetic
-template <class T>
-constexpr T safe_minimum(T /*ignored*/) {
-  constexpr auto one  = static_cast<T>(1);
-  constexpr auto eps  = epsilon_helper<T>::value;
-  constexpr auto tiny = norm_min_helper<T>::value;
-  constexpr auto huge = finite_max_helper<T>::value;
-  constexpr auto small = one / huge;  // error: is not a constant expression
-  return small >= tiny ? small * (one + eps) : tiny;
-}
-template <class> struct reciprocal_overflow_threshold_helper {};
-template <> struct reciprocal_overflow_threshold_helper<float> { static constexpr float value = safe_minimum(0.f); };
-template <> struct reciprocal_overflow_threshold_helper<double> { static constexpr double value = safe_minimum(0.); };
-template <> struct reciprocal_overflow_threshold_helper<long double> { static constexpr long double value = safe_minimum(0.l); };
-#else
-template <class> struct reciprocal_overflow_threshold_helper {};
-template <> struct reciprocal_overflow_threshold_helper<float> { static constexpr float value = norm_min_helper<float>::value; };  // OK for IEEE-754 floating-point numbers
-template <> struct reciprocal_overflow_threshold_helper<double> { static constexpr double value = norm_min_helper<double>::value; };
-template <> struct reciprocal_overflow_threshold_helper<long double> { static constexpr long double value = norm_min_helper<long double>::value; };
-#endif
-#undef KOKKOS_IMPL_WORKAROUND_CONSTANT_EXPRESSION_COMPILER_BUG
 template <class> struct quiet_NaN_helper {};
 template <> struct quiet_NaN_helper<float> { static constexpr float value = __builtin_nanf(""); };
 template <> struct quiet_NaN_helper<double> { static constexpr double value = __builtin_nan(""); };
@@ -276,17 +207,11 @@ template <> struct max_exponent10_helper<long double> { static constexpr int val
 // clang-format on
 }  // namespace Impl
 
-#if defined(KOKKOS_ENABLE_CXX17)
 #define KOKKOS_IMPL_DEFINE_TRAIT(TRAIT)                        \
   template <class T>                                           \
   struct TRAIT : Impl::TRAIT##_helper<std::remove_cv_t<T>> {}; \
   template <class T>                                           \
   inline constexpr auto TRAIT##_v = TRAIT<T>::value;
-#else
-#define KOKKOS_IMPL_DEFINE_TRAIT(TRAIT) \
-  template <class T>                    \
-  struct TRAIT : Impl::TRAIT##_helper<std::remove_cv_t<T>> {};
-#endif
 
 // Numeric distinguished value traits
 KOKKOS_IMPL_DEFINE_TRAIT(infinity)
@@ -296,7 +221,6 @@ KOKKOS_IMPL_DEFINE_TRAIT(epsilon)
 KOKKOS_IMPL_DEFINE_TRAIT(round_error)
 KOKKOS_IMPL_DEFINE_TRAIT(norm_min)
 KOKKOS_IMPL_DEFINE_TRAIT(denorm_min)
-KOKKOS_IMPL_DEFINE_TRAIT(reciprocal_overflow_threshold)
 KOKKOS_IMPL_DEFINE_TRAIT(quiet_NaN)
 KOKKOS_IMPL_DEFINE_TRAIT(signaling_NaN)
 
@@ -312,350 +236,10 @@ KOKKOS_IMPL_DEFINE_TRAIT(max_exponent10)
 
 #undef KOKKOS_IMPL_DEFINE_TRAIT
 
-}  // namespace Experimental
-
-template <class T>
-struct reduction_identity; /*{
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static T sum() { return T(); }  // 0
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static T prod()  // 1
-    { static_assert( false, "Missing specialization of
-Kokkos::reduction_identity for custom prod reduction type"); return T(); }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static T max()   // minimum value
-    { static_assert( false, "Missing specialization of
-Kokkos::reduction_identity for custom max reduction type"); return T(); }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static T min()   // maximum value
-    { static_assert( false, "Missing specialization of
-Kokkos::reduction_identity for custom min reduction type"); return T(); }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static T bor()   // 0, only for integer
-type { static_assert( false, "Missing specialization of
-Kokkos::reduction_identity for custom bor reduction type"); return T(); }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static T band()  // !0, only for integer
-type { static_assert( false, "Missing specialization of
-Kokkos::reduction_identity for custom band reduction type"); return T(); }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static T lor()   // 0, only for integer
-type { static_assert( false, "Missing specialization of
-Kokkos::reduction_identity for custom lor reduction type"); return T(); }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static T land()  // !0, only for integer
-type { static_assert( false, "Missing specialization of
-Kokkos::reduction_identity for custom land reduction type"); return T(); }
-};*/
-
-template <>
-struct reduction_identity<signed char> {
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char sum() {
-    return static_cast<signed char>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char prod() {
-    return static_cast<signed char>(1);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char max() {
-    return SCHAR_MIN;
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char min() {
-    return SCHAR_MAX;
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char bor() {
-    return static_cast<signed char>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char band() {
-    return ~static_cast<signed char>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char lor() {
-    return static_cast<signed char>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char land() {
-    return static_cast<signed char>(1);
-  }
-};
-
-template <>
-struct reduction_identity<bool> {
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static bool lor() {
-    return static_cast<bool>(false);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static bool land() {
-    return static_cast<bool>(true);
-  }
-};
-
-template <>
-struct reduction_identity<short> {
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static short sum() {
-    return static_cast<short>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static short prod() {
-    return static_cast<short>(1);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static short max() { return SHRT_MIN; }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static short min() { return SHRT_MAX; }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static short bor() {
-    return static_cast<short>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static short band() {
-    return ~static_cast<short>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static short lor() {
-    return static_cast<short>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static short land() {
-    return static_cast<short>(1);
-  }
-};
-
-template <>
-struct reduction_identity<int> {
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static int sum() {
-    return static_cast<int>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static int prod() {
-    return static_cast<int>(1);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static int max() { return INT_MIN; }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static int min() { return INT_MAX; }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static int bor() {
-    return static_cast<int>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static int band() {
-    return ~static_cast<int>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static int lor() {
-    return static_cast<int>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static int land() {
-    return static_cast<int>(1);
-  }
-};
-
-template <>
-struct reduction_identity<long> {
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static long sum() {
-    return static_cast<long>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static long prod() {
-    return static_cast<long>(1);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static long max() { return LONG_MIN; }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static long min() { return LONG_MAX; }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static long bor() {
-    return static_cast<long>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static long band() {
-    return ~static_cast<long>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static long lor() {
-    return static_cast<long>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static long land() {
-    return static_cast<long>(1);
-  }
-};
-
-template <>
-struct reduction_identity<long long> {
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static long long sum() {
-    return static_cast<long long>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static long long prod() {
-    return static_cast<long long>(1);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static long long max() {
-    return LLONG_MIN;
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static long long min() {
-    return LLONG_MAX;
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static long long bor() {
-    return static_cast<long long>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static long long band() {
-    return ~static_cast<long long>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static long long lor() {
-    return static_cast<long long>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static long long land() {
-    return static_cast<long long>(1);
-  }
-};
-
-template <>
-struct reduction_identity<unsigned char> {
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char sum() {
-    return static_cast<unsigned char>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char prod() {
-    return static_cast<unsigned char>(1);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char max() {
-    return static_cast<unsigned char>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char min() {
-    return UCHAR_MAX;
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char bor() {
-    return static_cast<unsigned char>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char band() {
-    return ~static_cast<unsigned char>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char lor() {
-    return static_cast<unsigned char>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char land() {
-    return static_cast<unsigned char>(1);
-  }
-};
-
-template <>
-struct reduction_identity<unsigned short> {
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short sum() {
-    return static_cast<unsigned short>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short prod() {
-    return static_cast<unsigned short>(1);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short max() {
-    return static_cast<unsigned short>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short min() {
-    return USHRT_MAX;
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short bor() {
-    return static_cast<unsigned short>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short band() {
-    return ~static_cast<unsigned short>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short lor() {
-    return static_cast<unsigned short>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short land() {
-    return static_cast<unsigned short>(1);
-  }
-};
-
-template <>
-struct reduction_identity<unsigned int> {
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int sum() {
-    return static_cast<unsigned int>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int prod() {
-    return static_cast<unsigned int>(1);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int max() {
-    return static_cast<unsigned int>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int min() {
-    return UINT_MAX;
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int bor() {
-    return static_cast<unsigned int>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int band() {
-    return ~static_cast<unsigned int>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int lor() {
-    return static_cast<unsigned int>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int land() {
-    return static_cast<unsigned int>(1);
-  }
-};
-
-template <>
-struct reduction_identity<unsigned long> {
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long sum() {
-    return static_cast<unsigned long>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long prod() {
-    return static_cast<unsigned long>(1);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long max() {
-    return static_cast<unsigned long>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long min() {
-    return ULONG_MAX;
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long bor() {
-    return static_cast<unsigned long>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long band() {
-    return ~static_cast<unsigned long>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long lor() {
-    return static_cast<unsigned long>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long land() {
-    return static_cast<unsigned long>(1);
-  }
-};
-
-template <>
-struct reduction_identity<unsigned long long> {
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long sum() {
-    return static_cast<unsigned long long>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long prod() {
-    return static_cast<unsigned long long>(1);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long max() {
-    return static_cast<unsigned long long>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long min() {
-    return ULLONG_MAX;
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long bor() {
-    return static_cast<unsigned long long>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long band() {
-    return ~static_cast<unsigned long long>(0x0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long lor() {
-    return static_cast<unsigned long long>(0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long land() {
-    return static_cast<unsigned long long>(1);
-  }
-};
-
-template <>
-struct reduction_identity<float> {
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static float sum() {
-    return static_cast<float>(0.0f);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static float prod() {
-    return static_cast<float>(1.0f);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static float max() { return -FLT_MAX; }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static float min() { return FLT_MAX; }
-};
-
-template <>
-struct reduction_identity<double> {
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static double sum() {
-    return static_cast<double>(0.0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static double prod() {
-    return static_cast<double>(1.0);
-  }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static double max() { return -DBL_MAX; }
-  KOKKOS_FORCEINLINE_FUNCTION constexpr static double min() { return DBL_MAX; }
-};
-
-// No __host__ __device__ annotation because long double treated as double in
-// device code.  May be revisited later if that is not true any more.
-template <>
-struct reduction_identity<long double> {
-  constexpr static long double sum() { return static_cast<long double>(0.0); }
-  constexpr static long double prod() { return static_cast<long double>(1.0); }
-  constexpr static long double max() { return -LDBL_MAX; }
-  constexpr static long double min() { return LDBL_MAX; }
-};
-
-}  // namespace Kokkos
+}  // namespace Kokkos::Experimental
 
-#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_NUMERICTRAITS
+#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_NUMERIC_TRAITS
 #undef KOKKOS_IMPL_PUBLIC_INCLUDE
-#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_NUMERICTRAITS
+#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_NUMERIC_TRAITS
 #endif
 #endif
diff --git a/packages/kokkos/core/src/Kokkos_OpenMP.hpp b/packages/kokkos/core/src/Kokkos_OpenMP.hpp
index 775b4704489f79a03c1ffecb8d37de6925dd3acc..bbe008afd959f5db2e7eaa2478e98a0f005c509a 100644
--- a/packages/kokkos/core/src/Kokkos_OpenMP.hpp
+++ b/packages/kokkos/core/src/Kokkos_OpenMP.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_OPENMP_HPP
 #define KOKKOS_OPENMP_HPP
@@ -107,6 +75,8 @@ class OpenMP {
 
   OpenMP();
 
+  OpenMP(int pool_size);
+
   /// \brief Print configuration information to the given output stream.
   void print_configuration(std::ostream& os, bool verbose = false) const;
 
@@ -128,19 +98,6 @@ class OpenMP {
   inline static bool is_asynchronous(OpenMP const& = OpenMP()) noexcept;
 
 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  /// \brief Partition the default instance into new instances without creating
-  ///  new masters
-  ///
-  /// This is a no-op on OpenMP since the default instance cannot be partitioned
-  /// without promoting other threads to 'master'
-  static std::vector<OpenMP> partition(...);
-
-  /// Non-default instances should be ref-counted so that when the last
-  /// is destroyed the instance resources are released
-  ///
-  /// This is a no-op on OpenMP since a non default instance cannot be created
-  static OpenMP create_instance(...);
-
   /// \brief Partition the default instance and call 'f' on each new 'master'
   /// thread
   ///
@@ -152,8 +109,7 @@ class OpenMP {
       int requested_partition_size = 0);
 #endif
 
-  // use UniqueToken
-  static int concurrency();
+  static int concurrency(OpenMP const& = OpenMP());
 
   static void impl_initialize(InitializationSettings const&);
 
@@ -164,13 +120,12 @@ class OpenMP {
   /// \brief Free any resources being consumed by the default execution space
   static void impl_finalize();
 
-  inline static int impl_thread_pool_size() noexcept;
+  inline static int impl_thread_pool_size(OpenMP const& = OpenMP()) noexcept;
 
   /** \brief  The rank of the executing thread in this thread pool */
-  KOKKOS_INLINE_FUNCTION
-  static int impl_thread_pool_rank() noexcept;
+  inline static int impl_thread_pool_rank() noexcept;
 
-  inline static int impl_thread_pool_size(int depth);
+  inline static int impl_thread_pool_size(int depth, OpenMP const& = OpenMP());
 
   // use UniqueToken
   inline static int impl_max_hardware_threads() noexcept;
@@ -182,22 +137,21 @@ class OpenMP {
   static int impl_get_current_max_threads() noexcept;
 
   Impl::OpenMPInternal* impl_internal_space_instance() const {
-#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS
-    return m_space_instance;
-#else
     return m_space_instance.get();
-#endif
   }
 
   static constexpr const char* name() noexcept { return "OpenMP"; }
   uint32_t impl_instance_id() const noexcept { return 1; }
 
  private:
-#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS
-  Impl::OpenMPInternal* m_space_instance;
-#else
+  friend bool operator==(OpenMP const& lhs, OpenMP const& rhs) {
+    return lhs.impl_internal_space_instance() ==
+           rhs.impl_internal_space_instance();
+  }
+  friend bool operator!=(OpenMP const& lhs, OpenMP const& rhs) {
+    return !(lhs == rhs);
+  }
   Kokkos::Impl::HostSharedPtr<Impl::OpenMPInternal> m_space_instance;
-#endif
 };
 
 namespace Tools {
diff --git a/packages/kokkos/core/src/Kokkos_OpenMPTarget.hpp b/packages/kokkos/core/src/Kokkos_OpenMPTarget.hpp
index 637b4c08f9088508f53d2bf13cce6e840b4006f1..4bcfed90e39d831f4cbf2c7299b6f16b0f8d7acf 100644
--- a/packages/kokkos/core/src/Kokkos_OpenMPTarget.hpp
+++ b/packages/kokkos/core/src/Kokkos_OpenMPTarget.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_OPENMPTARGET_HPP
 #define KOKKOS_OPENMPTARGET_HPP
@@ -105,7 +73,11 @@ class OpenMPTarget {
   static void impl_static_fence(const std::string& name);
 
   /** \brief  Return the maximum amount of concurrency.  */
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
   static int concurrency();
+#else
+  int concurrency() const;
+#endif
 
   //! Print configuration information to the given output stream.
   void print_configuration(std::ostream& os, bool verbose = false) const;
@@ -129,6 +101,13 @@ class OpenMPTarget {
   uint32_t impl_instance_id() const noexcept;
 
  private:
+  friend bool operator==(OpenMPTarget const& lhs, OpenMPTarget const& rhs) {
+    return lhs.impl_internal_space_instance() ==
+           rhs.impl_internal_space_instance();
+  }
+  friend bool operator!=(OpenMPTarget const& lhs, OpenMPTarget const& rhs) {
+    return !(lhs == rhs);
+  }
   Impl::OpenMPTargetInternal* m_space_instance;
 };
 }  // namespace Experimental
diff --git a/packages/kokkos/core/src/Kokkos_OpenMPTargetSpace.hpp b/packages/kokkos/core/src/Kokkos_OpenMPTargetSpace.hpp
index b4897449cb9e769438e3d5a0c48ad39a55cd8bad..ca015da379f4c312d00ae4c91c20893fa8702022 100644
--- a/packages/kokkos/core/src/Kokkos_OpenMPTargetSpace.hpp
+++ b/packages/kokkos/core/src/Kokkos_OpenMPTargetSpace.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_OPENMPTARGETSPACE_HPP
 #define KOKKOS_OPENMPTARGETSPACE_HPP
@@ -268,9 +236,9 @@ struct DeepCopy<Kokkos::Experimental::OpenMPTargetSpace,
     // be greater than zero to avoid error. omp_target_memcpy returns zero on
     // success.
     if (n > 0)
-      OMPT_SAFE_CALL(omp_target_memcpy(dst, const_cast<void*>(src), n, 0, 0,
-                                       omp_get_default_device(),
-                                       omp_get_default_device()));
+      KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy(
+          dst, const_cast<void*>(src), n, 0, 0, omp_get_default_device(),
+          omp_get_default_device()));
   }
   DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, size_t n) {
     exec.fence(
@@ -278,9 +246,9 @@ struct DeepCopy<Kokkos::Experimental::OpenMPTargetSpace,
         "before "
         "copy");
     if (n > 0)
-      OMPT_SAFE_CALL(omp_target_memcpy(dst, const_cast<void*>(src), n, 0, 0,
-                                       omp_get_default_device(),
-                                       omp_get_default_device()));
+      KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy(
+          dst, const_cast<void*>(src), n, 0, 0, omp_get_default_device(),
+          omp_get_default_device()));
   }
 };
 
@@ -289,18 +257,18 @@ struct DeepCopy<Kokkos::Experimental::OpenMPTargetSpace, HostSpace,
                 ExecutionSpace> {
   DeepCopy(void* dst, const void* src, size_t n) {
     if (n > 0)
-      OMPT_SAFE_CALL(omp_target_memcpy(dst, const_cast<void*>(src), n, 0, 0,
-                                       omp_get_default_device(),
-                                       omp_get_initial_device()));
+      KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy(
+          dst, const_cast<void*>(src), n, 0, 0, omp_get_default_device(),
+          omp_get_initial_device()));
   }
   DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, size_t n) {
     exec.fence(
         "Kokkos::Impl::DeepCopy<OpenMPTargetSpace, HostSpace>: fence before "
         "copy");
     if (n > 0)
-      OMPT_SAFE_CALL(omp_target_memcpy(dst, const_cast<void*>(src), n, 0, 0,
-                                       omp_get_default_device(),
-                                       omp_get_initial_device()));
+      KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy(
+          dst, const_cast<void*>(src), n, 0, 0, omp_get_default_device(),
+          omp_get_initial_device()));
   }
 };
 
@@ -309,18 +277,18 @@ struct DeepCopy<HostSpace, Kokkos::Experimental::OpenMPTargetSpace,
                 ExecutionSpace> {
   DeepCopy(void* dst, const void* src, size_t n) {
     if (n > 0)
-      OMPT_SAFE_CALL(omp_target_memcpy(dst, const_cast<void*>(src), n, 0, 0,
-                                       omp_get_initial_device(),
-                                       omp_get_default_device()));
+      KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy(
+          dst, const_cast<void*>(src), n, 0, 0, omp_get_initial_device(),
+          omp_get_default_device()));
   }
   DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, size_t n) {
     exec.fence(
         "Kokkos::Impl::DeepCopy<HostSpace, OpenMPTargetSpace>: fence before "
         "copy");
     if (n > 0)
-      OMPT_SAFE_CALL(omp_target_memcpy(dst, const_cast<void*>(src), n, 0, 0,
-                                       omp_get_initial_device(),
-                                       omp_get_default_device()));
+      KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy(
+          dst, const_cast<void*>(src), n, 0, 0, omp_get_initial_device(),
+          omp_get_default_device()));
   }
 };
 
diff --git a/packages/kokkos/core/src/Kokkos_Pair.hpp b/packages/kokkos/core/src/Kokkos_Pair.hpp
index 7e5b7ce250021b089cba6b97b972a78dc6633104..d42e07aa42369b1c8cb45decc1aa7c6238e7033f 100644
--- a/packages/kokkos/core/src/Kokkos_Pair.hpp
+++ b/packages/kokkos/core/src/Kokkos_Pair.hpp
@@ -1,43 +1,17 @@
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
 
 /// \file Kokkos_Pair.hpp
@@ -111,13 +85,16 @@ struct pair {
       : first(p.first), second(p.second) {
   }
 
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
   /// \brief Copy constructor.
   ///
   /// This calls the copy constructors of T1 and T2.  It won't compile
   /// if those copy constructors are not defined and public.
   template <class U, class V>
-  KOKKOS_FORCEINLINE_FUNCTION constexpr pair(const volatile pair<U, V>& p)
+  KOKKOS_DEPRECATED KOKKOS_FORCEINLINE_FUNCTION constexpr pair(
+      const volatile pair<U, V>& p)
       : first(p.first), second(p.second) {}
+#endif
 
   /// \brief Assignment operator.
   ///
@@ -130,6 +107,7 @@ struct pair {
     return *this;
   }
 
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
   /// \brief Assignment operator, for volatile <tt>*this</tt>.
   ///
   /// \param p [in] Input; right-hand side of the assignment.
@@ -142,13 +120,14 @@ struct pair {
   /// practice, this means that you should not chain assignments with
   /// volatile lvalues.
   template <class U, class V>
-  KOKKOS_FORCEINLINE_FUNCTION void operator=(
+  KOKKOS_DEPRECATED KOKKOS_FORCEINLINE_FUNCTION void operator=(
       const volatile pair<U, V>& p) volatile {
     first  = p.first;
     second = p.second;
     // We deliberately do not return anything here.  See explanation
     // in public documentation above.
   }
+#endif
 
   // from std::pair<U,V>
   template <class U, class V>
diff --git a/packages/kokkos/core/src/Kokkos_Parallel.hpp b/packages/kokkos/core/src/Kokkos_Parallel.hpp
index 2b5e39d24d808abcddf36f4840c2d47082a7a905..7c4207222662800481f4c395021437ee901ad1b2 100644
--- a/packages/kokkos/core/src/Kokkos_Parallel.hpp
+++ b/packages/kokkos/core/src/Kokkos_Parallel.hpp
@@ -1,58 +1,26 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /// \file Kokkos_Parallel.hpp
 /// \brief Declaration of parallel operators
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_PARALLEL_HPP
 #define KOKKOS_PARALLEL_HPP
@@ -185,18 +153,6 @@ inline void parallel_for(
   Kokkos::parallel_for("", policy, functor);
 }
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-template <class ExecPolicy, class FunctorType>
-KOKKOS_DEPRECATED_WITH_COMMENT(
-    "Use the overload taking the label as first argument instead!")
-inline void parallel_for(
-    const ExecPolicy& policy, const FunctorType& functor,
-    const std::string& str,
-    std::enable_if_t<is_execution_policy<ExecPolicy>::value>* = nullptr) {
-  Kokkos::parallel_for(str, policy, functor);
-}
-#endif
-
 template <class FunctorType>
 inline void parallel_for(const std::string& str, const size_t work_count,
                          const FunctorType& functor) {
@@ -214,16 +170,6 @@ inline void parallel_for(const size_t work_count, const FunctorType& functor) {
   ::Kokkos::parallel_for("", work_count, functor);
 }
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-template <class FunctorType>
-KOKKOS_DEPRECATED_WITH_COMMENT(
-    "Use the overload taking the label as first argument instead!")
-inline void parallel_for(const size_t work_count, const FunctorType& functor,
-                         const std::string& str) {
-  ::Kokkos::parallel_for(str, work_count, functor);
-}
-#endif
-
 }  // namespace Kokkos
 
 #include <Kokkos_Parallel_Reduce.hpp>
@@ -423,18 +369,6 @@ inline void parallel_scan(
   ::Kokkos::parallel_scan("", policy, functor);
 }
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-template <class ExecutionPolicy, class FunctorType>
-KOKKOS_DEPRECATED_WITH_COMMENT(
-    "Use the overload taking the label as first argument instead!")
-inline void parallel_scan(
-    const ExecutionPolicy& policy, const FunctorType& functor,
-    const std::string& str,
-    std::enable_if_t<is_execution_policy<ExecutionPolicy>::value>* = nullptr) {
-  ::Kokkos::parallel_scan(str, policy, functor);
-}
-#endif
-
 template <class FunctorType>
 inline void parallel_scan(const std::string& str, const size_t work_count,
                           const FunctorType& functor) {
@@ -453,16 +387,6 @@ inline void parallel_scan(const size_t work_count, const FunctorType& functor) {
   ::Kokkos::parallel_scan("", work_count, functor);
 }
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-template <class FunctorType>
-KOKKOS_DEPRECATED_WITH_COMMENT(
-    "Use the overload taking the label as first argument instead!")
-inline void parallel_scan(const size_t work_count, const FunctorType& functor,
-                          const std::string& str) {
-  ::Kokkos::parallel_scan(str, work_count, functor);
-}
-#endif
-
 template <class ExecutionPolicy, class FunctorType, class ReturnType,
           class Enable =
               std::enable_if_t<is_execution_policy<ExecutionPolicy>::value>>
@@ -473,17 +397,26 @@ inline void parallel_scan(const std::string& str, const ExecutionPolicy& policy,
   ExecutionPolicy inner_policy = policy;
   Kokkos::Tools::Impl::begin_parallel_scan(inner_policy, functor, str, kpID);
 
-  Kokkos::Impl::shared_allocation_tracking_disable();
-  Impl::ParallelScanWithTotal<FunctorType, ExecutionPolicy, ReturnType> closure(
-      functor, inner_policy, return_value);
-  Kokkos::Impl::shared_allocation_tracking_enable();
-
-  closure.execute();
+  if constexpr (Kokkos::is_view<ReturnType>::value) {
+    Kokkos::Impl::shared_allocation_tracking_disable();
+    Impl::ParallelScanWithTotal<FunctorType, ExecutionPolicy, ReturnType>
+        closure(functor, inner_policy, return_value);
+    Kokkos::Impl::shared_allocation_tracking_enable();
+    closure.execute();
+  } else {
+    Kokkos::Impl::shared_allocation_tracking_disable();
+    Kokkos::View<ReturnType, Kokkos::HostSpace> view(&return_value);
+    Impl::ParallelScanWithTotal<FunctorType, ExecutionPolicy, ReturnType>
+        closure(functor, inner_policy, view);
+    Kokkos::Impl::shared_allocation_tracking_enable();
+    closure.execute();
+  }
 
   Kokkos::Tools::Impl::end_parallel_scan(inner_policy, functor, str, kpID);
 
-  policy.space().fence(
-      "Kokkos::parallel_scan: fence due to result being a value, not a view");
+  if (!Kokkos::is_view<ReturnType>::value)
+    policy.space().fence(
+        "Kokkos::parallel_scan: fence due to result being a value, not a view");
 }
 
 template <class ExecutionPolicy, class FunctorType, class ReturnType>
@@ -494,18 +427,6 @@ inline void parallel_scan(
   ::Kokkos::parallel_scan("", policy, functor, return_value);
 }
 
-#ifdef KOKKOS_ENABLE_DISABLE_DEPRECATED_CODE_3
-template <class ExecutionPolicy, class FunctorType, class ReturnType>
-KOKKOS_DEPRECATED_WITH_COMMENT(
-    "Use the overload taking the label as first argument instead!")
-inline void parallel_scan(
-    const ExecutionPolicy& policy, const FunctorType& functor,
-    ReturnType& return_value, const std::string& str,
-    std::enable_if_t<is_execution_policy<ExecutionPolicy>::value>* = nullptr) {
-  ::Kokkos::parallel_scan(str, policy, functor, return_value);
-}
-#endif
-
 template <class FunctorType, class ReturnType>
 inline void parallel_scan(const std::string& str, const size_t work_count,
                           const FunctorType& functor,
@@ -526,16 +447,6 @@ inline void parallel_scan(const size_t work_count, const FunctorType& functor,
   ::Kokkos::parallel_scan("", work_count, functor, return_value);
 }
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-template <class FunctorType, class ReturnType>
-KOKKOS_DEPRECATED_WITH_COMMENT(
-    "Use the overload taking the label as first argument instead!")
-inline void parallel_scan(const size_t work_count, const FunctorType& functor,
-                          ReturnType& return_value, const std::string& str) {
-  ::Kokkos::parallel_scan(str, work_count, functor, return_value);
-}
-#endif
-
 }  // namespace Kokkos
 
 //----------------------------------------------------------------------------
diff --git a/packages/kokkos/core/src/Kokkos_Parallel_Reduce.hpp b/packages/kokkos/core/src/Kokkos_Parallel_Reduce.hpp
index 9213383ac9736f01dc59c89d58154fa92fd5a9cf..d44bd89a9b5ec85d205b835f11cfd6e64ecff79f 100644
--- a/packages/kokkos/core/src/Kokkos_Parallel_Reduce.hpp
+++ b/packages/kokkos/core/src/Kokkos_Parallel_Reduce.hpp
@@ -1,60 +1,28 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_PARALLEL_REDUCE_HPP
 #define KOKKOS_PARALLEL_REDUCE_HPP
 
-#include <Kokkos_NumericTraits.hpp>
+#include <Kokkos_ReductionIdentity.hpp>
 #include <Kokkos_View.hpp>
 #include <impl/Kokkos_FunctorAnalysis.hpp>
 #include <impl/Kokkos_Tools_Generic.hpp>
@@ -63,12 +31,6 @@ KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
 
 namespace Kokkos {
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-template <class T>
-using is_reducer_type KOKKOS_DEPRECATED_WITH_COMMENT(
-    "Use Kokkos::is_reducer instead!") = Kokkos::is_reducer<T>;
-#endif
-
 template <class Scalar, class Space>
 struct Sum {
  public:
@@ -109,6 +71,10 @@ struct Sum {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Scalar, typename... Properties>
+Sum(View<Scalar, Properties...> const&)
+    ->Sum<Scalar, typename View<Scalar, Properties...>::memory_space>;
+
 template <class Scalar, class Space>
 struct Prod {
  public:
@@ -149,6 +115,10 @@ struct Prod {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Scalar, typename... Properties>
+Prod(View<Scalar, Properties...> const&)
+    ->Prod<Scalar, typename View<Scalar, Properties...>::memory_space>;
+
 template <class Scalar, class Space>
 struct Min {
  public:
@@ -191,6 +161,10 @@ struct Min {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Scalar, typename... Properties>
+Min(View<Scalar, Properties...> const&)
+    ->Min<Scalar, typename View<Scalar, Properties...>::memory_space>;
+
 template <class Scalar, class Space>
 struct Max {
  public:
@@ -234,6 +208,10 @@ struct Max {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Scalar, typename... Properties>
+Max(View<Scalar, Properties...> const&)
+    ->Max<Scalar, typename View<Scalar, Properties...>::memory_space>;
+
 template <class Scalar, class Space>
 struct LAnd {
  public:
@@ -275,6 +253,10 @@ struct LAnd {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Scalar, typename... Properties>
+LAnd(View<Scalar, Properties...> const&)
+    ->LAnd<Scalar, typename View<Scalar, Properties...>::memory_space>;
+
 template <class Scalar, class Space>
 struct LOr {
  public:
@@ -317,6 +299,10 @@ struct LOr {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Scalar, typename... Properties>
+LOr(View<Scalar, Properties...> const&)
+    ->LOr<Scalar, typename View<Scalar, Properties...>::memory_space>;
+
 template <class Scalar, class Space>
 struct BAnd {
  public:
@@ -359,6 +345,10 @@ struct BAnd {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Scalar, typename... Properties>
+BAnd(View<Scalar, Properties...> const&)
+    ->BAnd<Scalar, typename View<Scalar, Properties...>::memory_space>;
+
 template <class Scalar, class Space>
 struct BOr {
  public:
@@ -401,6 +391,10 @@ struct BOr {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Scalar, typename... Properties>
+BOr(View<Scalar, Properties...> const&)
+    ->BOr<Scalar, typename View<Scalar, Properties...>::memory_space>;
+
 template <class Scalar, class Index>
 struct ValLocScalar {
   Scalar val;
@@ -460,6 +454,12 @@ struct MinLoc {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Scalar, typename Index, typename... Properties>
+MinLoc(View<ValLocScalar<Scalar, Index>, Properties...> const&)
+    ->MinLoc<Scalar, Index,
+             typename View<ValLocScalar<Scalar, Index>,
+                           Properties...>::memory_space>;
+
 template <class Scalar, class Index, class Space>
 struct MaxLoc {
  private:
@@ -507,6 +507,12 @@ struct MaxLoc {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Scalar, typename Index, typename... Properties>
+MaxLoc(View<ValLocScalar<Scalar, Index>, Properties...> const&)
+    ->MaxLoc<Scalar, Index,
+             typename View<ValLocScalar<Scalar, Index>,
+                           Properties...>::memory_space>;
+
 template <class Scalar>
 struct MinMaxScalar {
   Scalar min_val, max_val;
@@ -569,6 +575,11 @@ struct MinMax {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Scalar, typename... Properties>
+MinMax(View<MinMaxScalar<Scalar>, Properties...> const&)
+    ->MinMax<Scalar,
+             typename View<MinMaxScalar<Scalar>, Properties...>::memory_space>;
+
 template <class Scalar, class Index>
 struct MinMaxLocScalar {
   Scalar min_val, max_val;
@@ -639,6 +650,12 @@ struct MinMaxLoc {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Scalar, typename Index, typename... Properties>
+MinMaxLoc(View<MinMaxLocScalar<Scalar, Index>, Properties...> const&)
+    ->MinMaxLoc<Scalar, Index,
+                typename View<MinMaxLocScalar<Scalar, Index>,
+                              Properties...>::memory_space>;
+
 // --------------------------------------------------
 // reducers added to support std algorithms
 // --------------------------------------------------
@@ -697,6 +714,12 @@ struct MaxFirstLoc {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Scalar, typename Index, typename... Properties>
+MaxFirstLoc(View<ValLocScalar<Scalar, Index>, Properties...> const&)
+    ->MaxFirstLoc<Scalar, Index,
+                  typename View<ValLocScalar<Scalar, Index>,
+                                Properties...>::memory_space>;
+
 //
 // MaxFirstLocCustomComparator
 // recall that comp(a,b) returns true is a < b
@@ -756,6 +779,14 @@ struct MaxFirstLocCustomComparator {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Scalar, typename Index, typename ComparatorType,
+          typename... Properties>
+MaxFirstLocCustomComparator(
+    View<ValLocScalar<Scalar, Index>, Properties...> const&, ComparatorType)
+    ->MaxFirstLocCustomComparator<Scalar, Index, ComparatorType,
+                                  typename View<ValLocScalar<Scalar, Index>,
+                                                Properties...>::memory_space>;
+
 //
 // MinFirstLoc
 //
@@ -810,6 +841,12 @@ struct MinFirstLoc {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Scalar, typename Index, typename... Properties>
+MinFirstLoc(View<ValLocScalar<Scalar, Index>, Properties...> const&)
+    ->MinFirstLoc<Scalar, Index,
+                  typename View<ValLocScalar<Scalar, Index>,
+                                Properties...>::memory_space>;
+
 //
 // MinFirstLocCustomComparator
 // recall that comp(a,b) returns true is a < b
@@ -869,6 +906,14 @@ struct MinFirstLocCustomComparator {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Scalar, typename Index, typename ComparatorType,
+          typename... Properties>
+MinFirstLocCustomComparator(
+    View<ValLocScalar<Scalar, Index>, Properties...> const&, ComparatorType)
+    ->MinFirstLocCustomComparator<Scalar, Index, ComparatorType,
+                                  typename View<ValLocScalar<Scalar, Index>,
+                                                Properties...>::memory_space>;
+
 //
 // MinMaxFirstLastLoc
 //
@@ -934,6 +979,12 @@ struct MinMaxFirstLastLoc {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Scalar, typename Index, typename... Properties>
+MinMaxFirstLastLoc(View<MinMaxLocScalar<Scalar, Index>, Properties...> const&)
+    ->MinMaxFirstLastLoc<Scalar, Index,
+                         typename View<MinMaxLocScalar<Scalar, Index>,
+                                       Properties...>::memory_space>;
+
 //
 // MinMaxFirstLastLocCustomComparator
 // recall that comp(a,b) returns true is a < b
@@ -1003,6 +1054,15 @@ struct MinMaxFirstLastLocCustomComparator {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Scalar, typename Index, typename ComparatorType,
+          typename... Properties>
+MinMaxFirstLastLocCustomComparator(
+    View<MinMaxLocScalar<Scalar, Index>, Properties...> const&, ComparatorType)
+    ->MinMaxFirstLastLocCustomComparator<
+        Scalar, Index, ComparatorType,
+        typename View<MinMaxLocScalar<Scalar, Index>,
+                      Properties...>::memory_space>;
+
 //
 // FirstLoc
 //
@@ -1061,6 +1121,11 @@ struct FirstLoc {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Index, typename... Properties>
+FirstLoc(View<FirstLocScalar<Index>, Properties...> const&)
+    ->FirstLoc<Index, typename View<FirstLocScalar<Index>,
+                                    Properties...>::memory_space>;
+
 //
 // LastLoc
 //
@@ -1119,6 +1184,11 @@ struct LastLoc {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Index, typename... Properties>
+LastLoc(View<LastLocScalar<Index>, Properties...> const&)
+    ->LastLoc<Index,
+              typename View<LastLocScalar<Index>, Properties...>::memory_space>;
+
 template <class Index>
 struct StdIsPartScalar {
   Index max_loc_true, min_loc_false;
@@ -1186,6 +1256,11 @@ struct StdIsPartitioned {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Index, typename... Properties>
+StdIsPartitioned(View<StdIsPartScalar<Index>, Properties...> const&)
+    ->StdIsPartitioned<Index, typename View<StdIsPartScalar<Index>,
+                                            Properties...>::memory_space>;
+
 template <class Index>
 struct StdPartPointScalar {
   Index min_loc_false;
@@ -1247,6 +1322,11 @@ struct StdPartitionPoint {
   bool references_scalar() const { return references_scalar_v; }
 };
 
+template <typename Index, typename... Properties>
+StdPartitionPoint(View<StdPartPointScalar<Index>, Properties...> const&)
+    ->StdPartitionPoint<Index, typename View<StdPartPointScalar<Index>,
+                                             Properties...>::memory_space>;
+
 }  // namespace Kokkos
 namespace Kokkos {
 namespace Impl {
@@ -1400,19 +1480,6 @@ struct ParallelReduceAdaptor {
           const FunctorType& functor, ReturnType& return_value) {
     execute_impl(label, policy, functor, return_value);
   }
-
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  template <typename Dummy = ReturnType>
-  KOKKOS_DEPRECATED_WITH_COMMENT(
-      "Array reductions with a raw pointer return type are deprecated. Use a "
-      "Kokkos::View as return argument!")
-  static inline std::
-      enable_if_t<is_array_reduction && std::is_pointer<Dummy>::value> execute(
-          const std::string& label, const PolicyType& policy,
-          const FunctorType& functor, ReturnType& return_value) {
-    execute_impl(label, policy, functor, return_value);
-  }
-#endif
 };
 }  // namespace Impl
 
diff --git a/packages/kokkos/core/src/Kokkos_PointerOwnership.hpp b/packages/kokkos/core/src/Kokkos_PointerOwnership.hpp
index 41b18a8d1441dcc0b7f8237c91c1420039a8526a..0132ffb8da5923507304eefd1024d2fa5cf8a7c4 100644
--- a/packages/kokkos/core/src/Kokkos_PointerOwnership.hpp
+++ b/packages/kokkos/core/src/Kokkos_PointerOwnership.hpp
@@ -1,57 +1,25 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // Experimental unified task-data parallel manycore LDRD
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_IMPL_POINTEROWNERSHIP_HPP
 #define KOKKOS_IMPL_POINTEROWNERSHIP_HPP
diff --git a/packages/kokkos/core/src/Kokkos_Profiling_ProfileSection.hpp b/packages/kokkos/core/src/Kokkos_Profiling_ProfileSection.hpp
index 266605c0feca189bf6abbd5a2bc3078dd345cec2..29a04ac3b07ebb2b9676d84128583be1ef948036 100644
--- a/packages/kokkos/core/src/Kokkos_Profiling_ProfileSection.hpp
+++ b/packages/kokkos/core/src/Kokkos_Profiling_ProfileSection.hpp
@@ -1,46 +1,18 @@
-/*
- //@HEADER
- // ************************************************************************
- //
- //                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
- //
- // Under the terms of Contract DE-NA0003525 with NTESS,
- // the U.S. Government retains certain rights in this software.
- //
- // Redistribution and use in source and binary forms, with or without
- // modification, are permitted provided that the following conditions are
- // met:
- //
- // 1. Redistributions of source code must retain the above copyright
- // notice, this list of conditions and the following disclaimer.
- //
- // 2. Redistributions in binary form must reproduce the above copyright
- // notice, this list of conditions and the following disclaimer in the
- // documentation and/or other materials provided with the distribution.
- //
- // 3. Neither the name of the Corporation nor the names of the
- // contributors may be used to endorse or promote products derived from
- // this software without specific prior written permission.
- //
- // THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
- // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
- // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- // 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 Christian R. Trott (crtrott@sandia.gov)
- //
- // ************************************************************************
- //@HEADER
- */
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
 
 #ifndef KOKKOSP_PROFILE_SECTION_HPP
 #define KOKKOSP_PROFILE_SECTION_HPP
@@ -63,11 +35,7 @@ class ProfilingSection {
   ProfilingSection(ProfilingSection const&) = delete;
   ProfilingSection& operator=(ProfilingSection const&) = delete;
 
-  ProfilingSection(const std::string& sectionName)
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-      : secName(sectionName)
-#endif
-  {
+  ProfilingSection(const std::string& sectionName) {
     if (Kokkos::Profiling::profileLibraryLoaded()) {
       Kokkos::Profiling::createProfileSection(sectionName, &secID);
     }
@@ -91,16 +59,7 @@ class ProfilingSection {
     }
   }
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  KOKKOS_DEPRECATED std::string getName() { return secName; }
-
-  KOKKOS_DEPRECATED uint32_t getSectionID() { return secID; }
-#endif
-
  protected:
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  const std::string secName;
-#endif
   uint32_t secID;
 };
 
diff --git a/packages/kokkos/core/src/Kokkos_Rank.hpp b/packages/kokkos/core/src/Kokkos_Rank.hpp
index 025cf511fe90f4d21616449b226e4ef634ee9fe1..7979580275428b5622eef02e87b8c1970ce4b7b6 100644
--- a/packages/kokkos/core/src/Kokkos_Rank.hpp
+++ b/packages/kokkos/core/src/Kokkos_Rank.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_KOKKOS_RANK_HPP
 #define KOKKOS_KOKKOS_RANK_HPP
@@ -66,7 +34,7 @@ struct Rank {
   static_assert(N != 0u, "Kokkos Error: rank 0 undefined");
   static_assert(N != 1u,
                 "Kokkos Error: rank 1 is not a multi-dimensional range");
-  static_assert(N < 7u, "Kokkos Error: Unsupported rank...");
+  static_assert(N < 9u, "Kokkos Error: Unsupported rank...");
 
   using iteration_pattern = Rank<N, OuterDir, InnerDir>;
 
diff --git a/packages/kokkos/core/src/Kokkos_ReductionIdentity.hpp b/packages/kokkos/core/src/Kokkos_ReductionIdentity.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..a6d6eb3232cc032599650de1e3757ea0b424c3f1
--- /dev/null
+++ b/packages/kokkos/core/src/Kokkos_ReductionIdentity.hpp
@@ -0,0 +1,398 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_REDUCTION_IDENTITY_HPP
+#define KOKKOS_REDUCTION_IDENTITY_HPP
+#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
+#define KOKKOS_IMPL_PUBLIC_INCLUDE
+#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_REDUCTION_IDENTITY
+#endif
+
+#include <Kokkos_Macros.hpp>
+#include <cfloat>
+#include <climits>
+
+namespace Kokkos {
+
+template <class T>
+struct reduction_identity; /*{
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static T sum() { return T(); }  // 0
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static T prod()  // 1
+    { static_assert( false, "Missing specialization of
+Kokkos::reduction_identity for custom prod reduction type"); return T(); }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static T max()   // minimum value
+    { static_assert( false, "Missing specialization of
+Kokkos::reduction_identity for custom max reduction type"); return T(); }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static T min()   // maximum value
+    { static_assert( false, "Missing specialization of
+Kokkos::reduction_identity for custom min reduction type"); return T(); }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static T bor()   // 0, only for integer
+type { static_assert( false, "Missing specialization of
+Kokkos::reduction_identity for custom bor reduction type"); return T(); }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static T band()  // !0, only for integer
+type { static_assert( false, "Missing specialization of
+Kokkos::reduction_identity for custom band reduction type"); return T(); }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static T lor()   // 0, only for integer
+type { static_assert( false, "Missing specialization of
+Kokkos::reduction_identity for custom lor reduction type"); return T(); }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static T land()  // !0, only for integer
+type { static_assert( false, "Missing specialization of
+Kokkos::reduction_identity for custom land reduction type"); return T(); }
+};*/
+
+template <>
+struct reduction_identity<char> {
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static char sum() {
+    return static_cast<char>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static char prod() {
+    return static_cast<char>(1);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static char max() { return CHAR_MIN; }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static char min() { return CHAR_MAX; }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static char bor() {
+    return static_cast<char>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static char band() {
+    return ~static_cast<char>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static char lor() {
+    return static_cast<char>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static char land() {
+    return static_cast<char>(1);
+  }
+};
+
+template <>
+struct reduction_identity<signed char> {
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char sum() {
+    return static_cast<signed char>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char prod() {
+    return static_cast<signed char>(1);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char max() {
+    return SCHAR_MIN;
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char min() {
+    return SCHAR_MAX;
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char bor() {
+    return static_cast<signed char>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char band() {
+    return ~static_cast<signed char>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char lor() {
+    return static_cast<signed char>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char land() {
+    return static_cast<signed char>(1);
+  }
+};
+
+template <>
+struct reduction_identity<bool> {
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static bool lor() {
+    return static_cast<bool>(false);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static bool land() {
+    return static_cast<bool>(true);
+  }
+};
+
+template <>
+struct reduction_identity<short> {
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static short sum() {
+    return static_cast<short>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static short prod() {
+    return static_cast<short>(1);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static short max() { return SHRT_MIN; }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static short min() { return SHRT_MAX; }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static short bor() {
+    return static_cast<short>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static short band() {
+    return ~static_cast<short>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static short lor() {
+    return static_cast<short>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static short land() {
+    return static_cast<short>(1);
+  }
+};
+
+template <>
+struct reduction_identity<int> {
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static int sum() {
+    return static_cast<int>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static int prod() {
+    return static_cast<int>(1);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static int max() { return INT_MIN; }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static int min() { return INT_MAX; }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static int bor() {
+    return static_cast<int>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static int band() {
+    return ~static_cast<int>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static int lor() {
+    return static_cast<int>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static int land() {
+    return static_cast<int>(1);
+  }
+};
+
+template <>
+struct reduction_identity<long> {
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static long sum() {
+    return static_cast<long>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static long prod() {
+    return static_cast<long>(1);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static long max() { return LONG_MIN; }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static long min() { return LONG_MAX; }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static long bor() {
+    return static_cast<long>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static long band() {
+    return ~static_cast<long>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static long lor() {
+    return static_cast<long>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static long land() {
+    return static_cast<long>(1);
+  }
+};
+
+template <>
+struct reduction_identity<long long> {
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static long long sum() {
+    return static_cast<long long>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static long long prod() {
+    return static_cast<long long>(1);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static long long max() {
+    return LLONG_MIN;
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static long long min() {
+    return LLONG_MAX;
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static long long bor() {
+    return static_cast<long long>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static long long band() {
+    return ~static_cast<long long>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static long long lor() {
+    return static_cast<long long>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static long long land() {
+    return static_cast<long long>(1);
+  }
+};
+
+template <>
+struct reduction_identity<unsigned char> {
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char sum() {
+    return static_cast<unsigned char>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char prod() {
+    return static_cast<unsigned char>(1);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char max() {
+    return static_cast<unsigned char>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char min() {
+    return UCHAR_MAX;
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char bor() {
+    return static_cast<unsigned char>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char band() {
+    return ~static_cast<unsigned char>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char lor() {
+    return static_cast<unsigned char>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char land() {
+    return static_cast<unsigned char>(1);
+  }
+};
+
+template <>
+struct reduction_identity<unsigned short> {
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short sum() {
+    return static_cast<unsigned short>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short prod() {
+    return static_cast<unsigned short>(1);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short max() {
+    return static_cast<unsigned short>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short min() {
+    return USHRT_MAX;
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short bor() {
+    return static_cast<unsigned short>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short band() {
+    return ~static_cast<unsigned short>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short lor() {
+    return static_cast<unsigned short>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short land() {
+    return static_cast<unsigned short>(1);
+  }
+};
+
+template <>
+struct reduction_identity<unsigned int> {
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int sum() {
+    return static_cast<unsigned int>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int prod() {
+    return static_cast<unsigned int>(1);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int max() {
+    return static_cast<unsigned int>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int min() {
+    return UINT_MAX;
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int bor() {
+    return static_cast<unsigned int>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int band() {
+    return ~static_cast<unsigned int>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int lor() {
+    return static_cast<unsigned int>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int land() {
+    return static_cast<unsigned int>(1);
+  }
+};
+
+template <>
+struct reduction_identity<unsigned long> {
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long sum() {
+    return static_cast<unsigned long>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long prod() {
+    return static_cast<unsigned long>(1);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long max() {
+    return static_cast<unsigned long>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long min() {
+    return ULONG_MAX;
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long bor() {
+    return static_cast<unsigned long>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long band() {
+    return ~static_cast<unsigned long>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long lor() {
+    return static_cast<unsigned long>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long land() {
+    return static_cast<unsigned long>(1);
+  }
+};
+
+template <>
+struct reduction_identity<unsigned long long> {
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long sum() {
+    return static_cast<unsigned long long>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long prod() {
+    return static_cast<unsigned long long>(1);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long max() {
+    return static_cast<unsigned long long>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long min() {
+    return ULLONG_MAX;
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long bor() {
+    return static_cast<unsigned long long>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long band() {
+    return ~static_cast<unsigned long long>(0x0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long lor() {
+    return static_cast<unsigned long long>(0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long land() {
+    return static_cast<unsigned long long>(1);
+  }
+};
+
+template <>
+struct reduction_identity<float> {
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static float sum() {
+    return static_cast<float>(0.0f);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static float prod() {
+    return static_cast<float>(1.0f);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static float max() { return -FLT_MAX; }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static float min() { return FLT_MAX; }
+};
+
+template <>
+struct reduction_identity<double> {
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static double sum() {
+    return static_cast<double>(0.0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static double prod() {
+    return static_cast<double>(1.0);
+  }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static double max() { return -DBL_MAX; }
+  KOKKOS_FORCEINLINE_FUNCTION constexpr static double min() { return DBL_MAX; }
+};
+
+// No __host__ __device__ annotation because long double treated as double in
+// device code.  May be revisited later if that is not true any more.
+template <>
+struct reduction_identity<long double> {
+  constexpr static long double sum() { return static_cast<long double>(0.0); }
+  constexpr static long double prod() { return static_cast<long double>(1.0); }
+  constexpr static long double max() { return -LDBL_MAX; }
+  constexpr static long double min() { return LDBL_MAX; }
+};
+
+}  // namespace Kokkos
+
+#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_REDUCTION_IDENTITY
+#undef KOKKOS_IMPL_PUBLIC_INCLUDE
+#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_REDUCTION_IDENTITY
+#endif
+#endif
diff --git a/packages/kokkos/core/src/Kokkos_SYCL.hpp b/packages/kokkos/core/src/Kokkos_SYCL.hpp
index a7f169606f087628260e502ccc5eebbaf67c9501..0f8e744eb632a2701c6cc53702e4425285e468b3 100644
--- a/packages/kokkos/core/src/Kokkos_SYCL.hpp
+++ b/packages/kokkos/core/src/Kokkos_SYCL.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_SYCL_HPP
 #define KOKKOS_SYCL_HPP
@@ -57,7 +25,12 @@ KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
 #include <Kokkos_Macros.hpp>
 
 #ifdef KOKKOS_ENABLE_SYCL
+// FIXME_SYCL
+#if __has_include(<sycl/sycl.hpp>)
+#include <sycl/sycl.hpp>
+#else
 #include <CL/sycl.hpp>
+#endif
 #include <Kokkos_SYCL_Space.hpp>
 #include <Kokkos_Layout.hpp>
 #include <Kokkos_ScratchSpace.hpp>
@@ -134,11 +107,14 @@ class SYCL {
 
   static void impl_initialize(InitializationSettings const&);
 
-  int sycl_device() const;
-
   static bool impl_is_initialized();
 
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
   static int concurrency();
+#else
+  int concurrency() const;
+#endif
+
   static const char* name();
 
   inline Impl::SYCLInternal* impl_internal_space_instance() const {
@@ -149,6 +125,13 @@ class SYCL {
   static std::ostream& impl_sycl_info(std::ostream& os,
                                       const sycl::device& device);
 
+  friend bool operator==(SYCL const& lhs, SYCL const& rhs) {
+    return lhs.impl_internal_space_instance() ==
+           rhs.impl_internal_space_instance();
+  }
+  friend bool operator!=(SYCL const& lhs, SYCL const& rhs) {
+    return !(lhs == rhs);
+  }
   Kokkos::Impl::HostSharedPtr<Impl::SYCLInternal> m_space_instance;
 };
 
@@ -161,7 +144,7 @@ struct DeviceTypeTraits<Kokkos::Experimental::SYCL> {
   /// \brief An ID to differentiate (for example) Serial from OpenMP in Tooling
   static constexpr DeviceType id = DeviceType::SYCL;
   static int device_id(const Kokkos::Experimental::SYCL& exec) {
-    return exec.sycl_device();
+    return exec.impl_internal_space_instance()->m_syclDev;
   }
 };
 }  // namespace Experimental
@@ -170,11 +153,9 @@ struct DeviceTypeTraits<Kokkos::Experimental::SYCL> {
 namespace Experimental {
 template <class... Args>
 std::vector<SYCL> partition_space(const SYCL& sycl_space, Args...) {
-#ifdef __cpp_fold_expressions
   static_assert(
       (... && std::is_arithmetic_v<Args>),
       "Kokkos Error: partitioning arguments must be integers or floats");
-#endif
 
   sycl::context context = sycl_space.sycl_queue().get_context();
   sycl::device device =
diff --git a/packages/kokkos/core/src/Kokkos_SYCL_Space.hpp b/packages/kokkos/core/src/Kokkos_SYCL_Space.hpp
index e147d04dc86c4415276e192ece1eda20c01110c0..239c6e3ce0b40311cb1d486051f61c9641b771ac 100644
--- a/packages/kokkos/core/src/Kokkos_SYCL_Space.hpp
+++ b/packages/kokkos/core/src/Kokkos_SYCL_Space.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_SYCLSPACE_HPP
 #define KOKKOS_SYCLSPACE_HPP
diff --git a/packages/kokkos/core/src/Kokkos_ScratchSpace.hpp b/packages/kokkos/core/src/Kokkos_ScratchSpace.hpp
index 3e37eb61dcdc59a2ae2556aae0ce04128d0c4e04..a192b77f2802f56f0e7921526d7267c09537036c 100644
--- a/packages/kokkos/core/src/Kokkos_ScratchSpace.hpp
+++ b/packages/kokkos/core/src/Kokkos_ScratchSpace.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_SCRATCHSPACE_HPP
 #define KOKKOS_SCRATCHSPACE_HPP
@@ -73,9 +41,8 @@ class ScratchMemorySpace {
       "Instantiating ScratchMemorySpace on non-execution-space type.");
 
  public:
-  // Alignment of memory chunks returned by 'get'
-  // must be a power of two
-  enum { ALIGN = 8 };
+  // Minimal overalignment used by view scratch allocations
+  constexpr static int ALIGN = 8;
 
  private:
   mutable char* m_iter_L0 = nullptr;
@@ -87,7 +54,9 @@ class ScratchMemorySpace {
   mutable int m_offset        = 0;
   mutable int m_default_level = 0;
 
-  enum { MASK = ALIGN - 1 };  // Alignment used by View::shmem_size
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
+  constexpr static int DEFAULT_ALIGNMENT_MASK = ALIGN - 1;
+#endif
 
  public:
   //! Tag this class as a memory space
@@ -101,39 +70,58 @@ class ScratchMemorySpace {
 
   static constexpr const char* name() { return "ScratchMemorySpace"; }
 
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
+  // This function is unused
   template <typename IntType>
-  KOKKOS_INLINE_FUNCTION static IntType align(const IntType& size) {
-    return (size + MASK) & ~MASK;
+  KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION static constexpr IntType align(
+      const IntType& size) {
+    return (size + DEFAULT_ALIGNMENT_MASK) & ~DEFAULT_ALIGNMENT_MASK;
   }
+#endif
 
   template <typename IntType>
   KOKKOS_INLINE_FUNCTION void* get_shmem(const IntType& size,
                                          int level = -1) const {
-    return get_shmem_common</*aligned*/ false>(size, 1, level);
+    return get_shmem_common</*alignment_requested*/ false>(size, 1, level);
   }
 
   template <typename IntType>
   KOKKOS_INLINE_FUNCTION void* get_shmem_aligned(const IntType& size,
                                                  const ptrdiff_t alignment,
                                                  int level = -1) const {
-    return get_shmem_common</*aligned*/ true>(size, alignment, level);
+    return get_shmem_common</*alignment_requested*/ true>(size, alignment,
+                                                          level);
   }
 
  private:
-  template <bool aligned, typename IntType>
-  KOKKOS_INLINE_FUNCTION void* get_shmem_common(const IntType& size,
-                                                const ptrdiff_t alignment,
-                                                int level = -1) const {
+  template <bool alignment_requested, typename IntType>
+  KOKKOS_INLINE_FUNCTION void* get_shmem_common(
+      const IntType& size, [[maybe_unused]] const ptrdiff_t alignment,
+      int level = -1) const {
     if (level == -1) level = m_default_level;
-    auto& m_iter              = (level == 0) ? m_iter_L0 : m_iter_L1;
-    auto& m_end               = (level == 0) ? m_end_L0 : m_end_L1;
-    char* previous            = m_iter;
-    const ptrdiff_t missalign = size_t(m_iter) % alignment;
-    if (missalign) m_iter += alignment - missalign;
-
-    void* tmp = m_iter + m_offset * (aligned ? size : align(size));
-    if (m_end < (m_iter += (aligned ? size : align(size)) * m_multiplier)) {
-      m_iter = previous;  // put it back like it was
+    auto& m_iter    = (level == 0) ? m_iter_L0 : m_iter_L1;
+    auto m_iter_old = m_iter;
+    if constexpr (alignment_requested) {
+      const ptrdiff_t missalign = size_t(m_iter) % alignment;
+      if (missalign) m_iter += alignment - missalign;
+    }
+
+    // This is each thread's start pointer for its allocation
+    // Note: for team scratch m_offset is 0, since every
+    // thread will get back the same shared pointer
+    void* tmp           = m_iter + m_offset * size;
+    uintptr_t increment = size * m_multiplier;
+
+    // Cast to uintptr_t to avoid problems with pointer arithmetic using SYCL
+    const auto end_iter =
+        reinterpret_cast<uintptr_t>((level == 0) ? m_end_L0 : m_end_L1);
+    auto current_iter = reinterpret_cast<uintptr_t>(m_iter);
+    auto capacity     = end_iter - current_iter;
+
+    if (increment > capacity) {
+      // Request did overflow: return nullptr and reset m_iter
+      m_iter = m_iter_old;
+      tmp    = nullptr;
 #ifdef KOKKOS_ENABLE_DEBUG
       // mfh 23 Jun 2015: printf call consumes 25 registers
       // in a CUDA build, so only print in debug mode.  The
@@ -141,9 +129,10 @@ class ScratchMemorySpace {
       KOKKOS_IMPL_DO_NOT_USE_PRINTF(
           "ScratchMemorySpace<...>::get_shmem: Failed to allocate "
           "%ld byte(s); remaining capacity is %ld byte(s)\n",
-          long(size), long(m_end - m_iter));
+          long(size), long(capacity));
 #endif  // KOKKOS_ENABLE_DEBUG
-      tmp = nullptr;
+    } else {
+      m_iter += increment;
     }
     return tmp;
   }
diff --git a/packages/kokkos/core/src/Kokkos_Serial.hpp b/packages/kokkos/core/src/Kokkos_Serial.hpp
index ffdd1e9fc840595bd73c272ac592a19940f1a000..ede3c96b8bd071941d1d2a993b22157a6725bbc7 100644
--- a/packages/kokkos/core/src/Kokkos_Serial.hpp
+++ b/packages/kokkos/core/src/Kokkos_Serial.hpp
@@ -1,58 +1,26 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /// \file Kokkos_Serial.hpp
 /// \brief Declaration and definition of Kokkos::Serial device.
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_SERIAL_HPP
 #define KOKKOS_SERIAL_HPP
@@ -172,7 +140,11 @@ class Serial {
   }
 
   /** \brief  Return the maximum amount of concurrency.  */
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
   static int concurrency() { return 1; }
+#else
+  int concurrency() const { return 1; }
+#endif
 
   //! Print configuration information to the given output stream.
   void print_configuration(std::ostream& os, bool verbose = false) const;
@@ -203,19 +175,18 @@ class Serial {
   static const char* name();
 
   Impl::SerialInternal* impl_internal_space_instance() const {
-#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS
-    return m_space_instance;
-#else
     return m_space_instance.get();
-#endif
   }
 
  private:
-#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS
-  Impl::SerialInternal* m_space_instance;
-#else
   Kokkos::Impl::HostSharedPtr<Impl::SerialInternal> m_space_instance;
-#endif
+  friend bool operator==(Serial const& lhs, Serial const& rhs) {
+    return lhs.impl_internal_space_instance() ==
+           rhs.impl_internal_space_instance();
+  }
+  friend bool operator!=(Serial const& lhs, Serial const& rhs) {
+    return !(lhs == rhs);
+  }
   //--------------------------------------------------------------------------
 };
 
diff --git a/packages/kokkos/core/src/Kokkos_TaskScheduler.hpp b/packages/kokkos/core/src/Kokkos_TaskScheduler.hpp
index c3453b79e7d38dd696cffb485686b84db601a990..690c845b303316f6e40656eeca363a448e114857 100644
--- a/packages/kokkos/core/src/Kokkos_TaskScheduler.hpp
+++ b/packages/kokkos/core/src/Kokkos_TaskScheduler.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_TASKSCHEDULER_HPP
 #define KOKKOS_TASKSCHEDULER_HPP
diff --git a/packages/kokkos/core/src/Kokkos_TaskScheduler_fwd.hpp b/packages/kokkos/core/src/Kokkos_TaskScheduler_fwd.hpp
index 075a9bae2c1fa60e9615b603692ca5e870972af3..203fb16eaf0b4de3757df42c450bf684d9a547e5 100644
--- a/packages/kokkos/core/src/Kokkos_TaskScheduler_fwd.hpp
+++ b/packages/kokkos/core/src/Kokkos_TaskScheduler_fwd.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_TASKSCHEDULER_FWD_HPP
 #define KOKKOS_TASKSCHEDULER_FWD_HPP
diff --git a/packages/kokkos/core/src/Kokkos_Threads.hpp b/packages/kokkos/core/src/Kokkos_Threads.hpp
index e6dcad54c1409fc81df6679efa7527230705a5e6..db3b771f2b46b779edfa4c29a6b5bd720555184c 100644
--- a/packages/kokkos/core/src/Kokkos_Threads.hpp
+++ b/packages/kokkos/core/src/Kokkos_Threads.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_THREADS_HPP
 #define KOKKOS_THREADS_HPP
@@ -122,7 +90,11 @@ class Threads {
                  "Kokkos::Threads::fence: Unnamed Instance Fence") const;
 
   /** \brief  Return the maximum amount of concurrency.  */
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
   static int concurrency();
+#else
+  int concurrency() const;
+#endif
 
   /// \brief Free any resources being consumed by the device.
   ///
@@ -165,6 +137,9 @@ class Threads {
   static const char* name();
   //@}
   //----------------------------------------
+ private:
+  friend bool operator==(Threads const&, Threads const&) { return true; }
+  friend bool operator!=(Threads const&, Threads const&) { return false; }
 };
 
 namespace Tools {
diff --git a/packages/kokkos/core/src/Kokkos_Timer.hpp b/packages/kokkos/core/src/Kokkos_Timer.hpp
index 38309b0a3e88374abe65169a59369194007e800d..a210b6ff18329eb709243ef688460ddaaf6f2603 100644
--- a/packages/kokkos/core/src/Kokkos_Timer.hpp
+++ b/packages/kokkos/core/src/Kokkos_Timer.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TIMER_HPP
 #define KOKKOS_TIMER_HPP
diff --git a/packages/kokkos/core/src/Kokkos_Tuners.hpp b/packages/kokkos/core/src/Kokkos_Tuners.hpp
index dba602732c957098b5275adaba1c9bfda61a5efe..618401654e74042d8fdcd98a1a7a242f661a7199 100644
--- a/packages/kokkos/core/src/Kokkos_Tuners.hpp
+++ b/packages/kokkos/core/src/Kokkos_Tuners.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_KOKKOS_TUNERS_HPP
 #define KOKKOS_KOKKOS_TUNERS_HPP
diff --git a/packages/kokkos/core/src/Kokkos_UniqueToken.hpp b/packages/kokkos/core/src/Kokkos_UniqueToken.hpp
index 3c58423d37dcdce407a6975b701e75dad3d3f60a..18c714f786b8dae8a7889f1c3f77f7a6c6c5a5b1 100644
--- a/packages/kokkos/core/src/Kokkos_UniqueToken.hpp
+++ b/packages/kokkos/core/src/Kokkos_UniqueToken.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_UNIQUE_TOKEN_HPP
 #define KOKKOS_UNIQUE_TOKEN_HPP
@@ -94,7 +62,7 @@ class UniqueToken {
 };
 
 /// \brief Instance scope UniqueToken allows for a max size other than
-/// execution_space::concurrency()
+/// execution_space().concurrency()
 ///
 /// This object should behave like a ref-counted object, so that when the last
 /// instance is destroyed, resources are free if needed
@@ -111,9 +79,9 @@ class UniqueToken<ExecutionSpace, UniqueTokenScope::Instance>
   /// threads that will attempt to acquire the UniqueToken. This constructor is
   /// most commonly useful when you:
   ///   1) Have a loop bound that may be smaller than
-  ///   execution_space::concurrency().
+  ///   execution_space().concurrency().
   ///   2) Want a per-team unique token in the range [0,
-  ///   execution_space::concurrency() / team_size)
+  ///   execution_space().concurrency() / team_size)
   UniqueToken(size_type max_size, execution_space const& = execution_space());
 };
 
diff --git a/packages/kokkos/core/src/Kokkos_Vectorization.hpp b/packages/kokkos/core/src/Kokkos_Vectorization.hpp
index 4314ea4417e0e61fac9a9cae8b891d099787754f..e9477ae84b98e9e76dfa52030dc901e2082aa4d8 100644
--- a/packages/kokkos/core/src/Kokkos_Vectorization.hpp
+++ b/packages/kokkos/core/src/Kokkos_Vectorization.hpp
@@ -1,57 +1,25 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /// \file Kokkos_Vectorization.hpp
 /// \brief Declaration and definition of Kokkos::Vectorization interface.
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_VECTORIZATION_HPP
 #define KOKKOS_VECTORIZATION_HPP
diff --git a/packages/kokkos/core/src/Kokkos_View.hpp b/packages/kokkos/core/src/Kokkos_View.hpp
index f8dcfc869e195b93f2ed899b89f6f64be62c46e3..85957ba8fa540d88a5786f8328ef0153e2686d0f 100644
--- a/packages/kokkos/core/src/Kokkos_View.hpp
+++ b/packages/kokkos/core/src/Kokkos_View.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_VIEW_HPP
 #define KOKKOS_VIEW_HPP
@@ -67,6 +35,11 @@ KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
 
 #include <impl/Kokkos_Tools.hpp>
 
+#ifdef KOKKOS_ENABLE_IMPL_MDSPAN
+#include <View/MDSpan/Kokkos_MDSpan_Extents.hpp>
+#endif
+#include <Kokkos_MinMaxClamp.hpp>
+
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 
@@ -474,11 +447,9 @@ using is_always_assignable = is_always_assignable_impl<
     std::remove_reference_t<View1>,
     std::remove_const_t<std::remove_reference_t<View2>>>;
 
-#ifdef KOKKOS_ENABLE_CXX17
 template <class T1, class T2>
 inline constexpr bool is_always_assignable_v =
     is_always_assignable<T1, T2>::value;
-#endif
 
 template <class... ViewTDst, class... ViewTSrc>
 constexpr bool is_assignable(const Kokkos::View<ViewTDst...>& dst,
@@ -489,13 +460,8 @@ constexpr bool is_assignable(const Kokkos::View<ViewTDst...>& dst,
       Kokkos::Impl::ViewMapping<DstTraits, SrcTraits,
                                 typename DstTraits::specialize>;
 
-#ifdef KOKKOS_ENABLE_CXX17
   return is_always_assignable_v<Kokkos::View<ViewTDst...>,
                                 Kokkos::View<ViewTSrc...>> ||
-#else
-  return is_always_assignable<Kokkos::View<ViewTDst...>,
-                              Kokkos::View<ViewTSrc...>>::value ||
-#endif
          (mapping_type::is_assignable &&
           ((DstTraits::dimension::rank_dynamic >= 1) ||
            (dst.static_extent(0) == src.extent(0))) &&
@@ -596,6 +562,9 @@ struct is_view<View<D, P...>> : public std::true_type {};
 template <class D, class... P>
 struct is_view<const View<D, P...>> : public std::true_type {};
 
+template <class T>
+inline constexpr bool is_view_v = is_view<T>::value;
+
 template <class DataType, class... Properties>
 class View : public ViewTraits<DataType, Properties...> {
  private:
@@ -1399,9 +1368,6 @@ class View : public ViewTraits<DataType, Properties...> {
         .template get_label<typename traits::memory_space>();
   }
 
- private:
-  enum class check_input_args : bool { yes = true, no = false };
-
  public:
   //----------------------------------------
   // Allocation according to allocation properties and array layout
@@ -1410,25 +1376,16 @@ class View : public ViewTraits<DataType, Properties...> {
   explicit inline View(
       const Impl::ViewCtorProp<P...>& arg_prop,
       std::enable_if_t<!Impl::ViewCtorProp<P...>::has_pointer,
-                       typename traits::array_layout> const& arg_layout,
-      check_input_args check_args = check_input_args::no)
+                       typename traits::array_layout> const& arg_layout)
       : m_track(), m_map() {
-    // Append layout and spaces if not input
-    using alloc_prop_input = Impl::ViewCtorProp<P...>;
-
-    // use 'std::integral_constant<unsigned,I>' for non-types
-    // to avoid duplicate class error.
-    using alloc_prop = Impl::ViewCtorProp<
-        P...,
-        std::conditional_t<alloc_prop_input::has_label,
-                           std::integral_constant<unsigned int, 0>,
-                           std::string>,
-        std::conditional_t<alloc_prop_input::has_memory_space,
-                           std::integral_constant<unsigned int, 1>,
-                           typename traits::device_type::memory_space>,
-        std::conditional_t<alloc_prop_input::has_execution_space,
-                           std::integral_constant<unsigned int, 2>,
-                           typename traits::device_type::execution_space>>;
+    // Copy the input allocation properties with possibly defaulted properties
+    // We need to split it in two to avoid MSVC compiler errors
+    auto prop_copy_tmp =
+        Impl::with_properties_if_unset(arg_prop, std::string{});
+    auto prop_copy = Impl::with_properties_if_unset(
+        prop_copy_tmp, typename traits::device_type::memory_space{},
+        typename traits::device_type::execution_space{});
+    using alloc_prop = decltype(prop_copy);
 
     static_assert(traits::is_managed,
                   "View allocation constructor requires managed memory");
@@ -1442,28 +1399,21 @@ class View : public ViewTraits<DataType, Properties...> {
           "execution space");
     }
 
-    // Copy the input allocation properties with possibly defaulted properties
-    alloc_prop prop_copy(arg_prop);
-
-    if (check_args == check_input_args::yes) {
-      size_t i0 = arg_layout.dimension[0];
-      size_t i1 = arg_layout.dimension[1];
-      size_t i2 = arg_layout.dimension[2];
-      size_t i3 = arg_layout.dimension[3];
-      size_t i4 = arg_layout.dimension[4];
-      size_t i5 = arg_layout.dimension[5];
-      size_t i6 = arg_layout.dimension[6];
-      size_t i7 = arg_layout.dimension[7];
-
-      const std::string& alloc_name =
-          static_cast<Kokkos::Impl::ViewCtorProp<void, std::string> const&>(
-              prop_copy)
-              .value;
-      Impl::runtime_check_rank(
-          traits::rank, traits::rank_dynamic,
-          std::is_same<typename traits::specialize, void>::value, i0, i1, i2,
-          i3, i4, i5, i6, i7, alloc_name);
-    }
+    size_t i0 = arg_layout.dimension[0];
+    size_t i1 = arg_layout.dimension[1];
+    size_t i2 = arg_layout.dimension[2];
+    size_t i3 = arg_layout.dimension[3];
+    size_t i4 = arg_layout.dimension[4];
+    size_t i5 = arg_layout.dimension[5];
+    size_t i6 = arg_layout.dimension[6];
+    size_t i7 = arg_layout.dimension[7];
+
+    const std::string& alloc_name =
+        Impl::get_property<Impl::LabelTag>(prop_copy);
+    Impl::runtime_check_rank(
+        traits::rank, traits::rank_dynamic,
+        std::is_same<typename traits::specialize, void>::value, i0, i1, i2, i3,
+        i4, i5, i6, i7, alloc_name);
 
 //------------------------------------------------------------
 #if defined(KOKKOS_ENABLE_CUDA)
@@ -1508,8 +1458,7 @@ class View : public ViewTraits<DataType, Properties...> {
   explicit KOKKOS_INLINE_FUNCTION View(
       const Impl::ViewCtorProp<P...>& arg_prop,
       std::enable_if_t<Impl::ViewCtorProp<P...>::has_pointer,
-                       typename traits::array_layout> const& arg_layout,
-      check_input_args /*ignored*/ = check_input_args::no)  // Not checking
+                       typename traits::array_layout> const& arg_layout)
       : m_track()  // No memory tracking
         ,
         m_map(arg_prop, arg_layout) {
@@ -1535,8 +1484,7 @@ class View : public ViewTraits<DataType, Properties...> {
       const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG)
       : View(arg_prop,
              typename traits::array_layout(arg_N0, arg_N1, arg_N2, arg_N3,
-                                           arg_N4, arg_N5, arg_N6, arg_N7),
-             check_input_args::yes) {
+                                           arg_N4, arg_N5, arg_N6, arg_N7)) {
     static_assert(traits::array_layout::is_extent_constructible,
                   "Layout is not constructible from extent arguments. Use "
                   "overload taking a layout object instead.");
@@ -1556,8 +1504,7 @@ class View : public ViewTraits<DataType, Properties...> {
       const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG)
       : View(arg_prop,
              typename traits::array_layout(arg_N0, arg_N1, arg_N2, arg_N3,
-                                           arg_N4, arg_N5, arg_N6, arg_N7),
-             check_input_args::yes) {
+                                           arg_N4, arg_N5, arg_N6, arg_N7)) {
     static_assert(traits::array_layout::is_extent_constructible,
                   "Layout is not constructible from extent arguments. Use "
                   "overload taking a layout object instead.");
@@ -1569,8 +1516,7 @@ class View : public ViewTraits<DataType, Properties...> {
       const Label& arg_label,
       std::enable_if_t<Kokkos::Impl::is_view_label<Label>::value,
                        typename traits::array_layout> const& arg_layout)
-      : View(Impl::ViewCtorProp<std::string>(arg_label), arg_layout,
-             check_input_args::yes) {}
+      : View(Impl::ViewCtorProp<std::string>(arg_label), arg_layout) {}
 
   // Allocate label and layout, must disambiguate from subview constructor.
   template <typename Label>
@@ -1587,8 +1533,7 @@ class View : public ViewTraits<DataType, Properties...> {
       const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG)
       : View(Impl::ViewCtorProp<std::string>(arg_label),
              typename traits::array_layout(arg_N0, arg_N1, arg_N2, arg_N3,
-                                           arg_N4, arg_N5, arg_N6, arg_N7),
-             check_input_args::yes) {
+                                           arg_N4, arg_N5, arg_N6, arg_N7)) {
     static_assert(traits::array_layout::is_extent_constructible,
                   "Layout is not constructible from extent arguments. Use "
                   "overload taking a layout object instead.");
@@ -1653,8 +1598,7 @@ class View : public ViewTraits<DataType, Properties...> {
       const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG)
       : View(Impl::ViewCtorProp<pointer_type>(arg_ptr),
              typename traits::array_layout(arg_N0, arg_N1, arg_N2, arg_N3,
-                                           arg_N4, arg_N5, arg_N6, arg_N7),
-             check_input_args::yes) {
+                                           arg_N4, arg_N5, arg_N6, arg_N7)) {
     static_assert(traits::array_layout::is_extent_constructible,
                   "Layout is not constructible from extent arguments. Use "
                   "overload taking a layout object instead.");
@@ -1692,19 +1636,27 @@ class View : public ViewTraits<DataType, Properties...> {
         arg_N0, arg_N1, arg_N2, arg_N3, arg_N4, arg_N5, arg_N6, arg_N7));
   }
 
+ private:
+  // Want to be able to align to minimum scratch alignment or sizeof or alignof
+  // elements
+  static constexpr size_t scratch_value_alignment =
+      max({sizeof(typename traits::value_type),
+           alignof(typename traits::value_type),
+           static_cast<size_t>(
+               traits::execution_space::scratch_memory_space::ALIGN)});
+
+ public:
   static KOKKOS_INLINE_FUNCTION size_t
   shmem_size(typename traits::array_layout const& arg_layout) {
-    return map_type::memory_span(arg_layout) +
-           sizeof(typename traits::value_type);
+    return map_type::memory_span(arg_layout) + scratch_value_alignment;
   }
 
   explicit KOKKOS_INLINE_FUNCTION View(
       const typename traits::execution_space::scratch_memory_space& arg_space,
       const typename traits::array_layout& arg_layout)
-      : View(Impl::ViewCtorProp<pointer_type>(
-                 reinterpret_cast<pointer_type>(arg_space.get_shmem_aligned(
-                     map_type::memory_span(arg_layout),
-                     sizeof(typename traits::value_type)))),
+      : View(Impl::ViewCtorProp<pointer_type>(reinterpret_cast<pointer_type>(
+                 arg_space.get_shmem_aligned(map_type::memory_span(arg_layout),
+                                             scratch_value_alignment))),
              arg_layout) {}
 
   explicit KOKKOS_INLINE_FUNCTION View(
@@ -1722,10 +1674,9 @@ class View : public ViewTraits<DataType, Properties...> {
                      map_type::memory_span(typename traits::array_layout(
                          arg_N0, arg_N1, arg_N2, arg_N3, arg_N4, arg_N5, arg_N6,
                          arg_N7)),
-                     sizeof(typename traits::value_type)))),
+                     scratch_value_alignment))),
              typename traits::array_layout(arg_N0, arg_N1, arg_N2, arg_N3,
-                                           arg_N4, arg_N5, arg_N6, arg_N7),
-             check_input_args::yes) {
+                                           arg_N4, arg_N5, arg_N6, arg_N7)) {
     static_assert(traits::array_layout::is_extent_constructible,
                   "Layout is not constructible from extent arguments. Use "
                   "overload taking a layout object instead.");
@@ -1983,18 +1934,6 @@ KOKKOS_INLINE_FUNCTION DeducedCommonPropsType<Views...> common_view_alloc_prop(
 
 }  // namespace Kokkos
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-namespace Kokkos {
-namespace Impl {
-
-template <class T>
-using is_view KOKKOS_DEPRECATED_WITH_COMMENT("Use Kokkos::is_view instead!") =
-    Kokkos::is_view<T>;
-
-} /* namespace Impl */
-} /* namespace Kokkos */
-#endif
-
 #include <impl/Kokkos_ViewUniformType.hpp>
 #include <impl/Kokkos_Atomic_View.hpp>
 
diff --git a/packages/kokkos/core/src/Kokkos_WorkGraphPolicy.hpp b/packages/kokkos/core/src/Kokkos_WorkGraphPolicy.hpp
index 129a489387a46297bdd5ce17d3ad7873cbc1c80b..efa56a086e36ceafae0ce05b22b30b49c7d41d2c 100644
--- a/packages/kokkos/core/src/Kokkos_WorkGraphPolicy.hpp
+++ b/packages/kokkos/core/src/Kokkos_WorkGraphPolicy.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_WORKGRAPHPOLICY_HPP
 #define KOKKOS_WORKGRAPHPOLICY_HPP
diff --git a/packages/kokkos/core/src/Kokkos_hwloc.hpp b/packages/kokkos/core/src/Kokkos_hwloc.hpp
index abbec5409e067fae0bce73d3fb37d705a1a421aa..fbf9c137e634b4b4120c8145b5551bbf8692e2f3 100644
--- a/packages/kokkos/core/src/Kokkos_hwloc.hpp
+++ b/packages/kokkos/core/src/Kokkos_hwloc.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 #ifndef KOKKOS_HWLOC_HPP
 #define KOKKOS_HWLOC_HPP
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC.cpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC.cpp
index f3216095be34b3898124637123ee2cac6cbc25fa..f54c44d66f01b6f13db5aecbb6d7ab783650aed3 100644
--- a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC.cpp
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC.cpp
@@ -1,80 +1,95 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
 
 #include <OpenACC/Kokkos_OpenACC.hpp>
 #include <OpenACC/Kokkos_OpenACC_Instance.hpp>
+#include <OpenACC/Kokkos_OpenACC_Traits.hpp>
 #include <impl/Kokkos_Profiling.hpp>
 #include <impl/Kokkos_ExecSpaceManager.hpp>
+#include <impl/Kokkos_DeviceManagement.hpp>
 
-#include <ostream>
+#include <iostream>
 
 Kokkos::Experimental::OpenACC::OpenACC()
-    : m_space_instance(Impl::OpenACCInternal::singleton()) {}
+    : m_space_instance(
+          &Kokkos::Experimental::Impl::OpenACCInternal::singleton(),
+          [](Impl::OpenACCInternal*) {}) {
+  Impl::OpenACCInternal::singleton().verify_is_initialized(
+      "OpenACC instance constructor");
+}
+
+Kokkos::Experimental::OpenACC::OpenACC(int async_arg)
+    : m_space_instance(new Kokkos::Experimental::Impl::OpenACCInternal,
+                       [](Impl::OpenACCInternal* ptr) {
+                         ptr->finalize();
+                         delete ptr;
+                       }) {
+  Impl::OpenACCInternal::singleton().verify_is_initialized(
+      "OpenACC instance constructor");
+  m_space_instance->initialize(async_arg);
+}
 
 void Kokkos::Experimental::OpenACC::impl_initialize(
     InitializationSettings const& settings) {
-  Impl::OpenACCInternal::singleton()->initialize(settings);
+  if (Impl::OpenACC_Traits::may_fallback_to_host &&
+      acc_get_num_devices(Impl::OpenACC_Traits::dev_type) == 0 &&
+      !settings.has_device_id()) {
+    if (show_warnings()) {
+      std::cerr << "Warning: No GPU available for execution, falling back to"
+                   " using the host!"
+                << std::endl;
+    }
+    acc_set_device_type(acc_device_host);
+    Impl::OpenACCInternal::m_acc_device_num =
+        acc_get_device_num(acc_device_host);
+  } else {
+    using Kokkos::Impl::get_gpu;
+    int const dev_num = get_gpu(settings);
+    acc_set_device_num(dev_num, Impl::OpenACC_Traits::dev_type);
+    Impl::OpenACCInternal::m_acc_device_num = dev_num;
+  }
+  Impl::OpenACCInternal::singleton().initialize();
 }
 
 void Kokkos::Experimental::OpenACC::impl_finalize() {
-  Impl::OpenACCInternal::singleton()->finalize();
+  Impl::OpenACCInternal::singleton().finalize();
 }
 
 bool Kokkos::Experimental::OpenACC::impl_is_initialized() {
-  return Impl::OpenACCInternal::singleton()->is_initialized();
+  return Impl::OpenACCInternal::singleton().is_initialized();
 }
 
 void Kokkos::Experimental::OpenACC::print_configuration(std::ostream& os,
                                                         bool verbose) const {
-  os << "macro KOKKOS_ENABLE_OPENACC is defined\n";  // FIXME_OPENACC
+  os << "Device Execution Space:\n";
+  os << "  KOKKOS_ENABLE_OPENACC: yes\n";
+  os << "OpenACC Options:\n";
+  os << "  KOKKOS_ENABLE_OPENACC_COLLAPSE_HIERARCHICAL_CONSTRUCTS: ";
+#ifdef KOKKOS_ENABLE_OPENACC_COLLAPSE_HIERARCHICAL_CONSTRUCTS
+  os << "yes\n";
+#else
+  os << "no\n";
+#endif
   m_space_instance->print_configuration(os, verbose);
 }
 
 void Kokkos::Experimental::OpenACC::fence(std::string const& name) const {
-  Impl::OpenACCInternal::singleton()->fence(name);
+  m_space_instance->fence(name);
 }
 
 void Kokkos::Experimental::OpenACC::impl_static_fence(std::string const& name) {
@@ -90,6 +105,14 @@ uint32_t Kokkos::Experimental::OpenACC::impl_instance_id() const noexcept {
   return m_space_instance->instance_id();
 }
 
+int Kokkos::Experimental::OpenACC::acc_async_queue() const {
+  return m_space_instance->m_async_arg;
+}
+
+int Kokkos::Experimental::OpenACC::acc_device_number() const {
+  return Impl::OpenACCInternal::m_acc_device_num;
+}
+
 namespace Kokkos {
 namespace Impl {
 int g_openacc_space_factory_initialized =
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC.hpp
index 3ad59057b5158772e14e94e0a4cd216d1236451b..a115bc90f886ee7f406f4c8c01849ab10497f5ef 100644
--- a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC.hpp
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC.hpp
@@ -1,55 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 
 #ifndef KOKKOS_OPENACC_HPP
@@ -62,12 +30,17 @@ KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
 #include <impl/Kokkos_InitializationSettings.hpp>
 #include <impl/Kokkos_Profiling_Interface.hpp>
 #include <OpenACC/Kokkos_OpenACC_Traits.hpp>
+#include <impl/Kokkos_HostSharedPtr.hpp>
 
 #include <openacc.h>
 
 #include <iosfwd>
 #include <string>
 
+// FIXME_OPENACC: Below macro is temporarily enabled to avoid issues on existing
+// OpenACC compilers not supporting lambda with parallel loops.
+#define KOKKOS_ENABLE_OPENACC_COLLAPSE_HIERARCHICAL_CONSTRUCTS
+
 namespace Kokkos::Experimental::Impl {
 class OpenACCInternal;
 }
@@ -75,7 +48,15 @@ class OpenACCInternal;
 namespace Kokkos::Experimental {
 
 class OpenACC {
-  Impl::OpenACCInternal* m_space_instance = nullptr;
+  Kokkos::Impl::HostSharedPtr<Impl::OpenACCInternal> m_space_instance;
+
+  friend bool operator==(OpenACC const& lhs, OpenACC const& rhs) {
+    return lhs.impl_internal_space_instance() ==
+           rhs.impl_internal_space_instance();
+  }
+  friend bool operator!=(OpenACC const& lhs, OpenACC const& rhs) {
+    return !(lhs == rhs);
+  }
 
  public:
   using execution_space = OpenACC;
@@ -89,6 +70,8 @@ class OpenACC {
 
   OpenACC();
 
+  explicit OpenACC(int async_arg);
+
   static void impl_initialize(InitializationSettings const& settings);
   static void impl_finalize();
   static bool impl_is_initialized();
@@ -100,9 +83,19 @@ class OpenACC {
   static void impl_static_fence(std::string const& name);
 
   static char const* name() { return "OpenACC"; }
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
   static int concurrency() { return 256000; }  // FIXME_OPENACC
+#else
+  int concurrency() const { return 256000; }  // FIXME_OPENACC
+#endif
   static bool in_parallel() { return acc_on_device(acc_device_not_host); }
   uint32_t impl_instance_id() const noexcept;
+  Impl::OpenACCInternal* impl_internal_space_instance() const {
+    return m_space_instance.get();
+  }
+
+  int acc_async_queue() const;
+  int acc_device_number() const;
 };
 
 }  // namespace Kokkos::Experimental
@@ -112,14 +105,8 @@ struct Kokkos::Tools::Experimental::DeviceTypeTraits<
     ::Kokkos::Experimental::OpenACC> {
   static constexpr DeviceType id =
       ::Kokkos::Profiling::Experimental::DeviceType::OpenACC;
-  // FIXME_OPENACC: Need to return the device id from the execution space
-  // instance. In fact, acc_get_device_num() will return the same value as the
-  // device id from the execution space instance except for the host fallback
-  // case, where the device id may need to be updated with the value of
-  // acc_get_device_num().
-  static int device_id(const Kokkos::Experimental::OpenACC&) {
-    using Kokkos::Experimental::Impl::OpenACC_Traits;
-    return acc_get_device_num(OpenACC_Traits::dev_type);
+  static int device_id(const Kokkos::Experimental::OpenACC& accInstance) {
+    return accInstance.acc_device_number();
   }
 };
 
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACCSpace.cpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACCSpace.cpp
index bc2ba181562927bfa9154a7f584080384ed177ca..141ec77fd1f01187b61b4cb60041714654580632 100644
--- a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACCSpace.cpp
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACCSpace.cpp
@@ -1,58 +1,29 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
 
 #include <OpenACC/Kokkos_OpenACC.hpp>
 #include <OpenACC/Kokkos_OpenACCSpace.hpp>
+#include <OpenACC/Kokkos_OpenACC_DeepCopy.hpp>
 #include <impl/Kokkos_MemorySpace.hpp>
 #include <impl/Kokkos_Profiling_Interface.hpp>
 
 #include <openacc.h>
 
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
 void *Kokkos::Experimental::OpenACCSpace::allocate(
     const Kokkos::Experimental::OpenACC &exec_space,
     const size_t arg_alloc_size) const {
@@ -80,24 +51,8 @@ void *Kokkos::Experimental::OpenACCSpace::impl_allocate(
     const Kokkos::Experimental::OpenACC &exec_space, const char *arg_label,
     const size_t arg_alloc_size, const size_t arg_logical_size,
     const Kokkos::Tools::SpaceHandle arg_handle) const {
-  static_assert(sizeof(void *) == sizeof(uintptr_t),
-                "Error sizeof(void*) != sizeof(uintptr_t)");
-
-  void *ptr = nullptr;
-
-  // FIXME_OPENACC multiple device instances are not yet supported, and thus
-  // exec_space is ignored for now.
   (void)exec_space;
-
-  ptr = acc_malloc(arg_alloc_size);
-
-  if (Kokkos::Profiling::profileLibraryLoaded()) {
-    const size_t reported_size =
-        (arg_logical_size > 0) ? arg_logical_size : arg_alloc_size;
-    Kokkos::Profiling::allocateData(arg_handle, arg_label, ptr, reported_size);
-  }
-
-  return ptr;
+  return impl_allocate(arg_label, arg_alloc_size, arg_logical_size, arg_handle);
 }
 
 void *Kokkos::Experimental::OpenACCSpace::impl_allocate(
@@ -109,21 +64,8 @@ void *Kokkos::Experimental::OpenACCSpace::impl_allocate(
 
   void *ptr = nullptr;
 
-  //[DEBUG] Disabled due to the synchronous behavior of the current
-  // implementation.
-  /*
-    OpenACC::impl_static_fence(
-        "Kokkos::OpenACCSpace::impl_allocate: Pre OpenACC Allocation");
-  */
-
   ptr = acc_malloc(arg_alloc_size);
 
-  //[DEBUG] Disabled due to the synchronous behavior of the current
-  // implementation.
-  /*
-    OpenACC::impl_static_fence(
-        "Kokkos::OpenACCSpace::impl_allocate: Post OpenACC Allocation");
-  */
   if (Kokkos::Profiling::profileLibraryLoaded()) {
     const size_t reported_size =
         (arg_logical_size > 0) ? arg_logical_size : arg_alloc_size;
@@ -159,64 +101,3 @@ void Kokkos::Experimental::OpenACCSpace::impl_deallocate(
     acc_free(arg_alloc_ptr);
   }
 }
-
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
-
-#ifdef KOKKOS_ENABLE_DEBUG
-Kokkos::Impl::SharedAllocationRecord<void, void> SharedAllocationRecord<
-    Kokkos::Experimental::OpenACCSpace, void>::s_root_record;
-#endif
-
-Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace,
-                                     void>::~SharedAllocationRecord() {
-  m_space.deallocate(m_label.c_str(),
-                     SharedAllocationRecord<void, void>::m_alloc_ptr,
-                     (SharedAllocationRecord<void, void>::m_alloc_size -
-                      sizeof(SharedAllocationHeader)));
-}
-
-Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace, void>::
-    SharedAllocationRecord(
-        const Kokkos::Experimental::OpenACCSpace &arg_space,
-        const std::string &arg_label, const size_t arg_alloc_size,
-        const SharedAllocationRecord<void, void>::function_type arg_dealloc)
-    // Pass through allocated [ SharedAllocationHeader , user_memory ]
-    // Pass through deallocation function
-    : base_t(
-#ifdef KOKKOS_ENABLE_DEBUG
-          &SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace,
-                                  void>::s_root_record,
-#endif
-          Impl::checked_allocation_with_header(arg_space, arg_label,
-                                               arg_alloc_size),
-          sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc,
-          arg_label),
-      m_space(arg_space) {
-  SharedAllocationHeader header;
-
-  this->base_t::_fill_host_accessible_header_info(header, arg_label);
-
-  Kokkos::Impl::DeepCopy<Experimental::OpenACCSpace, HostSpace>(
-      RecordBase::m_alloc_ptr, &header, sizeof(SharedAllocationHeader));
-  Kokkos::fence(
-      "SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace, "
-      "void>::SharedAllocationRecord(): fence after copying header from "
-      "HostSpace");
-}
-
-//==============================================================================
-// <editor-fold desc="Explicit instantiations of CRTP Base classes"> {{{1
-
-#include <impl/Kokkos_SharedAlloc_timpl.hpp>
-
-// To avoid additional compilation cost for something that's (mostly?) not
-// performance sensitive, we explicitly instantiate these CRTP base classes
-// here, where we have access to the associated *_timpl.hpp header files.
-template class Kokkos::Impl::HostInaccessibleSharedAllocationRecordCommon<
-    Kokkos::Experimental::OpenACCSpace>;
-template class Kokkos::Impl::SharedAllocationRecordCommon<
-    Kokkos::Experimental::OpenACCSpace>;
-
-// </editor-fold> end Explicit instantiations of CRTP Base classes }}}1
-//==============================================================================
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACCSpace.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACCSpace.hpp
index a7347e8f91d111dcd6d24eb06c54c9181874903e..4e7170cbbdf350e05e6a36ae77ab2f683d367076 100644
--- a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACCSpace.hpp
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACCSpace.hpp
@@ -1,64 +1,30 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
 static_assert(false,
               "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
 #endif
 
 #ifndef KOKKOS_OPENACC_SPACE_HPP
 #define KOKKOS_OPENACC_SPACE_HPP
 
 #include <Kokkos_Concepts.hpp>
-
 #include <impl/Kokkos_Tools.hpp>
-#include <impl/Kokkos_SharedAlloc.hpp>
 
 #include <openacc.h>
 #include <iosfwd>
@@ -141,109 +107,4 @@ struct Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::OpenACCSpace,
 };
 /*--------------------------------------------------------------------------*/
 
-template <>
-class Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace,
-                                           void>
-    : public HostInaccessibleSharedAllocationRecordCommon<
-          Kokkos::Experimental::OpenACCSpace> {
- private:
-  friend class HostInaccessibleSharedAllocationRecordCommon<
-      Kokkos::Experimental::OpenACCSpace>;
-  friend class SharedAllocationRecordCommon<Kokkos::Experimental::OpenACCSpace>;
-  friend Kokkos::Experimental::OpenACCSpace;
-
-  using base_t = HostInaccessibleSharedAllocationRecordCommon<
-      Kokkos::Experimental::OpenACCSpace>;
-  using RecordBase = SharedAllocationRecord<void, void>;
-
-  SharedAllocationRecord(const SharedAllocationRecord&) = delete;
-  SharedAllocationRecord& operator=(const SharedAllocationRecord&) = delete;
-
-  /**\brief  Root record for tracked allocations from this OpenACCSpace
-   * instance */
-  static RecordBase s_root_record;
-
-  const Kokkos::Experimental::OpenACCSpace m_space;
-
- protected:
-  ~SharedAllocationRecord();
-  SharedAllocationRecord() = default;
-
-  template <typename ExecutionSpace>
-  SharedAllocationRecord(
-      const ExecutionSpace& /*exec_space*/,
-      const Kokkos::Experimental::OpenACCSpace& arg_space,
-      const std::string& arg_label, const size_t arg_alloc_size,
-      const RecordBase::function_type arg_dealloc = &deallocate)
-      : SharedAllocationRecord(arg_space, arg_label, arg_alloc_size,
-                               arg_dealloc) {}
-
-  SharedAllocationRecord(
-      const Kokkos::Experimental::OpenACCSpace& arg_space,
-      const std::string& arg_label, const size_t arg_alloc_size,
-      const RecordBase::function_type arg_dealloc = &deallocate);
-
- public:
-  KOKKOS_INLINE_FUNCTION static SharedAllocationRecord* allocate(
-      const Kokkos::Experimental::OpenACCSpace& arg_space,
-      const std::string& arg_label, const size_t arg_alloc_size) {
-    if (acc_on_device(acc_device_host)) {
-      return new SharedAllocationRecord(arg_space, arg_label, arg_alloc_size);
-    } else {
-      return nullptr;
-    }
-  }
-};
-
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
-
-// FIXME_OPENACC: Need to update the DeepCopy implementations below to support
-// multiple execution space instances.
-// The current OpenACC backend implementation assumes that there is only one
-// device execution space instance, and all the device operations (e.g., memory
-// transfers, kernel launches, etc.) are implemented to be synchronous, which
-// does not violate the Kokkos execution semantics with the single execution
-// space instance.
-template <class ExecutionSpace>
-struct Kokkos::Impl::DeepCopy<Kokkos::Experimental::OpenACCSpace,
-                              Kokkos::Experimental::OpenACCSpace,
-                              ExecutionSpace> {
-  DeepCopy(void* dst, const void* src, size_t n) {
-    // The behavior of acc_memcpy_device when bytes argument is zero is
-    // clarified only in the latest OpenACC specification (V3.2), and thus the
-    // value checking is added as a safeguard. (The current NVHPC (V22.5)
-    // supports OpenACC V2.7.)
-    if (n > 0) acc_memcpy_device(dst, const_cast<void*>(src), n);
-  }
-  DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, size_t n) {
-    exec.fence();
-    if (n > 0) acc_memcpy_device(dst, const_cast<void*>(src), n);
-  }
-};
-
-template <class ExecutionSpace>
-struct Kokkos::Impl::DeepCopy<Kokkos::Experimental::OpenACCSpace,
-                              Kokkos::HostSpace, ExecutionSpace> {
-  DeepCopy(void* dst, const void* src, size_t n) {
-    if (n > 0) acc_memcpy_to_device(dst, const_cast<void*>(src), n);
-  }
-  DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, size_t n) {
-    exec.fence();
-    if (n > 0) acc_memcpy_to_device(dst, const_cast<void*>(src), n);
-  }
-};
-
-template <class ExecutionSpace>
-struct Kokkos::Impl::DeepCopy<
-    Kokkos::HostSpace, Kokkos::Experimental::OpenACCSpace, ExecutionSpace> {
-  DeepCopy(void* dst, const void* src, size_t n) {
-    if (n > 0) acc_memcpy_from_device(dst, const_cast<void*>(src), n);
-  }
-  DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, size_t n) {
-    exec.fence();
-    if (n > 0) acc_memcpy_from_device(dst, const_cast<void*>(src), n);
-  }
-};
-
 #endif
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_DeepCopy.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_DeepCopy.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..4aed7e00f7651eeeba9b2ab9d87c7ccbdb766488
--- /dev/null
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_DeepCopy.hpp
@@ -0,0 +1,135 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_OPENACC_DEEP_COPY_HPP
+#define KOKKOS_OPENACC_DEEP_COPY_HPP
+
+#include <OpenACC/Kokkos_OpenACC.hpp>
+#include <OpenACC/Kokkos_OpenACCSpace.hpp>
+
+#include <Kokkos_Concepts.hpp>
+
+#include <openacc.h>
+
+template <>
+struct Kokkos::Impl::DeepCopy<Kokkos::Experimental::OpenACCSpace,
+                              Kokkos::Experimental::OpenACCSpace,
+                              Kokkos::Experimental::OpenACC> {
+  DeepCopy(void* dst, const void* src, size_t n) {
+    // The behavior of acc_memcpy_device when bytes argument is zero is
+    // clarified only in the latest OpenACC specification (V3.2), and thus the
+    // value checking is added as a safeguard. (The current NVHPC (V22.5)
+    // supports OpenACC V2.7.)
+    if (n > 0) {
+      acc_memcpy_device(dst, const_cast<void*>(src), n);
+    }
+  }
+  DeepCopy(const Kokkos::Experimental::OpenACC& exec, void* dst,
+           const void* src, size_t n) {
+    if (n > 0) {
+      acc_memcpy_device_async(dst, const_cast<void*>(src), n,
+                              exec.acc_async_queue());
+    }
+  }
+};
+
+template <class ExecutionSpace>
+struct Kokkos::Impl::DeepCopy<Kokkos::Experimental::OpenACCSpace,
+                              Kokkos::Experimental::OpenACCSpace,
+                              ExecutionSpace> {
+  DeepCopy(void* dst, const void* src, size_t n) {
+    if (n > 0) {
+      acc_memcpy_device(dst, const_cast<void*>(src), n);
+    }
+  }
+  DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, size_t n) {
+    exec.fence(
+        "Kokkos::Impl::DeepCopy<OpenACCSpace, OpenACCSpace, "
+        "ExecutionSpace>::DeepCopy: fence before copy");
+    if (n > 0) {
+      acc_memcpy_device(dst, const_cast<void*>(src), n);
+    }
+  }
+};
+
+template <>
+struct Kokkos::Impl::DeepCopy<Kokkos::Experimental::OpenACCSpace,
+                              Kokkos::HostSpace,
+                              Kokkos::Experimental::OpenACC> {
+  DeepCopy(void* dst, const void* src, size_t n) {
+    if (n > 0) acc_memcpy_to_device(dst, const_cast<void*>(src), n);
+  }
+  DeepCopy(const Kokkos::Experimental::OpenACC& exec, void* dst,
+           const void* src, size_t n) {
+    if (n > 0)
+      acc_memcpy_to_device_async(dst, const_cast<void*>(src), n,
+                                 exec.acc_async_queue());
+  }
+};
+
+template <class ExecutionSpace>
+struct Kokkos::Impl::DeepCopy<Kokkos::Experimental::OpenACCSpace,
+                              Kokkos::HostSpace, ExecutionSpace> {
+  DeepCopy(void* dst, const void* src, size_t n) {
+    if (n > 0) {
+      acc_memcpy_to_device(dst, const_cast<void*>(src), n);
+    }
+  }
+  DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, size_t n) {
+    exec.fence(
+        "Kokkos::Impl::DeepCopy<OpenACCSpace, HostSpace, "
+        "ExecutionSpace>::DeepCopy: fence before copy");
+    if (n > 0) {
+      acc_memcpy_to_device(dst, const_cast<void*>(src), n);
+    }
+  }
+};
+
+template <>
+struct Kokkos::Impl::DeepCopy<Kokkos::HostSpace,
+                              Kokkos::Experimental::OpenACCSpace,
+                              Kokkos::Experimental::OpenACC> {
+  DeepCopy(void* dst, const void* src, size_t n) {
+    if (n > 0) {
+      acc_memcpy_from_device(dst, const_cast<void*>(src), n);
+    }
+  }
+  DeepCopy(const Kokkos::Experimental::OpenACC& exec, void* dst,
+           const void* src, size_t n) {
+    if (n > 0) {
+      acc_memcpy_from_device_async(dst, const_cast<void*>(src), n,
+                                   exec.acc_async_queue());
+    }
+  }
+};
+
+template <class ExecutionSpace>
+struct Kokkos::Impl::DeepCopy<
+    Kokkos::HostSpace, Kokkos::Experimental::OpenACCSpace, ExecutionSpace> {
+  DeepCopy(void* dst, const void* src, size_t n) {
+    if (n > 0) acc_memcpy_from_device(dst, const_cast<void*>(src), n);
+  }
+  DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, size_t n) {
+    exec.fence(
+        "Kokkos::Impl::DeepCopy<HostSpace, OpenACCSpace, "
+        "ExecutionSpace>::DeepCopy: fence before copy");
+    if (n > 0) {
+      acc_memcpy_from_device(dst, const_cast<void*>(src), n);
+    }
+  }
+};
+
+#endif
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_FunctorAdapter.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_FunctorAdapter.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..1325e61e1d00024ccd932433841ebefdc4b79dd4
--- /dev/null
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_FunctorAdapter.hpp
@@ -0,0 +1,44 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_OPENACC_FUNCTOR_ADAPTER_HPP
+#define KOKKOS_OPENACC_FUNCTOR_ADAPTER_HPP
+
+#include <type_traits>
+
+namespace Kokkos::Experimental::Impl {
+
+template <class Functor, class Policy>
+class FunctorAdapter {
+  Functor m_functor;
+  using WorkTag = typename Policy::work_tag;
+
+ public:
+  FunctorAdapter(Functor const &functor) : m_functor(functor) {}
+
+  template <class... Args>
+  KOKKOS_FUNCTION void operator()(Args &&... args) const {
+    if constexpr (std::is_void_v<WorkTag>) {
+      m_functor(static_cast<Args &&>(args)...);
+    } else {
+      m_functor(WorkTag(), static_cast<Args &&>(args)...);
+    }
+  }
+};
+
+}  // namespace Kokkos::Experimental::Impl
+
+#endif
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Instance.cpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Instance.cpp
index 15d38803f9c5be559f96cf1aad9a663cd207be03..10a76fbd31361b4a5c4265439409e1f929384efb 100644
--- a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Instance.cpp
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Instance.cpp
@@ -1,52 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
 
-#include <OpenACC/Kokkos_OpenACC_Instance.hpp>
 #include <OpenACC/Kokkos_OpenACC.hpp>
-#include <OpenACC/Kokkos_OpenACC_Traits.hpp>
+#include <OpenACC/Kokkos_OpenACC_Instance.hpp>
 #include <impl/Kokkos_Profiling.hpp>
 #include <impl/Kokkos_DeviceManagement.hpp>
 
@@ -54,35 +25,34 @@
 
 #include <iostream>
 
-namespace Kokkos {
-bool show_warnings() noexcept;
-}
+// Arbitrary value to denote that we don't know yet what device to use.
+int Kokkos::Experimental::Impl::OpenACCInternal::m_acc_device_num = -1;
 
-Kokkos::Experimental::Impl::OpenACCInternal*
+Kokkos::Experimental::Impl::OpenACCInternal&
 Kokkos::Experimental::Impl::OpenACCInternal::singleton() {
   static OpenACCInternal self;
-  return &self;
+  return self;
+}
+
+bool Kokkos::Experimental::Impl::OpenACCInternal::verify_is_initialized(
+    const char* const label) const {
+  if (!m_is_initialized) {
+    Kokkos::abort((std::string("Kokkos::Experimental::OpenACC::") + label +
+                   " : ERROR device not initialized\n")
+                      .c_str());
+  }
+  return m_is_initialized;
 }
 
-void Kokkos::Experimental::Impl::OpenACCInternal::initialize(
-    InitializationSettings const& settings) {
-  if (OpenACC_Traits::may_fallback_to_host &&
-      acc_get_num_devices(OpenACC_Traits::dev_type) == 0 &&
-      !settings.has_device_id()) {
-    if (show_warnings()) {
-      std::cerr << "Warning: No GPU available for execution, falling back to"
-                   " using the host!"
-                << std::endl;
-    }
-    acc_set_device_type(acc_device_host);
-    // FIXME_OPENACC if multiple execution space instances are supported,
-    // device id variable should be explicitly set to the value returned by
-    // acc_get_device_num(acc_device_host).
-  } else {
-    using Kokkos::Impl::get_gpu;
-    int const dev_num = get_gpu(settings);
-    acc_set_device_num(dev_num, OpenACC_Traits::dev_type);
+void Kokkos::Experimental::Impl::OpenACCInternal::initialize(int async_arg) {
+  if ((async_arg < 0) && (async_arg != acc_async_sync) &&
+      (async_arg != acc_async_noval)) {
+    Kokkos::abort((std::string("Kokkos::Experimental::OpenACC::initialize()") +
+                   " : ERROR async_arg should be a non-negative integer" +
+                   " unless being a special value defined in OpenACC\n")
+                      .c_str());
   }
+  m_async_arg      = async_arg;
   m_is_initialized = true;
 }
 
@@ -105,14 +75,11 @@ void Kokkos::Experimental::Impl::OpenACCInternal::fence(
       Kokkos::Experimental::OpenACC>(
       name,
       Kokkos::Tools::Experimental::Impl::DirectFenceIDHandle{instance_id()},
-      [&]() {
-        //[DEBUG] disabled due to synchronous behaviors of the current
-        // parallel construct implementations. acc_wait_all();
-      });
+      [&]() { acc_wait(m_async_arg); });
 }
 
 uint32_t Kokkos::Experimental::Impl::OpenACCInternal::instance_id() const
     noexcept {
-  return Kokkos::Tools::Experimental::Impl::idForInstance<
-      Kokkos::Experimental::OpenACC>(reinterpret_cast<uintptr_t>(this));
+  return Kokkos::Tools::Experimental::Impl::idForInstance<OpenACC>(
+      reinterpret_cast<uintptr_t>(this));
 }
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Instance.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Instance.hpp
index cb69b4ae7a0524739105c4bb5c835ac365b85a1c..6645616ba51984ce917d543481bb09782fa8e5f9 100644
--- a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Instance.hpp
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Instance.hpp
@@ -1,52 +1,26 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_OPENACC_INSTANCE_HPP
 #define KOKKOS_OPENACC_INSTANCE_HPP
 
 #include <impl/Kokkos_InitializationSettings.hpp>
 
+#include <openacc.h>
+
 #include <cstdint>
 #include <iosfwd>
 #include <string>
@@ -56,14 +30,20 @@ namespace Kokkos::Experimental::Impl {
 class OpenACCInternal {
   bool m_is_initialized = false;
 
-  OpenACCInternal()                       = default;
   OpenACCInternal(const OpenACCInternal&) = default;
   OpenACCInternal& operator=(const OpenACCInternal&) = default;
 
  public:
-  static OpenACCInternal* singleton();
+  static int m_acc_device_num;
+  int m_async_arg = acc_async_sync;
+
+  OpenACCInternal() = default;
+
+  static OpenACCInternal& singleton();
+
+  bool verify_is_initialized(const char* const label) const;
 
-  void initialize(InitializationSettings const& settings);
+  void initialize(int async_arg = acc_async_sync);
   void finalize();
   bool is_initialized() const;
 
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_MDRangePolicy.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_MDRangePolicy.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..4525f37a612d3abd8e5961d43256800cbb9675c4
--- /dev/null
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_MDRangePolicy.hpp
@@ -0,0 +1,45 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_OPENACC_MDRANGE_POLICY_HPP_
+#define KOKKOS_OPENACC_MDRANGE_POLICY_HPP_
+
+#include <KokkosExp_MDRangePolicy.hpp>
+
+template <>
+struct Kokkos::default_outer_direction<Kokkos::Experimental::OpenACC> {
+  using type                     = Iterate;
+  static constexpr Iterate value = Iterate::Left;
+};
+
+template <>
+struct Kokkos::default_inner_direction<Kokkos::Experimental::OpenACC> {
+  using type                     = Iterate;
+  static constexpr Iterate value = Iterate::Left;
+};
+
+namespace Kokkos {
+namespace Impl {
+
+template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector>
+struct ThreadAndVectorNestLevel<Rank, Kokkos::Experimental::OpenACC,
+                                ThreadAndVector>
+    : AcceleratorBasedNestLevel<Rank, ThreadAndVector> {};
+
+}  // namespace Impl
+}  // namespace Kokkos
+
+#endif
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Macros.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Macros.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..bcd7b2deb9d40cebedd7edf2a7e0398ecaa5adb7
--- /dev/null
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Macros.hpp
@@ -0,0 +1,23 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_OPENACC_MACROS_HPP
+#define KOKKOS_OPENACC_MACROS_HPP
+
+#define KOKKOS_IMPL_ACC_PRAGMA_HELPER(x) _Pragma(#x)
+#define KOKKOS_IMPL_ACC_PRAGMA(x) KOKKOS_IMPL_ACC_PRAGMA_HELPER(acc x)
+
+#endif
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelFor_MDRange.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelFor_MDRange.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..ac219527c6aa3b0dfb1779fa4a71a6342542525f
--- /dev/null
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelFor_MDRange.hpp
@@ -0,0 +1,695 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_OPENACC_PARALLEL_FOR_MDRANGE_HPP
+#define KOKKOS_OPENACC_PARALLEL_FOR_MDRANGE_HPP
+
+#include <OpenACC/Kokkos_OpenACC.hpp>
+#include <OpenACC/Kokkos_OpenACC_FunctorAdapter.hpp>
+#include <OpenACC/Kokkos_OpenACC_MDRangePolicy.hpp>
+#include <Kokkos_Parallel.hpp>
+
+namespace Kokkos::Experimental::Impl {
+
+struct OpenACCCollapse {};
+struct OpenACCTile {};
+using OpenACCIterateLeft  = std::integral_constant<Iterate, Iterate::Left>;
+using OpenACCIterateRight = std::integral_constant<Iterate, Iterate::Right>;
+template <int N>
+using OpenACCMDRangeBegin = decltype(MDRangePolicy<OpenACC, Rank<N>>::m_lower);
+template <int N>
+using OpenACCMDRangeEnd = decltype(MDRangePolicy<OpenACC, Rank<N>>::m_upper);
+template <int N>
+using OpenACCMDRangeTile = decltype(MDRangePolicy<OpenACC, Rank<N>>::m_tile);
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateLeft,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<2> const& begin,
+                                     OpenACCMDRangeEnd<2> const& end,
+                                     int async_arg) {
+  int begin1 = begin[1];
+  int end1   = end[1];
+  int begin0 = begin[0];
+  int end0   = end[0];
+// clang-format off
+#pragma acc parallel loop gang vector collapse(2) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i1 = begin1; i1 < end1; ++i1) {
+    for (auto i0 = begin0; i0 < end0; ++i0) {
+      functor(i0, i1);
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateRight,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<2> const& begin,
+                                     OpenACCMDRangeEnd<2> const& end,
+                                     int async_arg) {
+  int begin0 = begin[0];
+  int end0   = end[0];
+  int begin1 = begin[1];
+  int end1   = end[1];
+// clang-format off
+#pragma acc parallel loop gang vector collapse(2) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i0 = begin0; i0 < end0; ++i0) {
+    for (auto i1 = begin1; i1 < end1; ++i1) {
+      functor(i0, i1);
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateLeft,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<2> const& begin,
+                                     OpenACCMDRangeEnd<2> const& end,
+                                     OpenACCMDRangeTile<2> const& tile,
+                                     int async_arg) {
+  int tile0  = tile[0];
+  int tile1  = tile[1];
+  int begin1 = begin[1];
+  int end1   = end[1];
+  int begin0 = begin[0];
+  int end0   = end[0];
+// clang-format off
+#pragma acc parallel loop gang vector tile(tile0,tile1) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i1 = begin1; i1 < end1; ++i1) {
+    for (auto i0 = begin0; i0 < end0; ++i0) {
+      functor(i0, i1);
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateRight,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<2> const& begin,
+                                     OpenACCMDRangeEnd<2> const& end,
+                                     OpenACCMDRangeTile<2> const& tile,
+                                     int async_arg) {
+  int tile1  = tile[1];
+  int tile0  = tile[0];
+  int begin0 = begin[0];
+  int end0   = end[0];
+  int begin1 = begin[1];
+  int end1   = end[1];
+// clang-format off
+#pragma acc parallel loop gang vector tile(tile1,tile0) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i0 = begin0; i0 < end0; ++i0) {
+    for (auto i1 = begin1; i1 < end1; ++i1) {
+      functor(i0, i1);
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateLeft,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<3> const& begin,
+                                     OpenACCMDRangeEnd<3> const& end,
+                                     int async_arg) {
+  int begin2 = begin[2];
+  int end2   = end[2];
+  int begin1 = begin[1];
+  int end1   = end[1];
+  int begin0 = begin[0];
+  int end0   = end[0];
+// clang-format off
+#pragma acc parallel loop gang vector collapse(3) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i2 = begin2; i2 < end2; ++i2) {
+    for (auto i1 = begin1; i1 < end1; ++i1) {
+      for (auto i0 = begin0; i0 < end0; ++i0) {
+        functor(i0, i1, i2);
+      }
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateRight,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<3> const& begin,
+                                     OpenACCMDRangeEnd<3> const& end,
+                                     int async_arg) {
+  int begin0 = begin[0];
+  int end0   = end[0];
+  int begin1 = begin[1];
+  int end1   = end[1];
+  int begin2 = begin[2];
+  int end2   = end[2];
+// clang-format off
+#pragma acc parallel loop gang vector collapse(3) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i0 = begin0; i0 < end0; ++i0) {
+    for (auto i1 = begin1; i1 < end1; ++i1) {
+      for (auto i2 = begin2; i2 < end2; ++i2) {
+        functor(i0, i1, i2);
+      }
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateLeft,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<3> const& begin,
+                                     OpenACCMDRangeEnd<3> const& end,
+                                     OpenACCMDRangeTile<3> const& tile,
+                                     int async_arg) {
+  int tile0  = tile[0];
+  int tile1  = tile[1];
+  int tile2  = tile[2];
+  int begin2 = begin[2];
+  int end2   = end[2];
+  int begin1 = begin[1];
+  int end1   = end[1];
+  int begin0 = begin[0];
+  int end0   = end[0];
+// clang-format off
+#pragma acc parallel loop gang vector tile(tile0,tile1,tile2) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i2 = begin2; i2 < end2; ++i2) {
+    for (auto i1 = begin1; i1 < end1; ++i1) {
+      for (auto i0 = begin0; i0 < end0; ++i0) {
+        functor(i0, i1, i2);
+      }
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateRight,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<3> const& begin,
+                                     OpenACCMDRangeEnd<3> const& end,
+                                     OpenACCMDRangeTile<3> const& tile,
+                                     int async_arg) {
+  int tile2  = tile[2];
+  int tile1  = tile[1];
+  int tile0  = tile[0];
+  int begin0 = begin[0];
+  int end0   = end[0];
+  int begin1 = begin[1];
+  int end1   = end[1];
+  int begin2 = begin[2];
+  int end2   = end[2];
+// clang-format off
+#pragma acc parallel loop gang vector tile(tile2,tile1,tile0) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i0 = begin0; i0 < end0; ++i0) {
+    for (auto i1 = begin1; i1 < end1; ++i1) {
+      for (auto i2 = begin2; i2 < end2; ++i2) {
+        functor(i0, i1, i2);
+      }
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateLeft,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<4> const& begin,
+                                     OpenACCMDRangeEnd<4> const& end,
+                                     int async_arg) {
+  int begin3 = begin[3];
+  int end3   = end[3];
+  int begin2 = begin[2];
+  int end2   = end[2];
+  int begin1 = begin[1];
+  int end1   = end[1];
+  int begin0 = begin[0];
+  int end0   = end[0];
+// clang-format off
+#pragma acc parallel loop gang vector collapse(4) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i3 = begin3; i3 < end3; ++i3) {
+    for (auto i2 = begin2; i2 < end2; ++i2) {
+      for (auto i1 = begin1; i1 < end1; ++i1) {
+        for (auto i0 = begin0; i0 < end0; ++i0) {
+          functor(i0, i1, i2, i3);
+        }
+      }
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateRight,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<4> const& begin,
+                                     OpenACCMDRangeEnd<4> const& end,
+                                     int async_arg) {
+  int begin0 = begin[0];
+  int end0   = end[0];
+  int begin1 = begin[1];
+  int end1   = end[1];
+  int begin2 = begin[2];
+  int end2   = end[2];
+  int begin3 = begin[3];
+  int end3   = end[3];
+// clang-format off
+#pragma acc parallel loop gang vector collapse(4) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i0 = begin0; i0 < end0; ++i0) {
+    for (auto i1 = begin1; i1 < end1; ++i1) {
+      for (auto i2 = begin2; i2 < end2; ++i2) {
+        for (auto i3 = begin3; i3 < end3; ++i3) {
+          functor(i0, i1, i2, i3);
+        }
+      }
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateLeft,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<4> const& begin,
+                                     OpenACCMDRangeEnd<4> const& end,
+                                     OpenACCMDRangeTile<4> const& tile,
+                                     int async_arg) {
+  int tile0  = tile[0];
+  int tile1  = tile[1];
+  int tile2  = tile[2];
+  int tile3  = tile[3];
+  int begin3 = begin[3];
+  int end3   = end[3];
+  int begin2 = begin[2];
+  int end2   = end[2];
+  int begin1 = begin[1];
+  int end1   = end[1];
+  int begin0 = begin[0];
+  int end0   = end[0];
+// clang-format off
+#pragma acc parallel loop gang vector tile(tile0,tile1,tile2,tile3) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i3 = begin3; i3 < end3; ++i3) {
+    for (auto i2 = begin2; i2 < end2; ++i2) {
+      for (auto i1 = begin1; i1 < end1; ++i1) {
+        for (auto i0 = begin0; i0 < end0; ++i0) {
+          functor(i0, i1, i2, i3);
+        }
+      }
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateRight,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<4> const& begin,
+                                     OpenACCMDRangeEnd<4> const& end,
+                                     OpenACCMDRangeTile<4> const& tile,
+                                     int async_arg) {
+  int tile3  = tile[3];
+  int tile2  = tile[2];
+  int tile1  = tile[1];
+  int tile0  = tile[0];
+  int begin0 = begin[0];
+  int end0   = end[0];
+  int begin1 = begin[1];
+  int end1   = end[1];
+  int begin2 = begin[2];
+  int end2   = end[2];
+  int begin3 = begin[3];
+  int end3   = end[3];
+// clang-format off
+#pragma acc parallel loop gang vector tile(tile3,tile2,tile1,tile0) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i0 = begin0; i0 < end0; ++i0) {
+    for (auto i1 = begin1; i1 < end1; ++i1) {
+      for (auto i2 = begin2; i2 < end2; ++i2) {
+        for (auto i3 = begin3; i3 < end3; ++i3) {
+          functor(i0, i1, i2, i3);
+        }
+      }
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateLeft,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<5> const& begin,
+                                     OpenACCMDRangeEnd<5> const& end,
+                                     int async_arg) {
+  int begin4 = begin[4];
+  int end4   = end[4];
+  int begin3 = begin[3];
+  int end3   = end[3];
+  int begin2 = begin[2];
+  int end2   = end[2];
+  int begin1 = begin[1];
+  int end1   = end[1];
+  int begin0 = begin[0];
+  int end0   = end[0];
+// clang-format off
+#pragma acc parallel loop gang vector collapse(5) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i4 = begin4; i4 < end4; ++i4) {
+    for (auto i3 = begin3; i3 < end3; ++i3) {
+      for (auto i2 = begin2; i2 < end2; ++i2) {
+        for (auto i1 = begin1; i1 < end1; ++i1) {
+          for (auto i0 = begin0; i0 < end0; ++i0) {
+            functor(i0, i1, i2, i3, i4);
+          }
+        }
+      }
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateRight,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<5> const& begin,
+                                     OpenACCMDRangeEnd<5> const& end,
+                                     int async_arg) {
+  int begin0 = begin[0];
+  int end0   = end[0];
+  int begin1 = begin[1];
+  int end1   = end[1];
+  int begin2 = begin[2];
+  int end2   = end[2];
+  int begin3 = begin[3];
+  int end3   = end[3];
+  int begin4 = begin[4];
+  int end4   = end[4];
+// clang-format off
+#pragma acc parallel loop gang vector collapse(5) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i0 = begin0; i0 < end0; ++i0) {
+    for (auto i1 = begin1; i1 < end1; ++i1) {
+      for (auto i2 = begin2; i2 < end2; ++i2) {
+        for (auto i3 = begin3; i3 < end3; ++i3) {
+          for (auto i4 = begin4; i4 < end4; ++i4) {
+            functor(i0, i1, i2, i3, i4);
+          }
+        }
+      }
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateLeft,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<5> const& begin,
+                                     OpenACCMDRangeEnd<5> const& end,
+                                     OpenACCMDRangeTile<5> const& tile,
+                                     int async_arg) {
+  int tile0  = tile[0];
+  int tile1  = tile[1];
+  int tile2  = tile[2];
+  int tile3  = tile[3];
+  int tile4  = tile[4];
+  int begin4 = begin[4];
+  int end4   = end[4];
+  int begin3 = begin[3];
+  int end3   = end[3];
+  int begin2 = begin[2];
+  int end2   = end[2];
+  int begin1 = begin[1];
+  int end1   = end[1];
+  int begin0 = begin[0];
+  int end0   = end[0];
+// clang-format off
+#pragma acc parallel loop gang vector tile(tile0,tile1,tile2,tile3,tile4) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i4 = begin4; i4 < end4; ++i4) {
+    for (auto i3 = begin3; i3 < end3; ++i3) {
+      for (auto i2 = begin2; i2 < end2; ++i2) {
+        for (auto i1 = begin1; i1 < end1; ++i1) {
+          for (auto i0 = begin0; i0 < end0; ++i0) {
+            functor(i0, i1, i2, i3, i4);
+          }
+        }
+      }
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateRight,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<5> const& begin,
+                                     OpenACCMDRangeEnd<5> const& end,
+                                     OpenACCMDRangeTile<5> const& tile,
+                                     int async_arg) {
+  int tile4  = tile[4];
+  int tile3  = tile[3];
+  int tile2  = tile[2];
+  int tile1  = tile[1];
+  int tile0  = tile[0];
+  int begin0 = begin[0];
+  int end0   = end[0];
+  int begin1 = begin[1];
+  int end1   = end[1];
+  int begin2 = begin[2];
+  int end2   = end[2];
+  int begin3 = begin[3];
+  int end3   = end[3];
+  int begin4 = begin[4];
+  int end4   = end[4];
+// clang-format off
+#pragma acc parallel loop gang vector tile(tile4,tile3,tile2,tile1,tile0) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i0 = begin0; i0 < end0; ++i0) {
+    for (auto i1 = begin1; i1 < end1; ++i1) {
+      for (auto i2 = begin2; i2 < end2; ++i2) {
+        for (auto i3 = begin3; i3 < end3; ++i3) {
+          for (auto i4 = begin4; i4 < end4; ++i4) {
+            functor(i0, i1, i2, i3, i4);
+          }
+        }
+      }
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateLeft,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<6> const& begin,
+                                     OpenACCMDRangeEnd<6> const& end,
+                                     int async_arg) {
+  int begin5 = begin[5];
+  int end5   = end[5];
+  int begin4 = begin[4];
+  int end4   = end[4];
+  int begin3 = begin[3];
+  int end3   = end[3];
+  int begin2 = begin[2];
+  int end2   = end[2];
+  int begin1 = begin[1];
+  int end1   = end[1];
+  int begin0 = begin[0];
+  int end0   = end[0];
+// clang-format off
+#pragma acc parallel loop gang vector collapse(6) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i5 = begin5; i5 < end5; ++i5) {
+    for (auto i4 = begin4; i4 < end4; ++i4) {
+      for (auto i3 = begin3; i3 < end3; ++i3) {
+        for (auto i2 = begin2; i2 < end2; ++i2) {
+          for (auto i1 = begin1; i1 < end1; ++i1) {
+            for (auto i0 = begin0; i0 < end0; ++i0) {
+              functor(i0, i1, i2, i3, i4, i5);
+            }
+          }
+        }
+      }
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateRight,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<6> const& begin,
+                                     OpenACCMDRangeEnd<6> const& end,
+                                     int async_arg) {
+  int begin0 = begin[0];
+  int end0   = end[0];
+  int begin1 = begin[1];
+  int end1   = end[1];
+  int begin2 = begin[2];
+  int end2   = end[2];
+  int begin3 = begin[3];
+  int end3   = end[3];
+  int begin4 = begin[4];
+  int end4   = end[4];
+  int begin5 = begin[5];
+  int end5   = end[5];
+// clang-format off
+#pragma acc parallel loop gang vector collapse(6) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i0 = begin0; i0 < end0; ++i0) {
+    for (auto i1 = begin1; i1 < end1; ++i1) {
+      for (auto i2 = begin2; i2 < end2; ++i2) {
+        for (auto i3 = begin3; i3 < end3; ++i3) {
+          for (auto i4 = begin4; i4 < end4; ++i4) {
+            for (auto i5 = begin5; i5 < end5; ++i5) {
+              functor(i0, i1, i2, i3, i4, i5);
+            }
+          }
+        }
+      }
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateLeft,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<6> const& begin,
+                                     OpenACCMDRangeEnd<6> const& end,
+                                     OpenACCMDRangeTile<6> const& tile,
+                                     int async_arg) {
+  int tile0  = tile[0];
+  int tile1  = tile[1];
+  int tile2  = tile[2];
+  int tile3  = tile[3];
+  int tile4  = tile[4];
+  int tile5  = tile[5];
+  int begin5 = begin[5];
+  int end5   = end[5];
+  int begin4 = begin[4];
+  int end4   = end[4];
+  int begin3 = begin[3];
+  int end3   = end[3];
+  int begin2 = begin[2];
+  int end2   = end[2];
+  int begin1 = begin[1];
+  int end1   = end[1];
+  int begin0 = begin[0];
+  int end0   = end[0];
+// clang-format off
+#pragma acc parallel loop gang vector tile(tile0,tile1,tile2,tile3,tile4,tile5) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i5 = begin5; i5 < end5; ++i5) {
+    for (auto i4 = begin4; i4 < end4; ++i4) {
+      for (auto i3 = begin3; i3 < end3; ++i3) {
+        for (auto i2 = begin2; i2 < end2; ++i2) {
+          for (auto i1 = begin1; i1 < end1; ++i1) {
+            for (auto i0 = begin0; i0 < end0; ++i0) {
+              functor(i0, i1, i2, i3, i4, i5);
+            }
+          }
+        }
+      }
+    }
+  }
+}
+
+template <class Functor>
+void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateRight,
+                                     Functor const& functor,
+                                     OpenACCMDRangeBegin<6> const& begin,
+                                     OpenACCMDRangeEnd<6> const& end,
+                                     OpenACCMDRangeTile<6> const& tile,
+                                     int async_arg) {
+  int tile5  = tile[5];
+  int tile4  = tile[4];
+  int tile3  = tile[3];
+  int tile2  = tile[2];
+  int tile1  = tile[1];
+  int tile0  = tile[0];
+  int begin0 = begin[0];
+  int end0   = end[0];
+  int begin1 = begin[1];
+  int end1   = end[1];
+  int begin2 = begin[2];
+  int end2   = end[2];
+  int begin3 = begin[3];
+  int end3   = end[3];
+  int begin4 = begin[4];
+  int end4   = end[4];
+  int begin5 = begin[5];
+  int end5   = end[5];
+// clang-format off
+#pragma acc parallel loop gang vector tile(tile5,tile4,tile3,tile2,tile1,tile0) copyin(functor) async(async_arg)
+  // clang-format on
+  for (auto i0 = begin0; i0 < end0; ++i0) {
+    for (auto i1 = begin1; i1 < end1; ++i1) {
+      for (auto i2 = begin2; i2 < end2; ++i2) {
+        for (auto i3 = begin3; i3 < end3; ++i3) {
+          for (auto i4 = begin4; i4 < end4; ++i4) {
+            for (auto i5 = begin5; i5 < end5; ++i5) {
+              functor(i0, i1, i2, i3, i4, i5);
+            }
+          }
+        }
+      }
+    }
+  }
+}
+
+}  // namespace Kokkos::Experimental::Impl
+
+template <class Functor, class... Traits>
+class Kokkos::Impl::ParallelFor<Functor, Kokkos::MDRangePolicy<Traits...>,
+                                Kokkos::Experimental::OpenACC> {
+  using Policy = MDRangePolicy<Traits...>;
+  Kokkos::Experimental::Impl::FunctorAdapter<Functor, Policy> m_functor;
+  Policy m_policy;
+
+ public:
+  ParallelFor(Functor const& functor, Policy const& policy)
+      : m_functor(functor), m_policy(policy) {}
+
+  void execute() const {
+    static_assert(1 < Policy::rank && Policy::rank < 7);
+    static_assert(Policy::inner_direction == Iterate::Left ||
+                  Policy::inner_direction == Iterate::Right);
+    constexpr int rank = Policy::rank;
+    for (int i = 0; i < rank; ++i) {
+      if (m_policy.m_lower[i] >= m_policy.m_upper[i]) {
+        return;
+      }
+    }
+    int const async_arg = m_policy.space().acc_async_queue();
+#if 0  // FIXME_OPENACC: OpenACC requires tile size to be constant.
+    for (int i = 0; i < rank; ++i) {
+      if (m_policy.m_tile[i] < 1) {
+        Kokkos::Experimental::Impl::OpenACCParallelForMDRangePolicy(
+            Kokkos::Experimental::Impl::OpenACCCollapse(),
+            std::integral_constant<Iterate, Policy::inner_direction>(),
+            m_functor, m_policy.m_lower, m_policy.m_upper, async_arg);
+        return;
+      }
+    }
+    Kokkos::Experimental::Impl::OpenACCParallelForMDRangePolicy(
+        Kokkos::Experimental::Impl::OpenACCTile(),
+        std::integral_constant<Iterate, Policy::inner_direction>(), m_functor,
+        m_policy.m_lower, m_policy.m_upper, m_policy.m_tile, async_arg);
+#else
+    Kokkos::Experimental::Impl::OpenACCParallelForMDRangePolicy(
+        Kokkos::Experimental::Impl::OpenACCCollapse(),
+        std::integral_constant<Iterate, Policy::inner_direction>(), m_functor,
+        m_policy.m_lower, m_policy.m_upper, async_arg);
+#endif
+  }
+};
+
+#endif
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelFor_Range.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelFor_Range.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..ede93ec19e122fe0795c0705d470fde6fe776b59
--- /dev/null
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelFor_Range.hpp
@@ -0,0 +1,105 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_OPENACC_PARALLEL_FOR_RANGE_HPP
+#define KOKKOS_OPENACC_PARALLEL_FOR_RANGE_HPP
+
+#include <OpenACC/Kokkos_OpenACC.hpp>
+#include <OpenACC/Kokkos_OpenACC_FunctorAdapter.hpp>
+#include <OpenACC/Kokkos_OpenACC_ScheduleType.hpp>
+#include <Kokkos_Parallel.hpp>
+
+namespace Kokkos::Experimental::Impl {
+template <class IndexType, class Functor>
+void OpenACCParallelForRangePolicy(Schedule<Static>, int chunk_size,
+                                   IndexType begin, IndexType end,
+                                   Functor afunctor, int async_arg) {
+  // FIXME_OPENACC FIXME_NVHPC workaround compiler bug (incorrect scope
+  // analysis)
+  // NVC++-S-1067-Cannot determine bounds for array - functor
+  auto const functor(afunctor);
+  if (chunk_size >= 1) {
+// clang-format off
+#pragma acc parallel loop gang(static:chunk_size) vector copyin(functor) async(async_arg)
+    // clang-format on
+    for (auto i = begin; i < end; ++i) {
+      functor(i);
+    }
+  } else {
+// clang-format off
+#pragma acc parallel loop gang(static:*) vector copyin(functor) async(async_arg)
+    // clang-format on
+    for (auto i = begin; i < end; ++i) {
+      functor(i);
+    }
+  }
+}
+
+template <class IndexType, class Functor>
+void OpenACCParallelForRangePolicy(Schedule<Dynamic>, int chunk_size,
+                                   IndexType begin, IndexType end,
+                                   Functor afunctor, int async_arg) {
+  // FIXME_OPENACC FIXME_NVHPC workaround compiler bug (incorrect scope
+  // analysis)
+  // NVC++-S-1067-Cannot determine bounds for array - functor
+  auto const functor(afunctor);
+  if (chunk_size >= 1) {
+// clang-format off
+#pragma acc parallel loop gang(static:chunk_size) vector copyin(functor) async(async_arg)
+    // clang-format on
+    for (auto i = begin; i < end; ++i) {
+      functor(i);
+    }
+  } else {
+// clang-format off
+#pragma acc parallel loop gang vector copyin(functor) async(async_arg)
+    // clang-format on
+    for (auto i = begin; i < end; ++i) {
+      functor(i);
+    }
+  }
+}
+}  // namespace Kokkos::Experimental::Impl
+
+template <class Functor, class... Traits>
+class Kokkos::Impl::ParallelFor<Functor, Kokkos::RangePolicy<Traits...>,
+                                Kokkos::Experimental::OpenACC> {
+  using Policy = Kokkos::RangePolicy<Traits...>;
+  Kokkos::Experimental::Impl::FunctorAdapter<Functor, Policy> m_functor;
+  Policy m_policy;
+  using ScheduleType = Kokkos::Experimental::Impl::OpenACCScheduleType<Policy>;
+
+ public:
+  ParallelFor(Functor const& functor, Policy const& policy)
+      : m_functor(functor), m_policy(policy) {}
+
+  void execute() const {
+    auto const begin = m_policy.begin();
+    auto const end   = m_policy.end();
+
+    if (end <= begin) {
+      return;
+    }
+
+    int const async_arg  = m_policy.space().acc_async_queue();
+    int const chunk_size = m_policy.chunk_size();
+
+    Kokkos::Experimental::Impl::OpenACCParallelForRangePolicy(
+        ScheduleType(), chunk_size, begin, end, m_functor, async_arg);
+  }
+};
+
+#endif
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelFor_Team.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelFor_Team.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..c08c15879c3656f15665388cf3292e2e67ca16e5
--- /dev/null
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelFor_Team.hpp
@@ -0,0 +1,206 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_OPENACC_PARALLEL_FOR_TEAM_HPP
+#define KOKKOS_OPENACC_PARALLEL_FOR_TEAM_HPP
+
+#include <openacc.h>
+#include <OpenACC/Kokkos_OpenACC_Team.hpp>
+#include <OpenACC/Kokkos_OpenACC_FunctorAdapter.hpp>
+
+#ifdef KOKKOS_ENABLE_OPENACC_COLLAPSE_HIERARCHICAL_CONSTRUCTS
+
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+// Hierarchical Parallelism -> Team level implementation
+template <class FunctorType, class... Properties>
+class Kokkos::Impl::ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
+                                Kokkos::Experimental::OpenACC> {
+ private:
+  using Policy = Kokkos::Impl::TeamPolicyInternal<Kokkos::Experimental::OpenACC,
+                                                  Properties...>;
+  Kokkos::Experimental::Impl::FunctorAdapter<FunctorType, Policy> m_functor;
+  using Member = typename Policy::member_type;
+
+  const Policy m_policy;
+
+ public:
+  inline void execute() const {
+    auto league_size   = m_policy.league_size();
+    auto team_size     = m_policy.team_size();
+    auto vector_length = m_policy.impl_vector_length();
+
+    auto const a_functor(m_functor);
+
+#pragma acc parallel loop gang vector num_gangs(league_size) \
+    vector_length(team_size* vector_length) copyin(a_functor)
+    for (int i = 0; i < league_size * team_size * vector_length; i++) {
+      int league_id = i / (team_size * vector_length);
+      typename Policy::member_type team(league_id, league_size, team_size,
+                                        vector_length);
+      a_functor(team);
+    }
+  }
+
+  inline ParallelFor(const FunctorType& arg_functor, Policy arg_policy)
+      : m_functor(arg_functor), m_policy(arg_policy) {}
+};
+
+namespace Kokkos {
+
+// Hierarchical Parallelism -> Team thread level implementation
+#pragma acc routine seq
+template <typename iType, class Lambda>
+KOKKOS_INLINE_FUNCTION void parallel_for(
+    const Impl::TeamThreadRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>&
+        loop_boundaries,
+    const Lambda& lambda) {
+  iType j_start =
+      loop_boundaries.team.team_rank() / loop_boundaries.team.vector_length();
+  iType j_end  = loop_boundaries.end;
+  iType j_step = loop_boundaries.team.team_size();
+  if (j_start >= loop_boundaries.start) {
+#pragma acc loop seq
+    for (iType j = j_start; j < j_end; j += j_step) {
+      lambda(j);
+    }
+  }
+}
+
+// Hierarchical Parallelism -> Thread vector level implementation
+#pragma acc routine seq
+template <typename iType, class Lambda>
+KOKKOS_INLINE_FUNCTION void parallel_for(
+    const Impl::ThreadVectorRangeBoundariesStruct<
+        iType, Impl::OpenACCTeamMember>& loop_boundaries,
+    const Lambda& lambda) {
+  iType j_start =
+      loop_boundaries.team.team_rank() % loop_boundaries.team.vector_length();
+  iType j_end  = loop_boundaries.end;
+  iType j_step = loop_boundaries.team.vector_length();
+  if (j_start >= loop_boundaries.start) {
+#pragma acc loop seq
+    for (iType j = j_start; j < j_end; j += j_step) {
+      lambda(j);
+    }
+  }
+}
+
+// Hierarchical Parallelism -> Team vector level implementation
+#pragma acc routine seq
+template <typename iType, class Lambda>
+KOKKOS_INLINE_FUNCTION void parallel_for(
+    const Impl::TeamVectorRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>&
+        loop_boundaries,
+    const Lambda& lambda) {
+  iType j_start =
+      loop_boundaries.team.team_rank() % loop_boundaries.team.vector_length();
+  iType j_end  = loop_boundaries.end;
+  iType j_step = loop_boundaries.team.vector_length();
+  if (j_start >= loop_boundaries.start) {
+#pragma acc loop seq
+    for (iType j = j_start; j < j_end; j += j_step) {
+      lambda(j);
+    }
+  }
+}
+
+}  // namespace Kokkos
+
+#else  // KOKKOS_ENABLE_OPENACC_COLLAPSE_HIERARCHICAL_CONSTRUCTS
+
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+// Hierarchical Parallelism -> Team level implementation
+template <class FunctorType, class... Properties>
+class Kokkos::Impl::ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
+                                Kokkos::Experimental::OpenACC> {
+ private:
+  using Policy = Kokkos::Impl::TeamPolicyInternal<Kokkos::Experimental::OpenACC,
+                                                  Properties...>;
+  Kokkos::Experimental::Impl::FunctorAdapter<FunctorType, Policy> m_functor;
+  using Member = typename Policy::member_type;
+
+  const Policy m_policy;
+
+ public:
+  inline void execute() const {
+    auto league_size   = m_policy.league_size();
+    auto team_size     = m_policy.team_size();
+    auto vector_length = m_policy.impl_vector_length();
+
+    auto const a_functor(m_functor);
+
+#pragma acc parallel loop gang num_gangs(league_size) num_workers(team_size) \
+    vector_length(vector_length) copyin(a_functor)
+    for (int i = 0; i < league_size; i++) {
+      int league_id = i;
+      typename Policy::member_type team(league_id, league_size, team_size,
+                                        vector_length);
+      a_functor(team);
+    }
+  }
+
+  inline ParallelFor(const FunctorType& arg_functor, Policy arg_policy)
+      : m_functor(arg_functor), m_policy(arg_policy) {}
+};
+
+namespace Kokkos {
+
+// Hierarchical Parallelism -> Team thread level implementation
+#pragma acc routine worker
+template <typename iType, class Lambda>
+KOKKOS_INLINE_FUNCTION void parallel_for(
+    const Impl::TeamThreadRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>&
+        loop_boundaries,
+    const Lambda& lambda) {
+#pragma acc loop worker
+  for (iType j = loop_boundaries.start; j < loop_boundaries.end; j++) {
+    lambda(j);
+  }
+}
+
+// Hierarchical Parallelism -> Thread vector level implementation
+#pragma acc routine vector
+template <typename iType, class Lambda>
+KOKKOS_INLINE_FUNCTION void parallel_for(
+    const Impl::ThreadVectorRangeBoundariesStruct<
+        iType, Impl::OpenACCTeamMember>& loop_boundaries,
+    const Lambda& lambda) {
+#pragma acc loop vector
+  for (iType i = loop_boundaries.start; i < loop_boundaries.end; i++) {
+    lambda(i);
+  }
+}
+
+// Hierarchical Parallelism -> Team vector level implementation
+#pragma acc routine vector
+template <typename iType, class Lambda>
+KOKKOS_INLINE_FUNCTION void parallel_for(
+    const Impl::TeamVectorRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>&
+        loop_boundaries,
+    const Lambda& lambda) {
+#pragma acc loop vector
+  for (iType i = loop_boundaries.start; i < loop_boundaries.end; i++) {
+    lambda(i);
+  }
+}
+
+}  // namespace Kokkos
+
+#endif /* #ifdef KOKKOS_ENABLE_OPENACC_COLLAPSE_HIERARCHICAL_CONSTRUCTS */
+
+#endif /* #ifndef KOKKOS_OPENACC_PARALLEL_FOR_TEAM_HPP */
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelReduce_Range.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelReduce_Range.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..278d9c1d5a68ba8d5db7d9e14bca860331cd1bdf
--- /dev/null
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelReduce_Range.hpp
@@ -0,0 +1,209 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_OPENACC_PARALLEL_REDUCE_RANGE_HPP
+#define KOKKOS_OPENACC_PARALLEL_REDUCE_RANGE_HPP
+
+#include <OpenACC/Kokkos_OpenACC.hpp>
+#include <OpenACC/Kokkos_OpenACC_Macros.hpp>
+#include <OpenACC/Kokkos_OpenACC_FunctorAdapter.hpp>
+#include <OpenACC/Kokkos_OpenACC_ScheduleType.hpp>
+#include <Kokkos_Parallel.hpp>
+#include <type_traits>
+
+namespace Kokkos::Experimental::Impl {
+
+// primary template: catch-all non-implemented custom reducers
+template <class Functor, class Reducer, class Policy,
+          bool = std::is_arithmetic_v<typename Reducer::value_type>>
+struct OpenACCParallelReduceHelper {
+  OpenACCParallelReduceHelper(Functor const&, Reducer const&, Policy const&) {
+    static_assert(!Kokkos::Impl::always_true<Functor>::value,
+                  "not implemented");
+  }
+};
+
+}  // namespace Kokkos::Experimental::Impl
+
+template <class Functor, class ReducerType, class... Traits>
+class Kokkos::Impl::ParallelReduce<Functor, Kokkos::RangePolicy<Traits...>,
+                                   ReducerType, Kokkos::Experimental::OpenACC> {
+  using Policy = RangePolicy<Traits...>;
+
+  using ReducerConditional =
+      if_c<std::is_same_v<InvalidType, ReducerType>, Functor, ReducerType>;
+  using ReducerTypeFwd = typename ReducerConditional::type;
+  using Analysis =
+      FunctorAnalysis<FunctorPatternInterface::REDUCE, Policy, ReducerTypeFwd>;
+
+  using Pointer   = typename Analysis::pointer_type;
+  using ValueType = typename Analysis::value_type;
+
+  Functor m_functor;
+  Policy m_policy;
+  ReducerType m_reducer;
+  Pointer m_result_ptr;
+
+ public:
+  ParallelReduce(Functor const& functor, Policy const& policy,
+                 ReducerType const& reducer)
+      : m_functor(functor),
+        m_policy(policy),
+        m_reducer(reducer),
+        m_result_ptr(reducer.view().data()) {}
+
+  template <class ViewType>
+  ParallelReduce(
+      const Functor& functor, const Policy& policy, const ViewType& result,
+      std::enable_if_t<Kokkos::is_view<ViewType>::value, void*> = nullptr)
+      : m_functor(functor),
+        m_policy(policy),
+        m_reducer(InvalidType()),
+        m_result_ptr(result.data()) {}
+
+  void execute() const {
+    auto const begin = m_policy.begin();
+    auto const end   = m_policy.end();
+
+    if (end <= begin) {
+      return;
+    }
+
+    ValueType val;
+    typename Analysis::Reducer final_reducer(
+        &ReducerConditional::select(m_functor, m_reducer));
+    final_reducer.init(&val);
+
+    Kokkos::Experimental::Impl::OpenACCParallelReduceHelper(
+        Kokkos::Experimental::Impl::FunctorAdapter<Functor, Policy>(m_functor),
+        std::conditional_t<is_reducer_v<ReducerType>, ReducerType,
+                           Sum<ValueType>>(val),
+        m_policy);
+
+    *m_result_ptr = val;
+  }
+};
+
+#define KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_DISPATCH_SCHEDULE(REDUCER,    \
+                                                              OPERATOR)   \
+  namespace Kokkos::Experimental::Impl {                                  \
+  template <class IndexType, class ValueType, class Functor>              \
+  void OpenACCParallelReduce##REDUCER(Schedule<Static>, int chunk_size,   \
+                                      IndexType begin, IndexType end,     \
+                                      ValueType& aval,                    \
+                                      Functor const& afunctor,            \
+                                      int async_arg) {                    \
+    /* FIXME_OPENACC FIXME_NVHPC workaround compiler bug (incorrect scope \
+       analysis)                                                          \
+       NVC++-S-1067-Cannot determine bounds for array - functor */        \
+    auto const functor(afunctor);                                         \
+    auto val = aval;                                                      \
+    if (chunk_size >= 1) {                                                \
+      /* clang-format off */ \
+      KOKKOS_IMPL_ACC_PRAGMA(parallel loop gang(static:chunk_size) vector reduction(OPERATOR:val) copyin(functor) async(async_arg))                                            \
+      /* clang-format on */                                               \
+      for (auto i = begin; i < end; i++) {                                \
+        functor(i, val);                                                  \
+      }                                                                   \
+    } else {                                                              \
+      /* clang-format off */ \
+      KOKKOS_IMPL_ACC_PRAGMA(parallel loop gang(static:*) vector reduction(OPERATOR:val) copyin(functor) async(async_arg))                                            \
+      /* clang-format on */                                               \
+      for (auto i = begin; i < end; i++) {                                \
+        functor(i, val);                                                  \
+      }                                                                   \
+    }                                                                     \
+    aval = val;                                                           \
+  }                                                                       \
+                                                                          \
+  template <class IndexType, class ValueType, class Functor>              \
+  void OpenACCParallelReduce##REDUCER(Schedule<Dynamic>, int chunk_size,  \
+                                      IndexType begin, IndexType end,     \
+                                      ValueType& aval,                    \
+                                      Functor const& afunctor,            \
+                                      int async_arg) {                    \
+    /* FIXME_OPENACC FIXME_NVHPC workaround compiler bug (incorrect scope \
+       analysis)                                                          \
+       NVC++-S-1067-Cannot determine bounds for array - functor */        \
+    auto const functor(afunctor);                                         \
+    auto val = aval;                                                      \
+    if (chunk_size >= 1) {                                                \
+      /* clang-format off */ \
+      KOKKOS_IMPL_ACC_PRAGMA(parallel loop gang(static:chunk_size) vector reduction(OPERATOR:val) copyin(functor) async(async_arg))                                            \
+      /* clang-format on */                                               \
+      for (auto i = begin; i < end; i++) {                                \
+        functor(i, val);                                                  \
+      }                                                                   \
+    } else {                                                              \
+      /* clang-format off */ \
+      KOKKOS_IMPL_ACC_PRAGMA(parallel loop gang vector reduction(OPERATOR:val) copyin(functor) async(async_arg))                                            \
+      /* clang-format on */                                               \
+      for (auto i = begin; i < end; i++) {                                \
+        functor(i, val);                                                  \
+      }                                                                   \
+    }                                                                     \
+    aval = val;                                                           \
+  }                                                                       \
+  }  // namespace Kokkos::Experimental::Impl
+
+#define KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER(REDUCER, OPERATOR)          \
+  KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_DISPATCH_SCHEDULE(REDUCER, OPERATOR)     \
+  template <class Functor, class Scalar, class Space, class... Traits>         \
+  struct Kokkos::Experimental::Impl::OpenACCParallelReduceHelper<              \
+      Functor, Kokkos::REDUCER<Scalar, Space>, Kokkos::RangePolicy<Traits...>, \
+      true> {                                                                  \
+    using Policy = RangePolicy<Traits...>;                                     \
+    using ScheduleType =                                                       \
+        Kokkos::Experimental::Impl::OpenACCScheduleType<Policy>;               \
+    using Reducer   = REDUCER<Scalar, Space>;                                  \
+    using ValueType = typename Reducer::value_type;                            \
+                                                                               \
+    OpenACCParallelReduceHelper(Functor const& functor,                        \
+                                Reducer const& reducer,                        \
+                                Policy const& policy) {                        \
+      auto const begin = policy.begin();                                       \
+      auto const end   = policy.end();                                         \
+                                                                               \
+      if (end <= begin) {                                                      \
+        return;                                                                \
+      }                                                                        \
+                                                                               \
+      ValueType val;                                                           \
+      reducer.init(val);                                                       \
+                                                                               \
+      int const async_arg  = policy.space().acc_async_queue();                 \
+      int const chunk_size = policy.chunk_size();                              \
+                                                                               \
+      OpenACCParallelReduce##REDUCER(ScheduleType(), chunk_size, begin, end,   \
+                                     val, functor, async_arg);                 \
+                                                                               \
+      reducer.reference() = val;                                               \
+    }                                                                          \
+  }
+
+KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER(Sum, +);
+KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER(Prod, *);
+KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER(Min, min);
+KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER(Max, max);
+KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER(LAnd, &&);
+KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER(LOr, ||);
+KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER(BAnd, &);
+KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER(BOr, |);
+
+#undef KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER
+#undef KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_DISPATCH_SCHEDULE
+
+#endif
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ScheduleType.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ScheduleType.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..717adc5a2f829b97d142a406fe685efe9694a42f
--- /dev/null
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ScheduleType.hpp
@@ -0,0 +1,41 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_OPENACC_SCHEDULE_TYPE_HPP
+#define KOKKOS_OPENACC_SCHEDULE_TYPE_HPP
+
+#include <Kokkos_Concepts.hpp>
+#include <type_traits>
+
+namespace Kokkos::Experimental::Impl {
+
+template <class Policy, class ScheduleType = typename Policy::schedule_type>
+struct OpenACCSchedule {
+  static_assert(is_execution_policy_v<Policy>);
+  static_assert(std::is_void_v<ScheduleType> ||
+                std::is_same_v<ScheduleType, Schedule<Static>> ||
+                std::is_same_v<ScheduleType, Schedule<Dynamic>>);
+  using type =
+      std::conditional_t<std::is_same_v<ScheduleType, Schedule<Static>>,
+                         Schedule<Static>, Schedule<Dynamic>>;
+};
+
+template <class Policy>
+using OpenACCScheduleType = typename OpenACCSchedule<Policy>::type;
+
+}  // namespace Kokkos::Experimental::Impl
+
+#endif
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_SharedAllocationRecord.cpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_SharedAllocationRecord.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..91faa64f733380801b9f58770454be1997087288
--- /dev/null
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_SharedAllocationRecord.cpp
@@ -0,0 +1,107 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#define KOKKOS_IMPL_PUBLIC_INCLUDE
+
+#include <OpenACC/Kokkos_OpenACC_SharedAllocationRecord.hpp>
+#include <OpenACC/Kokkos_OpenACC_DeepCopy.hpp>
+#include <impl/Kokkos_MemorySpace.hpp>
+#include <Kokkos_HostSpace.hpp>
+
+#ifdef KOKKOS_ENABLE_DEBUG
+Kokkos::Impl::SharedAllocationRecord<void, void> SharedAllocationRecord<
+    Kokkos::Experimental::OpenACCSpace, void>::s_root_record;
+#endif
+
+Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace,
+                                     void>::~SharedAllocationRecord() {
+  m_space.deallocate(m_label.c_str(),
+                     SharedAllocationRecord<void, void>::m_alloc_ptr,
+                     (SharedAllocationRecord<void, void>::m_alloc_size -
+                      sizeof(SharedAllocationHeader)));
+}
+
+Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace, void>::
+    SharedAllocationRecord(
+        const Kokkos::Experimental::OpenACCSpace &arg_space,
+        const std::string &arg_label, const size_t arg_alloc_size,
+        const SharedAllocationRecord<void, void>::function_type arg_dealloc)
+    // Pass through allocated [ SharedAllocationHeader , user_memory ]
+    // Pass through deallocation function
+    : base_t(
+#ifdef KOKKOS_ENABLE_DEBUG
+          &SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace,
+                                  void>::s_root_record,
+#endif
+          Impl::checked_allocation_with_header(arg_space, arg_label,
+                                               arg_alloc_size),
+          sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc,
+          arg_label),
+      m_space(arg_space) {
+  SharedAllocationHeader header;
+
+  this->base_t::_fill_host_accessible_header_info(header, arg_label);
+
+  Kokkos::Impl::DeepCopy<Experimental::OpenACCSpace, HostSpace>(
+      RecordBase::m_alloc_ptr, &header, sizeof(SharedAllocationHeader));
+  Kokkos::fence(
+      "SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace, "
+      "void>::SharedAllocationRecord(): fence after copying header from "
+      "HostSpace");
+}
+
+Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace, void>::
+    SharedAllocationRecord(
+        const Kokkos::Experimental::OpenACC &arg_exec_space,
+        const Kokkos::Experimental::OpenACCSpace &arg_space,
+        const std::string &arg_label, const size_t arg_alloc_size,
+        const SharedAllocationRecord<void, void>::function_type arg_dealloc)
+    // Pass through allocated [ SharedAllocationHeader , user_memory ]
+    // Pass through deallocation function
+    : base_t(
+#ifdef KOKKOS_ENABLE_DEBUG
+          &SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace,
+                                  void>::s_root_record,
+#endif
+          Impl::checked_allocation_with_header(arg_exec_space, arg_space,
+                                               arg_label, arg_alloc_size),
+          sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc,
+          arg_label),
+      m_space(arg_space) {
+  SharedAllocationHeader header;
+
+  this->base_t::_fill_host_accessible_header_info(header, arg_label);
+
+  Kokkos::Impl::DeepCopy<Experimental::OpenACCSpace, HostSpace>(
+      arg_exec_space, RecordBase::m_alloc_ptr, &header,
+      sizeof(SharedAllocationHeader));
+}
+
+//==============================================================================
+// <editor-fold desc="Explicit instantiations of CRTP Base classes"> {{{1
+
+#include <impl/Kokkos_SharedAlloc_timpl.hpp>
+
+// To avoid additional compilation cost for something that's (mostly?) not
+// performance sensitive, we explicitly instantiate these CRTP base classes
+// here, where we have access to the associated *_timpl.hpp header files.
+template class Kokkos::Impl::HostInaccessibleSharedAllocationRecordCommon<
+    Kokkos::Experimental::OpenACCSpace>;
+template class Kokkos::Impl::SharedAllocationRecordCommon<
+    Kokkos::Experimental::OpenACCSpace>;
+
+// </editor-fold> end Explicit instantiations of CRTP Base classes }}}1
+//==============================================================================
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_SharedAllocationRecord.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_SharedAllocationRecord.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..cf83a5b27bcb2b5f3b32940ee18811a0dca8af4d
--- /dev/null
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_SharedAllocationRecord.hpp
@@ -0,0 +1,74 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_OPENACC_SHARED_ALLOCATION_RECORD_HPP
+#define KOKKOS_OPENACC_SHARED_ALLOCATION_RECORD_HPP
+
+#include <OpenACC/Kokkos_OpenACCSpace.hpp>
+#include <impl/Kokkos_SharedAlloc.hpp>
+
+#include <openacc.h>
+
+template <>
+class Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace,
+                                           void>
+    : public HostInaccessibleSharedAllocationRecordCommon<
+          Kokkos::Experimental::OpenACCSpace> {
+ private:
+  friend class HostInaccessibleSharedAllocationRecordCommon<
+      Kokkos::Experimental::OpenACCSpace>;
+  friend class SharedAllocationRecordCommon<Kokkos::Experimental::OpenACCSpace>;
+  friend Kokkos::Experimental::OpenACCSpace;
+
+  using base_t = HostInaccessibleSharedAllocationRecordCommon<
+      Kokkos::Experimental::OpenACCSpace>;
+  using RecordBase = SharedAllocationRecord<void, void>;
+
+  SharedAllocationRecord(const SharedAllocationRecord&) = delete;
+  SharedAllocationRecord& operator=(const SharedAllocationRecord&) = delete;
+
+  /**\brief  Root record for tracked allocations from this OpenACCSpace
+   * instance */
+  static RecordBase s_root_record;
+
+  const Kokkos::Experimental::OpenACCSpace m_space;
+
+ protected:
+  ~SharedAllocationRecord();
+  SharedAllocationRecord() = default;
+
+  template <typename ExecutionSpace>
+  SharedAllocationRecord(
+      const ExecutionSpace& /*exec_space*/,
+      const Kokkos::Experimental::OpenACCSpace& arg_space,
+      const std::string& arg_label, const size_t arg_alloc_size,
+      const RecordBase::function_type arg_dealloc = &deallocate)
+      : SharedAllocationRecord(arg_space, arg_label, arg_alloc_size,
+                               arg_dealloc) {}
+
+  SharedAllocationRecord(
+      const Kokkos::Experimental::OpenACC& exec_space,
+      const Kokkos::Experimental::OpenACCSpace& arg_space,
+      const std::string& arg_label, const size_t arg_alloc_size,
+      const RecordBase::function_type arg_dealloc = &deallocate);
+
+  SharedAllocationRecord(
+      const Kokkos::Experimental::OpenACCSpace& arg_space,
+      const std::string& arg_label, const size_t arg_alloc_size,
+      const RecordBase::function_type arg_dealloc = &deallocate);
+};
+
+#endif
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Team.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Team.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..3a46f2c483440f85a94a6ed6dc12c37aa402c8a3
--- /dev/null
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Team.hpp
@@ -0,0 +1,578 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_OPENACC_TEAM_HPP
+#define KOKKOS_OPENACC_TEAM_HPP
+
+#include <openacc.h>
+#include <impl/Kokkos_Traits.hpp>
+#include <OpenACC/Kokkos_OpenACC.hpp>
+#include <Kokkos_ExecPolicy.hpp>
+
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+
+namespace Kokkos {
+namespace Impl {
+
+class OpenACCTeamMember {
+ public:
+  constexpr static int TEAM_REDUCE_SIZE = 512;
+  // FIXME_OPENACC: default-team-size macros are temporarily used for
+  // team_size_max and team_size_recommended APIs
+  constexpr static int DEFAULT_TEAM_SIZE_MAX = 512;
+  constexpr static int DEFAULT_TEAM_SIZE_REC = 128;
+
+  using execution_space      = Kokkos::Experimental::OpenACC;
+  using scratch_memory_space = execution_space::scratch_memory_space;
+  using team_handle          = OpenACCTeamMember;
+
+  scratch_memory_space m_team_shared;
+  int m_team_scratch_size[2];
+  int m_team_rank;
+  int m_team_size;
+  int m_league_rank;
+  int m_league_size;
+  int m_vector_length;
+
+ public:
+  KOKKOS_FUNCTION
+  const execution_space::scratch_memory_space& team_shmem() const {
+    return m_team_shared.set_team_thread_mode(0, 1, 0);
+  }
+
+  KOKKOS_FUNCTION
+  const execution_space::scratch_memory_space& team_scratch(int level) const {
+    return m_team_shared.set_team_thread_mode(level, 1,
+                                              m_team_scratch_size[level]);
+  }
+
+  KOKKOS_FUNCTION
+  const execution_space::scratch_memory_space& thread_scratch(int level) const {
+    return m_team_shared.set_team_thread_mode(level, team_size(), team_rank());
+  }
+
+  KOKKOS_FUNCTION int league_rank() const { return m_league_rank; }
+  KOKKOS_FUNCTION int league_size() const { return m_league_size; }
+  KOKKOS_FUNCTION int team_rank() const { return m_team_rank; }
+  KOKKOS_FUNCTION int vector_length() const { return m_vector_length; }
+  KOKKOS_FUNCTION int team_size() const { return m_team_size; }
+
+  // FIXME_OPENACC: OpenACC does not provide any explicit barrier constructs
+  // for device kernels.
+  KOKKOS_FUNCTION void team_barrier() const {
+    Kokkos::abort(
+        "Kokkos::Experimental::OpenACC ERROR: OpenACC does not provide any "
+        "explicit barrier constructs for device kernels; exit!");
+  }
+
+  // FIXME_OPENACC: team_broadcast() is not implemented.
+  template <class ValueType>
+  KOKKOS_FUNCTION void team_broadcast(ValueType& value, int thread_id) const {
+    static_assert(Kokkos::Impl::always_false<ValueType>::value,
+                  "Kokkos Error: team_broadcast() is not implemented for the "
+                  "OpenACC backend");
+    return ValueType();
+  }
+
+  template <class Closure, class ValueType>
+  KOKKOS_FUNCTION void team_broadcast(const Closure& f, ValueType& value,
+                                      int thread_id) const {
+    f(value);
+    team_broadcast(value, thread_id);
+  }
+
+  // FIXME_OPENACC: team_reduce() is not implemented.
+  template <class ValueType, class JoinOp>
+  KOKKOS_FUNCTION ValueType team_reduce(const ValueType& value,
+                                        const JoinOp& op_in) const {
+    static_assert(Kokkos::Impl::always_false<ValueType>::value,
+                  "Kokkos Error: team_reduce() is not implemented for the "
+                  "OpenACC backend");
+    return ValueType();
+  }
+
+  // FIXME_OPENACC: team_scan() is not implemented.
+  template <typename ArgType>
+  KOKKOS_FUNCTION ArgType team_scan(const ArgType& /*value*/,
+                                    ArgType* const /*global_accum*/) const {
+    static_assert(
+        Kokkos::Impl::always_false<ArgType>::value,
+        "Kokkos Error: team_scan() is not implemented for the OpenACC backend");
+    return ArgType();
+  }
+
+  template <typename Type>
+  KOKKOS_FUNCTION Type team_scan(const Type& value) const {
+    return this->template team_scan<Type>(value, 0);
+  }
+
+  //----------------------------------------
+  // Private for the driver
+
+ private:
+  using space = execution_space::scratch_memory_space;
+
+ public:
+  // FIXME_OPENACC - 512(16*32) bytes at the begining of the scratch space
+  // for each league is saved for reduction. It should actually be based on the
+  // ValueType of the reduction variable.
+  OpenACCTeamMember(const int league_rank, const int league_size,
+                    const int team_size,
+                    const int vector_length)  // const TeamPolicyInternal<
+                                              // OpenACC, Properties ...> & team
+      : m_team_size(team_size),
+        m_league_rank(league_rank),
+        m_league_size(league_size),
+        m_vector_length(vector_length) {
+#ifdef KOKKOS_COMPILER_NVHPC
+    m_team_rank = __pgi_vectoridx();
+#else
+    m_team_rank = 0;
+#endif
+  }
+
+  static int team_reduce_size() { return TEAM_REDUCE_SIZE; }
+};
+
+template <class... Properties>
+class TeamPolicyInternal<Kokkos::Experimental::OpenACC, Properties...>
+    : public PolicyTraits<Properties...> {
+ public:
+  //! Tag this class as a kokkos execution policy
+  using execution_policy = TeamPolicyInternal;
+
+  using traits = PolicyTraits<Properties...>;
+
+  //----------------------------------------
+
+  // FIXME_OPENACC: update team_size_max() APIs with realistic
+  // implementations.
+  template <class FunctorType>
+  static int team_size_max(const FunctorType&, const ParallelForTag&) {
+    return DEFAULT_TEAM_SIZE_MAX;
+  }
+
+  template <class FunctorType>
+  static int team_size_max(const FunctorType&, const ParallelReduceTag&) {
+    return DEFAULT_TEAM_SIZE_MAX;
+  }
+
+  template <class FunctorType, class ReducerType>
+  static int team_size_max(const FunctorType&, const ReducerType&,
+                           const ParallelReduceTag&) {
+    return DEFAULT_TEAM_SIZE_MAX;
+  }
+
+  // FIXME_OPENACC: update team_size_recommended() APIs with realistic
+  // implementations.
+  template <class FunctorType>
+  static int team_size_recommended(const FunctorType&, const ParallelForTag&) {
+    return DEFAULT_TEAM_SIZE_REC;
+  }
+
+  template <class FunctorType>
+  static int team_size_recommended(const FunctorType&,
+                                   const ParallelReduceTag&) {
+    return DEFAULT_TEAM_SIZE_REC;
+  }
+
+  template <class FunctorType, class ReducerType>
+  static int team_size_recommended(const FunctorType&, const ReducerType&,
+                                   const ParallelReduceTag&) {
+    return DEFAULT_TEAM_SIZE_REC;
+  }
+
+  //----------------------------------------
+
+ private:
+  int m_league_size;
+  int m_team_size;
+  int m_vector_length;
+  int m_team_alloc;
+  int m_team_iter;
+  std::array<size_t, 2> m_team_scratch_size;
+  std::array<size_t, 2> m_thread_scratch_size;
+  bool m_tune_team_size;
+  bool m_tune_vector_length;
+  constexpr static const size_t default_team_size =
+      OpenACCTeamMember::DEFAULT_TEAM_SIZE_REC;
+  int m_chunk_size;
+
+  void init(const int league_size_request, const int team_size_request,
+            const int vector_length_request) {
+    m_league_size   = league_size_request;
+    m_team_size     = team_size_request;
+    m_vector_length = vector_length_request;
+    set_auto_chunk_size();
+  }
+
+  template <typename ExecSpace, typename... OtherProperties>
+  friend class TeamPolicyInternal;
+
+ public:
+  bool impl_auto_team_size() const { return m_tune_team_size; }
+  bool impl_auto_vector_length() const { return m_tune_vector_length; }
+  void impl_set_team_size(const size_t size) { m_team_size = size; }
+  void impl_set_vector_length(const size_t length) {
+    m_tune_vector_length = length;
+  }
+  int impl_vector_length() const { return m_vector_length; }
+  int team_size() const { return m_team_size; }
+  int league_size() const { return m_league_size; }
+  size_t scratch_size(const int& level, int team_size_ = -1) const {
+    if (team_size_ < 0) team_size_ = m_team_size;
+    return m_team_scratch_size[level] +
+           team_size_ * m_thread_scratch_size[level];
+  }
+
+  Kokkos::Experimental::OpenACC space() const {
+    return Kokkos::Experimental::OpenACC();
+  }
+
+  template <class... OtherProperties>
+  TeamPolicyInternal(const TeamPolicyInternal<OtherProperties...>& p)
+      : m_league_size(p.m_league_size),
+        m_team_size(p.m_team_size),
+        m_vector_length(p.m_vector_length),
+        m_team_alloc(p.m_team_alloc),
+        m_team_iter(p.m_team_iter),
+        m_team_scratch_size(p.m_team_scratch_size),
+        m_thread_scratch_size(p.m_thread_scratch_size),
+        m_tune_team_size(p.m_tune_team_size),
+        m_tune_vector_length(p.m_tune_vector_length),
+        m_chunk_size(p.m_chunk_size) {}
+
+  /** \brief  Specify league size, request team size */
+  TeamPolicyInternal(const typename traits::execution_space&,
+                     int league_size_request, int team_size_request,
+                     int vector_length_request = 1)
+      : m_team_scratch_size{0, 0},
+        m_thread_scratch_size{0, 0},
+        m_tune_team_size(false),
+        m_tune_vector_length(false),
+        m_chunk_size(0) {
+    init(league_size_request, team_size_request, vector_length_request);
+  }
+
+  TeamPolicyInternal(const typename traits::execution_space&,
+                     int league_size_request,
+                     const Kokkos::AUTO_t& /* team_size_request */
+                     ,
+                     int vector_length_request = 1)
+      : m_team_scratch_size{0, 0},
+        m_thread_scratch_size{0, 0},
+        m_tune_team_size(true),
+        m_tune_vector_length(false),
+        m_chunk_size(0) {
+    init(league_size_request, default_team_size / vector_length_request,
+         vector_length_request);
+  }
+
+  TeamPolicyInternal(const typename traits::execution_space&,
+                     int league_size_request,
+                     const Kokkos::AUTO_t& /* team_size_request */
+                     ,
+                     const Kokkos::AUTO_t& /* vector_length_request */)
+      : m_team_scratch_size{0, 0},
+        m_thread_scratch_size{0, 0},
+        m_tune_team_size(true),
+        m_tune_vector_length(true),
+        m_chunk_size(0) {
+    init(league_size_request, default_team_size, 1);
+  }
+  TeamPolicyInternal(const typename traits::execution_space&,
+                     int league_size_request, int team_size_request,
+                     const Kokkos::AUTO_t& /* vector_length_request */)
+      : m_team_scratch_size{0, 0},
+        m_thread_scratch_size{0, 0},
+        m_tune_team_size(false),
+        m_tune_vector_length(true),
+        m_chunk_size(0) {
+    init(league_size_request, team_size_request, 1);
+  }
+
+  TeamPolicyInternal(int league_size_request, int team_size_request,
+                     int vector_length_request = 1)
+      : m_team_scratch_size{0, 0},
+        m_thread_scratch_size{0, 0},
+        m_tune_team_size(false),
+        m_tune_vector_length(false),
+        m_chunk_size(0) {
+    init(league_size_request, team_size_request, vector_length_request);
+  }
+
+  TeamPolicyInternal(int league_size_request,
+                     const Kokkos::AUTO_t& /* team_size_request */
+                     ,
+                     int vector_length_request = 1)
+      : m_team_scratch_size{0, 0},
+        m_thread_scratch_size{0, 0},
+        m_tune_team_size(true),
+        m_tune_vector_length(false),
+        m_chunk_size(0) {
+    init(league_size_request, default_team_size / vector_length_request,
+         vector_length_request);
+  }
+
+  TeamPolicyInternal(int league_size_request,
+                     const Kokkos::AUTO_t& /* team_size_request */
+                     ,
+                     const Kokkos::AUTO_t& /* vector_length_request */)
+      : m_team_scratch_size{0, 0},
+        m_thread_scratch_size{0, 0},
+        m_tune_team_size(true),
+        m_tune_vector_length(true),
+        m_chunk_size(0) {
+    init(league_size_request, default_team_size, 1);
+  }
+  TeamPolicyInternal(int league_size_request, int team_size_request,
+                     const Kokkos::AUTO_t& /* vector_length_request */)
+      : m_team_scratch_size{0, 0},
+        m_thread_scratch_size{0, 0},
+        m_tune_team_size(false),
+        m_tune_vector_length(true),
+        m_chunk_size(0) {
+    init(league_size_request, team_size_request, 1);
+  }
+  static size_t vector_length_max() {
+    return 32; /* TODO: this is bad. Need logic that is compiler and backend
+                  aware */
+  }
+  int team_alloc() const { return m_team_alloc; }
+  int team_iter() const { return m_team_iter; }
+
+  int chunk_size() const { return m_chunk_size; }
+
+  /** \brief set chunk_size to a discrete value*/
+  TeamPolicyInternal& set_chunk_size(typename traits::index_type chunk_size_) {
+    m_chunk_size = chunk_size_;
+    return *this;
+  }
+
+  /** \brief set per team scratch size for a specific level of the scratch
+   * hierarchy */
+  TeamPolicyInternal& set_scratch_size(const int& level,
+                                       const PerTeamValue& per_team) {
+    m_team_scratch_size[level] = per_team.value;
+    return *this;
+  }
+
+  /** \brief set per thread scratch size for a specific level of the scratch
+   * hierarchy */
+  TeamPolicyInternal& set_scratch_size(const int& level,
+                                       const PerThreadValue& per_thread) {
+    m_thread_scratch_size[level] = per_thread.value;
+    return *this;
+  }
+
+  /** \brief set per thread and per team scratch size for a specific level of
+   * the scratch hierarchy */
+  TeamPolicyInternal& set_scratch_size(const int& level,
+                                       const PerTeamValue& per_team,
+                                       const PerThreadValue& per_thread) {
+    m_team_scratch_size[level]   = per_team.value;
+    m_thread_scratch_size[level] = per_thread.value;
+    return *this;
+  }
+
+ private:
+  /** \brief finalize chunk_size if it was set to AUTO*/
+  void set_auto_chunk_size() {
+    int concurrency = 2048 * default_team_size;
+
+    if (m_chunk_size > 0) {
+      if (!Impl::is_integral_power_of_two(m_chunk_size))
+        Kokkos::abort("TeamPolicy blocking granularity must be power of two");
+    }
+
+    int new_chunk_size = 1;
+    while (new_chunk_size * 100 * concurrency < m_league_size)
+      new_chunk_size *= 2;
+    if (new_chunk_size < default_team_size) {
+      new_chunk_size = 1;
+      while ((new_chunk_size * 40 * concurrency < m_league_size) &&
+             (new_chunk_size < default_team_size))
+        new_chunk_size *= 2;
+    }
+    m_chunk_size = new_chunk_size;
+  }
+
+ public:
+  using member_type = Impl::OpenACCTeamMember;
+};
+}  // namespace Impl
+}  // namespace Kokkos
+
+namespace Kokkos {
+namespace Impl {
+
+template <typename iType>
+struct TeamThreadRangeBoundariesStruct<iType, OpenACCTeamMember> {
+  using index_type = iType;
+  const iType start;
+  const iType end;
+  const OpenACCTeamMember& team;
+
+  TeamThreadRangeBoundariesStruct(const OpenACCTeamMember& thread_, iType count)
+      : start(0), end(count), team(thread_) {}
+  TeamThreadRangeBoundariesStruct(const OpenACCTeamMember& thread_,
+                                  iType begin_, iType end_)
+      : start(begin_), end(end_), team(thread_) {}
+};
+
+template <typename iType>
+struct ThreadVectorRangeBoundariesStruct<iType, OpenACCTeamMember> {
+  using index_type = iType;
+  const index_type start;
+  const index_type end;
+  const OpenACCTeamMember& team;
+
+  ThreadVectorRangeBoundariesStruct(const OpenACCTeamMember& thread_,
+                                    index_type count)
+      : start(0), end(count), team(thread_) {}
+  ThreadVectorRangeBoundariesStruct(const OpenACCTeamMember& thread_,
+                                    index_type begin_, index_type end_)
+      : start(begin_), end(end_), team(thread_) {}
+};
+
+template <typename iType>
+struct TeamVectorRangeBoundariesStruct<iType, OpenACCTeamMember> {
+  using index_type = iType;
+  const index_type start;
+  const index_type end;
+  const OpenACCTeamMember& team;
+
+  TeamVectorRangeBoundariesStruct(const OpenACCTeamMember& thread_,
+                                  index_type count)
+      : start(0), end(count), team(thread_) {}
+  TeamVectorRangeBoundariesStruct(const OpenACCTeamMember& thread_,
+                                  index_type begin_, index_type end_)
+      : start(begin_), end(end_), team(thread_) {}
+};
+
+}  // namespace Impl
+}  // namespace Kokkos
+
+namespace Kokkos {
+
+template <typename iType>
+KOKKOS_INLINE_FUNCTION
+    Impl::TeamThreadRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>
+    TeamThreadRange(const Impl::OpenACCTeamMember& thread, const iType& count) {
+  return Impl::TeamThreadRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>(
+      thread, count);
+}
+
+template <typename iType1, typename iType2>
+KOKKOS_INLINE_FUNCTION Impl::TeamThreadRangeBoundariesStruct<
+    typename std::common_type<iType1, iType2>::type, Impl::OpenACCTeamMember>
+TeamThreadRange(const Impl::OpenACCTeamMember& thread, const iType1& begin,
+                const iType2& end) {
+  using iType = typename std::common_type<iType1, iType2>::type;
+  return Impl::TeamThreadRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>(
+      thread, iType(begin), iType(end));
+}
+
+template <typename iType>
+KOKKOS_INLINE_FUNCTION
+    Impl::ThreadVectorRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>
+    ThreadVectorRange(const Impl::OpenACCTeamMember& thread,
+                      const iType& count) {
+  return Impl::ThreadVectorRangeBoundariesStruct<iType,
+                                                 Impl::OpenACCTeamMember>(
+      thread, count);
+}
+
+template <typename iType1, typename iType2>
+KOKKOS_INLINE_FUNCTION Impl::ThreadVectorRangeBoundariesStruct<
+    typename std::common_type<iType1, iType2>::type, Impl::OpenACCTeamMember>
+ThreadVectorRange(const Impl::OpenACCTeamMember& thread,
+                  const iType1& arg_begin, const iType2& arg_end) {
+  using iType = typename std::common_type<iType1, iType2>::type;
+  return Impl::ThreadVectorRangeBoundariesStruct<iType,
+                                                 Impl::OpenACCTeamMember>(
+      thread, iType(arg_begin), iType(arg_end));
+}
+
+template <typename iType>
+KOKKOS_INLINE_FUNCTION
+    Impl::TeamVectorRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>
+    TeamVectorRange(const Impl::OpenACCTeamMember& thread, const iType& count) {
+  return Impl::TeamVectorRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>(
+      thread, count);
+}
+
+template <typename iType1, typename iType2>
+KOKKOS_INLINE_FUNCTION Impl::TeamVectorRangeBoundariesStruct<
+    typename std::common_type<iType1, iType2>::type, Impl::OpenACCTeamMember>
+TeamVectorRange(const Impl::OpenACCTeamMember& thread, const iType1& arg_begin,
+                const iType2& arg_end) {
+  using iType = typename std::common_type<iType1, iType2>::type;
+  return Impl::TeamVectorRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>(
+      thread, iType(arg_begin), iType(arg_end));
+}
+
+KOKKOS_INLINE_FUNCTION
+Impl::ThreadSingleStruct<Impl::OpenACCTeamMember> PerTeam(
+    const Impl::OpenACCTeamMember& thread) {
+  return Impl::ThreadSingleStruct<Impl::OpenACCTeamMember>(thread);
+}
+
+KOKKOS_INLINE_FUNCTION
+Impl::VectorSingleStruct<Impl::OpenACCTeamMember> PerThread(
+    const Impl::OpenACCTeamMember& thread) {
+  return Impl::VectorSingleStruct<Impl::OpenACCTeamMember>(thread);
+}
+}  // namespace Kokkos
+
+namespace Kokkos {
+
+template <class FunctorType>
+KOKKOS_INLINE_FUNCTION void single(
+    const Impl::VectorSingleStruct<Impl::OpenACCTeamMember>&
+    /*single_struct*/,
+    const FunctorType& lambda) {
+  lambda();
+}
+
+template <class FunctorType>
+KOKKOS_INLINE_FUNCTION void single(
+    const Impl::ThreadSingleStruct<Impl::OpenACCTeamMember>& single_struct,
+    const FunctorType& lambda) {
+  if (single_struct.team_member.team_rank() == 0) lambda();
+}
+
+template <class FunctorType, class ValueType>
+KOKKOS_INLINE_FUNCTION void single(
+    const Impl::VectorSingleStruct<Impl::OpenACCTeamMember>&
+    /*single_struct*/,
+    const FunctorType& lambda, ValueType& val) {
+  lambda(val);
+}
+
+template <class FunctorType, class ValueType>
+KOKKOS_INLINE_FUNCTION void single(
+    const Impl::ThreadSingleStruct<Impl::OpenACCTeamMember>& single_struct,
+    const FunctorType& lambda, ValueType& val) {
+  if (single_struct.team_member.team_rank() == 0) {
+    lambda(val);
+  }
+  single_struct.team_member.team_broadcast(val, 0);
+}
+}  // namespace Kokkos
+
+#endif /* #ifndef KOKKOS_OPENACC_TEAM_HPP */
diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Traits.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Traits.hpp
index f9451ecfe67d0a4e98e2c9378a6fd414130f9395..c8a6dfec6f71d901f7108b020ed691be5795d9ab 100644
--- a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Traits.hpp
+++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Traits.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_OPENACC_TRAITS_HPP
 #define KOKKOS_OPENACC_TRAITS_HPP
@@ -51,7 +23,7 @@ namespace Kokkos::Experimental::Impl {
 
 struct OpenACC_Traits {
 #if defined(KOKKOS_ARCH_PASCAL) || defined(KOKKOS_ARCH_VOLTA) || \
-    defined(KOKKOS_ARCH_AMPERE)
+    defined(KOKKOS_ARCH_AMPERE) || defined(KOKKOS_ARCH_HOPPER)
   static constexpr acc_device_t dev_type     = acc_device_nvidia;
   static constexpr bool may_fallback_to_host = false;
 #else
diff --git a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp
index 2397aa4785b88a236862f14f814ae147d5bdcf1c..b1ccac51562781983b4e86fdfffe9d50d420b3a1 100644
--- a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp
+++ b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp
@@ -1,58 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
 #endif
 
-#include <cstdio>
-#include <cstdlib>
-
-#include <limits>
-#include <iostream>
-#include <vector>
-
 #include <Kokkos_Core.hpp>
 
 #include <impl/Kokkos_Error.hpp>
@@ -60,14 +25,27 @@
 #include <impl/Kokkos_Tools.hpp>
 #include <impl/Kokkos_ExecSpaceManager.hpp>
 
+#include <cstdlib>
+#include <iomanip>
+#include <iostream>
+#include <sstream>
+#include <thread>
+
 namespace Kokkos {
 namespace Impl {
 
-int g_openmp_hardware_max_threads = 1;
+void OpenMPInternal::acquire_lock() {
+  while (1 == desul::atomic_compare_exchange(&m_pool_mutex, 0, 1,
+                                             desul::MemoryOrderAcquire(),
+                                             desul::MemoryScopeDevice())) {
+    // do nothing
+  }
+}
 
-thread_local int t_openmp_hardware_id = 0;
-// FIXME_OPENMP we can remove this after we remove partition_master
-thread_local OpenMPInternal *t_openmp_instance = nullptr;
+void OpenMPInternal::release_lock() {
+  desul::atomic_store(&m_pool_mutex, 0, desul::MemoryOrderRelease(),
+                      desul::MemoryScopeDevice());
+}
 
 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
 void OpenMPInternal::validate_partition_impl(const int nthreads,
@@ -196,10 +174,7 @@ void OpenMPInternal::resize_thread_data(size_t pool_reduce_bytes,
 
     memory_fence();
 
-#pragma omp parallel num_threads(m_pool_size)
-    {
-      const int rank = omp_get_thread_num();
-
+    for (int rank = 0; rank < m_pool_size; ++rank) {
       if (nullptr != m_pool[rank]) {
         m_pool[rank]->disband_pool();
 
@@ -220,10 +195,7 @@ void OpenMPInternal::resize_thread_data(size_t pool_reduce_bytes,
       m_pool[rank]->scratch_assign(((char *)ptr) + member_bytes, alloc_bytes,
                                    pool_reduce_bytes, team_reduce_bytes,
                                    team_shared_bytes, thread_local_bytes);
-
-      memory_fence();
     }
-    /* END #pragma omp parallel */
 
     HostThreadTeamData::organize_pool(m_pool, m_pool_size);
   }
@@ -270,14 +242,12 @@ void OpenMPInternal::initialize(int thread_count) {
 
   {
     if (Kokkos::show_warnings() && nullptr == std::getenv("OMP_PROC_BIND")) {
-      printf(
-          "Kokkos::OpenMP::initialize WARNING: OMP_PROC_BIND environment "
-          "variable not set\n");
-      printf(
-          "  In general, for best performance with OpenMP 4.0 or better set "
-          "OMP_PROC_BIND=spread and OMP_PLACES=threads\n");
-      printf("  For best performance with OpenMP 3.1 set OMP_PROC_BIND=true\n");
-      printf("  For unit testing set OMP_PROC_BIND=false\n");
+      std::cerr
+          << R"WARNING(Kokkos::OpenMP::initialize WARNING: OMP_PROC_BIND environment variable not set
+  In general, for best performance with OpenMP 4.0 or better set OMP_PROC_BIND=spread and OMP_PLACES=threads
+  For best performance with OpenMP 3.1 set OMP_PROC_BIND=true
+  For unit testing set OMP_PROC_BIND=false
+)WARNING" << std::endl;
     }
 
     OpenMP::memory_space space;
@@ -308,11 +278,12 @@ void OpenMPInternal::initialize(int thread_count) {
       }
     } else {
       if (Kokkos::show_warnings() && thread_count > process_num_threads) {
-        printf(
-            "Kokkos::OpenMP::initialize WARNING: You are likely "
-            "oversubscribing your CPU cores.\n");
-        printf("  process threads available : %3d,  requested thread : %3d\n",
-               process_num_threads, thread_count);
+        std::cerr << "Kokkos::OpenMP::initialize WARNING: You are likely "
+                     "oversubscribing your CPU cores.\n"
+                  << "  process threads available : " << std::setw(3)
+                  << process_num_threads
+                  << ",  requested thread : " << std::setw(3) << thread_count
+                  << std::endl;
       }
       Impl::g_openmp_hardware_max_threads = thread_count;
       omp_set_num_threads(Impl::g_openmp_hardware_max_threads);
@@ -320,10 +291,7 @@ void OpenMPInternal::initialize(int thread_count) {
 
 // setup thread local
 #pragma omp parallel num_threads(Impl::g_openmp_hardware_max_threads)
-    {
-      Impl::t_openmp_hardware_id = omp_get_thread_num();
-      Impl::SharedAllocationRecord<void, void>::tracking_enable();
-    }
+    { Impl::SharedAllocationRecord<void, void>::tracking_enable(); }
 
     auto &instance       = OpenMPInternal::singleton();
     instance.m_pool_size = Impl::g_openmp_hardware_max_threads;
@@ -341,21 +309,22 @@ void OpenMPInternal::initialize(int thread_count) {
   }
 
   // Check for over-subscription
+  auto const reported_ranks = mpi_ranks_per_node();
+  auto const mpi_local_size = reported_ranks < 0 ? 1 : reported_ranks;
+  int const procs_per_node  = std::thread::hardware_concurrency();
   if (Kokkos::show_warnings() &&
-      (Impl::mpi_ranks_per_node() * long(thread_count) >
-       Impl::processors_per_node())) {
+      (mpi_local_size * long(thread_count) > procs_per_node)) {
     std::cerr << "Kokkos::OpenMP::initialize WARNING: You are likely "
                  "oversubscribing your CPU cores."
               << std::endl;
     std::cerr << "                                    Detected: "
-              << Impl::processors_per_node() << " cores per node." << std::endl;
+              << procs_per_node << " cores per node." << std::endl;
     std::cerr << "                                    Detected: "
-              << Impl::mpi_ranks_per_node() << " MPI_ranks per node."
-              << std::endl;
+              << mpi_local_size << " MPI_ranks per node." << std::endl;
     std::cerr << "                                    Requested: "
               << thread_count << " threads per process." << std::endl;
   }
-  // Init the array for used for arbitrarily sized atomics
+  // Init the array used for arbitrarily sized atomics
   init_lock_array_host_space();
 
   m_initialized = true;
@@ -379,10 +348,7 @@ void OpenMPInternal::finalize() {
     (void)nthreads;
 
 #pragma omp parallel num_threads(nthreads)
-    {
-      Impl::t_openmp_hardware_id = 0;
-      Impl::SharedAllocationRecord<void, void>::tracking_disable();
-    }
+    { Impl::SharedAllocationRecord<void, void>::tracking_disable(); }
 
     // allow main thread to track
     Impl::SharedAllocationRecord<void, void>::tracking_enable();
@@ -422,16 +388,21 @@ bool OpenMPInternal::verify_is_initialized(const char *const label) const {
 //----------------------------------------------------------------------------
 
 OpenMP::OpenMP()
-#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS
-    : m_space_instance(&Impl::OpenMPInternal::singleton()) {
-}
-#else
     : m_space_instance(&Impl::OpenMPInternal::singleton(),
                        [](Impl::OpenMPInternal *) {}) {
   Impl::OpenMPInternal::singleton().verify_is_initialized(
       "OpenMP instance constructor");
 }
-#endif
+
+OpenMP::OpenMP(int pool_size)
+    : m_space_instance(new Impl::OpenMPInternal(pool_size),
+                       [](Impl::OpenMPInternal *ptr) {
+                         ptr->finalize();
+                         delete ptr;
+                       }) {
+  Impl::OpenMPInternal::singleton().verify_is_initialized(
+      "OpenMP instance constructor");
+}
 
 int OpenMP::impl_get_current_max_threads() noexcept {
   return Impl::OpenMPInternal::get_current_max_threads();
@@ -461,13 +432,9 @@ void OpenMP::print_configuration(std::ostream &os, bool /*verbose*/) const {
   m_space_instance->print_configuration(os);
 }
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-std::vector<OpenMP> OpenMP::partition(...) { return std::vector<OpenMP>(1); }
-
-OpenMP OpenMP::create_instance(...) { return OpenMP(); }
-#endif
-
-int OpenMP::concurrency() { return Impl::g_openmp_hardware_max_threads; }
+int OpenMP::concurrency(OpenMP const &instance) {
+  return impl_thread_pool_size(instance);
+}
 
 void OpenMP::fence(const std::string &name) const {
   Kokkos::Tools::Experimental::Impl::profile_fence_event<Kokkos::OpenMP>(
@@ -481,12 +448,4 @@ int g_openmp_space_factory_initialized =
 
 }  // namespace Impl
 
-#ifdef KOKKOS_ENABLE_CXX14
-namespace Tools {
-namespace Experimental {
-constexpr DeviceType DeviceTypeTraits<OpenMP>::id;
-}
-}  // namespace Tools
-#endif
-
 }  // namespace Kokkos
diff --git a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Instance.hpp b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Instance.hpp
index 1a2ee95a79e079b8918767fc409f1286a590ea85..e2d52a141ab085dce80bd0b9280a2b776c27019e 100644
--- a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Instance.hpp
+++ b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Instance.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_OPENMP_INSTANCE_HPP
 #define KOKKOS_OPENMP_INSTANCE_HPP
@@ -64,16 +36,22 @@
 
 #include <omp.h>
 
+#include <mutex>
+#include <numeric>
+#include <type_traits>
+#include <vector>
+
 namespace Kokkos {
 namespace Impl {
 
 class OpenMPInternal;
 
-extern int g_openmp_hardware_max_threads;
+inline int g_openmp_hardware_max_threads = 1;
 
-extern thread_local int t_openmp_hardware_id;
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
 // FIXME_OPENMP we can remove this after we remove partition_master
-extern thread_local OpenMPInternal* t_openmp_instance;
+inline thread_local OpenMPInternal* t_openmp_instance = nullptr;
+#endif
 
 struct OpenMPTraits {
   static int constexpr MAX_THREAD_COUNT = 512;
@@ -92,6 +70,7 @@ class OpenMPInternal {
 
   int m_pool_size;
   int m_level;
+  int m_pool_mutex = 0;
 
   HostThreadTeamData* m_pool[OpenMPTraits::MAX_THREAD_COUNT];
 
@@ -106,12 +85,15 @@ class OpenMPInternal {
 
   void clear_thread_data();
 
+  int thread_pool_size() const { return m_pool_size; }
+
+  // Acquire lock used to protect access to m_pool
+  void acquire_lock();
+
+  // Release lock used to protect access to m_pool
+  void release_lock();
+
 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  KOKKOS_DEPRECATED static void validate_partition(const int nthreads,
-                                                   int& num_partitions,
-                                                   int& partition_size) {
-    validate_partition_impl(nthreads, num_partitions, partition_size);
-  }
   static void validate_partition_impl(const int nthreads, int& num_partitions,
                                       int& partition_size);
 #endif
@@ -139,30 +121,40 @@ inline bool OpenMP::impl_is_initialized() noexcept {
   return Impl::OpenMPInternal::singleton().is_initialized();
 }
 
-inline bool OpenMP::in_parallel(OpenMP const&) noexcept {
-  // FIXME_OPENMP We are forced to use t_openmp_instance because the function is
-  // static and does not use the OpenMP object
-  return ((Impl::OpenMPInternal::singleton().m_level < omp_get_level()) &&
-          (!Impl::t_openmp_instance ||
-           Impl::t_openmp_instance->m_level < omp_get_level()));
+inline bool OpenMP::in_parallel(OpenMP const& exec_space) noexcept {
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
+  return (
+      (exec_space.impl_internal_space_instance()->m_level < omp_get_level()) &&
+      (!Impl::t_openmp_instance ||
+       Impl::t_openmp_instance->m_level < omp_get_level()));
+#else
+  return exec_space.impl_internal_space_instance()->m_level < omp_get_level();
+#endif
 }
 
-inline int OpenMP::impl_thread_pool_size() noexcept {
-  // FIXME_OPENMP We are forced to use t_openmp_instance because the function is
-  // static
-  return OpenMP::in_parallel()
+inline int OpenMP::impl_thread_pool_size(OpenMP const& exec_space) noexcept {
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
+  return OpenMP::in_parallel(exec_space)
              ? omp_get_num_threads()
              : (Impl::t_openmp_instance
                     ? Impl::t_openmp_instance->m_pool_size
-                    : Impl::OpenMPInternal::singleton().m_pool_size);
+                    : exec_space.impl_internal_space_instance()->m_pool_size);
+#else
+  return OpenMP::in_parallel(exec_space)
+             ? omp_get_num_threads()
+             : exec_space.impl_internal_space_instance()->m_pool_size;
+#endif
 }
 
-KOKKOS_INLINE_FUNCTION
-int OpenMP::impl_thread_pool_rank() noexcept {
-  // FIXME_OPENMP We are forced to use t_openmp_instance because the function is
-  // static
+inline int OpenMP::impl_thread_pool_rank() noexcept {
+  // FIXME_OPENMP Can we remove this when removing partition_master? It's only
+  // used in one partition_master test
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
   KOKKOS_IF_ON_HOST(
       (return Impl::t_openmp_instance ? 0 : omp_get_thread_num();))
+#else
+  KOKKOS_IF_ON_HOST((return omp_get_thread_num();))
+#endif
 
   KOKKOS_IF_ON_DEVICE((return -1;))
 }
@@ -332,9 +324,11 @@ class UniqueToken<OpenMP, UniqueTokenScope::Global> {
   }
 
   /// \brief acquire value such that 0 <= value < size()
+  // FIXME this is wrong when using nested parallelism. In that case multiple
+  // threads have the same thread ID.
   KOKKOS_INLINE_FUNCTION
   int acquire() const noexcept {
-    KOKKOS_IF_ON_HOST((return Kokkos::Impl::t_openmp_hardware_id;))
+    KOKKOS_IF_ON_HOST((return omp_get_thread_num();))
 
     KOKKOS_IF_ON_DEVICE((return 0;))
   }
@@ -346,13 +340,13 @@ class UniqueToken<OpenMP, UniqueTokenScope::Global> {
 
 }  // namespace Experimental
 
-inline int OpenMP::impl_thread_pool_size(int depth) {
-  return depth < 2 ? impl_thread_pool_size() : 1;
+inline int OpenMP::impl_thread_pool_size(int depth, OpenMP const& exec_space) {
+  return depth < 2 ? impl_thread_pool_size(exec_space) : 1;
 }
 
 KOKKOS_INLINE_FUNCTION
 int OpenMP::impl_hardware_thread_id() noexcept {
-  KOKKOS_IF_ON_HOST((return Impl::t_openmp_hardware_id;))
+  KOKKOS_IF_ON_HOST((return omp_get_thread_num();))
 
   KOKKOS_IF_ON_DEVICE((return -1;))
 }
@@ -361,6 +355,59 @@ inline int OpenMP::impl_max_hardware_threads() noexcept {
   return Impl::g_openmp_hardware_max_threads;
 }
 
+namespace Experimental {
+namespace Impl {
+// Partitioning an Execution Space: expects space and integer arguments for
+// relative weight
+template <typename T>
+inline std::vector<OpenMP> create_OpenMP_instances(
+    OpenMP const& main_instance, std::vector<T> const& weights) {
+  static_assert(
+      std::is_arithmetic<T>::value,
+      "Kokkos Error: partitioning arguments must be integers or floats");
+  if (weights.size() == 0) {
+    Kokkos::abort("Kokkos::abort: Partition weights vector is empty.");
+  }
+  std::vector<OpenMP> instances(weights.size());
+  double total_weight = std::accumulate(weights.begin(), weights.end(), 0.);
+  int const main_pool_size =
+      main_instance.impl_internal_space_instance()->thread_pool_size();
+
+  int resources_left = main_pool_size;
+  for (unsigned int i = 0; i < weights.size() - 1; ++i) {
+    int instance_pool_size = (weights[i] / total_weight) * main_pool_size;
+    if (instance_pool_size == 0) {
+      Kokkos::abort("Kokkos::abort: Instance has no resource allocated to it");
+    }
+    instances[i] = OpenMP(instance_pool_size);
+    resources_left -= instance_pool_size;
+  }
+  // Last instance get all resources left
+  if (resources_left <= 0) {
+    Kokkos::abort(
+        "Kokkos::abort: Partition not enough resources left to create the last "
+        "instance.");
+  }
+  instances[weights.size() - 1] = resources_left;
+
+  return instances;
+}
+}  // namespace Impl
+
+template <typename... Args>
+std::vector<OpenMP> partition_space(OpenMP const& main_instance, Args... args) {
+  // Unpack the arguments and create the weight vector. Note that if not all of
+  // the types are the same, you will get a narrowing warning.
+  std::vector<std::common_type_t<Args...>> const weights = {args...};
+  return Impl::create_OpenMP_instances(main_instance, weights);
+}
+
+template <typename T>
+std::vector<OpenMP> partition_space(OpenMP const& main_instance,
+                                    std::vector<T>& weights) {
+  return Impl::create_OpenMP_instances(main_instance, weights);
+}
+}  // namespace Experimental
 }  // namespace Kokkos
 
 #endif
diff --git a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_MDRangePolicy.hpp b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_MDRangePolicy.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..aa97ea92a8f7c062f9bd1537b0c2cdb62fc9b3ed
--- /dev/null
+++ b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_MDRangePolicy.hpp
@@ -0,0 +1,32 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_OPENMP_MDRANGEPOLICY_HPP_
+#define KOKKOS_OPENMP_MDRANGEPOLICY_HPP_
+
+#include <KokkosExp_MDRangePolicy.hpp>
+
+namespace Kokkos {
+namespace Impl {
+
+// Settings for TeamMDRangePolicy
+template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector>
+struct ThreadAndVectorNestLevel<Rank, OpenMP, ThreadAndVector>
+    : HostBasedNestLevel<Rank, ThreadAndVector> {};
+
+}  // namespace Impl
+}  // namespace Kokkos
+#endif
diff --git a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Parallel.hpp b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Parallel.hpp
index 94c465dc2e03c67accd86470ea69d425afcfc1df..cbd687bec57025a19bf9a22694c6b1123f8bbdd2 100644
--- a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Parallel.hpp
+++ b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Parallel.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_OPENMP_PARALLEL_HPP
 #define KOKKOS_OPENMP_PARALLEL_HPP
@@ -72,6 +44,11 @@
 namespace Kokkos {
 namespace Impl {
 
+inline bool execute_in_serial(OpenMP const& space = OpenMP()) {
+  return (OpenMP::in_parallel(space) &&
+          !(omp_get_nested() && (omp_get_level() == 1)));
+}
+
 template <class FunctorType, class... Traits>
 class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP> {
  private:
@@ -113,7 +90,7 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP> {
     // prevent bug in NVHPC 21.9/CUDA 11.4 (entering zero iterations loop)
     if (m_policy.begin() >= m_policy.end()) return;
 #pragma omp parallel for schedule(dynamic KOKKOS_OPENMP_OPTIONAL_CHUNK_SIZE) \
-    num_threads(OpenMP::impl_thread_pool_size())
+    num_threads(m_instance->thread_pool_size())
     KOKKOS_PRAGMA_IVDEP_IF_ENABLED
     for (auto iwork = m_policy.begin(); iwork < m_policy.end(); ++iwork) {
       exec_work(m_functor, iwork);
@@ -124,8 +101,15 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP> {
   std::enable_if_t<!std::is_same<typename Policy::schedule_type::type,
                                  Kokkos::Dynamic>::value>
   execute_parallel() const {
+// Specifying an chunksize with GCC compiler leads to performance regression
+// with static schedule.
+#ifdef KOKKOS_COMPILER_GNU
+#pragma omp parallel for schedule(static) \
+    num_threads(m_instance->thread_pool_size())
+#else
 #pragma omp parallel for schedule(static KOKKOS_OPENMP_OPTIONAL_CHUNK_SIZE) \
-    num_threads(OpenMP::impl_thread_pool_size())
+    num_threads(m_instance->thread_pool_size())
+#endif
     KOKKOS_PRAGMA_IVDEP_IF_ENABLED
     for (auto iwork = m_policy.begin(); iwork < m_policy.end(); ++iwork) {
       exec_work(m_functor, iwork);
@@ -134,7 +118,7 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP> {
 
  public:
   inline void execute() const {
-    if (OpenMP::in_parallel()) {
+    if (execute_in_serial(m_policy.space())) {
       exec_range(m_functor, m_policy.begin(), m_policy.end());
       return;
     }
@@ -145,7 +129,7 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP> {
     constexpr bool is_dynamic =
         std::is_same<typename Policy::schedule_type::type,
                      Kokkos::Dynamic>::value;
-#pragma omp parallel num_threads(OpenMP::impl_thread_pool_size())
+#pragma omp parallel num_threads(m_instance->thread_pool_size())
     {
       HostThreadTeamData& data = *(m_instance->get_thread_data());
 
@@ -173,11 +157,15 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP> {
 
   inline ParallelFor(const FunctorType& arg_functor, Policy arg_policy)
       : m_instance(nullptr), m_functor(arg_functor), m_policy(arg_policy) {
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
     if (t_openmp_instance) {
       m_instance = t_openmp_instance;
     } else {
       m_instance = arg_policy.space().impl_internal_space_instance();
     }
+#else
+    m_instance = arg_policy.space().impl_internal_space_instance();
+#endif
   }
 };
 
@@ -193,21 +181,17 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
   using WorkRange = typename Policy::WorkRange;
   using Member    = typename Policy::member_type;
 
+  using index_type   = typename Policy::index_type;
   using iterate_type = typename Kokkos::Impl::HostIterateTile<
       MDRangePolicy, FunctorType, typename MDRangePolicy::work_tag, void>;
 
   OpenMPInternal* m_instance;
-  const FunctorType m_functor;
-  const MDRangePolicy m_mdr_policy;
-  const Policy m_policy;  // construct as RangePolicy( 0, num_tiles
-                          // ).set_chunk_size(1) in ctor
+  const iterate_type m_iter;
 
-  inline static void exec_range(const MDRangePolicy& mdr_policy,
-                                const FunctorType& functor, const Member ibeg,
-                                const Member iend) {
+  inline void exec_range(const Member ibeg, const Member iend) const {
     KOKKOS_PRAGMA_IVDEP_IF_ENABLED
     for (Member iwork = ibeg; iwork < iend; ++iwork) {
-      iterate_type(mdr_policy, functor)(iwork);
+      m_iter(iwork);
     }
   }
 
@@ -215,11 +199,11 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
   typename std::enable_if_t<std::is_same<typename Policy::schedule_type::type,
                                          Kokkos::Dynamic>::value>
   execute_parallel() const {
-#pragma omp parallel for schedule(dynamic KOKKOS_OPENMP_OPTIONAL_CHUNK_SIZE) \
-    num_threads(OpenMP::impl_thread_pool_size())
+#pragma omp parallel for schedule(dynamic, 1) \
+    num_threads(m_instance->thread_pool_size())
     KOKKOS_PRAGMA_IVDEP_IF_ENABLED
-    for (auto iwork = m_policy.begin(); iwork < m_policy.end(); ++iwork) {
-      iterate_type(m_mdr_policy, m_functor)(iwork);
+    for (index_type iwork = 0; iwork < m_iter.m_rp.m_num_tiles; ++iwork) {
+      m_iter(iwork);
     }
   }
 
@@ -227,21 +211,22 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
   typename std::enable_if<!std::is_same<typename Policy::schedule_type::type,
                                         Kokkos::Dynamic>::value>::type
   execute_parallel() const {
-#pragma omp parallel for schedule(static KOKKOS_OPENMP_OPTIONAL_CHUNK_SIZE) \
-    num_threads(OpenMP::impl_thread_pool_size())
+#pragma omp parallel for schedule(static, 1) \
+    num_threads(m_instance->thread_pool_size())
     KOKKOS_PRAGMA_IVDEP_IF_ENABLED
-    for (auto iwork = m_policy.begin(); iwork < m_policy.end(); ++iwork) {
-      iterate_type(m_mdr_policy, m_functor)(iwork);
+    for (index_type iwork = 0; iwork < m_iter.m_rp.m_num_tiles; ++iwork) {
+      m_iter(iwork);
     }
   }
 
  public:
   inline void execute() const {
-    if (OpenMP::in_parallel()) {
-      ParallelFor::exec_range(m_mdr_policy, m_functor, m_policy.begin(),
-                              m_policy.end());
+#ifndef KOKKOS_COMPILER_INTEL
+    if (execute_in_serial(m_iter.m_rp.space())) {
+      exec_range(0, m_iter.m_rp.m_num_tiles);
       return;
     }
+#endif
 
 #ifndef KOKKOS_INTERNAL_DISABLE_NATIVE_OPENMP
     execute_parallel<Policy>();
@@ -250,12 +235,11 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
         std::is_same<typename Policy::schedule_type::type,
                      Kokkos::Dynamic>::value;
 
-#pragma omp parallel num_threads(OpenMP::impl_thread_pool_size())
+#pragma omp parallel num_threads(m_instance->thread_pool_size())
     {
       HostThreadTeamData& data = *(m_instance->get_thread_data());
 
-      data.set_work_partition(m_policy.end() - m_policy.begin(),
-                              m_policy.chunk_size());
+      data.set_work_partition(m_iter.m_rp.m_num_tiles, 1);
 
       if (is_dynamic) {
         // Make sure work partition is set before stealing
@@ -268,9 +252,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
         range = is_dynamic ? data.get_work_stealing_chunk()
                            : data.get_work_partition();
 
-        ParallelFor::exec_range(m_mdr_policy, m_functor,
-                                range.first + m_policy.begin(),
-                                range.second + m_policy.begin());
+        exec_range(range.first, range.second);
 
       } while (is_dynamic && 0 <= range.first);
     }
@@ -279,15 +261,16 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
   }
 
   inline ParallelFor(const FunctorType& arg_functor, MDRangePolicy arg_policy)
-      : m_instance(nullptr),
-        m_functor(arg_functor),
-        m_mdr_policy(arg_policy),
-        m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)) {
+      : m_instance(nullptr), m_iter(arg_policy, arg_functor) {
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
     if (t_openmp_instance) {
       m_instance = t_openmp_instance;
     } else {
       m_instance = arg_policy.space().impl_internal_space_instance();
     }
+#else
+    m_instance = arg_policy.space().impl_internal_space_instance();
+#endif
   }
   template <typename Policy, typename Functor>
   static int max_tile_size_product(const Policy&, const Functor&) {
@@ -379,6 +362,8 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
     const size_t pool_reduce_bytes =
         Analysis::value_size(ReducerConditional::select(m_functor, m_reducer));
 
+    m_instance->acquire_lock();
+
     m_instance->resize_thread_data(pool_reduce_bytes, 0  // team_reduce_bytes
                                    ,
                                    0  // team_shared_bytes
@@ -386,7 +371,22 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
                                    0  // thread_local_bytes
     );
 
-    const int pool_size = OpenMP::impl_thread_pool_size();
+    if (execute_in_serial(m_policy.space())) {
+      const pointer_type ptr =
+          m_result_ptr
+              ? m_result_ptr
+              : pointer_type(
+                    m_instance->get_thread_data(0)->pool_reduce_local());
+
+      reference_type update = final_reducer.init(ptr);
+
+      ParallelReduce::template exec_range<WorkTag>(m_functor, m_policy.begin(),
+                                                   m_policy.end(), update);
+
+      final_reducer.final(ptr);
+      return;
+    }
+    const int pool_size = m_instance->thread_pool_size();
 #pragma omp parallel num_threads(pool_size)
     {
       HostThreadTeamData& data = *(m_instance->get_thread_data());
@@ -436,6 +436,8 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
         m_result_ptr[j] = ptr[j];
       }
     }
+
+    m_instance->release_lock();
   }
 
   //----------------------------------------
@@ -452,11 +454,15 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
         m_policy(arg_policy),
         m_reducer(InvalidType()),
         m_result_ptr(arg_view.data()) {
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
     if (t_openmp_instance) {
       m_instance = t_openmp_instance;
     } else {
       m_instance = arg_policy.space().impl_internal_space_instance();
     }
+#else
+    m_instance = arg_policy.space().impl_internal_space_instance();
+#endif
     /*static_assert( std::is_same< typename ViewType::memory_space
                                     , Kokkos::HostSpace >::value
       , "Reduction result on Kokkos::OpenMP must be a Kokkos::View in HostSpace"
@@ -470,11 +476,15 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
         m_policy(arg_policy),
         m_reducer(reducer),
         m_result_ptr(reducer.view().data()) {
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
     if (t_openmp_instance) {
       m_instance = t_openmp_instance;
     } else {
       m_instance = arg_policy.space().impl_internal_space_instance();
     }
+#else
+    m_instance = arg_policy.space().impl_internal_space_instance();
+#endif
     /*static_assert( std::is_same< typename ViewType::memory_space
                                     , Kokkos::HostSpace >::value
       , "Reduction result on Kokkos::OpenMP must be a Kokkos::View in HostSpace"
@@ -514,30 +524,23 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
                                              WorkTag, reference_type>;
 
   OpenMPInternal* m_instance;
-  const FunctorType m_functor;
-  const MDRangePolicy m_mdr_policy;
-  const Policy m_policy;  // construct as RangePolicy( 0, num_tiles
-                          // ).set_chunk_size(1) in ctor
+  const iterate_type m_iter;
   const ReducerType m_reducer;
   const pointer_type m_result_ptr;
 
-  inline static void exec_range(const MDRangePolicy& mdr_policy,
-                                const FunctorType& functor, const Member ibeg,
-                                const Member iend, reference_type update) {
+  inline void exec_range(const Member ibeg, const Member iend,
+                         reference_type update) const {
     for (Member iwork = ibeg; iwork < iend; ++iwork) {
-      iterate_type(mdr_policy, functor, update)(iwork);
+      m_iter(iwork, update);
     }
   }
 
  public:
   inline void execute() const {
-    enum {
-      is_dynamic = std::is_same<typename Policy::schedule_type::type,
-                                Kokkos::Dynamic>::value
-    };
+    const size_t pool_reduce_bytes = Analysis::value_size(
+        ReducerConditional::select(m_iter.m_func, m_reducer));
 
-    const size_t pool_reduce_bytes =
-        Analysis::value_size(ReducerConditional::select(m_functor, m_reducer));
+    m_instance->acquire_lock();
 
     m_instance->resize_thread_data(pool_reduce_bytes, 0  // team_reduce_bytes
                                    ,
@@ -547,15 +550,39 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
     );
 
     typename Analysis::Reducer final_reducer(
-        &ReducerConditional::select(m_functor, m_reducer));
+        &ReducerConditional::select(m_iter.m_func, m_reducer));
+
+#ifndef KOKKOS_COMPILER_INTEL
+    if (execute_in_serial(m_iter.m_rp.space())) {
+      const pointer_type ptr =
+          m_result_ptr
+              ? m_result_ptr
+              : pointer_type(
+                    m_instance->get_thread_data(0)->pool_reduce_local());
 
-    const int pool_size = OpenMP::impl_thread_pool_size();
+      reference_type update = final_reducer.init(ptr);
+
+      ParallelReduce::exec_range(0, m_iter.m_rp.m_num_tiles, update);
+
+      final_reducer.final(ptr);
+
+      m_instance->release_lock();
+
+      return;
+    }
+#endif
+
+    enum {
+      is_dynamic = std::is_same<typename Policy::schedule_type::type,
+                                Kokkos::Dynamic>::value
+    };
+
+    const int pool_size = m_instance->thread_pool_size();
 #pragma omp parallel num_threads(pool_size)
     {
       HostThreadTeamData& data = *(m_instance->get_thread_data());
 
-      data.set_work_partition(m_policy.end() - m_policy.begin(),
-                              m_policy.chunk_size());
+      data.set_work_partition(m_iter.m_rp.m_num_tiles, 1);
 
       if (is_dynamic) {
         // Make sure work partition is set before stealing
@@ -571,9 +598,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
         range = is_dynamic ? data.get_work_stealing_chunk()
                            : data.get_work_partition();
 
-        ParallelReduce::exec_range(m_mdr_policy, m_functor,
-                                   range.first + m_policy.begin(),
-                                   range.second + m_policy.begin(), update);
+        ParallelReduce::exec_range(range.first, range.second, update);
 
       } while (is_dynamic && 0 <= range.first);
     }
@@ -594,12 +619,14 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
 
     if (m_result_ptr) {
       const int n = Analysis::value_count(
-          ReducerConditional::select(m_functor, m_reducer));
+          ReducerConditional::select(m_iter.m_func, m_reducer));
 
       for (int j = 0; j < n; ++j) {
         m_result_ptr[j] = ptr[j];
       }
     }
+
+    m_instance->release_lock();
   }
 
   //----------------------------------------
@@ -612,16 +639,18 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
                            !Kokkos::is_reducer<ReducerType>::value,
                        void*> = nullptr)
       : m_instance(nullptr),
-        m_functor(arg_functor),
-        m_mdr_policy(arg_policy),
-        m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)),
+        m_iter(arg_policy, arg_functor),
         m_reducer(InvalidType()),
         m_result_ptr(arg_view.data()) {
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
     if (t_openmp_instance) {
       m_instance = t_openmp_instance;
     } else {
       m_instance = arg_policy.space().impl_internal_space_instance();
     }
+#else
+    m_instance = arg_policy.space().impl_internal_space_instance();
+#endif
     /*static_assert( std::is_same< typename ViewType::memory_space
                                     , Kokkos::HostSpace >::value
       , "Reduction result on Kokkos::OpenMP must be a Kokkos::View in HostSpace"
@@ -631,16 +660,18 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
   inline ParallelReduce(const FunctorType& arg_functor,
                         MDRangePolicy arg_policy, const ReducerType& reducer)
       : m_instance(nullptr),
-        m_functor(arg_functor),
-        m_mdr_policy(arg_policy),
-        m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)),
+        m_iter(arg_policy, arg_functor),
         m_reducer(reducer),
         m_result_ptr(reducer.view().data()) {
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
     if (t_openmp_instance) {
       m_instance = t_openmp_instance;
     } else {
       m_instance = arg_policy.space().impl_internal_space_instance();
     }
+#else
+    m_instance = arg_policy.space().impl_internal_space_instance();
+#endif
     /*static_assert( std::is_same< typename ViewType::memory_space
                                     , Kokkos::HostSpace >::value
       , "Reduction result on Kokkos::OpenMP must be a Kokkos::View in HostSpace"
@@ -717,7 +748,19 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>,
                                    0  // thread_local_bytes
     );
 
-#pragma omp parallel num_threads(OpenMP::impl_thread_pool_size())
+    if (execute_in_serial(m_policy.space())) {
+      typename Analysis::Reducer final_reducer(&m_functor);
+
+      reference_type update = final_reducer.init(
+          pointer_type(m_instance->get_thread_data(0)->pool_reduce_local()));
+
+      ParallelScan::template exec_range<WorkTag>(m_functor, m_policy.begin(),
+                                                 m_policy.end(), update, true);
+
+      return;
+    }
+
+#pragma omp parallel num_threads(m_instance->thread_pool_size())
     {
       HostThreadTeamData& data = *(m_instance->get_thread_data());
       typename Analysis::Reducer final_reducer(&m_functor);
@@ -768,11 +811,15 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>,
 
   inline ParallelScan(const FunctorType& arg_functor, const Policy& arg_policy)
       : m_instance(nullptr), m_functor(arg_functor), m_policy(arg_policy) {
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
     if (t_openmp_instance) {
       m_instance = t_openmp_instance;
     } else {
       m_instance = arg_policy.space().impl_internal_space_instance();
     }
+#else
+    m_instance = arg_policy.space().impl_internal_space_instance();
+#endif
   }
 
   //----------------------------------------
@@ -791,13 +838,14 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
   using WorkRange = typename Policy::WorkRange;
   using Member    = typename Policy::member_type;
 
+  using value_type     = typename Analysis::value_type;
   using pointer_type   = typename Analysis::pointer_type;
   using reference_type = typename Analysis::reference_type;
 
   OpenMPInternal* m_instance;
   const FunctorType m_functor;
   const Policy m_policy;
-  ReturnType& m_returnvalue;
+  const pointer_type m_result_ptr;
 
   template <class TagType>
   inline static std::enable_if_t<std::is_void<TagType>::value> exec_range(
@@ -823,6 +871,8 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
     const int value_count          = Analysis::value_count(m_functor);
     const size_t pool_reduce_bytes = 2 * Analysis::value_size(m_functor);
 
+    m_instance->acquire_lock();
+
     m_instance->resize_thread_data(pool_reduce_bytes, 0  // team_reduce_bytes
                                    ,
                                    0  // team_shared_bytes
@@ -830,7 +880,23 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
                                    0  // thread_local_bytes
     );
 
-#pragma omp parallel num_threads(OpenMP::impl_thread_pool_size())
+    if (execute_in_serial(m_policy.space())) {
+      typename Analysis::Reducer final_reducer(&m_functor);
+
+      reference_type update = final_reducer.init(
+          pointer_type(m_instance->get_thread_data(0)->pool_reduce_local()));
+
+      this->template exec_range<WorkTag>(m_functor, m_policy.begin(),
+                                         m_policy.end(), update, true);
+
+      *m_result_ptr = update;
+
+      m_instance->release_lock();
+
+      return;
+    }
+
+#pragma omp parallel num_threads(m_instance->thread_pool_size())
     {
       HostThreadTeamData& data = *(m_instance->get_thread_data());
       typename Analysis::Reducer final_reducer(&m_functor);
@@ -875,25 +941,36 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
           m_functor, range.begin(), range.end(), update_base, true);
 
       if (omp_get_thread_num() == omp_get_num_threads() - 1) {
-        m_returnvalue = update_base;
+        *m_result_ptr = update_base;
       }
     }
+
+    m_instance->release_lock();
   }
 
   //----------------------------------------
 
-  inline ParallelScanWithTotal(const FunctorType& arg_functor,
-                               const Policy& arg_policy,
-                               ReturnType& arg_returnvalue)
+  template <class ViewType>
+  ParallelScanWithTotal(const FunctorType& arg_functor,
+                        const Policy& arg_policy,
+                        const ViewType& arg_result_view)
       : m_instance(nullptr),
         m_functor(arg_functor),
         m_policy(arg_policy),
-        m_returnvalue(arg_returnvalue) {
+        m_result_ptr(arg_result_view.data()) {
+    static_assert(
+        Kokkos::Impl::MemorySpaceAccess<typename ViewType::memory_space,
+                                        Kokkos::HostSpace>::accessible,
+        "Kokkos::OpenMP parallel_scan result must be host-accessible!");
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
     if (t_openmp_instance) {
       m_instance = t_openmp_instance;
     } else {
       m_instance = arg_policy.space().impl_internal_space_instance();
     }
+#else
+    m_instance = arg_policy.space().impl_internal_space_instance();
+#endif
   }
 
   //----------------------------------------
@@ -972,10 +1049,22 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
     const size_t team_shared_size  = m_shmem_size;
     const size_t thread_local_size = 0;  // Never shrinks
 
+    m_instance->acquire_lock();
+
     m_instance->resize_thread_data(pool_reduce_size, team_reduce_size,
                                    team_shared_size, thread_local_size);
 
-#pragma omp parallel num_threads(OpenMP::impl_thread_pool_size())
+    if (execute_in_serial(m_policy.space())) {
+      ParallelFor::template exec_team<WorkTag>(
+          m_functor, *(m_instance->get_thread_data()), 0,
+          m_policy.league_size(), m_policy.league_size());
+
+      m_instance->release_lock();
+
+      return;
+    }
+
+#pragma omp parallel num_threads(m_instance->thread_pool_size())
     {
       HostThreadTeamData& data = *(m_instance->get_thread_data());
 
@@ -1010,6 +1099,8 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
 
       data.disband_team();
     }
+
+    m_instance->release_lock();
   }
 
   inline ParallelFor(const FunctorType& arg_functor, const Policy& arg_policy)
@@ -1019,11 +1110,15 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>,
         m_shmem_size(arg_policy.scratch_size(0) + arg_policy.scratch_size(1) +
                      FunctorTeamShmemSize<FunctorType>::value(
                          arg_functor, arg_policy.team_size())) {
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
     if (t_openmp_instance) {
       m_instance = t_openmp_instance;
     } else {
       m_instance = arg_policy.space().impl_internal_space_instance();
     }
+#else
+    m_instance = arg_policy.space().impl_internal_space_instance();
+#endif
   }
 };
 
@@ -1124,10 +1219,30 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
     const size_t team_shared_size  = m_shmem_size + m_policy.scratch_size(1);
     const size_t thread_local_size = 0;  // Never shrinks
 
+    m_instance->acquire_lock();
+
     m_instance->resize_thread_data(pool_reduce_size, team_reduce_size,
                                    team_shared_size, thread_local_size);
 
-    const int pool_size = OpenMP::impl_thread_pool_size();
+    if (execute_in_serial(m_policy.space())) {
+      HostThreadTeamData& data = *(m_instance->get_thread_data());
+      pointer_type ptr =
+          m_result_ptr ? m_result_ptr : pointer_type(data.pool_reduce_local());
+      reference_type update       = final_reducer.init(ptr);
+      const int league_rank_begin = 0;
+      const int league_rank_end   = m_policy.league_size();
+      ParallelReduce::template exec_team<WorkTag>(
+          m_functor, data, update, league_rank_begin, league_rank_end,
+          m_policy.league_size());
+
+      final_reducer.final(ptr);
+
+      m_instance->release_lock();
+
+      return;
+    }
+
+    const int pool_size = m_instance->thread_pool_size();
 #pragma omp parallel num_threads(pool_size)
     {
       HostThreadTeamData& data = *(m_instance->get_thread_data());
@@ -1201,6 +1316,8 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
         m_result_ptr[j] = ptr[j];
       }
     }
+
+    m_instance->release_lock();
   }
 
   //----------------------------------------
@@ -1220,11 +1337,15 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
         m_shmem_size(arg_policy.scratch_size(0) + arg_policy.scratch_size(1) +
                      FunctorTeamShmemSize<FunctorType>::value(
                          arg_functor, arg_policy.team_size())) {
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
     if (t_openmp_instance) {
       m_instance = t_openmp_instance;
     } else {
       m_instance = arg_policy.space().impl_internal_space_instance();
     }
+#else
+    m_instance = arg_policy.space().impl_internal_space_instance();
+#endif
   }
 
   inline ParallelReduce(const FunctorType& arg_functor, Policy arg_policy,
@@ -1237,11 +1358,15 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
         m_shmem_size(arg_policy.scratch_size(0) + arg_policy.scratch_size(1) +
                      FunctorTeamShmemSize<FunctorType>::value(
                          arg_functor, arg_policy.team_size())) {
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
     if (t_openmp_instance) {
       m_instance = t_openmp_instance;
     } else {
       m_instance = arg_policy.space().impl_internal_space_instance();
     }
+#else
+    m_instance = arg_policy.space().impl_internal_space_instance();
+#endif
     /*static_assert( std::is_same< typename ViewType::memory_space
                             , Kokkos::HostSpace >::value
     , "Reduction result on Kokkos::OpenMP must be a Kokkos::View in HostSpace"
diff --git a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Task.cpp b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Task.cpp
index 4babcf03d9c143d7221bcd8c7d554455835aefc9..3e67d8d62527d151b65dd097b6bf0aaee68f8011 100644
--- a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Task.cpp
+++ b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Task.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
diff --git a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Task.hpp b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Task.hpp
index ec1ede0e2abf59dea97f5902c0ea372b7e99b050..d6fd45ae9ae5e3cfa07bbbbe0055fcdb40e4534e 100644
--- a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Task.hpp
+++ b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Task.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_OPENMP_TASK_HPP
 #define KOKKOS_IMPL_OPENMP_TASK_HPP
@@ -100,6 +72,8 @@ class TaskQueueSpecialization<SimpleTaskScheduler<Kokkos::OpenMP, QueueType>> {
         execution_space().impl_internal_space_instance();
     const int pool_size = get_max_team_count(scheduler.get_execution_space());
 
+    instance->acquire_lock();
+
     // TODO @tasking @new_feature DSH allow team sizes other than 1
     const int team_size = 1;                      // Threads per core
     instance->resize_thread_data(0,               /* global reduce buffer */
@@ -177,10 +151,12 @@ class TaskQueueSpecialization<SimpleTaskScheduler<Kokkos::OpenMP, QueueType>> {
       }
       self.disband_team();
     }  // end pragma omp parallel
+
+    instance->release_lock();
   }
 
   static uint32_t get_max_team_count(execution_space const& espace) {
-    return static_cast<uint32_t>(espace.impl_thread_pool_size());
+    return static_cast<uint32_t>(OpenMP::impl_thread_pool_size(espace));
   }
 
   // TODO @tasking @optimization DSH specialize this for trivially destructible
@@ -258,7 +234,9 @@ class TaskQueueSpecializationConstrained<
 
     Impl::OpenMPInternal* instance =
         execution_space().impl_internal_space_instance();
-    const int pool_size = OpenMP::impl_thread_pool_size();
+    const int pool_size = instance->thread_pool_size();
+
+    instance->acquire_lock();
 
     const int team_size = 1;       // Threads per core
     instance->resize_thread_data(0 /* global reduce buffer */
@@ -361,6 +339,8 @@ class TaskQueueSpecializationConstrained<
       }
       self.disband_team();
     }  // end pragma omp parallel
+
+    instance->release_lock();
   }
 
   template <typename TaskType>
diff --git a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Team.hpp b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Team.hpp
index 73533178b6f4d943c7bfe776ac38c24d081a40f8..280b1701ad603a812bd07c4fd22f62a4be6a3da8 100644
--- a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Team.hpp
+++ b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Team.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_OPENMP_TEAM_HPP
 #define KOKKOS_OPENMP_TEAM_HPP
@@ -62,10 +34,7 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...>
 
   using traits = PolicyTraits<Properties...>;
 
-  const typename traits::execution_space& space() const {
-    static typename traits::execution_space m_space;
-    return m_space;
-  }
+  const typename traits::execution_space& space() const { return m_space; }
 
   template <class ExecSpace, class... OtherProperties>
   friend class TeamPolicyInternal;
@@ -84,12 +53,13 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...>
     m_chunk_size             = p.m_chunk_size;
     m_tune_team              = p.m_tune_team;
     m_tune_vector            = p.m_tune_vector;
+    m_space                  = p.m_space;
   }
   //----------------------------------------
 
   template <class FunctorType>
   int team_size_max(const FunctorType&, const ParallelForTag&) const {
-    int pool_size          = traits::execution_space::impl_thread_pool_size(1);
+    int pool_size = traits::execution_space::impl_thread_pool_size(1, m_space);
     int max_host_team_size = Impl::HostThreadTeamData::max_team_members;
     return pool_size < max_host_team_size ? pool_size : max_host_team_size;
   }
@@ -98,7 +68,7 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...>
 
   template <class FunctorType>
   int team_size_max(const FunctorType&, const ParallelReduceTag&) const {
-    int pool_size          = traits::execution_space::impl_thread_pool_size(1);
+    int pool_size = traits::execution_space::impl_thread_pool_size(1, m_space);
     int max_host_team_size = Impl::HostThreadTeamData::max_team_members;
     return pool_size < max_host_team_size ? pool_size : max_host_team_size;
   }
@@ -109,12 +79,12 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...>
   }
   template <class FunctorType>
   int team_size_recommended(const FunctorType&, const ParallelForTag&) const {
-    return traits::execution_space::impl_thread_pool_size(2);
+    return traits::execution_space::impl_thread_pool_size(2, m_space);
   }
   template <class FunctorType>
   int team_size_recommended(const FunctorType&,
                             const ParallelReduceTag&) const {
-    return traits::execution_space::impl_thread_pool_size(2);
+    return traits::execution_space::impl_thread_pool_size(2, m_space);
   }
   template <class FunctorType, class ReducerType>
   inline int team_size_recommended(const FunctorType& f, const ReducerType&,
@@ -147,9 +117,13 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...>
   bool m_tune_team;
   bool m_tune_vector;
 
+  typename traits::execution_space m_space;
+
   inline void init(const int league_size_request, const int team_size_request) {
-    const int pool_size  = traits::execution_space::impl_thread_pool_size(0);
-    const int team_grain = traits::execution_space::impl_thread_pool_size(2);
+    const int pool_size =
+        traits::execution_space::impl_thread_pool_size(0, m_space);
+    const int team_grain =
+        traits::execution_space::impl_thread_pool_size(2, m_space);
     const int max_host_team_size = Impl::HostThreadTeamData::max_team_members;
     const int team_max =
         ((pool_size < max_host_team_size) ? pool_size : max_host_team_size);
@@ -163,12 +137,17 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...>
     // Round team size up to a multiple of 'team_gain'
     const int team_size_grain =
         team_grain * ((m_team_size + team_grain - 1) / team_grain);
+
+    // more helpful than "floating point exception occured"
+    if (0 == team_size_grain) {
+      Kokkos::abort("Kokkos::abort: Requested Team Size rounded up to 0!");
+    }
     const int team_count = pool_size / team_size_grain;
 
     // Constraint : pool_size = m_team_alloc * team_count
     m_team_alloc = pool_size / team_count;
 
-    // Maxumum number of iterations each team will take:
+    // Maximum number of iterations each team will take:
     m_team_iter = (m_league_size + team_count - 1) / team_count;
 
     set_auto_chunk_size();
@@ -190,18 +169,19 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...>
   }
 
   /** \brief  Specify league size, request team size */
-  TeamPolicyInternal(const typename traits::execution_space&,
+  TeamPolicyInternal(const typename traits::execution_space& space,
                      int league_size_request, int team_size_request,
                      int /* vector_length_request */ = 1)
       : m_team_scratch_size{0, 0},
         m_thread_scratch_size{0, 0},
         m_chunk_size(0),
         m_tune_team(false),
-        m_tune_vector(false) {
+        m_tune_vector(false),
+        m_space(space) {
     init(league_size_request, team_size_request);
   }
 
-  TeamPolicyInternal(const typename traits::execution_space&,
+  TeamPolicyInternal(const typename traits::execution_space& space,
                      int league_size_request,
                      const Kokkos::AUTO_t& /* team_size_request */
                      ,
@@ -210,12 +190,13 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...>
         m_thread_scratch_size{0, 0},
         m_chunk_size(0),
         m_tune_team(true),
-        m_tune_vector(false) {
+        m_tune_vector(false),
+        m_space(space) {
     init(league_size_request,
-         traits::execution_space::impl_thread_pool_size(2));
+         traits::execution_space::impl_thread_pool_size(2, m_space));
   }
 
-  TeamPolicyInternal(const typename traits::execution_space&,
+  TeamPolicyInternal(const typename traits::execution_space& space,
                      int league_size_request,
                      const Kokkos::AUTO_t& /* team_size_request */
                      ,
@@ -224,19 +205,21 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...>
         m_thread_scratch_size{0, 0},
         m_chunk_size(0),
         m_tune_team(true),
-        m_tune_vector(true) {
+        m_tune_vector(true),
+        m_space(space) {
     init(league_size_request,
-         traits::execution_space::impl_thread_pool_size(2));
+         traits::execution_space::impl_thread_pool_size(2, m_space));
   }
 
-  TeamPolicyInternal(const typename traits::execution_space&,
+  TeamPolicyInternal(const typename traits::execution_space& space,
                      int league_size_request, const int team_size_request,
                      const Kokkos::AUTO_t& /* vector_length_request */)
       : m_team_scratch_size{0, 0},
         m_thread_scratch_size{0, 0},
         m_chunk_size(0),
         m_tune_team(false),
-        m_tune_vector(true) {
+        m_tune_vector(true),
+        m_space(space) {
     init(league_size_request, team_size_request);
   }
 
@@ -260,7 +243,7 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...>
         m_tune_team(true),
         m_tune_vector(false) {
     init(league_size_request,
-         traits::execution_space::impl_thread_pool_size(2));
+         traits::execution_space::impl_thread_pool_size(2, m_space));
   }
 
   TeamPolicyInternal(int league_size_request,
@@ -273,7 +256,7 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...>
         m_tune_team(true),
         m_tune_vector(true) {
     init(league_size_request,
-         traits::execution_space::impl_thread_pool_size(2));
+         traits::execution_space::impl_thread_pool_size(2, m_space));
   }
 
   TeamPolicyInternal(int league_size_request, int team_size_request,
@@ -328,7 +311,8 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...>
   /** \brief finalize chunk_size if it was set to AUTO*/
   inline void set_auto_chunk_size() {
     int concurrency =
-        traits::execution_space::impl_thread_pool_size(0) / m_team_alloc;
+        traits::execution_space::impl_thread_pool_size(0, m_space) /
+        m_team_alloc;
     if (concurrency == 0) concurrency = 1;
 
     if (m_chunk_size > 0) {
diff --git a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_WorkGraphPolicy.hpp b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_WorkGraphPolicy.hpp
index 55d9c58607315d8f5d53473648c8c72cf975101a..6cc52815de9a6200b450fcd4c218fbceff340247 100644
--- a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_WorkGraphPolicy.hpp
+++ b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_WorkGraphPolicy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_OPENMP_WORKGRAPHPOLICY_HPP
 #define KOKKOS_OPENMP_WORKGRAPHPOLICY_HPP
@@ -74,7 +46,11 @@ class ParallelFor<FunctorType, Kokkos::WorkGraphPolicy<Traits...>,
 
  public:
   inline void execute() {
-#pragma omp parallel num_threads(OpenMP::impl_thread_pool_size())
+    // We need to introduce pool_size to work around NVHPC 22.5 ICE
+    // We need to use [[maybe_unused]] to work around an unused-variable warning
+    // from HIP
+    [[maybe_unused]] int pool_size = OpenMP::impl_thread_pool_size();
+#pragma omp parallel num_threads(pool_size)
     {
       // Spin until COMPLETED_TOKEN.
       // END_TOKEN indicates no work is currently available.
diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp
index 5ff9bf32b6f7f94cada3641519c6a740f76652b0..f30abb0c875ac7454e280ba4b6697d2fa5a26539 100644
--- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp
+++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Abort.hpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Abort.hpp
index ff07ce4f3ae86a32e0272891f5113536af38df07..29641165d2c67c4369b3f9f01dc4f1faf2cf8d6f 100644
--- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Abort.hpp
+++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Abort.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_OPENMPTARGET_ABORT_HPP
 #define KOKKOS_OPENMPTARGET_ABORT_HPP
diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Error.hpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Error.hpp
index 1ca30631af920badd089559874a7d24a7cfb63f7..fd0b47f15196a3ac49b30007ce20d945ec6134e5 100644
--- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Error.hpp
+++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Error.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_OPENMPTARGET_ERROR_HPP
 #define KOKKOS_OPENMPTARGET_ERROR_HPP
@@ -64,7 +36,7 @@ inline void ompt_internal_safe_call(int e, const char* name,
   }
 }
 
-#define OMPT_SAFE_CALL(call) \
+#define KOKKOS_IMPL_OMPT_SAFE_CALL(call) \
   Kokkos::Impl::ompt_internal_safe_call(call, #call, __FILE__, __LINE__)
 
 }  // namespace Impl
diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.cpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.cpp
index d3bec5aebff8c425aaf5c4cc5060844f6cf55874..40da73ebc641c11e1e0b9a8ce14134f72ea73f23 100644
--- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.cpp
+++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -159,9 +131,9 @@ int* OpenMPTargetExec::get_lock_array(int num_teams) {
 
     for (int i = 0; i < lock_array_elem; ++i) h_lock_array[i] = 0;
 
-    OMPT_SAFE_CALL(omp_target_memcpy(m_lock_array, h_lock_array, m_lock_size, 0,
-                                     0, omp_get_default_device(),
-                                     omp_get_initial_device()));
+    KOKKOS_IMPL_OMPT_SAFE_CALL(
+        omp_target_memcpy(m_lock_array, h_lock_array, m_lock_size, 0, 0,
+                          omp_get_default_device(), omp_get_initial_device()));
 
     omp_target_free(h_lock_array, omp_get_initial_device());
   }
diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.hpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.hpp
index 52f5dcb83e8f3d7390ae8c7382fb0405363350ae..6d62a3c7e4b7d7b9f0cbeee441c92c38c99dbee6 100644
--- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.hpp
+++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_OPENMPTARGETEXEC_HPP
 #define KOKKOS_OPENMPTARGETEXEC_HPP
@@ -749,8 +721,8 @@ class OpenMPTargetExec {
   // teams possible is calculated based on NVIDIA's Volta GPU. In
   // future this value should be based on the chosen architecture for the
   // OpenMPTarget backend.
-  enum { MAX_ACTIVE_THREADS = 2080 * 80 };
-  enum { MAX_ACTIVE_TEAMS = MAX_ACTIVE_THREADS / 32 };
+  static constexpr int MAX_ACTIVE_THREADS = 2080 * 80;
+  static constexpr int MAX_ACTIVE_TEAMS   = MAX_ACTIVE_THREADS / 32;
 
  private:
   static void* scratch_ptr;
@@ -785,13 +757,11 @@ namespace Impl {
 
 class OpenMPTargetExecTeamMember {
  public:
-  enum { TEAM_REDUCE_SIZE = 512 };
-
-  /** \brief  Thread states for team synchronization */
-  enum { Active = 0, Rendezvous = 1 };
+  static constexpr int TEAM_REDUCE_SIZE = 512;
 
   using execution_space      = Kokkos::Experimental::OpenMPTarget;
   using scratch_memory_space = execution_space::scratch_memory_space;
+  using team_handle          = OpenMPTargetExecTeamMember;
 
   scratch_memory_space m_team_shared;
   size_t m_team_scratch_size[2];
@@ -1112,11 +1082,6 @@ class TeamPolicyInternal<Kokkos::Experimental::OpenMPTarget, Properties...>
     m_tune_vector_length = length;
   }
   inline int impl_vector_length() const { return m_vector_length; }
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  KOKKOS_DEPRECATED inline int vector_length() const {
-    return impl_vector_length();
-  }
-#endif
   inline int team_size() const { return m_team_size; }
   inline int league_size() const { return m_league_size; }
   inline size_t scratch_size(const int& level, int team_size_ = -1) const {
@@ -1601,7 +1566,6 @@ KOKKOS_INLINE_FUNCTION void parallel_scan(
   //   Note this thing is called .member in the CUDA specialization of
   //   TeamThreadRangeBoundariesStruct
   auto& member         = loop_bounds.team;
-  const auto team_size = member.team_size();
   const auto team_rank = member.team_rank();
 
 #if defined(KOKKOS_IMPL_TEAM_SCAN_WORKAROUND)
@@ -1614,8 +1578,9 @@ KOKKOS_INLINE_FUNCTION void parallel_scan(
   }
 #pragma omp barrier
 #else
-  const auto nchunk = (end - start + team_size - 1) / team_size;
-  value_type accum  = 0;
+  const auto team_size = member.team_size();
+  const auto nchunk    = (end - start + team_size - 1) / team_size;
+  value_type accum     = 0;
   // each team has to process one or
   //      more chunks of the prefix scan
   for (iType i = 0; i < nchunk; ++i) {
diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp
index a9bc085912356ec90bbef0c63688cd3f91d11a95..4a33961205224faea928b14eeb29d572ad44174c 100644
--- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp
+++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -93,7 +65,13 @@ void OpenMPTargetInternal::fence(const std::string& name,
         [&]() {});
   }
 }
-int OpenMPTargetInternal::concurrency() { return 128000; }
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
+int OpenMPTargetInternal::concurrency() {
+#else
+int OpenMPTargetInternal::concurrency() const {
+#endif
+  return 128000;  // FIXME_OPENMPTARGET
+}
 const char* OpenMPTargetInternal::name() { return "OpenMPTarget"; }
 void OpenMPTargetInternal::print_configuration(std::ostream& os,
                                                bool /*verbose*/) const {
@@ -115,8 +93,9 @@ void OpenMPTargetInternal::impl_initialize() {
 
   // FIXME_OPENMPTARGET:  Only fix the number of teams for NVIDIA architectures
   // from Pascal and upwards.
-#if defined(KOKKOS_ARCH_PASCAL) || defined(KOKKOS_ARCH_VOLTA) || \
-    defined(KOKKOS_ARCH_TURING75) || defined(KOKKOS_ARCH_AMPERE)
+#if defined(KOKKOS_ARCH_PASCAL) || defined(KOKKOS_ARCH_VOLTA) ||    \
+    defined(KOKKOS_ARCH_TURING75) || defined(KOKKOS_ARCH_AMPERE) || \
+    defined(KOKKOS_ARCH_HOPPER)
 #if defined(KOKKOS_COMPILER_CLANG) && (KOKKOS_COMPILER_CLANG >= 1300)
   omp_set_num_teams(512);
 #endif
@@ -203,9 +182,9 @@ UniqueToken<Kokkos::Experimental::OpenMPTarget,
         Kokkos::kokkos_malloc<Kokkos::Experimental::OpenMPTargetSpace>(
             "Kokkos::OpenMPTarget::m_uniquetoken_ptr", size));
     std::vector<uint32_t> h_buf(count, 0);
-    OMPT_SAFE_CALL(omp_target_memcpy(ptr, h_buf.data(), size, 0, 0,
-                                     omp_get_default_device(),
-                                     omp_get_initial_device()));
+    KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy(ptr, h_buf.data(), size, 0, 0,
+                                                 omp_get_default_device(),
+                                                 omp_get_initial_device()));
 
     Kokkos::Impl::OpenMPTargetExec::m_uniquetoken_ptr = ptr;
   }
diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.hpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.hpp
index 8e4baf8c0529f31d226d91470dbe7cc9674d6272..9f4349c00ef65c404eefbf7352449c50d67a51cf 100644
--- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.hpp
+++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_OPENMPTARGET_INSTANCE_HPP
 #define KOKKOS_OPENMPTARGET_INSTANCE_HPP
diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_MDRangePolicy.hpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_MDRangePolicy.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..d718f56d38b0382dc16d0684a5bf6efa42bd68cb
--- /dev/null
+++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_MDRangePolicy.hpp
@@ -0,0 +1,33 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_OPENMPTARGET_MDRANGEPOLICY_HPP_
+#define KOKKOS_OPENMPTARGET_MDRANGEPOLICY_HPP_
+
+#include <KokkosExp_MDRangePolicy.hpp>
+
+namespace Kokkos {
+namespace Impl {
+
+template <typename Rank,
+          ::Kokkos::Impl::TeamMDRangeThreadAndVector ThreadAndVector>
+struct ThreadAndVectorNestLevel<Rank, Kokkos::Experimental::OpenMPTarget,
+                                ThreadAndVector>
+    : AcceleratorBasedNestLevel<Rank, ThreadAndVector> {};
+
+}  // namespace Impl
+}  // namespace Kokkos
+#endif
diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel.hpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel.hpp
index dfb9ea70a1af0458933ef22c695b1a689359add0..71ce4b18f2896545b1d4d50edef1590f561e5a22 100644
--- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel.hpp
+++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_OPENMPTARGET_PARALLEL_HPP
 #define KOKKOS_OPENMPTARGET_PARALLEL_HPP
@@ -112,9 +84,9 @@ struct ParallelReduceCommon {
   static void memcpy_result(PointerType dest, PointerType src, size_t size,
                             bool ptr_on_device) {
     if (ptr_on_device) {
-      OMPT_SAFE_CALL(omp_target_memcpy(dest, src, size, 0, 0,
-                                       omp_get_default_device(),
-                                       omp_get_initial_device()));
+      KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy(dest, src, size, 0, 0,
+                                                   omp_get_default_device(),
+                                                   omp_get_initial_device()));
     } else {
       *dest = *src;
     }
@@ -319,11 +291,11 @@ struct ParallelReduceSpecialize<FunctorType, Kokkos::RangePolicy<PolicyArgs...>,
       // If there is no work to be done, copy back the initialized values and
       // exit.
       if (!ptr_on_device)
-        OMPT_SAFE_CALL(omp_target_memcpy(
+        KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy(
             ptr, scratch_ptr, value_count * sizeof(ValueType), 0, 0,
             omp_get_initial_device(), omp_get_default_device()));
       else
-        OMPT_SAFE_CALL(omp_target_memcpy(
+        KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy(
             ptr, scratch_ptr, value_count * sizeof(ValueType), 0, 0,
             omp_get_default_device(), omp_get_default_device()));
 
@@ -400,11 +372,11 @@ struct ParallelReduceSpecialize<FunctorType, Kokkos::RangePolicy<PolicyArgs...>,
 
     // If the result view is on the host, copy back the values via memcpy.
     if (!ptr_on_device)
-      OMPT_SAFE_CALL(omp_target_memcpy(
+      KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy(
           ptr, scratch_ptr, value_count * sizeof(ValueType), 0, 0,
           omp_get_initial_device(), omp_get_default_device()));
     else
-      OMPT_SAFE_CALL(omp_target_memcpy(
+      KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy(
           ptr, scratch_ptr, value_count * sizeof(ValueType), 0, 0,
           omp_get_default_device(), omp_get_default_device()));
   }
@@ -542,6 +514,9 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>,
   const FunctorType m_functor;
   const Policy m_policy;
 
+  value_type* m_result_ptr;
+  const bool m_result_ptr_device_accessible;
+
   template <class TagType>
   std::enable_if_t<std::is_void<TagType>::value> call_with_tag(
       const FunctorType& f, const idx_type& idx, value_type& val,
@@ -648,6 +623,8 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>,
             local_offset_value = offset_value;
           if (idx < N)
             call_with_tag<WorkTag>(a_functor, idx, local_offset_value, true);
+          if (idx == N - 1 && m_result_ptr_device_accessible)
+            *m_result_ptr = local_offset_value;
         }
       }
     }
@@ -676,8 +653,13 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>,
 
   //----------------------------------------
 
-  ParallelScan(const FunctorType& arg_functor, const Policy& arg_policy)
-      : m_functor(arg_functor), m_policy(arg_policy) {}
+  ParallelScan(const FunctorType& arg_functor, const Policy& arg_policy,
+               pointer_type arg_result_ptr           = nullptr,
+               bool arg_result_ptr_device_accessible = false)
+      : m_functor(arg_functor),
+        m_policy(arg_policy),
+        m_result_ptr(arg_result_ptr),
+        m_result_ptr_device_accessible(arg_result_ptr_device_accessible) {}
 
   //----------------------------------------
 };
@@ -690,7 +672,6 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
   using base_t     = ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>,
                               Kokkos::Experimental::OpenMPTarget>;
   using value_type = typename base_t::value_type;
-  value_type& m_returnvalue;
 
  public:
   void execute() const {
@@ -714,18 +695,24 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
 
       base_t::impl_execute(element_values, chunk_values, count);
 
-      const int size = base_t::Analysis::value_size(base_t::m_functor);
-      DeepCopy<HostSpace, Kokkos::Experimental::OpenMPTargetSpace>(
-          &m_returnvalue, chunk_values.data() + (n_chunks - 1), size);
-    } else {
-      m_returnvalue = 0;
+      if (!base_t::m_result_ptr_device_accessible) {
+        const int size = base_t::Analysis::value_size(base_t::m_functor);
+        DeepCopy<HostSpace, Kokkos::Experimental::OpenMPTargetSpace>(
+            base_t::m_result_ptr, chunk_values.data() + (n_chunks - 1), size);
+      }
+    } else if (!base_t::m_result_ptr_device_accessible) {
+      *base_t::m_result_ptr = 0;
     }
   }
 
+  template <class ViewType>
   ParallelScanWithTotal(const FunctorType& arg_functor,
                         const typename base_t::Policy& arg_policy,
-                        ReturnType& arg_returnvalue)
-      : base_t(arg_functor, arg_policy), m_returnvalue(arg_returnvalue) {}
+                        const ViewType& arg_result_view)
+      : base_t(arg_functor, arg_policy, arg_result_view.data(),
+               MemorySpaceAccess<Kokkos::Experimental::OpenMPTargetSpace,
+                                 typename ViewType::memory_space>::accessible) {
+  }
 };
 }  // namespace Impl
 }  // namespace Kokkos
@@ -1094,11 +1081,11 @@ struct ParallelReduceSpecialize<FunctorType, TeamPolicyInternal<PolicyArgs...>,
       // If there is no work to be done, copy back the initialized values and
       // exit.
       if (!ptr_on_device)
-        OMPT_SAFE_CALL(omp_target_memcpy(
+        KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy(
             ptr, scratch_ptr, value_count * sizeof(ValueType), 0, 0,
             omp_get_initial_device(), omp_get_default_device()));
       else
-        OMPT_SAFE_CALL(omp_target_memcpy(
+        KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy(
             ptr, scratch_ptr, value_count * sizeof(ValueType), 0, 0,
             omp_get_default_device(), omp_get_default_device()));
 
@@ -1158,11 +1145,11 @@ struct ParallelReduceSpecialize<FunctorType, TeamPolicyInternal<PolicyArgs...>,
 
     // If the result view is on the host, copy back the values via memcpy.
     if (!ptr_on_device)
-      OMPT_SAFE_CALL(omp_target_memcpy(
+      KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy(
           ptr, scratch_ptr, value_count * sizeof(ValueType), 0, 0,
           omp_get_initial_device(), omp_get_default_device()));
     else
-      OMPT_SAFE_CALL(omp_target_memcpy(
+      KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy(
           ptr, scratch_ptr, value_count * sizeof(ValueType), 0, 0,
           omp_get_default_device(), omp_get_default_device()));
   }
diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel_MDRange.hpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel_MDRange.hpp
index 2399b424f58cf9bf632d64e87b3da2383f8f8270..21bdb67e34f5432e315d0450fa28ff5188ca543f 100644
--- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel_MDRange.hpp
+++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel_MDRange.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_OPENMPTARGET_PARALLEL_MDRANGE_HPP
 #define KOKKOS_OPENMPTARGET_PARALLEL_MDRANGE_HPP
@@ -458,12 +430,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
   using pointer_type   = typename Analysis::pointer_type;
   using reference_type = typename Analysis::reference_type;
 
-  enum {
-    HasJoin =
-        Impl::FunctorAnalysis<Impl::FunctorPatternInterface::REDUCE, Policy,
-                              FunctorType>::has_join_member_function
-  };
-  enum { UseReducer = is_reducer<ReducerType>::value };
+  static constexpr bool UseReducer = is_reducer<ReducerType>::value;
 
   const pointer_type m_result_ptr;
   const FunctorType m_functor;
diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.cpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.cpp
index 1ada2b1911af954e7b1fbe2a91a60fdda6530eb4..458c4c9a43e617b0ad3c6bcecf823acc931fb109 100644
--- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.cpp
+++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.hpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.hpp
index f7ba01dffecb950de6320e1028d2c8d36744e089..c9aa7b128f17eda3782b903c07c001217b406acd 100644
--- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.hpp
+++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_OPENMP_TASK_HPP
 #define KOKKOS_IMPL_OPENMP_TASK_HPP
diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_UniqueToken.hpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_UniqueToken.hpp
index fa348611b953aa62704cb760521a275a04729985..c7f146871bd5ab1518cb28e2d4000feaf71698a6 100644
--- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_UniqueToken.hpp
+++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_UniqueToken.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_OPENMPTARGET_UNIQUE_TOKEN_HPP
 #define KOKKOS_OPENMPTARGET_UNIQUE_TOKEN_HPP
diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL.cpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL.cpp
index 840db4327cb363409e058602885f7b079ae85e31..e38b011c89b5987707a61aa3b2f7709260bdd25d 100644
--- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL.cpp
+++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -93,9 +65,13 @@ SYCL::SYCL(const sycl::queue& stream)
   m_space_instance->initialize(stream);
 }
 
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
 int SYCL::concurrency() {
   return Impl::SYCLInternal::singleton().m_maxConcurrency;
 }
+#else
+int SYCL::concurrency() const { return m_space_instance->m_maxConcurrency; }
+#endif
 
 const char* SYCL::name() { return "SYCL"; }
 
@@ -142,10 +118,6 @@ void SYCL::impl_static_fence(const std::string& name) {
       });
 }
 
-int SYCL::sycl_device() const {
-  return impl_internal_space_instance()->m_syclDev;
-}
-
 void SYCL::impl_initialize(InitializationSettings const& settings) {
   std::vector<sycl::device> gpu_devices =
       sycl::device::get_devices(sycl::info::device_type::gpu);
@@ -155,14 +127,16 @@ void SYCL::impl_initialize(InitializationSettings const& settings) {
 #if !defined(KOKKOS_ARCH_INTEL_GPU) && !defined(KOKKOS_ARCH_KEPLER) && \
     !defined(KOKKOS_ARCH_MAXWELL) && !defined(KOKKOS_ARCH_PASCAL) &&   \
     !defined(KOKKOS_ARCH_VOLTA) && !defined(KOKKOS_ARCH_TURING75) &&   \
-    !defined(KOKKOS_ARCH_AMPERE)
+    !defined(KOKKOS_ARCH_AMPERE) && !defined(KOKKOS_ARCH_HOPPER)
   if (!settings.has_device_id() && gpu_devices.empty()) {
     Impl::SYCLInternal::singleton().initialize(sycl::device());
+    Impl::SYCLInternal::m_syclDev = 0;
     return;
   }
 #endif
-  using Kokkos::Impl::get_gpu;
-  Impl::SYCLInternal::singleton().initialize(gpu_devices[get_gpu(settings)]);
+  const auto id = ::Kokkos::Impl::get_gpu(settings);
+  Impl::SYCLInternal::singleton().initialize(gpu_devices[id]);
+  Impl::SYCLInternal::m_syclDev = id;
 }
 
 std::ostream& SYCL::impl_sycl_info(std::ostream& os,
diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Abort.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Abort.hpp
index e376f012f73acdb7ddd4875bf23e4f7dfcf385ba..9e6d9fd7e23ff779b03fd5786ac4b15986abd0dd 100644
--- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Abort.hpp
+++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Abort.hpp
@@ -1,53 +1,30 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SYCL_ABORT_HPP
 #define KOKKOS_SYCL_ABORT_HPP
 
 #include <Kokkos_Macros.hpp>
 #if defined(KOKKOS_ENABLE_SYCL)
+// FIXME_SYCL
+#if __has_include(<sycl/sycl.hpp>)
+#include <sycl/sycl.hpp>
+#else
 #include <CL/sycl.hpp>
+#endif
 
 namespace Kokkos {
 namespace Impl {
diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_DeepCopy.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_DeepCopy.hpp
index 160f6068482b0884abdef061a8a8f83fb018b2db..62b7977fcc0325410ea876b95a6f55cbfe3109e7 100644
--- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_DeepCopy.hpp
+++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_DeepCopy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SYCLDEEPCOPY_HPP
 #define KOKKOS_SYCLDEEPCOPY_HPP
diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Half_Conversion.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Half_Conversion.hpp
index 3adbb16268e35999458d6f5c2db7fbe3e79ea6f3..d7b0271e15d10893e8f0ed233c5a5033769fad54 100644
--- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Half_Conversion.hpp
+++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Half_Conversion.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.5
+//                        Kokkos v. 4.0
 //       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SYCL_HALF_HPP_
 #define KOKKOS_SYCL_HALF_HPP_
@@ -48,7 +20,7 @@
 #ifdef KOKKOS_IMPL_SYCL_HALF_TYPE_DEFINED
 
 #include <Kokkos_Half.hpp>
-#include <Kokkos_NumericTraits.hpp>  // reduction_identity
+#include <Kokkos_ReductionIdentity.hpp>
 
 namespace Kokkos {
 namespace Experimental {
diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Half_Impl_Type.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Half_Impl_Type.hpp
index cf7d513b990e0e82e51939ca6b333b67610e4314..8932c15883044c1c7341955490cb5c6dad70e2f7 100644
--- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Half_Impl_Type.hpp
+++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Half_Impl_Type.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.5
+//                        Kokkos v. 4.0
 //       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SYCL_HALF_IMPL_TYPE_HPP_
 #define KOKKOS_SYCL_HALF_IMPL_TYPE_HPP_
@@ -48,7 +20,12 @@
 #include <Kokkos_Macros.hpp>
 #ifdef KOKKOS_ENABLE_SYCL
 
+// FIXME_SYCL
+#if __has_include(<sycl/sycl.hpp>)
+#include <sycl/sycl.hpp>
+#else
 #include <CL/sycl.hpp>
+#endif
 
 #ifndef KOKKOS_IMPL_HALF_TYPE_DEFINED
 // Make sure no one else tries to define half_t
diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.cpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.cpp
index 37721247a73ae8d0b0d3723b424d7833c5b9a3dc..0e1738d6acbc7b0833418f10f3d6b1a0ea31f1e0 100644
--- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.cpp
+++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -138,20 +110,6 @@ void SYCLInternal::initialize(const sycl::queue& q) {
         m_maxWorkgroupSize * 2 *
         d.template get_info<sycl::info::device::max_compute_units>();
 
-    // Setup concurent bitset for obtaining unique tokens from within an
-    // executing kernel.
-    {
-      const int32_t buffer_bound =
-          Kokkos::Impl::concurrent_bitset::buffer_bound(m_maxConcurrency);
-      using Record = Kokkos::Impl::SharedAllocationRecord<
-          Kokkos::Experimental::SYCLDeviceUSMSpace, void>;
-      Record* const r =
-          Record::allocate(Kokkos::Experimental::SYCLDeviceUSMSpace(*m_queue),
-                           "Kokkos::Experimental::SYCL::InternalScratchBitset",
-                           sizeof(uint32_t) * buffer_bound);
-      Record::increment(r);
-    }
-
     m_maxShmemPerBlock =
         d.template get_info<sycl::info::device::local_mem_size>();
 
@@ -356,6 +314,8 @@ void SYCLInternal::USMObjectMem<Kind>::reset() {
   m_q.reset();
 }
 
+int SYCLInternal::m_syclDev;
+
 template class SYCLInternal::USMObjectMem<sycl::usm::alloc::shared>;
 template class SYCLInternal::USMObjectMem<sycl::usm::alloc::device>;
 template class SYCLInternal::USMObjectMem<sycl::usm::alloc::host>;
diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.hpp
index 45a7887873e66127315eade103f71d3cde38746f..58775647f0c7ef52d1ab55b41a1cc05493310579 100644
--- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.hpp
+++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.hpp
@@ -1,52 +1,29 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SYCL_INSTANCE_HPP_
 #define KOKKOS_SYCL_INSTANCE_HPP_
 
 #include <optional>
+// FIXME_SYCL
+#if __has_include(<sycl/sycl.hpp>)
+#include <sycl/sycl.hpp>
+#else
 #include <CL/sycl.hpp>
+#endif
 
 #include <impl/Kokkos_Error.hpp>
 #include <impl/Kokkos_Profiling.hpp>
@@ -72,7 +49,7 @@ class SYCLInternal {
                                                    bool force_shrink = false);
 
   uint32_t impl_get_instance_id() const;
-  int m_syclDev = 0;
+  static int m_syclDev;
 
   size_t m_maxWorkgroupSize   = 0;
   uint32_t m_maxConcurrency   = 0;
diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_MDRangePolicy.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_MDRangePolicy.hpp
index 3e90ec1fb50b21e92f4f2ce589f98e2e755967ea..d212e2dacc3aa298d01b1c0a8d75e4897b19b419 100644
--- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_MDRangePolicy.hpp
+++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_MDRangePolicy.hpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #ifndef KOKKOS_SYCL_MDRANGEPOLICY_HPP_
 #define KOKKOS_SYCL_MDRANGEPOLICY_HPP_
 
@@ -32,6 +48,12 @@ inline TileSizeProperties get_tile_size_properties<Kokkos::Experimental::SYCL>(
   return properties;
 }
 
-}  // Namespace Impl
+// Settings for TeamMDRangePolicy
+template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector>
+struct ThreadAndVectorNestLevel<Rank, Kokkos::Experimental::SYCL,
+                                ThreadAndVector>
+    : AcceleratorBasedNestLevel<Rank, ThreadAndVector> {};
+
+}  // namespace Impl
 }  // Namespace Kokkos
 #endif
diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Range.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Range.hpp
index cf292f957ca9113ac594839cd351819f7e1dbc23..73475f92a6c10e546a0d283a361172c412bf6ec7 100644
--- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Range.hpp
+++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Range.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SYCL_PARALLEL_RANGE_HPP_
 #define KOKKOS_SYCL_PARALLEL_RANGE_HPP_
@@ -56,7 +28,7 @@ struct FunctorWrapperRangePolicyParallelFor {
 
   void operator()(sycl::item<1> item) const {
     const typename Policy::index_type id = item.get_linear_id() + m_begin;
-    if constexpr (std::is_void<WorkTag>::value)
+    if constexpr (std::is_void_v<WorkTag>)
       m_functor_wrapper.get_functor()(id);
     else
       m_functor_wrapper.get_functor()(WorkTag(), id);
@@ -65,6 +37,27 @@ struct FunctorWrapperRangePolicyParallelFor {
   typename Policy::index_type m_begin;
   FunctorWrapper m_functor_wrapper;
 };
+
+// Same as above but for a user-provided workgroup size
+template <typename FunctorWrapper, typename Policy>
+struct FunctorWrapperRangePolicyParallelForCustom {
+  using WorkTag = typename Policy::work_tag;
+
+  void operator()(sycl::item<1> item) const {
+    const typename Policy::index_type id = item.get_linear_id();
+    if (id < m_work_size) {
+      const auto shifted_id = id + m_begin;
+      if constexpr (std::is_void_v<WorkTag>)
+        m_functor_wrapper.get_functor()(shifted_id);
+      else
+        m_functor_wrapper.get_functor()(WorkTag(), shifted_id);
+    }
+  }
+
+  typename Policy::index_type m_begin;
+  FunctorWrapper m_functor_wrapper;
+  typename Policy::index_type m_work_size;
+};
 }  // namespace Kokkos::Impl
 
 template <class FunctorType, class... Traits>
@@ -74,9 +67,8 @@ class Kokkos::Impl::ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>,
   using Policy = Kokkos::RangePolicy<Traits...>;
 
  private:
-  using Member       = typename Policy::member_type;
-  using WorkTag      = typename Policy::work_tag;
-  using LaunchBounds = typename Policy::launch_bounds;
+  using Member  = typename Policy::member_type;
+  using WorkTag = typename Policy::work_tag;
 
   const FunctorType m_functor;
   const Policy m_policy;
@@ -90,12 +82,29 @@ class Kokkos::Impl::ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>,
     sycl::queue& q                          = space.sycl_queue();
 
     auto parallel_for_event = q.submit([&](sycl::handler& cgh) {
-      FunctorWrapperRangePolicyParallelFor<Functor, Policy> f{policy.begin(),
-                                                              functor};
-      sycl::range<1> range(policy.end() - policy.begin());
       cgh.depends_on(memcpy_event);
-      cgh.parallel_for<FunctorWrapperRangePolicyParallelFor<Functor, Policy>>(
-          range, f);
+      if (policy.chunk_size() <= 1) {
+        FunctorWrapperRangePolicyParallelFor<Functor, Policy> f{policy.begin(),
+                                                                functor};
+        sycl::range<1> range(policy.end() - policy.begin());
+        cgh.parallel_for<FunctorWrapperRangePolicyParallelFor<Functor, Policy>>(
+            range, f);
+      } else {
+        // Use the chunk size as workgroup size. We need to make sure that the
+        // range the kernel is launched with is a multiple of the workgroup
+        // size. Hence, we need to restrict the execution of the functor in the
+        // kernel to the actual range.
+        const auto actual_range = policy.end() - policy.begin();
+        const auto wgroup_size  = policy.chunk_size();
+        const auto launch_range =
+            (actual_range + wgroup_size - 1) / wgroup_size * wgroup_size;
+        FunctorWrapperRangePolicyParallelForCustom<Functor, Policy> f{
+            policy.begin(), functor, actual_range};
+        sycl::nd_range<1> range(launch_range, wgroup_size);
+        cgh.parallel_for<
+            FunctorWrapperRangePolicyParallelForCustom<Functor, Policy>>(range,
+                                                                         f);
+      }
     });
     q.ext_oneapi_submit_barrier(std::vector<sycl::event>{parallel_for_event});
 
@@ -140,7 +149,6 @@ class Kokkos::Impl::ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
  private:
   using array_index_type = typename Policy::array_index_type;
   using index_type       = typename Policy::index_type;
-  using LaunchBounds     = typename Policy::launch_bounds;
   using WorkTag          = typename Policy::work_tag;
 
   const FunctorType m_functor;
diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Reduce.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Reduce.hpp
index e980a82a580a1284244328884856de8b8765bced..c7959c1c1c5eb04b9c4523ed2e4bbddedd7d5db2 100644
--- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Reduce.hpp
+++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Reduce.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SYCL_PARALLEL_REDUCE_HPP
 #define KOKKOS_SYCL_PARALLEL_REDUCE_HPP
@@ -267,23 +239,13 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
         *space.impl_internal_space_instance();
     sycl::queue& q = space.sycl_queue();
 
-    // FIXME_SYCL optimize
-    constexpr size_t wgroup_size       = 128;
     constexpr size_t values_per_thread = 2;
     std::size_t size                   = policy.end() - policy.begin();
-    const auto init_size               = std::max<std::size_t>(
-        ((size + values_per_thread - 1) / values_per_thread + wgroup_size - 1) /
-            wgroup_size,
-        1);
     const unsigned int value_count =
         Analysis::value_count(ReducerConditional::select(m_functor, m_reducer));
-    const auto results_ptr =
-        static_cast<sycl::device_ptr<value_type>>(instance.scratch_space(
-            sizeof(value_type) * std::max(value_count, 1u) * init_size));
+    sycl::device_ptr<value_type> results_ptr = nullptr;
     sycl::global_ptr<value_type> device_accessible_result_ptr =
         m_result_ptr_device_accessible ? m_result_ptr : nullptr;
-    auto scratch_flags = static_cast<sycl::device_ptr<unsigned int>>(
-        instance.scratch_flags(sizeof(unsigned int)));
 
     sycl::event last_reduction_event;
 
@@ -291,6 +253,10 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
     // working with the global scratch memory but don't copy back to
     // m_result_ptr yet.
     if (size <= 1) {
+      results_ptr =
+          static_cast<sycl::device_ptr<value_type>>(instance.scratch_space(
+              sizeof(value_type) * std::max(value_count, 1u)));
+
       auto parallel_reduce_event = q.submit([&](sycl::handler& cgh) {
         const auto begin = policy.begin();
         cgh.depends_on(memcpy_events);
@@ -323,25 +289,23 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
     // until only one workgroup does the reduction and thus gets the final
     // value.
     if (size > 1) {
-      auto n_wgroups = ((size + values_per_thread - 1) / values_per_thread +
-                        wgroup_size - 1) /
-                       wgroup_size;
-      auto parallel_reduce_event = q.submit([&](sycl::handler& cgh) {
-        sycl::accessor<value_type, 1, sycl::access::mode::read_write,
-                       sycl::access::target::local>
-            local_mem(sycl::range<1>(wgroup_size) * std::max(value_count, 1u),
-                      cgh);
-        sycl::accessor<unsigned int, 1, sycl::access::mode::read_write,
-                       sycl::access::target::local>
-            num_teams_done(1, cgh);
-
-        const auto begin = policy.begin();
-
-        cgh.depends_on(memcpy_events);
+      auto scratch_flags = static_cast<sycl::device_ptr<unsigned int>>(
+          instance.scratch_flags(sizeof(unsigned int)));
+
+      auto reduction_lambda_factory =
+          [&](sycl::accessor<value_type, 1, sycl::access::mode::read_write,
+                             sycl::access::target::local>
+                  local_mem,
+              sycl::accessor<unsigned int, 1, sycl::access::mode::read_write,
+                             sycl::access::target::local>
+                  num_teams_done,
+              sycl::device_ptr<value_type> results_ptr) {
+            const auto begin = policy.begin();
+
+            auto lambda = [=](sycl::nd_item<1> item) {
+              const auto n_wgroups   = item.get_group_range()[0];
+              const auto wgroup_size = item.get_local_range()[0];
 
-        cgh.parallel_for(
-            sycl::nd_range<1>(n_wgroups * wgroup_size, wgroup_size),
-            [=](sycl::nd_item<1> item) {
               const auto local_id = item.get_local_linear_id();
               const auto global_id =
                   wgroup_size * item.get_group_linear_id() * values_per_thread +
@@ -441,9 +405,69 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType,
                       std::min(n_wgroups, wgroup_size));
                 }
               }
-            });
+            };
+            return lambda;
+          };
+
+      auto parallel_reduce_event = q.submit([&](sycl::handler& cgh) {
+        sycl::accessor<unsigned int, 1, sycl::access::mode::read_write,
+                       sycl::access::target::local>
+            num_teams_done(1, cgh);
+
+        auto dummy_reduction_lambda =
+            reduction_lambda_factory({1, cgh}, num_teams_done, nullptr);
+
+        static sycl::kernel kernel = [&] {
+          sycl::kernel_id functor_kernel_id =
+              sycl::get_kernel_id<decltype(dummy_reduction_lambda)>();
+          auto kernel_bundle =
+              sycl::get_kernel_bundle<sycl::bundle_state::executable>(
+                  q.get_context(), std::vector{functor_kernel_id});
+          return kernel_bundle.get_kernel(functor_kernel_id);
+        }();
+        auto multiple = kernel.get_info<sycl::info::kernel_device_specific::
+                                            preferred_work_group_size_multiple>(
+            q.get_device());
+        auto max =
+            kernel
+                .get_info<sycl::info::kernel_device_specific::work_group_size>(
+                    q.get_device());
+
+// FIXME_SYCL 1024 seems to be invalid when running on a Volta70.
+#ifndef KOKKOS_ARCH_INTEL_GPU
+        if (max > 512) max = 512;
+#endif
+
+        const size_t wgroup_size =
+            static_cast<size_t>(max / multiple) * multiple;
+
+        const std::size_t init_size =
+            ((size + values_per_thread - 1) / values_per_thread + wgroup_size -
+             1) /
+            wgroup_size;
+        results_ptr =
+            static_cast<sycl::device_ptr<value_type>>(instance.scratch_space(
+                sizeof(value_type) * std::max(value_count, 1u) * init_size));
+
+        auto n_wgroups = ((size + values_per_thread - 1) / values_per_thread +
+                          wgroup_size - 1) /
+                         wgroup_size;
+
+        sycl::accessor<value_type, 1, sycl::access::mode::read_write,
+                       sycl::access::target::local>
+            local_mem(sycl::range<1>(wgroup_size) * std::max(value_count, 1u),
+                      cgh);
+
+        cgh.depends_on(memcpy_events);
+
+        auto reduction_lambda =
+            reduction_lambda_factory(local_mem, num_teams_done, results_ptr);
+        cgh.parallel_for(
+            sycl::nd_range<1>(n_wgroups * wgroup_size, wgroup_size),
+            reduction_lambda);
       });
-      last_reduction_event       = q.ext_oneapi_submit_barrier(
+
+      last_reduction_event = q.ext_oneapi_submit_barrier(
           std::vector<sycl::event>{parallel_reduce_event});
     }
 
diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Scan.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Scan.hpp
index e2afc9783961cf24bfa6677e7e44a1899b218884..cf651ced95e5c1f34ad8705189b6cd15f8c526ba 100644
--- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Scan.hpp
+++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Scan.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKO_SYCL_PARALLEL_SCAN_HPP
 #define KOKKO_SYCL_PARALLEL_SCAN_HPP
@@ -142,6 +114,8 @@ class ParallelScanSYCLBase {
   const FunctorType m_functor;
   const Policy m_policy;
   pointer_type m_scratch_space = nullptr;
+  const pointer_type m_result_ptr;
+  const bool m_result_ptr_device_accessible;
 
   // Only let one Parallel/Scan modify the shared memory. The
   // constructor acquires the mutex which is released in the destructor.
@@ -254,7 +228,11 @@ class ParallelScanSYCLBase {
 
     // Write results to global memory
     auto update_global_results = q.submit([&](sycl::handler& cgh) {
-      auto global_mem = m_scratch_space;
+      auto global_mem                   = m_scratch_space;
+      auto result_ptr_device_accessible = m_result_ptr_device_accessible;
+      // The compiler failed with CL_INVALID_ARG_VALUE if using m_result_ptr
+      // directly.
+      auto result_ptr = m_result_ptr_device_accessible ? m_result_ptr : nullptr;
       cgh.parallel_for(sycl::range<1>(len), [=](sycl::item<1> item) {
         auto global_id = item.get_id(0);
 
@@ -264,6 +242,8 @@ class ParallelScanSYCLBase {
         else
           functor_wrapper.get_functor()(WorkTag(), global_id, update, true);
         global_mem[global_id] = update;
+        if (global_id == len - 1 && result_ptr_device_accessible)
+          *result_ptr = update;
       });
     });
     q.ext_oneapi_submit_barrier(
@@ -313,9 +293,13 @@ class ParallelScanSYCLBase {
     post_functor();
   }
 
-  ParallelScanSYCLBase(const FunctorType& arg_functor, const Policy& arg_policy)
+  ParallelScanSYCLBase(const FunctorType& arg_functor, const Policy& arg_policy,
+                       pointer_type arg_result_ptr,
+                       bool arg_result_ptr_device_accessible)
       : m_functor(arg_functor),
         m_policy(arg_policy),
+        m_result_ptr(arg_result_ptr),
+        m_result_ptr_device_accessible(arg_result_ptr_device_accessible),
         m_shared_memory_lock(m_policy.space()
                                  .impl_internal_space_instance()
                                  ->m_mutexScratchSpace) {}
@@ -334,7 +318,7 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>,
 
   ParallelScan(const FunctorType& arg_functor,
                const typename Base::Policy& arg_policy)
-      : Base(arg_functor, arg_policy) {}
+      : Base(arg_functor, arg_policy, nullptr, false) {}
 };
 
 //----------------------------------------------------------------------------
@@ -342,30 +326,32 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>,
 template <class FunctorType, class ReturnType, class... Traits>
 class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
                             ReturnType, Kokkos::Experimental::SYCL>
-    : private ParallelScanSYCLBase<FunctorType, Traits...> {
+    : public ParallelScanSYCLBase<FunctorType, Traits...> {
  public:
   using Base = ParallelScanSYCLBase<FunctorType, Traits...>;
 
-  ReturnType& m_returnvalue;
   const Kokkos::Experimental::SYCL& m_exec;
 
   inline void execute() {
     Base::impl_execute([&]() {
       const long long nwork = Base::m_policy.end() - Base::m_policy.begin();
-      if (nwork > 0) {
+      if (nwork > 0 && !Base::m_result_ptr_device_accessible) {
         const int size = Base::Analysis::value_size(Base::m_functor);
         DeepCopy<HostSpace, Kokkos::Experimental::SYCLDeviceUSMSpace,
-                 Kokkos::Experimental::SYCL>(
-            m_exec, &m_returnvalue, Base::m_scratch_space + nwork - 1, size);
+                 Kokkos::Experimental::SYCL>(m_exec, Base::m_result_ptr,
+                                             Base::m_scratch_space + nwork - 1,
+                                             size);
       }
     });
   }
 
+  template <class ViewType>
   ParallelScanWithTotal(const FunctorType& arg_functor,
                         const typename Base::Policy& arg_policy,
-                        ReturnType& arg_returnvalue)
-      : Base(arg_functor, arg_policy),
-        m_returnvalue(arg_returnvalue),
+                        const ViewType& arg_result_view)
+      : Base(arg_functor, arg_policy, arg_result_view.data(),
+             MemorySpaceAccess<Experimental::SYCLDeviceUSMSpace,
+                               typename ViewType::memory_space>::accessible),
         m_exec(arg_policy.space()) {}
 };
 
diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Team.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Team.hpp
index 5ac7d8af3089f0acd4a3923b4811ae0aec080472..601580b2d8b7b591844bd102fd2165c324e1ab60 100644
--- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Team.hpp
+++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Team.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SYCL_PARALLEL_TEAM_HPP
 #define KOKKOS_SYCL_PARALLEL_TEAM_HPP
@@ -164,9 +136,6 @@ class TeamPolicyInternal<Kokkos::Experimental::SYCL, Properties...>
   inline void impl_set_vector_length(size_t size) { m_vector_length = size; }
   inline void impl_set_team_size(size_t size) { m_team_size = size; }
   int impl_vector_length() const { return m_vector_length; }
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  KOKKOS_DEPRECATED int vector_length() const { return impl_vector_length(); }
-#endif
 
   int team_size() const { return m_team_size; }
 
@@ -335,9 +304,10 @@ class TeamPolicyInternal<Kokkos::Experimental::SYCL, Properties...>
     return std::min({
              int(m_space.impl_internal_space_instance()->m_maxWorkgroupSize),
       // FIXME_SYCL Avoid requesting to many registers on NVIDIA GPUs.
-#if defined(KOKKOS_ARCH_KEPLER) || defined(KOKKOS_ARCH_MAXWELL) || \
-    defined(KOKKOS_ARCH_PASCAL) || defined(KOKKOS_ARCH_VOLTA) ||   \
-    defined(KOKKOS_ARCH_TURING75) || defined(KOKKOS_ARCH_AMPERE)
+#if defined(KOKKOS_ARCH_KEPLER) || defined(KOKKOS_ARCH_MAXWELL) ||  \
+    defined(KOKKOS_ARCH_PASCAL) || defined(KOKKOS_ARCH_VOLTA) ||    \
+    defined(KOKKOS_ARCH_TURING75) || defined(KOKKOS_ARCH_AMPERE) || \
+    defined(KOKKOS_ARCH_HOPPER)
                  256,
 #endif
                  max_threads_for_memory
@@ -367,9 +337,10 @@ class TeamPolicyInternal<Kokkos::Experimental::SYCL, Properties...>
     return std::min<int>({
              int(m_space.impl_internal_space_instance()->m_maxWorkgroupSize),
       // FIXME_SYCL Avoid requesting to many registers on NVIDIA GPUs.
-#if defined(KOKKOS_ARCH_KEPLER) || defined(KOKKOS_ARCH_MAXWELL) || \
-    defined(KOKKOS_ARCH_PASCAL) || defined(KOKKOS_ARCH_VOLTA) ||   \
-    defined(KOKKOS_ARCH_TURING75) || defined(KOKKOS_ARCH_AMPERE)
+#if defined(KOKKOS_ARCH_KEPLER) || defined(KOKKOS_ARCH_MAXWELL) ||  \
+    defined(KOKKOS_ARCH_PASCAL) || defined(KOKKOS_ARCH_VOLTA) ||    \
+    defined(KOKKOS_ARCH_TURING75) || defined(KOKKOS_ARCH_AMPERE) || \
+    defined(KOKKOS_ARCH_HOPPER)
                  256,
 #endif
                  max_threads_for_memory
@@ -690,7 +661,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>,
             [&](sycl::accessor<value_type, 1, sycl::access::mode::read_write,
                                sycl::access::target::local>
                     local_mem,
-                sycl::device_ptr<value_type> results_ptr) mutable {
+                sycl::device_ptr<value_type> results_ptr) {
               sycl::global_ptr<value_type> device_accessible_result_ptr =
                   m_result_ptr_device_accessible ? m_result_ptr : nullptr;
               auto lambda = [=](sycl::nd_item<2> item) {
diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Space.cpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Space.cpp
index 07ca907fa5adbaab309e32a36e8b37a97678fe33..6151b3eaafbd4217d046f42d00895e24c5f6cb29 100644
--- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Space.cpp
+++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Space.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Team.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Team.hpp
index a8c60412cbca1318e5e3c6654a45cd725b3389f8..674037ed9590fecc7a8ded10a3b1cf43a9324e28 100644
--- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Team.hpp
+++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Team.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SYCL_TEAM_HPP
 #define KOKKOS_SYCL_TEAM_HPP
@@ -63,6 +35,7 @@ class SYCLTeamMember {
  public:
   using execution_space      = Kokkos::Experimental::SYCL;
   using scratch_memory_space = execution_space::scratch_memory_space;
+  using team_handle          = SYCLTeamMember;
 
  private:
   mutable sycl::local_ptr<void> m_team_reduce;
@@ -364,10 +337,11 @@ class SYCLTeamMember {
   // Private for the driver
 
   KOKKOS_INLINE_FUNCTION
-  SYCLTeamMember(sycl::local_ptr<void> shared, const int shared_begin,
-                 const int shared_size,
+  SYCLTeamMember(sycl::local_ptr<void> shared, const std::size_t shared_begin,
+                 const std::size_t shared_size,
                  sycl::device_ptr<void> scratch_level_1_ptr,
-                 const int scratch_level_1_size, const sycl::nd_item<2> item)
+                 const std::size_t scratch_level_1_size,
+                 const sycl::nd_item<2> item)
       : m_team_reduce(shared),
         m_team_shared(static_cast<sycl::local_ptr<char>>(shared) + shared_begin,
                       shared_size, scratch_level_1_ptr, scratch_level_1_size),
diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_UniqueToken.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_UniqueToken.hpp
index 82bfae46f590165823dfe74b5487dd32ea3a54f7..2f0a67b3dd06a71cdd95b20000931cb047f222dd 100644
--- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_UniqueToken.hpp
+++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_UniqueToken.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SYCL_UNIQUE_TOKEN_HPP
 #define KOKKOS_SYCL_UNIQUE_TOKEN_HPP
diff --git a/packages/kokkos/core/src/Serial/Kokkos_Serial.cpp b/packages/kokkos/core/src/Serial/Kokkos_Serial.cpp
index 9205e82560a34c0ef383ee1d8ed43c6352fd8e2c..df91d8499ac02ce4cbd7e42fce525f9956a29744 100644
--- a/packages/kokkos/core/src/Serial/Kokkos_Serial.cpp
+++ b/packages/kokkos/core/src/Serial/Kokkos_Serial.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -173,14 +145,8 @@ void SerialInternal::resize_thread_team_data(size_t pool_reduce_bytes,
 }  // namespace Impl
 
 Serial::Serial()
-#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS
-    : m_space_instance(&Impl::SerialInternal::singleton()) {
-}
-#else
     : m_space_instance(&Impl::SerialInternal::singleton(),
-                       [](Impl::SerialInternal*) {}) {
-}
-#endif
+                       [](Impl::SerialInternal*) {}) {}
 
 void Serial::print_configuration(std::ostream& os, bool /*verbose*/) const {
   os << "Host Serial Execution Space:\n";
@@ -216,12 +182,4 @@ int g_serial_space_factory_initialized =
 
 }  // namespace Impl
 
-#ifdef KOKKOS_ENABLE_CXX14
-namespace Tools {
-namespace Experimental {
-constexpr DeviceType DeviceTypeTraits<Serial>::id;
-}
-}  // namespace Tools
-#endif
-
 }  // namespace Kokkos
diff --git a/packages/kokkos/core/src/Serial/Kokkos_Serial_MDRangePolicy.hpp b/packages/kokkos/core/src/Serial/Kokkos_Serial_MDRangePolicy.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..4ffe64af07120333c2068123a68bcb5e381125ec
--- /dev/null
+++ b/packages/kokkos/core/src/Serial/Kokkos_Serial_MDRangePolicy.hpp
@@ -0,0 +1,32 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_SERIAL_MDRANGEPOLICY_HPP_
+#define KOKKOS_SERIAL_MDRANGEPOLICY_HPP_
+
+#include <KokkosExp_MDRangePolicy.hpp>
+
+namespace Kokkos {
+namespace Impl {
+
+// Settings for TeamMDRangePolicy
+template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector>
+struct ThreadAndVectorNestLevel<Rank, Serial, ThreadAndVector>
+    : HostBasedNestLevel<Rank, ThreadAndVector> {};
+
+}  // namespace Impl
+}  // namespace Kokkos
+#endif
diff --git a/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp b/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp
index d726a86f76493187e193f8687f834fe90df0d8f5..afdecd2f054652d5937c6e0eb23688debc37460e 100644
--- a/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp
+++ b/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKO_SERIAL_PARALLEL_MDRANGE_HPP
 #define KOKKO_SERIAL_PARALLEL_MDRANGE_HPP
@@ -61,14 +33,12 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
   using iterate_type = typename Kokkos::Impl::HostIterateTile<
       MDRangePolicy, FunctorType, typename MDRangePolicy::work_tag, void>;
 
-  const FunctorType m_functor;
-  const MDRangePolicy m_mdr_policy;
-  const Policy m_policy;
+  const iterate_type m_iter;
 
   void exec() const {
-    const typename Policy::member_type e = m_policy.end();
-    for (typename Policy::member_type i = m_policy.begin(); i < e; ++i) {
-      iterate_type(m_mdr_policy, m_functor)(i);
+    const typename Policy::member_type e = m_iter.m_rp.m_num_tiles;
+    for (typename Policy::member_type i = 0; i < e; ++i) {
+      m_iter(i);
     }
   }
 
@@ -85,9 +55,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
   }
   inline ParallelFor(const FunctorType& arg_functor,
                      const MDRangePolicy& arg_policy)
-      : m_functor(arg_functor),
-        m_mdr_policy(arg_policy),
-        m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)) {}
+      : m_iter(arg_policy, arg_functor) {}
 };
 
 template <class FunctorType, class ReducerType, class... Traits>
@@ -117,17 +85,14 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
   using iterate_type =
       typename Kokkos::Impl::HostIterateTile<MDRangePolicy, FunctorType,
                                              WorkTag, reference_type>;
-
-  const FunctorType m_functor;
-  const MDRangePolicy m_mdr_policy;
-  const Policy m_policy;
+  const iterate_type m_iter;
   const ReducerType m_reducer;
   const pointer_type m_result_ptr;
 
   inline void exec(reference_type update) const {
-    const typename Policy::member_type e = m_policy.end();
-    for (typename Policy::member_type i = m_policy.begin(); i < e; ++i) {
-      iterate_type(m_mdr_policy, m_functor, update)(i);
+    const typename Policy::member_type e = m_iter.m_rp.m_num_tiles;
+    for (typename Policy::member_type i = 0; i < e; ++i) {
+      m_iter(i, update);
     }
   }
 
@@ -142,13 +107,14 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
     return 1024;
   }
   inline void execute() const {
-    const size_t pool_reduce_size =
-        Analysis::value_size(ReducerConditional::select(m_functor, m_reducer));
+    const size_t pool_reduce_size = Analysis::value_size(
+        ReducerConditional::select(m_iter.m_func, m_reducer));
     const size_t team_reduce_size  = 0;  // Never shrinks
     const size_t team_shared_size  = 0;  // Never shrinks
     const size_t thread_local_size = 0;  // Never shrinks
 
-    auto* internal_instance = m_policy.space().impl_internal_space_instance();
+    auto* internal_instance =
+        m_iter.m_rp.space().impl_internal_space_instance();
     // Need to lock resize_thread_team_data
     std::lock_guard<std::mutex> lock(
         internal_instance->m_thread_team_data_mutex);
@@ -163,7 +129,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
                   internal_instance->m_thread_team_data.pool_reduce_local());
 
     typename Analysis::Reducer final_reducer(
-        &ReducerConditional::select(m_functor, m_reducer));
+        &ReducerConditional::select(m_iter.m_func, m_reducer));
 
     reference_type update = final_reducer.init(ptr);
 
@@ -179,9 +145,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
                  std::enable_if_t<Kokkos::is_view<HostViewType>::value &&
                                       !Kokkos::is_reducer<ReducerType>::value,
                                   void*> = nullptr)
-      : m_functor(arg_functor),
-        m_mdr_policy(arg_policy),
-        m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)),
+      : m_iter(arg_policy, arg_functor),
         m_reducer(InvalidType()),
         m_result_ptr(arg_result_view.data()) {
     static_assert(Kokkos::is_view<HostViewType>::value,
@@ -195,9 +159,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
 
   inline ParallelReduce(const FunctorType& arg_functor,
                         MDRangePolicy arg_policy, const ReducerType& reducer)
-      : m_functor(arg_functor),
-        m_mdr_policy(arg_policy),
-        m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)),
+      : m_iter(arg_policy, arg_functor),
         m_reducer(reducer),
         m_result_ptr(reducer.view().data()) {
     /*static_assert( std::is_same< typename ViewType::memory_space
diff --git a/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_Range.hpp b/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_Range.hpp
index 84262227f54ad9dafcdc114417fdde2984313132..f35c13170b8d5b0210dec7183d2433f20fd7303f 100644
--- a/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_Range.hpp
+++ b/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_Range.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKO_SERIAL_PARALLEL_RANGE_HPP
 #define KOKKO_SERIAL_PARALLEL_RANGE_HPP
@@ -272,12 +244,13 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
   using Analysis =
       FunctorAnalysis<FunctorPatternInterface::SCAN, Policy, FunctorType>;
 
+  using value_type     = typename Analysis::value_type;
   using pointer_type   = typename Analysis::pointer_type;
   using reference_type = typename Analysis::reference_type;
 
   const FunctorType m_functor;
   const Policy m_policy;
-  ReturnType& m_returnvalue;
+  const pointer_type m_result_ptr;
 
   template <class TagType>
   inline std::enable_if_t<std::is_void<TagType>::value> exec(
@@ -320,15 +293,22 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
 
     this->template exec<WorkTag>(update);
 
-    m_returnvalue = update;
+    *m_result_ptr = update;
   }
 
-  inline ParallelScanWithTotal(const FunctorType& arg_functor,
-                               const Policy& arg_policy,
-                               ReturnType& arg_returnvalue)
+  template <class ViewType,
+            class Enable = std::enable_if_t<Kokkos::is_view<ViewType>::value>>
+  ParallelScanWithTotal(const FunctorType& arg_functor,
+                        const Policy& arg_policy,
+                        const ViewType& arg_result_view)
       : m_functor(arg_functor),
         m_policy(arg_policy),
-        m_returnvalue(arg_returnvalue) {}
+        m_result_ptr(arg_result_view.data()) {
+    static_assert(
+        Kokkos::Impl::MemorySpaceAccess<typename ViewType::memory_space,
+                                        Kokkos::HostSpace>::accessible,
+        "Kokkos::Serial parallel_scan result must be host-accessible!");
+  }
 };
 
 }  // namespace Impl
diff --git a/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_Team.hpp b/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_Team.hpp
index 782ae75feb5e195feec743d4ca32523eee1ddd95..c5156f1f7f21913589070fe13404a3c801d3252c 100644
--- a/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_Team.hpp
+++ b/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_Team.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKO_SERIAL_PARALLEL_TEAM_HPP
 #define KOKKO_SERIAL_PARALLEL_TEAM_HPP
diff --git a/packages/kokkos/core/src/Serial/Kokkos_Serial_Task.cpp b/packages/kokkos/core/src/Serial/Kokkos_Serial_Task.cpp
index 468f27eebd4da29fab83bae37beb518e2da2c99d..0a7ba2852e492c5a910894ac1ecf1f9ff7195ecf 100644
--- a/packages/kokkos/core/src/Serial/Kokkos_Serial_Task.cpp
+++ b/packages/kokkos/core/src/Serial/Kokkos_Serial_Task.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
diff --git a/packages/kokkos/core/src/Serial/Kokkos_Serial_Task.hpp b/packages/kokkos/core/src/Serial/Kokkos_Serial_Task.hpp
index 8d8c1d748dade42ddd8a09050a29afbd45800c84..c744f34760ca6a0d42362ac3124bd769bcd957e2 100644
--- a/packages/kokkos/core/src/Serial/Kokkos_Serial_Task.hpp
+++ b/packages/kokkos/core/src/Serial/Kokkos_Serial_Task.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_SERIAL_TASK_HPP
 #define KOKKOS_IMPL_SERIAL_TASK_HPP
diff --git a/packages/kokkos/core/src/Serial/Kokkos_Serial_UniqueToken.hpp b/packages/kokkos/core/src/Serial/Kokkos_Serial_UniqueToken.hpp
index cc845f3dca7eac39519a965d2f4be1a19ac55020..c8f46d63397c1e8da1679a2e3c48f5afb5f1d086 100644
--- a/packages/kokkos/core/src/Serial/Kokkos_Serial_UniqueToken.hpp
+++ b/packages/kokkos/core/src/Serial/Kokkos_Serial_UniqueToken.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SERIAL_UNIQUE_TOKEN_HPP
 #define KOKKOS_SERIAL_UNIQUE_TOKEN_HPP
diff --git a/packages/kokkos/core/src/Serial/Kokkos_Serial_WorkGraphPolicy.hpp b/packages/kokkos/core/src/Serial/Kokkos_Serial_WorkGraphPolicy.hpp
index 05980170b841daae67941b07c51fca6fa9a03e57..7e5cd8d88a3da1af62f8c76eba05e3bcff57b837 100644
--- a/packages/kokkos/core/src/Serial/Kokkos_Serial_WorkGraphPolicy.hpp
+++ b/packages/kokkos/core/src/Serial/Kokkos_Serial_WorkGraphPolicy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SERIAL_WORKGRAPHPOLICY_HPP
 #define KOKKOS_SERIAL_WORKGRAPHPOLICY_HPP
diff --git a/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.cpp b/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.cpp
index 346eb1dc08d6e789385a4a590075f79b4d256d42..8f39c726c722a2a1c555905a3f3219074d497ad6 100644
--- a/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.cpp
+++ b/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -780,17 +752,18 @@ void ThreadsExec::initialize(int thread_count_arg) {
   }
 
   // Check for over-subscription
+  auto const reported_ranks = mpi_ranks_per_node();
+  auto const mpi_local_size = reported_ranks < 0 ? 1 : reported_ranks;
+  int const procs_per_node  = std::thread::hardware_concurrency();
   if (Kokkos::show_warnings() &&
-      (Impl::mpi_ranks_per_node() * long(thread_count) >
-       Impl::processors_per_node())) {
+      (mpi_local_size * long(thread_count) > procs_per_node)) {
     std::cerr << "Kokkos::Threads::initialize WARNING: You are likely "
                  "oversubscribing your CPU cores."
               << std::endl;
     std::cerr << "                                    Detected: "
-              << Impl::processors_per_node() << " cores per node." << std::endl;
+              << procs_per_node << " cores per node." << std::endl;
     std::cerr << "                                    Detected: "
-              << Impl::mpi_ranks_per_node() << " MPI_ranks per node."
-              << std::endl;
+              << mpi_local_size << " MPI_ranks per node." << std::endl;
     std::cerr << "                                    Requested: "
               << thread_count << " threads per process." << std::endl;
   }
@@ -859,7 +832,12 @@ void ThreadsExec::finalize() {
 
 namespace Kokkos {
 
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
 int Threads::concurrency() { return impl_thread_pool_size(0); }
+#else
+int Threads::concurrency() const { return impl_thread_pool_size(0); }
+#endif
+
 void Threads::fence(const std::string &name) const {
   Impl::ThreadsExec::internal_fence(name, Impl::fence_is_static::no);
 }
@@ -891,12 +869,4 @@ int g_threads_space_factory_initialized =
 
 }  // namespace Impl
 
-#ifdef KOKKOS_ENABLE_CXX14
-namespace Tools {
-namespace Experimental {
-constexpr DeviceType DeviceTypeTraits<Threads>::id;
-}
-}  // namespace Tools
-#endif
-
 } /* namespace Kokkos */
diff --git a/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.hpp b/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.hpp
index 238a7655457944445752b40c7e55f93d76d378d1..8b15928debce7048c80bac661deb157a8ffaab7a 100644
--- a/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.hpp
+++ b/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_THREADSEXEC_HPP
 #define KOKKOS_THREADSEXEC_HPP
@@ -109,7 +81,7 @@ class ThreadsExec {
   // Which thread am I stealing from currently
   int m_current_steal_target;
   // This thread's owned work_range
-  Kokkos::pair<long, long> m_work_range __attribute__((aligned(16)));
+  alignas(16) Kokkos::pair<long, long> m_work_range;
   // Team Offset if one thread determines work_range for others
   long m_team_work_index;
 
diff --git a/packages/kokkos/core/src/Threads/Kokkos_ThreadsTeam.hpp b/packages/kokkos/core/src/Threads/Kokkos_ThreadsTeam.hpp
index 02ce9325065e11e311252b2c931245318f289dc4..3f734f08d4f986fcb48c1691d14a794bc744a4de 100644
--- a/packages/kokkos/core/src/Threads/Kokkos_ThreadsTeam.hpp
+++ b/packages/kokkos/core/src/Threads/Kokkos_ThreadsTeam.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_THREADSTEAM_HPP
 #define KOKKOS_THREADSTEAM_HPP
@@ -74,6 +46,7 @@ class ThreadsExecTeamMember {
  public:
   using execution_space      = Kokkos::Threads;
   using scratch_memory_space = execution_space::scratch_memory_space;
+  using team_handle          = ThreadsExecTeamMember;
 
  private:
   using space = execution_space::scratch_memory_space;
@@ -782,7 +755,7 @@ class TeamPolicyInternal<Kokkos::Threads, Properties...>
  private:
   /** \brief finalize chunk_size if it was set to AUTO*/
   inline void set_auto_chunk_size() {
-    int64_t concurrency = traits::execution_space::concurrency() / m_team_alloc;
+    int64_t concurrency = space().concurrency() / m_team_alloc;
     if (concurrency == 0) concurrency = 1;
 
     if (m_chunk_size > 0) {
diff --git a/packages/kokkos/core/src/Threads/Kokkos_Threads_MDRangePolicy.hpp b/packages/kokkos/core/src/Threads/Kokkos_Threads_MDRangePolicy.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..50d66aae6ab0022695d7ed3c2af80612071ce1c2
--- /dev/null
+++ b/packages/kokkos/core/src/Threads/Kokkos_Threads_MDRangePolicy.hpp
@@ -0,0 +1,32 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_THREADS_MDRANGEPOLICY_HPP_
+#define KOKKOS_THREADS_MDRANGEPOLICY_HPP_
+
+#include <KokkosExp_MDRangePolicy.hpp>
+
+namespace Kokkos {
+namespace Impl {
+
+// Settings for TeamMDRangePolicy
+template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector>
+struct ThreadAndVectorNestLevel<Rank, Threads, ThreadAndVector>
+    : HostBasedNestLevel<Rank, ThreadAndVector> {};
+
+}  // namespace Impl
+}  // namespace Kokkos
+#endif
diff --git a/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_MDRange.hpp b/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_MDRange.hpp
index 6d1a38da1da1ae79334ff2fbd248c86bbed83437..35392e3bfb054004ef3f01239e84b15362bc8cfe 100644
--- a/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_MDRange.hpp
+++ b/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_MDRange.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_THREADS_PARALLEL_MDRANGE_HPP
 #define KOKKOS_THREADS_PARALLEL_MDRANGE_HPP
@@ -67,20 +39,11 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
   using iterate_type = typename Kokkos::Impl::HostIterateTile<
       MDRangePolicy, FunctorType, typename MDRangePolicy::work_tag, void>;
 
-  const FunctorType m_functor;
-  const MDRangePolicy m_mdr_policy;
-  const Policy m_policy;  // construct as RangePolicy( 0, num_tiles
-                          // ).set_chunk_size(1) in ctor
-
-  inline static void exec_range(const MDRangePolicy &mdr_policy,
-                                const FunctorType &functor, const Member ibeg,
-                                const Member iend) {
-#if defined(KOKKOS_ENABLE_AGGRESSIVE_VECTORIZATION) && \
-    defined(KOKKOS_ENABLE_PRAGMA_IVDEP)
-#pragma ivdep
-#endif
+  const iterate_type m_iter;
+
+  inline void exec_range(const Member ibeg, const Member iend) const {
     for (Member i = ibeg; i < iend; ++i) {
-      iterate_type(mdr_policy, functor)(i);
+      m_iter(i);
     }
   }
 
@@ -93,10 +56,11 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
   exec_schedule(ThreadsExec &exec, const void *arg) {
     const ParallelFor &self = *((const ParallelFor *)arg);
 
-    WorkRange range(self.m_policy, exec.pool_rank(), exec.pool_size());
+    auto const num_tiles = self.m_iter.m_rp.m_num_tiles;
+    WorkRange range(Policy(0, num_tiles).set_chunk_size(1), exec.pool_rank(),
+                    exec.pool_size());
 
-    ParallelFor::exec_range(self.m_mdr_policy, self.m_functor, range.begin(),
-                            range.end());
+    self.exec_range(range.begin(), range.end());
 
     exec.fan_in();
   }
@@ -106,23 +70,21 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
   exec_schedule(ThreadsExec &exec, const void *arg) {
     const ParallelFor &self = *((const ParallelFor *)arg);
 
-    WorkRange range(self.m_policy, exec.pool_rank(), exec.pool_size());
+    auto const num_tiles = self.m_iter.m_rp.m_num_tiles;
+    WorkRange range(Policy(0, num_tiles).set_chunk_size(1), exec.pool_rank(),
+                    exec.pool_size());
 
-    exec.set_work_range(range.begin(), range.end(), self.m_policy.chunk_size());
+    exec.set_work_range(range.begin(), range.end(), 1);
     exec.reset_steal_target();
     exec.barrier();
 
     long work_index = exec.get_work_index();
 
     while (work_index != -1) {
-      const Member begin =
-          static_cast<Member>(work_index) * self.m_policy.chunk_size();
-      const Member end =
-          begin + self.m_policy.chunk_size() < self.m_policy.end()
-              ? begin + self.m_policy.chunk_size()
-              : self.m_policy.end();
-
-      ParallelFor::exec_range(self.m_mdr_policy, self.m_functor, begin, end);
+      const Member begin = static_cast<Member>(work_index);
+      const Member end   = begin + 1 < num_tiles ? begin + 1 : num_tiles;
+
+      self.exec_range(begin, end);
       work_index = exec.get_work_index();
     }
 
@@ -136,9 +98,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>,
   }
 
   ParallelFor(const FunctorType &arg_functor, const MDRangePolicy &arg_policy)
-      : m_functor(arg_functor),
-        m_mdr_policy(arg_policy),
-        m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)) {}
+      : m_iter(arg_policy, arg_functor) {}
 
   template <typename Policy, typename Functor>
   static int max_tile_size_product(const Policy &, const Functor &) {
@@ -180,22 +140,14 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
       typename Kokkos::Impl::HostIterateTile<MDRangePolicy, FunctorType,
                                              WorkTag, reference_type>;
 
-  const FunctorType m_functor;
-  const MDRangePolicy m_mdr_policy;
-  const Policy m_policy;  // construct as RangePolicy( 0, num_tiles
-                          // ).set_chunk_size(1) in ctor
+  const iterate_type m_iter;
   const ReducerType m_reducer;
   const pointer_type m_result_ptr;
 
-  inline static void exec_range(const MDRangePolicy &mdr_policy,
-                                const FunctorType &functor, const Member &ibeg,
-                                const Member &iend, reference_type update) {
-#if defined(KOKKOS_ENABLE_AGGRESSIVE_VECTORIZATION) && \
-    defined(KOKKOS_ENABLE_PRAGMA_IVDEP)
-#pragma ivdep
-#endif
+  inline void exec_range(const Member &ibeg, const Member &iend,
+                         reference_type update) const {
     for (Member i = ibeg; i < iend; ++i) {
-      iterate_type(mdr_policy, functor, update)(i);
+      m_iter(i, update);
     }
   }
 
@@ -207,13 +159,16 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
   static std::enable_if_t<std::is_same<Schedule, Kokkos::Static>::value>
   exec_schedule(ThreadsExec &exec, const void *arg) {
     const ParallelReduce &self = *((const ParallelReduce *)arg);
-    const WorkRange range(self.m_policy, exec.pool_rank(), exec.pool_size());
+
+    const auto num_tiles = self.m_iter.m_rp.m_num_tiles;
+    const WorkRange range(Policy(0, num_tiles).set_chunk_size(1),
+                          exec.pool_rank(), exec.pool_size());
 
     typename Analysis::Reducer reducer(
-        &ReducerConditional::select(self.m_functor, self.m_reducer));
+        &ReducerConditional::select(self.m_iter.m_func, self.m_reducer));
 
-    ParallelReduce::exec_range(
-        self.m_mdr_policy, self.m_functor, range.begin(), range.end(),
+    self.exec_range(
+        range.begin(), range.end(),
         reducer.init(static_cast<pointer_type>(exec.reduce_memory())));
 
     exec.fan_in_reduce(reducer);
@@ -223,27 +178,25 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
   static std::enable_if_t<std::is_same<Schedule, Kokkos::Dynamic>::value>
   exec_schedule(ThreadsExec &exec, const void *arg) {
     const ParallelReduce &self = *((const ParallelReduce *)arg);
-    const WorkRange range(self.m_policy, exec.pool_rank(), exec.pool_size());
 
-    exec.set_work_range(range.begin(), range.end(), self.m_policy.chunk_size());
+    const auto num_tiles = self.m_iter.m_rp.m_num_tiles;
+    const WorkRange range(Policy(0, num_tiles).set_chunk_size(1),
+                          exec.pool_rank(), exec.pool_size());
+
+    exec.set_work_range(range.begin(), range.end(), 1);
     exec.reset_steal_target();
     exec.barrier();
 
     long work_index = exec.get_work_index();
     typename Analysis::Reducer reducer(
-        &ReducerConditional::select(self.m_functor, self.m_reducer));
+        &ReducerConditional::select(self.m_iter.m_func, self.m_reducer));
 
     reference_type update =
         reducer.init(static_cast<pointer_type>(exec.reduce_memory()));
     while (work_index != -1) {
-      const Member begin =
-          static_cast<Member>(work_index) * self.m_policy.chunk_size();
-      const Member end =
-          begin + self.m_policy.chunk_size() < self.m_policy.end()
-              ? begin + self.m_policy.chunk_size()
-              : self.m_policy.end();
-      ParallelReduce::exec_range(self.m_mdr_policy, self.m_functor, begin, end,
-                                 update);
+      const Member begin = static_cast<Member>(work_index);
+      const Member end   = begin + 1 < num_tiles ? begin + 1 : num_tiles;
+      self.exec_range(begin, end, update);
       work_index = exec.get_work_index();
     }
 
@@ -252,9 +205,9 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
 
  public:
   inline void execute() const {
-    ThreadsExec::resize_scratch(
-        Analysis::value_size(ReducerConditional::select(m_functor, m_reducer)),
-        0);
+    ThreadsExec::resize_scratch(Analysis::value_size(ReducerConditional::select(
+                                    m_iter.m_func, m_reducer)),
+                                0);
 
     ThreadsExec::start(&ParallelReduce::exec, this);
 
@@ -265,7 +218,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
           (pointer_type)ThreadsExec::root_reduce_scratch();
 
       const unsigned n = Analysis::value_count(
-          ReducerConditional::select(m_functor, m_reducer));
+          ReducerConditional::select(m_iter.m_func, m_reducer));
       for (unsigned i = 0; i < n; ++i) {
         m_result_ptr[i] = data[i];
       }
@@ -279,9 +232,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
                  std::enable_if_t<Kokkos::is_view<HostViewType>::value &&
                                       !Kokkos::is_reducer<ReducerType>::value,
                                   void *> = nullptr)
-      : m_functor(arg_functor),
-        m_mdr_policy(arg_policy),
-        m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)),
+      : m_iter(arg_policy, arg_functor),
         m_reducer(InvalidType()),
         m_result_ptr(arg_result_view.data()) {
     static_assert(Kokkos::is_view<HostViewType>::value,
@@ -294,9 +245,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType,
 
   inline ParallelReduce(const FunctorType &arg_functor,
                         MDRangePolicy arg_policy, const ReducerType &reducer)
-      : m_functor(arg_functor),
-        m_mdr_policy(arg_policy),
-        m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)),
+      : m_iter(arg_policy, arg_functor),
         m_reducer(reducer),
         m_result_ptr(reducer.view().data()) {
     /*static_assert( std::is_same< typename ViewType::memory_space
diff --git a/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_Range.hpp b/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_Range.hpp
index 971a0bb9c2bd2d1f4005fddf58bc47041df07a93..7d3527facdf174b40513228a117656fab64a67f8 100644
--- a/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_Range.hpp
+++ b/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_Range.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_THREADS_PARALLEL_RANGE_HPP
 #define KOKKOS_THREADS_PARALLEL_RANGE_HPP
@@ -405,12 +377,13 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
   using Analysis = Impl::FunctorAnalysis<Impl::FunctorPatternInterface::SCAN,
                                          Policy, FunctorType>;
 
+  using value_type     = typename Analysis::value_type;
   using pointer_type   = typename Analysis::pointer_type;
   using reference_type = typename Analysis::reference_type;
 
   const FunctorType m_functor;
   const Policy m_policy;
-  ReturnType &m_returnvalue;
+  const pointer_type m_result_ptr;
 
   template <class TagType>
   inline static std::enable_if_t<std::is_void<TagType>::value> exec_range(
@@ -461,7 +434,7 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
     exec.fan_in();
 
     if (exec.pool_rank() == exec.pool_size() - 1) {
-      self.m_returnvalue = update;
+      *self.m_result_ptr = update;
     }
   }
 
@@ -472,11 +445,18 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>,
     ThreadsExec::fence();
   }
 
+  template <class ViewType>
   ParallelScanWithTotal(const FunctorType &arg_functor,
-                        const Policy &arg_policy, ReturnType &arg_returnvalue)
+                        const Policy &arg_policy,
+                        const ViewType &arg_result_view)
       : m_functor(arg_functor),
         m_policy(arg_policy),
-        m_returnvalue(arg_returnvalue) {}
+        m_result_ptr(arg_result_view.data()) {
+    static_assert(
+        Kokkos::Impl::MemorySpaceAccess<typename ViewType::memory_space,
+                                        Kokkos::HostSpace>::accessible,
+        "Kokkos::Threads parallel_scan result must be host-accessible!");
+  }
 };
 
 }  // namespace Impl
diff --git a/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_Team.hpp b/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_Team.hpp
index bdda110d37cef39df4d9aa977d9acf7b25fc2fb0..a602078c5229eb5323d1be14d2f8936ecef2a32b 100644
--- a/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_Team.hpp
+++ b/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_Team.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_THREADS_PARALLEL_TEAM_HPP
 #define KOKKOS_THREADS_PARALLEL_TEAM_HPP
diff --git a/packages/kokkos/core/src/Threads/Kokkos_Threads_UniqueToken.hpp b/packages/kokkos/core/src/Threads/Kokkos_Threads_UniqueToken.hpp
index f9901198f7db469b17514dc89283fb8fbcc6b21e..29887f958e5444686b0935c5ec143c4eac9d89e1 100644
--- a/packages/kokkos/core/src/Threads/Kokkos_Threads_UniqueToken.hpp
+++ b/packages/kokkos/core/src/Threads/Kokkos_Threads_UniqueToken.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_THREADS_UNIQUETOKEN_HPP
 #define KOKKOS_THREADS_UNIQUETOKEN_HPP
diff --git a/packages/kokkos/core/src/Threads/Kokkos_Threads_WorkGraphPolicy.hpp b/packages/kokkos/core/src/Threads/Kokkos_Threads_WorkGraphPolicy.hpp
index 5e8ac4604c044e5f37544bdf84ec7a0f155f43ce..7c29ce57395d5ea6cdba296fa6307882fdde1e72 100644
--- a/packages/kokkos/core/src/Threads/Kokkos_Threads_WorkGraphPolicy.hpp
+++ b/packages/kokkos/core/src/Threads/Kokkos_Threads_WorkGraphPolicy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_THREADS_WORKGRAPHPOLICY_HPP
 #define KOKKOS_THREADS_WORKGRAPHPOLICY_HPP
diff --git a/packages/kokkos/core/src/View/Hooks/Kokkos_ViewHooks.hpp b/packages/kokkos/core/src/View/Hooks/Kokkos_ViewHooks.hpp
index 77b2730b1b6b2db13397d58d16fd8101e88e2ef8..9baba9459bad0e320398d78b4e97f99b074adb76 100644
--- a/packages/kokkos/core/src/View/Hooks/Kokkos_ViewHooks.hpp
+++ b/packages/kokkos/core/src/View/Hooks/Kokkos_ViewHooks.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_EXPERIMENTAL_VIEWHOOKS_HPP
 #define KOKKOS_EXPERIMENTAL_VIEWHOOKS_HPP
diff --git a/packages/kokkos/core/src/View/MDSpan/Kokkos_MDSpan_Extents.hpp b/packages/kokkos/core/src/View/MDSpan/Kokkos_MDSpan_Extents.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..fb5195254344c4295a1339ec871df37be37d7622
--- /dev/null
+++ b/packages/kokkos/core/src/View/MDSpan/Kokkos_MDSpan_Extents.hpp
@@ -0,0 +1,111 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
+static_assert(false,
+              "Including non-public Kokkos header files is not allowed.");
+#endif
+
+#ifndef KOKKOS_EXPERIMENTAL_MDSPAN_EXTENTS_HPP
+#define KOKKOS_EXPERIMENTAL_MDSPAN_EXTENTS_HPP
+
+#include "Kokkos_MDSpan_Header.hpp"
+
+namespace Kokkos::Impl {
+
+// Forward declarations from impl/Kokkos_ViewMapping.hpp
+// We cannot include directly since ViewMapping is used elsewhere in View.
+// After View is fully moved to mdspan we can include it only from here.
+template <class DataType>
+struct ViewArrayAnalysis;
+
+template <std::size_t... Vals>
+struct ViewDimension;
+
+template <class T, class Dim>
+struct ViewDataType;
+}  // namespace Kokkos::Impl
+
+namespace Kokkos::Experimental::Impl {
+
+// A few things to note --
+// - mdspan allows for 0-rank extents similarly to View, so we don't need
+// special handling of this case
+// - View dynamic dimensions must be appear before static dimensions. This isn't
+// a requirement in mdspan but won't cause an issue here
+template <std::size_t N>
+struct ExtentFromDimension {
+  static constexpr std::size_t value = N;
+};
+
+// Kokkos uses a dimension of '0' to denote a dynamic dimension.
+template <>
+struct ExtentFromDimension<std::size_t{0}> {
+  static constexpr std::size_t value = std::experimental::dynamic_extent;
+};
+
+template <std::size_t N>
+struct DimensionFromExtent {
+  static constexpr std::size_t value = N;
+};
+
+template <>
+struct DimensionFromExtent<std::experimental::dynamic_extent> {
+  static constexpr std::size_t value = std::size_t{0};
+};
+
+template <class IndexType, class Dimension, class Indices>
+struct ExtentsFromDimension;
+
+template <class IndexType, class Dimension, std::size_t... Indices>
+struct ExtentsFromDimension<IndexType, Dimension,
+                            std::index_sequence<Indices...>> {
+  using type = std::experimental::extents<
+      IndexType,
+      ExtentFromDimension<Dimension::static_extent(Indices)>::value...>;
+};
+
+template <class Extents, class Indices>
+struct DimensionsFromExtent;
+
+template <class Extents, std::size_t... Indices>
+struct DimensionsFromExtent<Extents, std::index_sequence<Indices...>> {
+  using type = ::Kokkos::Impl::ViewDimension<
+      DimensionFromExtent<Extents::static_extent(Indices)>::value...>;
+};
+
+template <class IndexType, class DataType>
+struct ExtentsFromDataType {
+  using array_analysis = ::Kokkos::Impl::ViewArrayAnalysis<DataType>;
+  using dimension_type = typename array_analysis::dimension;
+
+  using type = typename ExtentsFromDimension<
+      IndexType, dimension_type,
+      std::make_index_sequence<dimension_type::rank>>::type;
+};
+
+template <class T, class Extents>
+struct DataTypeFromExtents {
+  using extents_type   = Extents;
+  using dimension_type = typename DimensionsFromExtent<
+      Extents, std::make_index_sequence<extents_type::rank()>>::type;
+
+  // Will cause a compile error if it is malformed (i.e. dynamic after static)
+  using type = typename ::Kokkos::Impl::ViewDataType<T, dimension_type>::type;
+};
+}  // namespace Kokkos::Experimental::Impl
+
+#endif  // KOKKOS_EXPERIMENTAL_MDSPAN_EXTENTS_HPP
diff --git a/packages/kokkos/core/src/View/MDSpan/Kokkos_MDSpan_Header.hpp b/packages/kokkos/core/src/View/MDSpan/Kokkos_MDSpan_Header.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..495b891cca3b8c1f5d4c55f823453d44e41d76d3
--- /dev/null
+++ b/packages/kokkos/core/src/View/MDSpan/Kokkos_MDSpan_Header.hpp
@@ -0,0 +1,34 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
+static_assert(false,
+              "Including non-public Kokkos header files is not allowed.");
+#endif
+
+#ifndef KOKKOS_EXPERIMENTAL_MDSPAN_HPP
+#define KOKKOS_EXPERIMENTAL_MDSPAN_HPP
+
+// Look for the right mdspan
+#if __has_include(<mdspan>)
+#include <mdspan>
+namespace mdspan_ns = std;
+#else
+#include <experimental/mdspan>
+namespace mdspan_ns = std::experimental;
+#endif
+
+#endif  // KOKKOS_EXPERIMENTAL_MDSPAN_HPP
diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_CUDA.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_CUDA.hpp
index aedb8d035cd8945fffad4332fd0bea8874a61b0a..215b18f221980a921f5bfed7c1c60668da4ad13a 100644
--- a/packages/kokkos/core/src/decl/Kokkos_Declare_CUDA.hpp
+++ b/packages/kokkos/core/src/decl/Kokkos_Declare_CUDA.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_DECLARE_CUDA_HPP
 #define KOKKOS_DECLARE_CUDA_HPP
diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_HBWSpace.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_HBWSpace.hpp
index ff5133ed286d3cc845245e878c0b4c8e0a407ecf..1328c93135243c7906643157af5d66b8dc4d1cbb 100644
--- a/packages/kokkos/core/src/decl/Kokkos_Declare_HBWSpace.hpp
+++ b/packages/kokkos/core/src/decl/Kokkos_Declare_HBWSpace.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_DECLARE_HBWSPACE_HPP
 #define KOKKOS_DECLARE_HBWSPACE_HPP
diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_HIP.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_HIP.hpp
index b3bf14dbf2408d68cd76e618f4e5c9346dca21b4..09ea8826004be8bc409e708a626972f25668b39c 100644
--- a/packages/kokkos/core/src/decl/Kokkos_Declare_HIP.hpp
+++ b/packages/kokkos/core/src/decl/Kokkos_Declare_HIP.hpp
@@ -1,52 +1,44 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_DECLARE_HIP_HPP
 #define KOKKOS_DECLARE_HIP_HPP
 
 #if defined(KOKKOS_ENABLE_HIP)
-#include <Kokkos_HIP.hpp>
+#include <HIP/Kokkos_HIP.hpp>
+#include <HIP/Kokkos_HIP_Space.hpp>
+#include <HIP/Kokkos_HIP_DeepCopy.hpp>
+#include <HIP/Kokkos_HIP_Half_Impl_Type.hpp>
+#include <HIP/Kokkos_HIP_Half_Conversion.hpp>
+#include <HIP/Kokkos_HIP_Instance.hpp>
+#include <HIP/Kokkos_HIP_MDRangePolicy.hpp>
+#include <HIP/Kokkos_HIP_Parallel_Range.hpp>
+#include <HIP/Kokkos_HIP_Parallel_MDRange.hpp>
+#include <HIP/Kokkos_HIP_Parallel_Team.hpp>
+#include <HIP/Kokkos_HIP_SharedAllocationRecord.hpp>
+#include <HIP/Kokkos_HIP_UniqueToken.hpp>
+
+namespace Kokkos {
+namespace Experimental {
+using HIPSpace           = ::Kokkos::HIPSpace;
+using HIPHostPinnedSpace = ::Kokkos::HIPHostPinnedSpace;
+using HIPManagedSpace    = ::Kokkos::HIPManagedSpace;
+using HIP                = ::Kokkos::HIP;
+}  // namespace Experimental
+}  // namespace Kokkos
 #endif
 
 #endif
diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_HPX.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_HPX.hpp
index 2cbecc9e76c47d3b1fee87de9c74f3acc1051852..73f94591f528256313d8d57a16bae994ef653b1b 100644
--- a/packages/kokkos/core/src/decl/Kokkos_Declare_HPX.hpp
+++ b/packages/kokkos/core/src/decl/Kokkos_Declare_HPX.hpp
@@ -1,52 +1,25 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_DECLARE_HPX_HPP
 #define KOKKOS_DECLARE_HPX_HPP
 
 #if defined(KOKKOS_ENABLE_HPX)
 #include <Kokkos_HPX.hpp>
+#include <HPX/Kokkos_HPX_MDRangePolicy.hpp>
 #endif
 
 #endif
diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_OPENACC.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_OPENACC.hpp
index 5c09b7a3b65b3a65b9331476fec317108a739827..137286c741b413e6bbe581e6912ad2f3b455b198 100644
--- a/packages/kokkos/core/src/decl/Kokkos_Declare_OPENACC.hpp
+++ b/packages/kokkos/core/src/decl/Kokkos_Declare_OPENACC.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_DECLARE_OPENACC_HPP
 #define KOKKOS_DECLARE_OPENACC_HPP
@@ -48,7 +20,13 @@
 #if defined(KOKKOS_ENABLE_OPENACC)
 #include <OpenACC/Kokkos_OpenACC.hpp>
 #include <OpenACC/Kokkos_OpenACCSpace.hpp>
-#include <OpenACC/Kokkos_OpenACC_Traits.hpp>
+#include <OpenACC/Kokkos_OpenACC_DeepCopy.hpp>
+#include <OpenACC/Kokkos_OpenACC_SharedAllocationRecord.hpp>
+#include <OpenACC/Kokkos_OpenACC_ParallelFor_Range.hpp>
+#include <OpenACC/Kokkos_OpenACC_ParallelReduce_Range.hpp>
+#include <OpenACC/Kokkos_OpenACC_MDRangePolicy.hpp>
+#include <OpenACC/Kokkos_OpenACC_ParallelFor_MDRange.hpp>
+#include <OpenACC/Kokkos_OpenACC_ParallelFor_Team.hpp>
 #endif
 
 #endif
diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_OPENMP.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_OPENMP.hpp
index 069dd5c160bec56a485b667da9c58c548943be42..1e1314145d203154ecf01a09e2e110f87c4673f9 100644
--- a/packages/kokkos/core/src/decl/Kokkos_Declare_OPENMP.hpp
+++ b/packages/kokkos/core/src/decl/Kokkos_Declare_OPENMP.hpp
@@ -1,52 +1,25 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_DECLARE_OPENMP_HPP
 #define KOKKOS_DECLARE_OPENMP_HPP
 
 #if defined(KOKKOS_ENABLE_OPENMP)
 #include <Kokkos_OpenMP.hpp>
+#include <OpenMP/Kokkos_OpenMP_MDRangePolicy.hpp>
 #endif
 
 #endif
diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_OPENMPTARGET.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_OPENMPTARGET.hpp
index b193d1e741bc19d1725994839c682fa84f2267f9..0bd89ef4cf4ba9af2f59a61b622c6f7efa200743 100644
--- a/packages/kokkos/core/src/decl/Kokkos_Declare_OPENMPTARGET.hpp
+++ b/packages/kokkos/core/src/decl/Kokkos_Declare_OPENMPTARGET.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_DECLARE_OPENMPTARGET_HPP
 #define KOKKOS_DECLARE_OPENMPTARGET_HPP
@@ -48,6 +20,7 @@
 #if defined(KOKKOS_ENABLE_OPENMPTARGET)
 #include <Kokkos_OpenMPTarget.hpp>
 #include <Kokkos_OpenMPTargetSpace.hpp>
+#include <OpenMPTarget/Kokkos_OpenMPTarget_MDRangePolicy.hpp>
 #include <OpenMPTarget/Kokkos_OpenMPTarget_UniqueToken.hpp>
 #endif
 
diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_SERIAL.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_SERIAL.hpp
index 45661b5af29949b54dca0126e90bd605e2bea6c6..bb59ae2ce8bea2b9fb9817398b00bb3451039150 100644
--- a/packages/kokkos/core/src/decl/Kokkos_Declare_SERIAL.hpp
+++ b/packages/kokkos/core/src/decl/Kokkos_Declare_SERIAL.hpp
@@ -1,52 +1,25 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_DECLARE_SERIAL_HPP
 #define KOKKOS_DECLARE_SERIAL_HPP
 
 #if defined(KOKKOS_ENABLE_SERIAL)
 #include <Kokkos_Serial.hpp>
+#include <Serial/Kokkos_Serial_MDRangePolicy.hpp>
 #endif
 
 #endif
diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_SYCL.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_SYCL.hpp
index 72a26b27f4e70dfa42a2449252932b255a762ed0..0c8dddbeb3cc19a1eb6ffc1ab8c57b10bcd1870a 100644
--- a/packages/kokkos/core/src/decl/Kokkos_Declare_SYCL.hpp
+++ b/packages/kokkos/core/src/decl/Kokkos_Declare_SYCL.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_DECLARE_SYCL_HPP
 #define KOKKOS_DECLARE_SYCL_HPP
diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_THREADS.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_THREADS.hpp
index adb8f12a9c7b1b97a112f631d3455ef9f20d2b9b..b7af04be3c33da95de03427cf0c1ee60c79c01dd 100644
--- a/packages/kokkos/core/src/decl/Kokkos_Declare_THREADS.hpp
+++ b/packages/kokkos/core/src/decl/Kokkos_Declare_THREADS.hpp
@@ -1,52 +1,25 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_DECLARE_THREADS_HPP
 #define KOKKOS_DECLARE_THREADS_HPP
 
 #if defined(KOKKOS_ENABLE_THREADS)
 #include <Kokkos_Threads.hpp>
+#include <Threads/Kokkos_Threads_MDRangePolicy.hpp>
 #endif
 
 #endif
diff --git a/packages/kokkos/core/src/dummy.cpp b/packages/kokkos/core/src/dummy.cpp
index 4f5f14e7d323e97a5289d271be98667c59b5cf34..929380b6c33b3ea6b581f3d5c137de88293e4bb9 100644
--- a/packages/kokkos/core/src/dummy.cpp
+++ b/packages/kokkos/core/src/dummy.cpp
@@ -1,4 +1,18 @@
-
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
 
 namespace Kokkos {
 namespace AvoidCompilerWarnings {
diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_CUDA.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_CUDA.hpp
index 4bda5e9411f05bfd76495c346f053acf958a84a7..5151a3dc6407e79c17912b511ea5971195f6fd88 100644
--- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_CUDA.hpp
+++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_CUDA.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CUDA_FWD_HPP_
 #define KOKKOS_CUDA_FWD_HPP_
diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_HBWSpace.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_HBWSpace.hpp
index d9dada27a01ddf24eb36dd5b3030ecc2c2e8c41b..21ba7fad01cf0be4e2b1857a15860a8b3e4be74b 100644
--- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_HBWSpace.hpp
+++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_HBWSpace.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HBWSPACE_FWD_HPP_
 #define KOKKOS_HBWSPACE_FWD_HPP_
diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_HIP.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_HIP.hpp
index 27540865a5950ba10096fadfb57b752e6fdef0a0..82cc98be27d349da79781639e6d2c6437007af31 100644
--- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_HIP.hpp
+++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_HIP.hpp
@@ -1,58 +1,28 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HIP_FWD_HPP_
 #define KOKKOS_HIP_FWD_HPP_
 
 #if defined(KOKKOS_ENABLE_HIP)
 namespace Kokkos {
-namespace Experimental {
 class HIPSpace;            ///< Memory space on HIP GPU
 class HIPHostPinnedSpace;  ///< Memory space on Host accessible to HIP GPU
 class HIPManagedSpace;     ///< Memory migratable between Host and HIP GPU
 class HIP;                 ///< Execution space for HIP GPU
-}  // namespace Experimental
 }  // namespace Kokkos
 #endif
 #endif
diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_HPX.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_HPX.hpp
index 8949c527fc62a1cad4cf0cc9de197f8eee57165f..636f74676ed1b78ac60c2f33a171ba0fcf2e3827 100644
--- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_HPX.hpp
+++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_HPX.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HPX_FWD_HPP_
 #define KOKKOS_HPX_FWD_HPP_
diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENACC.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENACC.hpp
index d733f993d023d8247c14bc3a0594068b95b64786..0e81d5b4ef99cc5f65056980e9b776c334b1c83c 100644
--- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENACC.hpp
+++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENACC.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_OPENACC_FWD_HPP_
 #define KOKKOS_OPENACC_FWD_HPP_
diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENMP.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENMP.hpp
index fc2223d3e29dc9f5e227dd3f84c1f5be05572b84..b6058d4751d16d70909dab6c1d33bc2e965a214f 100644
--- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENMP.hpp
+++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENMP.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_OPENMP_FWD_HPP_
 #define KOKKOS_OPENMP_FWD_HPP_
diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENMPTARGET.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENMPTARGET.hpp
index 8d12b8b701482295f53373609608dcb6ac4b038e..2846694899ca5118804b65b6df866635f86259b5 100644
--- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENMPTARGET.hpp
+++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENMPTARGET.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_OPENMPTARGET_FWD_HPP_
 #define KOKKOS_OPENMPTARGET_FWD_HPP_
diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_SERIAL.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_SERIAL.hpp
index 8f253d0a7504102d8c7fbe0d5d4aaec6c3ad6e14..b5d6b3a3f0524ce6bd41c216b6f27b1f080e2c54 100644
--- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_SERIAL.hpp
+++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_SERIAL.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SERIAL_FWD_HPP_
 #define KOKKOS_SERIAL_FWD_HPP_
diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_SYCL.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_SYCL.hpp
index 0ce680cd69efb1de0e9cbebadfda1f739e325630..400794f86591f41946d31f1fed42e64466fe12de 100644
--- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_SYCL.hpp
+++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_SYCL.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SYCL_FWD_HPP_
 #define KOKKOS_SYCL_FWD_HPP_
diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_THREADS.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_THREADS.hpp
index af53777ddea2311f55198a14407238d7bc5c466a..db674affe138a5c7c5af94746f7517210d06fc7b 100644
--- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_THREADS.hpp
+++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_THREADS.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_THREADS_FWD_HPP_
 #define KOKKOS_THREADS_FWD_HPP_
diff --git a/packages/kokkos/core/src/impl/KokkosExp_Host_IterateTile.hpp b/packages/kokkos/core/src/impl/KokkosExp_Host_IterateTile.hpp
index 2b2120ce49b30da1db2c07b9aa6cd8a3ca1be321..e2b606004fece193df834ee95c2b7617aef84281 100644
--- a/packages/kokkos/core/src/impl/KokkosExp_Host_IterateTile.hpp
+++ b/packages/kokkos/core/src/impl/KokkosExp_Host_IterateTile.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HOST_EXP_ITERATE_TILE_HPP
 #define KOKKOS_HOST_EXP_ITERATE_TILE_HPP
@@ -1914,8 +1886,8 @@ struct HostIterateTile<RP, Functor, Tag, ValueType,
     m_func(m_tag, args...);
   }
 
-  RP const& m_rp;
-  Functor const& m_func;
+  RP const m_rp;
+  Functor const m_func;
   std::conditional_t<std::is_void<Tag>::value, int, Tag> m_tag;
 };
 
@@ -1930,12 +1902,10 @@ struct HostIterateTile<RP, Functor, Tag, ValueType,
 
   using value_type = ValueType;
 
-  inline HostIterateTile(RP const& rp, Functor const& func, value_type& v)
+  inline HostIterateTile(RP const& rp, Functor const& func)
       : m_rp(rp)  // Cuda 7.0 does not like braces...
         ,
-        m_func(func),
-        m_v(v)  // use with non-void ValueType struct
-  {
+        m_func(func) {
     // Errors due to braces rather than parenthesis for init (with cuda 7.0)
     //      /home/ndellin/kokkos/core/src/impl/KokkosExp_Host_IterateTile.hpp:1216:98:
     //      error: too many braces around initializer for ‘int’ [-fpermissive]
@@ -1973,7 +1943,7 @@ struct HostIterateTile<RP, Functor, Tag, ValueType,
 
 #if KOKKOS_ENABLE_NEW_LOOP_MACROS
   template <typename IType>
-  inline void operator()(IType tile_idx) const {
+  inline void operator()(IType tile_idx, value_type& val) const {
     point_type m_offset;
     point_type m_tiledims;
 
@@ -1996,7 +1966,7 @@ struct HostIterateTile<RP, Functor, Tag, ValueType,
     const bool full_tile = check_iteration_bounds(m_tiledims, m_offset);
 
     Tile_Loop_Type<RP::rank, (RP::inner_direction == Iterate::Left), index_type,
-                   Tag>::apply(m_v, m_func, full_tile, m_offset, m_rp.m_tile,
+                   Tag>::apply(val, m_func, full_tile, m_offset, m_rp.m_tile,
                                m_tiledims);
   }
 
@@ -2315,7 +2285,6 @@ struct HostIterateTile<RP, Functor, Tag, ValueType,
     }  // end Iterate::Right
 
   }  // end op() rank == 8
-#endif
 
   template <typename... Args>
   std::enable_if_t<(sizeof...(Args) == RP::rank && std::is_void<Tag>::value),
@@ -2330,10 +2299,10 @@ struct HostIterateTile<RP, Functor, Tag, ValueType,
   apply(Args&&... args) const {
     m_func(m_tag, args..., m_v);
   }
+#endif
 
-  RP const& m_rp;
-  Functor const& m_func;
-  value_type& m_v;
+  RP const m_rp;
+  Functor const m_func;
   std::conditional_t<std::is_void<Tag>::value, int, Tag> m_tag;
 };
 
@@ -2352,15 +2321,10 @@ struct HostIterateTile<RP, Functor, Tag, ValueType,
                                         // 'array-ness' [], only
                                         // underlying type remains
 
-  inline HostIterateTile(
-      RP const& rp, Functor const& func,
-      value_type* v)  // v should be an array; treat as pointer for
-                      // compatibility since size is not known nor needed here
-      : m_rp(rp)      // Cuda 7.0 does not like braces...
+  inline HostIterateTile(RP const& rp, Functor const& func)
+      : m_rp(rp)  // Cuda 7.0 does not like braces...
         ,
-        m_func(func),
-        m_v(v)  // use with non-void ValueType struct
-  {}
+        m_func(func) {}
 
   inline bool check_iteration_bounds(point_type& partial_tile,
                                      point_type& offset) const {
@@ -2392,7 +2356,7 @@ struct HostIterateTile<RP, Functor, Tag, ValueType,
 
 #if KOKKOS_ENABLE_NEW_LOOP_MACROS
   template <typename IType>
-  inline void operator()(IType tile_idx) const {
+  inline void operator()(IType tile_idx, value_type* val) const {
     point_type m_offset;
     point_type m_tiledims;
 
@@ -2415,7 +2379,7 @@ struct HostIterateTile<RP, Functor, Tag, ValueType,
     const bool full_tile = check_iteration_bounds(m_tiledims, m_offset);
 
     Tile_Loop_Type<RP::rank, (RP::inner_direction == Iterate::Left), index_type,
-                   Tag>::apply(m_v, m_func, full_tile, m_offset, m_rp.m_tile,
+                   Tag>::apply(val, m_func, full_tile, m_offset, m_rp.m_tile,
                                m_tiledims);
   }
 
@@ -2734,8 +2698,6 @@ struct HostIterateTile<RP, Functor, Tag, ValueType,
     }  // end Iterate::Right
 
   }  // end op() rank == 8
-#endif
-
   template <typename... Args>
   std::enable_if_t<(sizeof...(Args) == RP::rank && std::is_void<Tag>::value),
                    void>
@@ -2749,10 +2711,10 @@ struct HostIterateTile<RP, Functor, Tag, ValueType,
   apply(Args&&... args) const {
     m_func(m_tag, args..., m_v);
   }
+#endif
 
-  RP const& m_rp;
-  Functor const& m_func;
-  value_type* m_v;
+  RP const m_rp;
+  Functor const m_func;
   std::conditional_t<std::is_void<Tag>::value, int, Tag> m_tag;
 };
 
diff --git a/packages/kokkos/core/src/impl/KokkosExp_IterateTileGPU.hpp b/packages/kokkos/core/src/impl/KokkosExp_IterateTileGPU.hpp
index 957c3b638c5e23cc08b6efdd8a16afe415e366a3..e1273ab9e3bd65804072ada103b556a29228053b 100644
--- a/packages/kokkos/core/src/impl/KokkosExp_IterateTileGPU.hpp
+++ b/packages/kokkos/core/src/impl/KokkosExp_IterateTileGPU.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_EXP_ITERATE_TILE_GPU_HPP
 #define KOKKOS_EXP_ITERATE_TILE_GPU_HPP
diff --git a/packages/kokkos/core/src/impl/KokkosExp_ViewMapping.hpp b/packages/kokkos/core/src/impl/KokkosExp_ViewMapping.hpp
index a41ffb1e8a0572b4b1a06be8c27bfab0126c9500..81e9d5e6aa589a6dfc3b883c173203eb64a50bf3 100644
--- a/packages/kokkos/core/src/impl/KokkosExp_ViewMapping.hpp
+++ b/packages/kokkos/core/src/impl/KokkosExp_ViewMapping.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // Deprecated file for backward compatibility
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_AnalyzePolicy.hpp b/packages/kokkos/core/src/impl/Kokkos_AnalyzePolicy.hpp
index 2ffcd626d673420f62989d59f6be397961a8be16..d77ec0c7537fd465c9029c89705e64d913f35168 100644
--- a/packages/kokkos/core/src/impl/Kokkos_AnalyzePolicy.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_AnalyzePolicy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_ANALYZE_POLICY_HPP
 #define KOKKOS_IMPL_ANALYZE_POLICY_HPP
@@ -206,28 +178,14 @@ struct ExecPolicyTraitsWithDefaults : AnalysisResults {
 
 //------------------------------------------------------------------------------
 
-constexpr bool warn_if_deprecated(std::false_type) { return true; }
-KOKKOS_DEPRECATED_WITH_COMMENT(
-    "Invalid WorkTag template argument in execution policy!!")
-constexpr bool warn_if_deprecated(std::true_type) { return true; }
-#define KOKKOS_IMPL_STATIC_WARNING(...) \
-  static_assert(                        \
-      warn_if_deprecated(std::integral_constant<bool, __VA_ARGS__>()), "")
-
 template <typename... Traits>
 struct PolicyTraits
     : ExecPolicyTraitsWithDefaults<AnalyzeExecPolicy<void, Traits...>> {
   using base_t =
       ExecPolicyTraitsWithDefaults<AnalyzeExecPolicy<void, Traits...>>;
   using base_t::base_t;
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-  KOKKOS_IMPL_STATIC_WARNING(!std::is_empty<typename base_t::work_tag>::value &&
-                             !std::is_void<typename base_t::work_tag>::value);
-#endif
 };
 
-#undef KOKKOS_IMPL_STATIC_WARNING
-
 }  // namespace Impl
 }  // namespace Kokkos
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Assembly.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Assembly.hpp
index a31dd1cf49365bd1b05d0f188637e398417a0dd7..59d70e7f7c8523d67a4ec97bd41b25b6a7fc5ec0 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Assembly.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Assembly.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Macros.hpp>
 #if defined(KOKKOS_ATOMIC_HPP) && !defined(KOKKOS_ATOMIC_ASSEMBLY_HPP)
diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Compare_Exchange_Strong.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Compare_Exchange_Strong.hpp
index e203c0a2bd1e85797fd41928860b3e1f40ba2024..08091ab9ce4c56da255e153fac714e3962026d0f 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Compare_Exchange_Strong.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Compare_Exchange_Strong.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #if defined(KOKKOS_ENABLE_RFO_PREFETCH)
 #include <xmmintrin.h>
@@ -315,9 +287,9 @@ KOKKOS_INLINE_FUNCTION T atomic_compare_exchange(volatile T* const dest_v,
 // dummy for non-CUDA Kokkos headers being processed by NVCC
 #if defined(__CUDA_ARCH__) && !defined(KOKKOS_ENABLE_CUDA)
 template <typename T>
-__inline__ __device__ T
-atomic_compare_exchange(volatile T* const, const Kokkos::Impl::identity_t<T>,
-                        const Kokkos::Impl::identity_t<T>) {
+__inline__ __device__ T atomic_compare_exchange(
+    volatile T* const, const Kokkos::Impl::type_identity_t<T>,
+    const Kokkos::Impl::type_identity_t<T>) {
   return T();
 }
 #endif
diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Compare_Exchange_Weak.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Compare_Exchange_Weak.hpp
index ad5b010558d94d753bc880ce09195366c794b193..884927783602b6cf427164b4635ff7a53db045f2 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Compare_Exchange_Weak.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Compare_Exchange_Weak.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #if defined(KOKKOS_ENABLE_RFO_PREFETCH)
 #include <xmmintrin.h>
diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Decrement.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Decrement.hpp
index 47961b5c717fcd88c2b6a66266a42a6df256a00b..aac5233b3a579662bfe0b2ff2fad75521bc747dd 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Decrement.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Decrement.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #if defined(KOKKOS_ENABLE_RFO_PREFETCH)
 #include <xmmintrin.h>
diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Exchange.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Exchange.hpp
index a8f77d8353fad6f6cff5d290c893c35705c86f27..abfc1f631a5a428f83c61fa332bd169fc52a7201 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Exchange.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Exchange.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #if defined(KOKKOS_ENABLE_RFO_PREFETCH)
 #include <xmmintrin.h>
@@ -389,14 +361,14 @@ inline void atomic_assign(volatile T* const dest_v, const T val) {
 // dummy for non-CUDA Kokkos headers being processed by NVCC
 #if defined(__CUDA_ARCH__) && !defined(KOKKOS_ENABLE_CUDA)
 template <typename T>
-__inline__ __device__ T atomic_exchange(volatile T* const,
-                                        const Kokkos::Impl::identity_t<T>) {
+__inline__ __device__ T
+atomic_exchange(volatile T* const, const Kokkos::Impl::type_identity_t<T>) {
   return T();
 }
 
 template <typename T>
-__inline__ __device__ void atomic_assign(volatile T* const,
-                                         const Kokkos::Impl::identity_t<T>) {}
+__inline__ __device__ void atomic_assign(
+    volatile T* const, const Kokkos::Impl::type_identity_t<T>) {}
 #endif
 
 }  // namespace Kokkos
diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Add.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Add.hpp
index c188f45427be2d189392264e37daac83c6620eac..a8c421fbdbd84e169eb9046f5593573b5de4a189 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Add.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Add.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #if defined(KOKKOS_ENABLE_RFO_PREFETCH)
 #include <xmmintrin.h>
@@ -171,8 +143,7 @@ __inline__ __device__ T atomic_fetch_add(
 #if !defined(__CUDA_ARCH__) || defined(KOKKOS_IMPL_CUDA_CLANG_WORKAROUND)
 #if defined(KOKKOS_ENABLE_GNU_ATOMICS) || defined(KOKKOS_ENABLE_INTEL_ATOMICS)
 
-#if defined(KOKKOS_ENABLE_ASM) && (defined(KOKKOS_ENABLE_ISA_X86_64) || \
-                                   defined(KOKKOS_KNL_USE_ASM_WORKAROUND))
+#if defined(KOKKOS_ENABLE_ASM) && defined(KOKKOS_ENABLE_ISA_X86_64)
 inline int atomic_fetch_add(volatile int* dest, const int val) {
 #if defined(KOKKOS_ENABLE_RFO_PREFETCH)
   _mm_prefetch((const char*)dest, _MM_HINT_ET0);
@@ -380,7 +351,7 @@ T atomic_fetch_add(volatile T* const dest_v, std::add_const_t<T> val) {
 #if defined(__CUDA_ARCH__) && !defined(KOKKOS_ENABLE_CUDA)
 template <typename T>
 __inline__ __device__ T atomic_fetch_add(volatile T* const,
-                                         Kokkos::Impl::identity_t<T>) {
+                                         Kokkos::Impl::type_identity_t<T>) {
   return T();
 }
 #endif
diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_And.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_And.hpp
index 50bd2b0fa146cd68c5ec655efef01b506cdef41d..25049db8f0b87ae33b94a9570f6f2e96f3d64982 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_And.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_And.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #if defined(KOKKOS_ENABLE_RFO_PREFETCH)
 #include <xmmintrin.h>
@@ -176,7 +148,7 @@ T atomic_fetch_and(volatile T* const dest_v, const T val) {
 #if defined(__CUDA_ARCH__) && !defined(KOKKOS_ENABLE_CUDA)
 template <typename T>
 __inline__ __device__ T atomic_fetch_and(volatile T* const,
-                                         Kokkos::Impl::identity_t<T>) {
+                                         Kokkos::Impl::type_identity_t<T>) {
   return T();
 }
 #endif
diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Or.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Or.hpp
index 7a04a8c7cab1889608c958fd2b0102f776ad17d8..fa581bc1552fc75b3ade87071a92755e70b3c95f 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Or.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Or.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #if defined(KOKKOS_ENABLE_RFO_PREFETCH)
 #include <xmmintrin.h>
@@ -177,7 +149,7 @@ T atomic_fetch_or(volatile T* const dest_v, const T val) {
 #if defined(__CUDA_ARCH__) && !defined(KOKKOS_ENABLE_CUDA)
 template <typename T>
 __inline__ __device__ T atomic_fetch_or(volatile T* const,
-                                        Kokkos::Impl::identity_t<T>) {
+                                        Kokkos::Impl::type_identity_t<T>) {
   return T();
 }
 #endif
diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Sub.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Sub.hpp
index 6aaf36970c3d914e2ab87a7c3bd8b640492dc529..a4db7d7cf45fc5bf7a30dd1ac286007453554b1f 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Sub.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Sub.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #if defined(KOKKOS_ENABLE_RFO_PREFETCH)
 #include <xmmintrin.h>
@@ -312,7 +284,7 @@ T atomic_fetch_sub(volatile T* const dest_v, const T val) {
 #if defined(__CUDA_ARCH__) && !defined(KOKKOS_ENABLE_CUDA)
 template <typename T>
 __inline__ __device__ T atomic_fetch_sub(volatile T* const,
-                                         Kokkos::Impl::identity_t<T>) {
+                                         Kokkos::Impl::type_identity_t<T>) {
   return T();
 }
 #endif
diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Generic.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Generic.hpp
index aac0d12c8173061970c192a3eff41e348059202a..69d101fb8ea09706a3494fa974558a92a89d40c3 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Generic.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Generic.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Macros.hpp>
 #if defined(KOKKOS_ATOMIC_HPP) && !defined(KOKKOS_ATOMIC_GENERIC_HPP)
diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Generic_Secondary.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Generic_Secondary.hpp
index 7ab6358434e1c0129672fcf04a7d5eba83e61e87..af43bf66795b88369465c89e16f460df33a92030 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Generic_Secondary.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Generic_Secondary.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #if defined(KOKKOS_ATOMIC_HPP) && !defined(KOKKOS_ATOMIC_GENERIC_SECONDARY_HPP)
 #define KOKKOS_ATOMIC_GENERIC_SECONDARY_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Increment.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Increment.hpp
index 65630aa84cdf9845afca761d56e68c6ffe3ef269..b40e7dfecb2693c3bf434326395e2882721cb841 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Increment.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Increment.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #if defined(KOKKOS_ENABLE_RFO_PREFETCH)
 #include <xmmintrin.h>
diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Load.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Load.hpp
index f4437326dddceab23a47525fc3ae8c89af199f66..fc4a04b501362a23f741cccd2726b99249dc7e49 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Load.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Load.hpp
@@ -1,45 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//              Copyright (2019) Sandia Corporation
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_KOKKOS_ATOMIC_LOAD_HPP
 #define KOKKOS_IMPL_KOKKOS_ATOMIC_LOAD_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Memory_Order.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Memory_Order.hpp
index 72a6dfa9a466e0161b4b98ec8069f99187c748a2..d8c68212676a3e536f348b6c4214a89e37a9e7fe 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Memory_Order.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Memory_Order.hpp
@@ -1,45 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//              Copyright (2019) Sandia Corporation
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_ATOMIC_MEMORY_ORDER_HPP
 #define KOKKOS_KOKKOS_ATOMIC_MEMORY_ORDER_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_MinMax.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_MinMax.hpp
index 7338a5c545f25f58662c2e05c4a20bda4992e203..42898c82a4631a5efb564ef95c41ea0ad5b6f2f2 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_MinMax.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_MinMax.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Macros.hpp>
 #if defined(KOKKOS_ATOMIC_HPP) && !defined(KOKKOS_ATOMIC_MINMAX_HPP)
diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Store.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Store.hpp
index ffe018b4d6120212d8c03c1b6d05106e3e6011a3..3c82e0e3dd0f84d126cf3912054434913ad52f1e 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Store.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Store.hpp
@@ -1,45 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//              Copyright (2019) Sandia Corporation
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_KOKKOS_ATOMIC_STORE_HPP
 #define KOKKOS_IMPL_KOKKOS_ATOMIC_STORE_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_View.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_View.hpp
index f763f8c7916e4875e6c1b2a6c3733c89c532f6bb..45d01c9f9f33bc90dd1e42dab4c8207970023586 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_View.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_View.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 #ifndef KOKKOS_ATOMIC_VIEW_HPP
 #define KOKKOS_ATOMIC_VIEW_HPP
 
@@ -60,19 +32,14 @@ class AtomicDataElement {
   using value_type           = typename ViewTraits::value_type;
   using const_value_type     = typename ViewTraits::const_value_type;
   using non_const_value_type = typename ViewTraits::non_const_value_type;
-  volatile value_type* const ptr;
+  value_type* const ptr;
 
   KOKKOS_INLINE_FUNCTION
   AtomicDataElement(value_type* ptr_, AtomicViewConstTag) : ptr(ptr_) {}
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator=(const_value_type& val) const {
-    *ptr = val;
-    return val;
-  }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator=(volatile const_value_type& val) const {
-    *ptr = val;
+    Kokkos::Impl::atomic_store(ptr, val, Kokkos::Impl::memory_order_relaxed);
     return val;
   }
 
@@ -111,129 +78,67 @@ class AtomicDataElement {
     const_value_type tmp = Kokkos::atomic_fetch_add(ptr, val);
     return tmp + val;
   }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator+=(volatile const_value_type& val) const {
-    const_value_type tmp = Kokkos::atomic_fetch_add(ptr, val);
-    return tmp + val;
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator-=(const_value_type& val) const {
     const_value_type tmp = Kokkos::atomic_fetch_sub(ptr, val);
     return tmp - val;
   }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator-=(volatile const_value_type& val) const {
-    const_value_type tmp = Kokkos::atomic_fetch_sub(ptr, val);
-    return tmp - val;
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator*=(const_value_type& val) const {
     return Kokkos::atomic_mul_fetch(ptr, val);
   }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator*=(volatile const_value_type& val) const {
-    return Kokkos::atomic_mul_fetch(ptr, val);
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator/=(const_value_type& val) const {
     return Kokkos::atomic_div_fetch(ptr, val);
   }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator/=(volatile const_value_type& val) const {
-    return Kokkos::atomic_div_fetch(ptr, val);
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator%=(const_value_type& val) const {
     return Kokkos::atomic_mod_fetch(ptr, val);
   }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator%=(volatile const_value_type& val) const {
-    return Kokkos::atomic_mod_fetch(ptr, val);
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator&=(const_value_type& val) const {
     return Kokkos::atomic_and_fetch(ptr, val);
   }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator&=(volatile const_value_type& val) const {
-    return Kokkos::atomic_and_fetch(ptr, val);
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator^=(const_value_type& val) const {
     return Kokkos::atomic_xor_fetch(ptr, val);
   }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator^=(volatile const_value_type& val) const {
-    return Kokkos::atomic_xor_fetch(ptr, val);
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator|=(const_value_type& val) const {
     return Kokkos::atomic_or_fetch(ptr, val);
   }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator|=(volatile const_value_type& val) const {
-    return Kokkos::atomic_or_fetch(ptr, val);
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator<<=(const_value_type& val) const {
     return Kokkos::atomic_lshift_fetch(ptr, val);
   }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator<<=(volatile const_value_type& val) const {
-    return Kokkos::atomic_lshift_fetch(ptr, val);
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator>>=(const_value_type& val) const {
     return Kokkos::atomic_rshift_fetch(ptr, val);
   }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator>>=(volatile const_value_type& val) const {
-    return Kokkos::atomic_rshift_fetch(ptr, val);
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator+(const_value_type& val) const { return *ptr + val; }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator+(volatile const_value_type& val) const {
-    return *ptr + val;
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator-(const_value_type& val) const { return *ptr - val; }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator-(volatile const_value_type& val) const {
-    return *ptr - val;
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator*(const_value_type& val) const { return *ptr * val; }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator*(volatile const_value_type& val) const {
-    return *ptr * val;
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator/(const_value_type& val) const { return *ptr / val; }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator/(volatile const_value_type& val) const {
-    return *ptr / val;
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator%(const_value_type& val) const { return *ptr ^ val; }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator%(volatile const_value_type& val) const {
-    return *ptr ^ val;
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator!() const { return !*ptr; }
@@ -242,40 +147,20 @@ class AtomicDataElement {
   const_value_type operator&&(const_value_type& val) const {
     return *ptr && val;
   }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator&&(volatile const_value_type& val) const {
-    return *ptr && val;
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator||(const_value_type& val) const {
     return *ptr | val;
   }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator||(volatile const_value_type& val) const {
-    return *ptr | val;
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator&(const_value_type& val) const { return *ptr & val; }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator&(volatile const_value_type& val) const {
-    return *ptr & val;
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator|(const_value_type& val) const { return *ptr | val; }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator|(volatile const_value_type& val) const {
-    return *ptr | val;
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator^(const_value_type& val) const { return *ptr ^ val; }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator^(volatile const_value_type& val) const {
-    return *ptr ^ val;
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator~() const { return ~*ptr; }
@@ -284,63 +169,33 @@ class AtomicDataElement {
   const_value_type operator<<(const unsigned int& val) const {
     return *ptr << val;
   }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator<<(volatile const unsigned int& val) const {
-    return *ptr << val;
-  }
 
   KOKKOS_INLINE_FUNCTION
   const_value_type operator>>(const unsigned int& val) const {
     return *ptr >> val;
   }
-  KOKKOS_INLINE_FUNCTION
-  const_value_type operator>>(volatile const unsigned int& val) const {
-    return *ptr >> val;
-  }
 
   KOKKOS_INLINE_FUNCTION
   bool operator==(const AtomicDataElement& val) const { return *ptr == val; }
-  KOKKOS_INLINE_FUNCTION
-  bool operator==(volatile const AtomicDataElement& val) const {
-    return *ptr == val;
-  }
 
   KOKKOS_INLINE_FUNCTION
   bool operator!=(const AtomicDataElement& val) const { return *ptr != val; }
-  KOKKOS_INLINE_FUNCTION
-  bool operator!=(volatile const AtomicDataElement& val) const {
-    return *ptr != val;
-  }
 
   KOKKOS_INLINE_FUNCTION
   bool operator>=(const_value_type& val) const { return *ptr >= val; }
-  KOKKOS_INLINE_FUNCTION
-  bool operator>=(volatile const_value_type& val) const { return *ptr >= val; }
 
   KOKKOS_INLINE_FUNCTION
   bool operator<=(const_value_type& val) const { return *ptr <= val; }
-  KOKKOS_INLINE_FUNCTION
-  bool operator<=(volatile const_value_type& val) const { return *ptr <= val; }
 
   KOKKOS_INLINE_FUNCTION
   bool operator<(const_value_type& val) const { return *ptr < val; }
-  KOKKOS_INLINE_FUNCTION
-  bool operator<(volatile const_value_type& val) const { return *ptr < val; }
 
   KOKKOS_INLINE_FUNCTION
   bool operator>(const_value_type& val) const { return *ptr > val; }
-  KOKKOS_INLINE_FUNCTION
-  bool operator>(volatile const_value_type& val) const { return *ptr > val; }
-
-  KOKKOS_INLINE_FUNCTION
-  operator const_value_type() const {
-    // return Kokkos::atomic_load(ptr);
-    return *ptr;
-  }
 
   KOKKOS_INLINE_FUNCTION
-  operator non_const_value_type() volatile const {
-    return Kokkos::Impl::atomic_load(ptr);
+  operator value_type() const {
+    return Kokkos::Impl::atomic_load(ptr, Kokkos::Impl::memory_order_relaxed);
   }
 };
 
@@ -365,19 +220,6 @@ class AtomicViewDataHandle {
   operator typename ViewTraits::value_type*() const { return ptr; }
 };
 
-template <unsigned Size>
-struct Kokkos_Atomic_is_only_allowed_with_32bit_and_64bit_scalars;
-
-template <>
-struct Kokkos_Atomic_is_only_allowed_with_32bit_and_64bit_scalars<4> {
-  using type = int;
-};
-
-template <>
-struct Kokkos_Atomic_is_only_allowed_with_32bit_and_64bit_scalars<8> {
-  using type = int64_t;
-};
-
 }  // namespace Impl
 }  // namespace Kokkos
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Windows.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Windows.hpp
index c5207b51e9fadc631566551c1eaf451a0a1ad081..ffb0d2bae27ecfb0f595addf8cbd9592c1ecc396 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Windows.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Windows.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 #ifndef KOKKOS_ATOMIC_WINDOWS_HPP
 #define KOKKOS_ATOMIC_WINDOWS_HPP
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_BitOps.hpp b/packages/kokkos/core/src/impl/Kokkos_BitOps.hpp
index a41d19aafa303823cf543a048c28c821c05ffdcd..16a28f2419faa4f0d40ef1c9809ea3b4d53f1333 100644
--- a/packages/kokkos/core/src/impl/Kokkos_BitOps.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_BitOps.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_BITOPS_HPP
 #define KOKKOS_BITOPS_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_CPUDiscovery.cpp b/packages/kokkos/core/src/impl/Kokkos_CPUDiscovery.cpp
index a8fc928d10d4e44e6ba4e29695777d7a3f5b7bdb..85ffaaf9698df1279e27ccbdd0d2934350fed4dd 100644
--- a/packages/kokkos/core/src/impl/Kokkos_CPUDiscovery.cpp
+++ b/packages/kokkos/core/src/impl/Kokkos_CPUDiscovery.cpp
@@ -1,124 +1,56 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
 #endif
 
-#ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#elif defined(__APPLE__)
-#include <sys/types.h>
-#include <sys/sysctl.h>
-#else
-#include <unistd.h>
-#endif
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <cerrno>
-#include <string>
+#include <impl/Kokkos_CPUDiscovery.hpp>
 
-namespace Kokkos {
-namespace Impl {
+#include <cstdlib>  // getenv
+#include <string>
 
-int processors_per_node() {
-#ifdef _SC_NPROCESSORS_ONLN
-  int const num_procs     = sysconf(_SC_NPROCESSORS_ONLN);
-  int const num_procs_max = sysconf(_SC_NPROCESSORS_CONF);
-  if ((num_procs < 1) || (num_procs_max < 1)) {
-    return -1;
+int Kokkos::Impl::mpi_ranks_per_node() {
+  for (char const* env_var : {
+           "OMPI_COMM_WORLD_LOCAL_SIZE",  // OpenMPI
+           "MV2_COMM_WORLD_LOCAL_SIZE",   // MVAPICH2
+           "MPI_LOCALNRANKS",             // MPICH
+                                          // SLURM???
+           "PMI_LOCAL_SIZE",              // PMI
+       }) {
+    char const* str = std::getenv(env_var);
+    if (str) {
+      return std::stoi(str);
+    }
   }
-  return num_procs;
-#elif defined(__APPLE__)
-  int ncpu;
-  int activecpu;
-  size_t size = sizeof(int);
-  sysctlbyname("hw.ncpu", &ncpu, &size, nullptr, 0);
-  sysctlbyname("hw.activecpu", &activecpu, &size, nullptr, 0);
-  if (ncpu < 1 || activecpu < 1)
-    return -1;
-  else
-    return activecpu;
-#else
   return -1;
-#endif
-}
-
-int mpi_ranks_per_node() {
-  char *str;
-  int ppn = 1;
-  // if ((str = getenv("SLURM_TASKS_PER_NODE"))) {
-  //  ppn = std::stoi(str);
-  //  if(ppn<=0) ppn = 1;
-  //}
-  if ((str = getenv("MV2_COMM_WORLD_LOCAL_SIZE"))) {
-    ppn = std::stoi(str);
-    if (ppn <= 0) ppn = 1;
-  }
-  if ((str = getenv("OMPI_COMM_WORLD_LOCAL_SIZE"))) {
-    ppn = std::stoi(str);
-    if (ppn <= 0) ppn = 1;
-  }
-  return ppn;
 }
 
-int mpi_local_rank_on_node() {
-  char *str;
-  int local_rank = 0;
-  // if ((str = getenv("SLURM_LOCALID"))) {
-  //  local_rank = std::stoi(str);
-  //}
-  if ((str = getenv("MV2_COMM_WORLD_LOCAL_RANK"))) {
-    local_rank = std::stoi(str);
-  }
-  if ((str = getenv("OMPI_COMM_WORLD_LOCAL_RANK"))) {
-    local_rank = std::stoi(str);
+int Kokkos::Impl::mpi_local_rank_on_node() {
+  for (char const* env_var : {
+           "OMPI_COMM_WORLD_LOCAL_RANK",  // OpenMPI
+           "MV2_COMM_WORLD_LOCAL_RANK",   // MVAPICH2
+           "MPI_LOCALRANKID",             // MPICH
+           "SLURM_LOCALID",               // SLURM
+           "PMI_LOCAL_RANK",              // PMI
+       }) {
+    char const* str = std::getenv(env_var);
+    if (str) {
+      return std::stoi(str);
+    }
   }
-  return local_rank;
+  return -1;
 }
-
-}  // namespace Impl
-}  // namespace Kokkos
diff --git a/packages/kokkos/core/src/impl/Kokkos_CPUDiscovery.hpp b/packages/kokkos/core/src/impl/Kokkos_CPUDiscovery.hpp
index 6ba14c85b1c8d6bbaf2e8afc97780df1cace4b32..27b8cd3a7c17baaad6951279ca77ba5fedb26c57 100644
--- a/packages/kokkos/core/src/impl/Kokkos_CPUDiscovery.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_CPUDiscovery.hpp
@@ -1,50 +1,21 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 namespace Kokkos {
 namespace Impl {
 
-int processors_per_node();
 int mpi_ranks_per_node();
 int mpi_local_rank_on_node();
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_ChaseLev.hpp b/packages/kokkos/core/src/impl/Kokkos_ChaseLev.hpp
index 1a372d8c954a604a27e30a04930824cfec5a7afc..855654408e28fdaea7ae46d8701624cd760aac78 100644
--- a/packages/kokkos/core/src/impl/Kokkos_ChaseLev.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_ChaseLev.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // Experimental unified task-data parallel manycore LDRD
 
@@ -58,7 +30,7 @@
 #include <impl/Kokkos_LinkedListNode.hpp>  // KOKKOS_EXPECTS
 
 #include <Kokkos_Atomic.hpp>  // atomic_compare_exchange, atomic_fence
-#include "Kokkos_LIFO.hpp"
+#include <impl/Kokkos_LIFO.hpp>
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
diff --git a/packages/kokkos/core/src/impl/Kokkos_ClockTic.hpp b/packages/kokkos/core/src/impl/Kokkos_ClockTic.hpp
index ecece72cf958c937702dd18b4a22642e479c857c..9e8c70076c6d192349f6aab09e4ad35877c3e9d1 100644
--- a/packages/kokkos/core/src/impl/Kokkos_ClockTic.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_ClockTic.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CLOCKTIC_HPP
 #define KOKKOS_CLOCKTIC_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_Combined_Reducer.hpp b/packages/kokkos/core/src/impl/Kokkos_Combined_Reducer.hpp
index 21a202994fbcdad4fe4d20d89776795ee7cd81e2..d7304779c77c76fa623da9601d2048cb9079365b 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Combined_Reducer.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Combined_Reducer.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_COMBINED_REDUCER_HPP
 #define KOKKOS_COMBINED_REDUCER_HPP
@@ -51,7 +23,6 @@
 #include <Kokkos_Parallel_Reduce.hpp>
 #include <Kokkos_ExecPolicy.hpp>
 #include <Kokkos_AnonymousSpace.hpp>
-#include <impl/Kokkos_Utilities.hpp>  // comma operator fold emulation
 
 #include <utility>
 
@@ -152,15 +123,11 @@ struct CombinedReducerStorageImpl {
   // model Reducer
 
   KOKKOS_INLINE_FUNCTION
-  constexpr _fold_comma_emulation_return _init(value_type& val) const {
-    m_reducer.init(val);
-    return _fold_comma_emulation_return{};
-  }
+  constexpr void _init(value_type& val) const { m_reducer.init(val); }
 
-  KOKKOS_INLINE_FUNCTION constexpr _fold_comma_emulation_return _join(
-      value_type& dest, value_type const& src) const {
+  KOKKOS_INLINE_FUNCTION constexpr void _join(value_type& dest,
+                                              value_type const& src) const {
     m_reducer.join(dest, src);
-    return _fold_comma_emulation_return{};
   }
 };
 
@@ -231,16 +198,16 @@ struct CombinedReducerImpl<std::integer_sequence<size_t, Idxs...>, Space,
 
   KOKKOS_FUNCTION constexpr void join(value_type& dest,
                                       value_type const& src) const noexcept {
-    emulate_fold_comma_operator(
-        this->CombinedReducerStorageImpl<Idxs, Reducers>::_join(
-            dest.template get<Idxs, typename Reducers::value_type>(),
-            src.template get<Idxs, typename Reducers::value_type>())...);
+    (this->CombinedReducerStorageImpl<Idxs, Reducers>::_join(
+         dest.template get<Idxs, typename Reducers::value_type>(),
+         src.template get<Idxs, typename Reducers::value_type>()),
+     ...);
   }
 
   KOKKOS_FUNCTION constexpr void init(value_type& dest) const noexcept {
-    emulate_fold_comma_operator(
-        this->CombinedReducerStorageImpl<Idxs, Reducers>::_init(
-            dest.template get<Idxs, typename Reducers::value_type>())...);
+    (this->CombinedReducerStorageImpl<Idxs, Reducers>::_init(
+         dest.template get<Idxs, typename Reducers::value_type>()),
+     ...);
   }
 
   // TODO figure out if we also need to call through to final
@@ -274,11 +241,11 @@ struct CombinedReducerImpl<std::integer_sequence<size_t, Idxs...>, Space,
   static void write_value_back_to_original_references(
       const ExecutionSpace& exec_space, value_type const& value,
       Reducers const&... reducers_that_reference_original_values) noexcept {
-    emulate_fold_comma_operator(
-        (write_one_value_back<ExecutionSpace, Idxs>(
-             exec_space, reducers_that_reference_original_values.view(),
-             value.template get<Idxs, typename Reducers::value_type>()),
-         0)...);
+    (write_one_value_back<ExecutionSpace, Idxs>(
+         exec_space, reducers_that_reference_original_values.view(),
+         value.template get<Idxs, typename Reducers::value_type>()),
+
+     ...);
   }
 };
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_Command_Line_Parsing.cpp b/packages/kokkos/core/src/impl/Kokkos_Command_Line_Parsing.cpp
index ca56352f4e8fd45228185115a23f3cad7cbcaeee..a12de7a01cbad606db469cfbee566e15798f6fb0 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Command_Line_Parsing.cpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Command_Line_Parsing.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
diff --git a/packages/kokkos/core/src/impl/Kokkos_Command_Line_Parsing.hpp b/packages/kokkos/core/src/impl/Kokkos_Command_Line_Parsing.hpp
index b22bc3e342812abf546dd68960f5333791779dbb..95f4050d08a7047f91809eaf93e75259262ef491 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Command_Line_Parsing.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Command_Line_Parsing.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_COMMAND_LINE_PARSING_HPP
 #define KOKKOS_COMMAND_LINE_PARSING_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_ConcurrentBitset.hpp b/packages/kokkos/core/src/impl/Kokkos_ConcurrentBitset.hpp
index dafe57f8da71cd22ea09a4e93a84f3196b24ca5c..ca4edce5c3884ac89e24c578767d4a15f231ccf1 100644
--- a/packages/kokkos/core/src/impl/Kokkos_ConcurrentBitset.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_ConcurrentBitset.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CONCURRENTBITSET_HPP
 #define KOKKOS_CONCURRENTBITSET_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_Core.cpp b/packages/kokkos/core/src/impl/Kokkos_Core.cpp
index a5bd0032374ffc5e0e73627e33aeb3fa7c1b788e..a35510dd64ec7e08e88e751bc2d87ae2702c5b01 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Core.cpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Core.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -52,6 +24,7 @@
 #include <impl/Kokkos_ParseCommandLineArgumentsAndEnvironmentVariables.hpp>
 #include <impl/Kokkos_DeviceManagement.hpp>
 #include <impl/Kokkos_ExecSpaceManager.hpp>
+#include <impl/Kokkos_CPUDiscovery.hpp>
 
 #include <algorithm>
 #include <cctype>
@@ -160,7 +133,7 @@ int get_device_count() {
 #if defined(KOKKOS_ENABLE_CUDA)
   return Kokkos::Cuda::detect_device_count();
 #elif defined(KOKKOS_ENABLE_HIP)
-  return Kokkos::Experimental::HIP::detect_device_count();
+  return Kokkos::HIP::detect_device_count();
 #elif defined(KOKKOS_ENABLE_SYCL)
   return sycl::device::get_devices(sycl::info::device_type::gpu).size();
 #elif defined(KOKKOS_ENABLE_OPENACC)
@@ -231,7 +204,7 @@ void Kokkos::Impl::ExecSpaceManager::print_configuration(std::ostream& os,
   }
 }
 
-int Kokkos::Impl::get_ctest_gpu(const char* local_rank_str) {
+int Kokkos::Impl::get_ctest_gpu(int local_rank) {
   auto const* ctest_kokkos_device_type =
       std::getenv("CTEST_KOKKOS_DEVICE_TYPE");
   if (!ctest_kokkos_device_type) {
@@ -246,7 +219,7 @@ int Kokkos::Impl::get_ctest_gpu(const char* local_rank_str) {
 
   // Make sure rank is within bounds of resource groups specified by CTest
   auto resource_group_count = std::stoi(ctest_resource_group_count_str);
-  auto local_rank           = std::stoi(local_rank_str);
+  assert(local_rank >= 0);
   if (local_rank >= resource_group_count) {
     std::ostringstream ss;
     ss << "Error: local rank " << local_rank
@@ -428,20 +401,10 @@ int Kokkos::Impl::get_gpu(const InitializationSettings& settings) {
     Kokkos::abort("implementation bug");
   }
 
-  char const* local_rank_str = nullptr;
-  for (char const* env_var : {
-           "OMPI_COMM_WORLD_LOCAL_RANK",  // OpenMPI
-           "MV2_COMM_WORLD_LOCAL_RANK",   // MVAPICH2
-           "MPI_LOCALRANKID",             // MPICH
-           "SLURM_LOCALID",               // SLURM
-           "PMI_LOCAL_RANK"               // PMI
-       }) {
-    local_rank_str = std::getenv(env_var);
-    if (local_rank_str) break;
-  }
+  int const mpi_local_rank = mpi_local_rank_on_node();
 
   // use first GPU available for execution if unable to detect local MPI rank
-  if (!local_rank_str) {
+  if (mpi_local_rank < 0) {
     if (settings.has_map_device_id_by()) {
       std::cerr << "Warning: unable to detect local MPI rank."
                 << " Falling back to the first GPU available for execution."
@@ -453,10 +416,10 @@ int Kokkos::Impl::get_gpu(const InitializationSettings& settings) {
   // use device assigned by CTest when resource allocation is activated
   if (std::getenv("CTEST_KOKKOS_DEVICE_TYPE") &&
       std::getenv("CTEST_RESOURCE_GROUP_COUNT")) {
-    return get_ctest_gpu(local_rank_str);
+    return get_ctest_gpu(mpi_local_rank);
   }
 
-  return visible_devices[std::stoi(local_rank_str) % visible_devices.size()];
+  return visible_devices[mpi_local_rank % visible_devices.size()];
 }
 
 namespace {
@@ -532,11 +495,6 @@ void pre_initialize_internal(const Kokkos::InitializationSettings& settings) {
                                  std::to_string(KOKKOS_COMPILER_GNU));
   declare_configuration_metadata("tools_only", "compiler_family", "gnu");
 #endif
-#ifdef KOKKOS_COMPILER_IBM
-  declare_configuration_metadata("compiler_version", "KOKKOS_COMPILER_IBM",
-                                 std::to_string(KOKKOS_COMPILER_IBM));
-  declare_configuration_metadata("tools_only", "compiler_family", "ibm");
-#endif
 #ifdef KOKKOS_COMPILER_INTEL
   declare_configuration_metadata("compiler_version", "KOKKOS_COMPILER_INTEL",
                                  std::to_string(KOKKOS_COMPILER_INTEL));
@@ -592,13 +550,6 @@ void pre_initialize_internal(const Kokkos::InitializationSettings& settings) {
   declare_configuration_metadata("vectorization",
                                  "KOKKOS_ENABLE_PRAGMA_LOOPCOUNT", "no");
 #endif
-#ifdef KOKKOS_ENABLE_PRAGMA_SIMD
-  declare_configuration_metadata("vectorization", "KOKKOS_ENABLE_PRAGMA_SIMD",
-                                 "yes");
-#else
-  declare_configuration_metadata("vectorization", "KOKKOS_ENABLE_PRAGMA_SIMD",
-                                 "no");
-#endif
 #ifdef KOKKOS_ENABLE_PRAGMA_UNROLL
   declare_configuration_metadata("vectorization", "KOKKOS_ENABLE_PRAGMA_UNROLL",
                                  "yes");
@@ -632,11 +583,6 @@ void pre_initialize_internal(const Kokkos::InitializationSettings& settings) {
 #else
   declare_configuration_metadata("options", "KOKKOS_ENABLE_ASM", "no");
 #endif
-#ifdef KOKKOS_ENABLE_CXX14
-  declare_configuration_metadata("options", "KOKKOS_ENABLE_CXX14", "yes");
-#else
-  declare_configuration_metadata("options", "KOKKOS_ENABLE_CXX14", "no");
-#endif
 #ifdef KOKKOS_ENABLE_CXX17
   declare_configuration_metadata("options", "KOKKOS_ENABLE_CXX17", "yes");
 #else
@@ -647,6 +593,11 @@ void pre_initialize_internal(const Kokkos::InitializationSettings& settings) {
 #else
   declare_configuration_metadata("options", "KOKKOS_ENABLE_CXX20", "no");
 #endif
+#ifdef KOKKOS_ENABLE_CXX23
+  declare_configuration_metadata("options", "KOKKOS_ENABLE_CXX23", "yes");
+#else
+  declare_configuration_metadata("options", "KOKKOS_ENABLE_CXX23", "no");
+#endif
 #ifdef KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK
   declare_configuration_metadata("options", "KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK",
                                  "yes");
@@ -671,6 +622,150 @@ void pre_initialize_internal(const Kokkos::InitializationSettings& settings) {
 #endif
   declare_configuration_metadata("architecture", "Default Device",
                                  typeid(Kokkos::DefaultExecutionSpace).name());
+
+#if defined(KOKKOS_ARCH_A64FX)
+  declare_configuration_metadata("architecture", "CPU architecture", "A64FX");
+#elif defined(KOKKOS_ARCH_AMDAVX)
+  declare_configuration_metadata("architecture", "CPU architecture", "AMDAVX");
+#elif defined(KOKKOS_ARCH_ARMV80)
+  declare_configuration_metadata("architecture", "CPU architecture", "ARMV80");
+#elif defined(KOKKOS_ARCH_ARMV81)
+  declare_configuration_metadata("architecture", "CPU architecture", "ARMV81");
+#elif defined(KOKKOS_ARCH_ARMV8_THUNDERX)
+  declare_configuration_metadata("architecture", "CPU architecture",
+                                 "ARMV8_THUNDERX");
+#elif defined(KOKKOS_ARCH_ARMV8_THUNDERX2)
+  declare_configuration_metadata("architecture", "CPU architecture",
+                                 "ARMV8_THUNDERX2");
+#elif defined(KOKKOS_ARCH_BDW)
+  declare_configuration_metadata("architecture", "CPU architecture", "BDW");
+#elif defined(KOKKOS_ARCH_BGQ)
+  declare_configuration_metadata("architecture", "CPU architecture", "BGQ");
+#elif defined(KOKKOS_ARCH_HSW)
+  declare_configuration_metadata("architecture", "CPU architecture", "HSW");
+#elif defined(KOKKOS_ARCH_ICL)
+  declare_configuration_metadata("architecture", "CPU architecture", "ICL");
+#elif defined(KOKKOS_ARCH_ICX)
+  declare_configuration_metadata("architecture", "CPU architecture", "ICX");
+#elif defined(KOKKOS_ARCH_KNC)
+  declare_configuration_metadata("architecture", "CPU architecture", "KNC");
+#elif defined(KOKKOS_ARCH_KNL)
+  declare_configuration_metadata("architecture", "CPU architecture", "KNL");
+#elif defined(KOKKOS_ARCH_NATIVE)
+  declare_configuration_metadata("architecture", "CPU architecture", "NATIVE");
+#elif defined(KOKKOS_ARCH_POWER7)
+  declare_configuration_metadata("architecture", "CPU architecture", "POWER7");
+#elif defined(KOKKOS_ARCH_POWER8)
+  declare_configuration_metadata("architecture", "CPU architecture", "POWER8");
+#elif defined(KOKKOS_ARCH_POWER9)
+  declare_configuration_metadata("architecture", "CPU architecture", "POWER9");
+#elif defined(KOKKOS_ARCH_SKL)
+  declare_configuration_metadata("architecture", "CPU architecture", "SKL");
+#elif defined(KOKKOS_ARCH_SKX)
+  declare_configuration_metadata("architecture", "CPU architecture", "SKX");
+#elif defined(KOKKOS_ARCH_SNB)
+  declare_configuration_metadata("architecture", "CPU architecture", "SNB");
+#elif defined(KOKKOS_ARCH_SPR)
+  declare_configuration_metadata("architecture", "CPU architecture", "SPR");
+#elif defined(KOKKOS_ARCH_WSM)
+  declare_configuration_metadata("architecture", "CPU architecture", "WSM");
+#elif defined(KOKKOS_ARCH_AMD_ZEN)
+  declare_configuration_metadata("architecture", "CPU architecture", "AMD_ZEN");
+#elif defined(KOKKOS_ARCH_AMD_ZEN2)
+  declare_configuration_metadata("architecture", "CPU architecture",
+                                 "AMD_ZEN2");
+#elif defined(KOKKOS_ARCH_AMD_ZEN3)
+  declare_configuration_metadata("architecture", "CPU architecture",
+                                 "AMD_ZEN3");
+#else
+  declare_configuration_metadata("architecture", "CPU architecture", "none");
+#endif
+
+#if defined(KOKKOS_ARCH_INTEL_GEN)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "INTEL_GEN");
+#elif defined(KOKKOS_ARCH_INTEL_DG1)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "INTEL_DG1");
+#elif defined(KOKKOS_ARCH_INTEL_GEN9)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "INTEL_GEN9");
+#elif defined(KOKKOS_ARCH_INTEL_GEN11)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "INTEL_GEN11");
+#elif defined(KOKKOS_ARCH_INTEL_GEN12LP)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "INTEL_GEN12LP");
+#elif defined(KOKKOS_ARCH_INTEL_XEHP)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "INTEL_XEHP");
+#elif defined(KOKKOS_ARCH_INTEL_PVC)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "INTEL_PVC");
+
+#elif defined(KOKKOS_ARCH_KEPLER30)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "KEPLER30");
+#elif defined(KOKKOS_ARCH_KEPLER32)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "KEPLER32");
+#elif defined(KOKKOS_ARCH_KEPLER35)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "KEPLER35");
+#elif defined(KOKKOS_ARCH_KEPLER37)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "KELPER37");
+#elif defined(KOKKOS_ARCH_MAXWELL50)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "MAXWELL50");
+#elif defined(KOKKOS_ARCH_MAXWELL52)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "MAXWELL52");
+#elif defined(KOKKOS_ARCH_MAXWELL53)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "MAXWELL53");
+#elif defined(KOKKOS_ARCH_PASCAL60)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "PASCAL60");
+#elif defined(KOKKOS_ARCH_PASCAL61)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "PASCAL61");
+#elif defined(KOKKOS_ARCH_VOLTA70)
+  declare_configuration_metadata("architecture", "GPU architecture", "VOLTA70");
+#elif defined(KOKKOS_ARCH_VOLTA72)
+  declare_configuration_metadata("architecture", "GPU architecture", "VOLTA72");
+#elif defined(KOKKOS_ARCH_TURING75)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "TURING75");
+#elif defined(KOKKOS_ARCH_AMPERE80)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "AMPERE80");
+#elif defined(KOKKOS_ARCH_AMPERE86)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "AMPERE86");
+#elif defined(KOKKOS_ARCH_ADA89)
+  declare_configuration_metadata("architecture", "GPU architecture", "ADA89");
+#elif defined(KOKKOS_ARCH_HOPPER90)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "HOPPER90");
+#elif defined(KOKKOS_ARCH_VEGA900)
+  declare_configuration_metadata("architecture", "GPU architecture", "VEGA900");
+#elif defined(KOKKOS_ARCH_VEGA906)
+  declare_configuration_metadata("architecture", "GPU architecture", "VEGA906");
+#elif defined(KOKKOS_ARCH_VEGA908)
+  declare_configuration_metadata("architecture", "GPU architecture", "VEGA908");
+#elif defined(KOKKOS_ARCH_VEGA90A)
+  declare_configuration_metadata("architecture", "GPU architecture", "VEGA90A");
+#elif defined(KOKKOS_ARCH_NAVI1030)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "NAVI1030");
+#elif defined(KOKKOS_ARCH_NAVI1100)
+  declare_configuration_metadata("architecture", "GPU architecture",
+                                 "NAVI1100");
+
+#else
+  declare_configuration_metadata("architecture", "GPU architecture", "none");
+#endif
 }
 
 void post_initialize_internal(const Kokkos::InitializationSettings& settings) {
@@ -690,7 +785,7 @@ void initialize_internal(const Kokkos::InitializationSettings& settings) {
   post_initialize_internal(settings);
 }
 
-void finalize_internal() {
+void pre_finalize_internal() {
   typename decltype(finalize_hooks)::size_type numSuccessfulCalls = 0;
   while (!finalize_hooks.empty()) {
     auto f = finalize_hooks.top();
@@ -719,9 +814,9 @@ void finalize_internal() {
   }
 
   Kokkos::Profiling::finalize();
+}
 
-  Kokkos::Impl::ExecSpaceManager::get_instance().finalize_spaces();
-
+void post_finalize_internal() {
   g_is_initialized = false;
   g_is_finalized   = true;
   g_show_warnings  = true;
@@ -1070,8 +1165,19 @@ void Kokkos::Impl::parse_environment_variables(
 }
 
 //----------------------------------------------------------------------------
+namespace {
+bool kokkos_initialize_was_called() {
+  return Kokkos::is_initialized() || Kokkos::is_finalized();
+}
+bool kokkos_finalize_was_called() { return Kokkos::is_finalized(); }
+}  // namespace
 
 void Kokkos::initialize(int& argc, char* argv[]) {
+  if (kokkos_initialize_was_called()) {
+    Kokkos::abort(
+        "Error: Kokkos::initialize() has already been called."
+        " Kokkos can be initialized at most once.\n");
+  }
   InitializationSettings settings;
   Impl::parse_environment_variables(settings);
   Impl::parse_command_line_arguments(argc, argv, settings);
@@ -1079,6 +1185,11 @@ void Kokkos::initialize(int& argc, char* argv[]) {
 }
 
 void Kokkos::initialize(InitializationSettings const& settings) {
+  if (kokkos_initialize_was_called()) {
+    Kokkos::abort(
+        "Error: Kokkos::initialize() has already been called."
+        " Kokkos can be initialized at most once.\n");
+  }
   InitializationSettings tmp;
   Impl::parse_environment_variables(tmp);
   combine(tmp, settings);
@@ -1093,15 +1204,27 @@ void Kokkos::Impl::post_initialize(const InitializationSettings& settings) {
   post_initialize_internal(settings);
 }
 
+void Kokkos::Impl::pre_finalize() { pre_finalize_internal(); }
+
+void Kokkos::Impl::post_finalize() { post_finalize_internal(); }
+
 void Kokkos::push_finalize_hook(std::function<void()> f) {
   finalize_hooks.push(f);
 }
 
-void Kokkos::finalize() { finalize_internal(); }
-
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-KOKKOS_DEPRECATED void Kokkos::finalize_all() { finalize_internal(); }
-#endif
+void Kokkos::finalize() {
+  if (!kokkos_initialize_was_called()) {
+    Kokkos::abort(
+        "Error: Kokkos::finalize() may only be called after Kokkos has been "
+        "initialized.\n");
+  }
+  if (kokkos_finalize_was_called()) {
+    Kokkos::abort("Error: Kokkos::finalize() has already been called.\n");
+  }
+  pre_finalize_internal();
+  Impl::ExecSpaceManager::get_instance().finalize_spaces();
+  post_finalize_internal();
+}
 
 #ifdef KOKKOS_COMPILER_INTEL
 void Kokkos::fence() { fence("Kokkos::fence: Unnamed Global Fence"); }
@@ -1112,7 +1235,7 @@ namespace {
 void print_helper(std::ostream& os,
                   const std::map<std::string, std::string>& print_me) {
   for (const auto& kv : print_me) {
-    os << kv.first << ": " << kv.second << '\n';
+    os << "  " << kv.first << ": " << kv.second << '\n';
   }
 }
 }  // namespace
@@ -1141,13 +1264,11 @@ void Kokkos::print_configuration(std::ostream& os, bool verbose) {
   Impl::ExecSpaceManager::get_instance().print_configuration(os, verbose);
 }
 
-KOKKOS_ATTRIBUTE_NODISCARD bool Kokkos::is_initialized() noexcept {
+[[nodiscard]] bool Kokkos::is_initialized() noexcept {
   return g_is_initialized;
 }
 
-KOKKOS_ATTRIBUTE_NODISCARD bool Kokkos::is_finalized() noexcept {
-  return g_is_finalized;
-}
+[[nodiscard]] bool Kokkos::is_finalized() noexcept { return g_is_finalized; }
 
 bool Kokkos::show_warnings() noexcept { return g_show_warnings; }
 
@@ -1164,7 +1285,3 @@ void _kokkos_pgi_compiler_bug_workaround() {}
 }  // end namespace Impl
 #endif
 }  // namespace Kokkos
-
-Kokkos::Impl::InitializationSettingsHelper<std::string>::storage_type const
-    Kokkos::Impl::InitializationSettingsHelper<std::string>::unspecified =
-        "some string we don't expect user would ever provide";
diff --git a/packages/kokkos/core/src/impl/Kokkos_Default_GraphNodeKernel.hpp b/packages/kokkos/core/src/impl/Kokkos_Default_GraphNodeKernel.hpp
index 1edcca8f5e45dd2de4724fff42f9d1d7be4d57af..c71c21d2ac988d923710ada399ddbd8c0384570a 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Default_GraphNodeKernel.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Default_GraphNodeKernel.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_HOST_GRAPHNODEKERNEL_HPP
 #define KOKKOS_KOKKOS_HOST_GRAPHNODEKERNEL_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_Default_GraphNode_Impl.hpp b/packages/kokkos/core/src/impl/Kokkos_Default_GraphNode_Impl.hpp
index 37041534718984b98e42f767a5bbde58f0490277..223ae391ab40f1b4347a4a7613d41fddd9ad69f0 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Default_GraphNode_Impl.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Default_GraphNode_Impl.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_HOST_GRAPHNODE_IMPL_HPP
 #define KOKKOS_KOKKOS_HOST_GRAPHNODE_IMPL_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_Default_Graph_Impl.hpp b/packages/kokkos/core/src/impl/Kokkos_Default_Graph_Impl.hpp
index e4667ca0121849511a44f1ca49fe0ca9646b24d9..d65b448f1f71a7335458e505252e3dd589a86fb1 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Default_Graph_Impl.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Default_Graph_Impl.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HOST_GRAPH_IMPL_HPP
 #define KOKKOS_HOST_GRAPH_IMPL_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_Default_Graph_fwd.hpp b/packages/kokkos/core/src/impl/Kokkos_Default_Graph_fwd.hpp
index cdbed72888288ffb71a3bf8ee4e3e837c3c90219..e028d944c1da9d9ba03ea221ee23157c7d89ba1f 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Default_Graph_fwd.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Default_Graph_fwd.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_HOST_GRAPH_FWD_HPP
 #define KOKKOS_KOKKOS_HOST_GRAPH_FWD_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_DeviceManagement.hpp b/packages/kokkos/core/src/impl/Kokkos_DeviceManagement.hpp
index 34421f0fe58447c47af872cb259ddab3d0f79413..bd89c8b19ca9d323d12d9139c885dfefa92e0bc1 100644
--- a/packages/kokkos/core/src/impl/Kokkos_DeviceManagement.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_DeviceManagement.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_DEVICE_MANAGEMENT_HPP
 #define KOKKOS_DEVICE_MANAGEMENT_HPP
@@ -52,7 +24,7 @@ class InitializationSettings;
 namespace Impl {
 int get_gpu(const Kokkos::InitializationSettings& settings);
 // This declaration is provided for testing purposes only
-int get_ctest_gpu(const char* local_rank_str);
+int get_ctest_gpu(int local_rank);
 // ditto
 std::vector<int> get_visible_devices(
     Kokkos::InitializationSettings const& settings, int device_count);
diff --git a/packages/kokkos/core/src/impl/Kokkos_EBO.hpp b/packages/kokkos/core/src/impl/Kokkos_EBO.hpp
index 87d6c044a57756a9bb49d1b930f364c116c9dfb9..8ba94ba4ccc46bd2f8fd93cce0347cdf8ab4b067 100644
--- a/packages/kokkos/core/src/impl/Kokkos_EBO.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_EBO.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_EBO_HPP
 #define KOKKOS_EBO_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_Error.cpp b/packages/kokkos/core/src/impl/Kokkos_Error.cpp
index 750228331578bab658f14106d80b9cb9e231409a..efd0fb998e1ac854a7eb483375cfd69aa57a915a 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Error.cpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Error.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
diff --git a/packages/kokkos/core/src/impl/Kokkos_Error.hpp b/packages/kokkos/core/src/impl/Kokkos_Error.hpp
index 63b40f297e08bc7b61214c14e6024e53b33e9832..e2054d4ce076e766c9b6acaee45b86afa9d8517e 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Error.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Error.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_ERROR_HPP
 #define KOKKOS_IMPL_ERROR_HPP
@@ -58,10 +30,6 @@
 #include <SYCL/Kokkos_SYCL_Abort.hpp>
 #endif
 
-#ifndef KOKKOS_ABORT_MESSAGE_BUFFER_SIZE
-#define KOKKOS_ABORT_MESSAGE_BUFFER_SIZE 2048
-#endif  // ifndef KOKKOS_ABORT_MESSAGE_BUFFER_SIZE
-
 namespace Kokkos {
 namespace Impl {
 
@@ -69,8 +37,7 @@ namespace Impl {
 
 #if defined(KOKKOS_ENABLE_CUDA) && defined(__CUDA_ARCH__)
 
-#if defined(__APPLE__) || defined(KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK)
-// cuda_abort does not abort when building for macOS.
+#if defined(KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK)
 // required to workaround failures in random number generator unit tests with
 // pre-volta architectures
 #define KOKKOS_IMPL_ABORT_NORETURN
@@ -89,7 +56,7 @@ namespace Impl {
 #elif defined(KOKKOS_ENABLE_SYCL) && defined(__SYCL_DEVICE_ONLY__)
 // FIXME_SYCL SYCL doesn't abort
 #define KOKKOS_IMPL_ABORT_NORETURN
-#elif !defined(KOKKOS_ENABLE_OPENMPTARGET)
+#elif !defined(KOKKOS_ENABLE_OPENMPTARGET) && !defined(KOKKOS_ENABLE_OPENACC)
 // Host aborts
 #define KOKKOS_IMPL_ABORT_NORETURN [[noreturn]]
 #else
@@ -97,14 +64,18 @@ namespace Impl {
 #define KOKKOS_IMPL_ABORT_NORETURN
 #endif
 
-#ifdef KOKKOS_ENABLE_SYCL  // FIXME_SYCL
+// FIXME_SYCL
+// Accomodate host pass for device functions that are not [[noreturn]]
+#if defined(KOKKOS_ENABLE_SYCL) || \
+    (defined(KOKKOS_ENABLE_CUDA) && defined(KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK))
 #define KOKKOS_IMPL_ABORT_NORETURN_DEVICE
 #else
 #define KOKKOS_IMPL_ABORT_NORETURN_DEVICE KOKKOS_IMPL_ABORT_NORETURN
 #endif
 
-#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \
-    defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENMPTARGET)
+#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) ||          \
+    defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENMPTARGET) || \
+    defined(KOKKOS_ENABLE_OPENACC)
 KOKKOS_IMPL_ABORT_NORETURN_DEVICE inline KOKKOS_IMPL_DEVICE_FUNCTION void
 device_abort(const char *const msg) {
 #if defined(KOKKOS_ENABLE_CUDA)
@@ -113,8 +84,8 @@ device_abort(const char *const msg) {
   ::Kokkos::Impl::hip_abort(msg);
 #elif defined(KOKKOS_ENABLE_SYCL)
   ::Kokkos::Impl::sycl_abort(msg);
-#elif defined(KOKKOS_ENABLE_OPENMPTARGET)
-  printf("%s", msg);  // FIXME_OPENMPTARGET
+#elif defined(KOKKOS_ENABLE_OPENMPTARGET) || defined(KOKKOS_ENABLE_OPENACC)
+  printf("%s", msg);  // FIXME_OPENMPTARGET FIXME_OPENACC
 #else
 #error faulty logic
 #endif
@@ -186,8 +157,7 @@ class RawMemoryAllocationFailure : public std::bad_alloc {
 
   ~RawMemoryAllocationFailure() noexcept override = default;
 
-  KOKKOS_ATTRIBUTE_NODISCARD
-  const char *what() const noexcept override {
+  [[nodiscard]] const char *what() const noexcept override {
     if (m_failure_mode == FailureMode::OutOfMemoryError) {
       return "Memory allocation error: out of memory";
     } else if (m_failure_mode == FailureMode::AllocationNotAligned) {
@@ -197,23 +167,24 @@ class RawMemoryAllocationFailure : public std::bad_alloc {
     return nullptr;  // unreachable
   }
 
-  KOKKOS_ATTRIBUTE_NODISCARD
-  size_t attempted_size() const noexcept { return m_attempted_size; }
+  [[nodiscard]] size_t attempted_size() const noexcept {
+    return m_attempted_size;
+  }
 
-  KOKKOS_ATTRIBUTE_NODISCARD
-  size_t attempted_alignment() const noexcept { return m_attempted_alignment; }
+  [[nodiscard]] size_t attempted_alignment() const noexcept {
+    return m_attempted_alignment;
+  }
 
-  KOKKOS_ATTRIBUTE_NODISCARD
-  AllocationMechanism allocation_mechanism() const noexcept {
+  [[nodiscard]] AllocationMechanism allocation_mechanism() const noexcept {
     return m_mechanism;
   }
 
-  KOKKOS_ATTRIBUTE_NODISCARD
-  FailureMode failure_mode() const noexcept { return m_failure_mode; }
+  [[nodiscard]] FailureMode failure_mode() const noexcept {
+    return m_failure_mode;
+  }
 
   void print_error_message(std::ostream &o) const;
-  KOKKOS_ATTRIBUTE_NODISCARD
-  std::string get_error_message() const;
+  [[nodiscard]] std::string get_error_message() const;
 
   virtual void append_additional_error_information(std::ostream &) const {}
 };
diff --git a/packages/kokkos/core/src/impl/Kokkos_ExecPolicy.cpp b/packages/kokkos/core/src/impl/Kokkos_ExecPolicy.cpp
index 75b89c73a9cb03b36e955fff45e46719caa7b4a1..04c5e0bd22a29abeea7b6b835e74d5d3c80992e0 100644
--- a/packages/kokkos/core/src/impl/Kokkos_ExecPolicy.cpp
+++ b/packages/kokkos/core/src/impl/Kokkos_ExecPolicy.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
diff --git a/packages/kokkos/core/src/impl/Kokkos_ExecSpaceManager.hpp b/packages/kokkos/core/src/impl/Kokkos_ExecSpaceManager.hpp
index 354bdde9bf7696e621226260f2dfd279dea566fd..f0edc8ac47d3716b8db70316289cee5f2a4415b7 100644
--- a/packages/kokkos/core/src/impl/Kokkos_ExecSpaceManager.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_ExecSpaceManager.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_EXEC_SPACE_MANAGER_HPP
 #define KOKKOS_EXEC_SPACE_MANAGER_HPP
@@ -52,55 +24,90 @@
 #include <iosfwd>
 #include <map>
 #include <string>
+#include <utility>
 
 namespace {
 
 template <class T>
 using public_member_types_t = std::enable_if_t<
-    Kokkos::is_execution_space<typename T::execution_space>::value &&
-    Kokkos::is_memory_space<typename T::memory_space>::value &&
-    Kokkos::is_device<typename T::device_type>::value &&
-    Kokkos::is_array_layout<typename T::array_layout>::value &&
-    std::is_integral<typename T::size_type>::value &&
-    Kokkos::is_memory_space<typename T::scratch_memory_space>::value>;
+    Kokkos::is_execution_space_v<typename T::execution_space> &&
+    Kokkos::is_memory_space_v<typename T::memory_space> &&
+    Kokkos::is_device_v<typename T::device_type> &&
+    Kokkos::is_array_layout_v<typename T::array_layout> &&
+    std::is_integral_v<typename T::size_type> &&
+    Kokkos::is_memory_space_v<typename T::scratch_memory_space>>;
 
 template <class T>
 using print_configuration_t = std::enable_if_t<
-    std::is_void<decltype(std::declval<T const&>().print_configuration(
-        std::declval<std::ostream&>()))>::value &&
-    std::is_void<decltype(std::declval<T const&>().print_configuration(
-        std::declval<std::ostream&>(), false))>::value>;
+    std::is_void_v<decltype(std::declval<T const&>().print_configuration(
+        std::declval<std::ostream&>()))> &&
+    std::is_void_v<decltype(std::declval<T const&>().print_configuration(
+        std::declval<std::ostream&>(), false))>>;
 
 template <class T>
 using initialize_finalize_t = std::enable_if_t<
-    std::is_void<decltype(T::impl_initialize(
-        std::declval<Kokkos::InitializationSettings const&>()))>::value &&
-    std::is_void<decltype(T::impl_finalize())>::value>;
+    std::is_void_v<decltype(T::impl_initialize(
+        std::declval<Kokkos::InitializationSettings const&>()))> &&
+    std::is_void_v<decltype(T::impl_finalize())>>;
 
 template <class T>
 using fence_t = std::enable_if_t<
-    std::is_void<decltype(std::declval<T const&>().fence())>::value &&
-    std::is_void<decltype(std::declval<T const&>().fence("name"))>::value &&
-    std::is_void<decltype(T::impl_static_fence("name"))>::value>;
+    std::is_void_v<decltype(std::declval<T const&>().fence())> &&
+    std::is_void_v<decltype(std::declval<T const&>().fence("name"))> &&
+    std::is_void_v<decltype(T::impl_static_fence("name"))>>;
+
+template <class T>
+using concurrency_t = std::enable_if_t<
+    std::is_same_v<int, decltype(std::declval<T const&>().concurrency())>>;
+
+template <class T>
+constexpr bool check_is_semiregular() {
+  static_assert(std::is_default_constructible_v<T>);
+  static_assert(std::is_copy_constructible_v<T>);
+  static_assert(std::is_move_constructible_v<T>);
+  static_assert(std::is_copy_assignable_v<T>);
+  static_assert(std::is_move_assignable_v<T>);
+  static_assert(std::is_destructible_v<T>);
+  return true;
+}
 
-#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, "")  // FIXME C++17
+template <class T>
+using equal_to_t =
+    decltype(std::declval<T const&>() == std::declval<T const&>());
+
+template <class T>
+using not_equal_to_t =
+    decltype(std::declval<T const&>() != std::declval<T const&>());
+
+template <class T>
+constexpr bool check_is_equality_comparable() {
+  using Kokkos::is_detected_exact_v;
+  static_assert(is_detected_exact_v<bool, equal_to_t, T>);
+  static_assert(is_detected_exact_v<bool, not_equal_to_t, T>);
+  return true;
+}
+
+template <class T>
+constexpr bool check_is_regular() {
+  static_assert(check_is_semiregular<T>() && check_is_equality_comparable<T>());
+  return true;
+}
 
 template <class ExecutionSpace>
 constexpr bool check_valid_execution_space() {
-  using Kokkos::is_detected;
-  STATIC_ASSERT(std::is_default_constructible<ExecutionSpace>::value);
-  STATIC_ASSERT(is_detected<public_member_types_t, ExecutionSpace>::value);
-  STATIC_ASSERT(is_detected<print_configuration_t, ExecutionSpace>::value);
-  STATIC_ASSERT(is_detected<initialize_finalize_t, ExecutionSpace>::value);
-  STATIC_ASSERT(is_detected<fence_t, ExecutionSpace>::value);
+  using Kokkos::is_detected_v;
+  static_assert(std::is_default_constructible_v<ExecutionSpace>);
+  static_assert(is_detected_v<public_member_types_t, ExecutionSpace>);
+  static_assert(is_detected_v<print_configuration_t, ExecutionSpace>);
+  static_assert(is_detected_v<initialize_finalize_t, ExecutionSpace>);
+  static_assert(is_detected_v<fence_t, ExecutionSpace>);
+  static_assert(is_detected_v<concurrency_t, ExecutionSpace>);
 #ifndef KOKKOS_ENABLE_HPX  // FIXME_HPX
-  STATIC_ASSERT(sizeof(ExecutionSpace) <= 2 * sizeof(void*));
+  static_assert(sizeof(ExecutionSpace) <= 2 * sizeof(void*));
 #endif
   return true;
 }
 
-#undef STATIC_ASSERT
-
 }  // namespace
 
 namespace Kokkos {
@@ -116,7 +123,8 @@ struct ExecSpaceBase {
 
 template <class ExecutionSpace>
 struct ExecSpaceDerived : ExecSpaceBase {
-  static_assert(check_valid_execution_space<ExecutionSpace>(), "");
+  static_assert(check_valid_execution_space<ExecutionSpace>());
+  static_assert(check_is_regular<ExecutionSpace>());
   void initialize(InitializationSettings const& settings) final {
     ExecutionSpace::impl_initialize(settings);
   }
diff --git a/packages/kokkos/core/src/impl/Kokkos_FixedBufferMemoryPool.hpp b/packages/kokkos/core/src/impl/Kokkos_FixedBufferMemoryPool.hpp
index 3068ef3db0389d48149d2d9ce28efac3112f1c27..4726a87b97cb2bc79ccbd267cf67927fab315cd4 100644
--- a/packages/kokkos/core/src/impl/Kokkos_FixedBufferMemoryPool.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_FixedBufferMemoryPool.hpp
@@ -1,45 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//              Copyright (2019) Sandia Corporation
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_KOKKOS_FIXEDBUFFERMEMORYPOOL_HPP
 #define KOKKOS_IMPL_KOKKOS_FIXEDBUFFERMEMORYPOOL_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_FunctorAnalysis.hpp b/packages/kokkos/core/src/impl/Kokkos_FunctorAnalysis.hpp
index 6569e49014fa2410a66e0025f0e0b6a2d4ffaad6..5ef017a004fb920e2033738fe65b8a72d5eeedcf 100644
--- a/packages/kokkos/core/src/impl/Kokkos_FunctorAnalysis.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_FunctorAnalysis.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_FUNCTORANALYSIS_HPP
 #define KOKKOS_FUNCTORANALYSIS_HPP
@@ -655,6 +627,11 @@ struct FunctorAnalysis {
                         detected_volatile_join_no_tag<F>::value)>>
       : public has_volatile_join_no_tag_function<F> {
     enum : bool { value = true };
+#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
+    static_assert(Impl::dependent_false_v<F>,
+                  "Reducer with a join() operator taking "
+                  "volatile-qualified parameters is no longer supported");
+#endif
   };
 
   template <class F = Functor, typename = void>
@@ -673,6 +650,11 @@ struct FunctorAnalysis {
                                          detected_volatile_join_tag<F>::value)>>
       : public has_volatile_join_tag_function<F> {
     enum : bool { value = true };
+#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
+    static_assert(Impl::dependent_false_v<F>,
+                  "Reducer with a join() operator taking "
+                  "volatile-qualified parameters is no longer supported");
+#endif
   };
 
   //----------------------------------------
diff --git a/packages/kokkos/core/src/impl/Kokkos_GraphImpl.hpp b/packages/kokkos/core/src/impl/Kokkos_GraphImpl.hpp
index 9bf9e29d0fdee715aad9eb7a8db4e22db99140a7..56f95c814d88480b3037e2bd77454562388a9872 100644
--- a/packages/kokkos/core/src/impl/Kokkos_GraphImpl.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_GraphImpl.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_KOKKOS_GRAPHIMPL_HPP
 #define KOKKOS_IMPL_KOKKOS_GRAPHIMPL_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_GraphImpl_Utilities.hpp b/packages/kokkos/core/src/impl/Kokkos_GraphImpl_Utilities.hpp
index 109d37a05db2c0b2b52e7361ed3e1e7ab5008c10..2ab05cb8e439f0124670c54001f27658e0a123de 100644
--- a/packages/kokkos/core/src/impl/Kokkos_GraphImpl_Utilities.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_GraphImpl_Utilities.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_GRAPHIMPL_UTILITIES_HPP
 #define KOKKOS_KOKKOS_GRAPHIMPL_UTILITIES_HPP
@@ -85,10 +57,9 @@ struct is_compatible_type_erasure<
     std::enable_if_t<!std::is_same<TSrc, TDst>::value ||
                      !std::is_same<USrc, UDst>::value ||
                      !std::is_same<VSrc, VDst>::value>>
-    : std::integral_constant<
-          bool, is_compatible_type_erasure<TSrc, TDst>::value &&
-                    is_compatible_type_erasure<USrc, UDst>::value &&
-                    is_compatible_type_erasure<VSrc, VDst>::value> {};
+    : std::bool_constant<is_compatible_type_erasure<TSrc, TDst>::value &&
+                         is_compatible_type_erasure<USrc, UDst>::value &&
+                         is_compatible_type_erasure<VSrc, VDst>::value> {};
 
 // </editor-fold> end is_compatible_type_erasure }}}1
 //==============================================================================
diff --git a/packages/kokkos/core/src/impl/Kokkos_GraphImpl_fwd.hpp b/packages/kokkos/core/src/impl/Kokkos_GraphImpl_fwd.hpp
index 37c53075d01df464ee790b3db8546385b2447398..1656b5bb77e0c4f2b7b374e44720f6719d38dcd8 100644
--- a/packages/kokkos/core/src/impl/Kokkos_GraphImpl_fwd.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_GraphImpl_fwd.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_KOKKOS_GRAPHIMPL_FWD_HPP
 #define KOKKOS_IMPL_KOKKOS_GRAPHIMPL_FWD_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_GraphNodeCustomization.hpp b/packages/kokkos/core/src/impl/Kokkos_GraphNodeCustomization.hpp
index fc75f945a1ff0f7b10ee4aa12b4e25c40e6ef7a7..f4513679ad29210894d02dea29604c8b2da4fc19 100644
--- a/packages/kokkos/core/src/impl/Kokkos_GraphNodeCustomization.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_GraphNodeCustomization.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_KOKKOS_GRAPHNODECUSTOMIZATION_HPP
 #define KOKKOS_IMPL_KOKKOS_GRAPHNODECUSTOMIZATION_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_GraphNodeImpl.hpp b/packages/kokkos/core/src/impl/Kokkos_GraphNodeImpl.hpp
index 2515995c0e3861fff03c8e1345a12dd25c1e0c52..fe8cb89c4fe43ed81aafb2a0930bc6f0b645e948 100644
--- a/packages/kokkos/core/src/impl/Kokkos_GraphNodeImpl.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_GraphNodeImpl.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_GRAPHNODEIMPL_HPP
 #define KOKKOS_IMPL_GRAPHNODEIMPL_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_HBWSpace.cpp b/packages/kokkos/core/src/impl/Kokkos_HBWSpace.cpp
index d533ec05cdcf5a5d9b808e9ae497d698c7d2c1b0..7402f1a74476c8184ccbb3873c25d7069ebbde2a 100644
--- a/packages/kokkos/core/src/impl/Kokkos_HBWSpace.cpp
+++ b/packages/kokkos/core/src/impl/Kokkos_HBWSpace.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -219,13 +191,7 @@ void SharedAllocationRecord<Kokkos::Experimental::HBWSpace, void>::deallocate(
 }
 
 SharedAllocationRecord<Kokkos::Experimental::HBWSpace,
-                       void>::~SharedAllocationRecord()
-#if defined( \
-    KOKKOS_IMPL_INTEL_WORKAROUND_NOEXCEPT_SPECIFICATION_VIRTUAL_FUNCTION)
-    noexcept
-#endif
-{
-
+                       void>::~SharedAllocationRecord() {
   m_space.deallocate(m_label.c_str(),
                      SharedAllocationRecord<void, void>::m_alloc_ptr,
                      SharedAllocationRecord<void, void>::m_alloc_size,
diff --git a/packages/kokkos/core/src/impl/Kokkos_HostBarrier.cpp b/packages/kokkos/core/src/impl/Kokkos_HostBarrier.cpp
index 9ad2dae55181622aa38458e1409a296711476ffd..e2722d8bfeaf8dc4dd57253a39d7a042097738d2 100644
--- a/packages/kokkos/core/src/impl/Kokkos_HostBarrier.cpp
+++ b/packages/kokkos/core/src/impl/Kokkos_HostBarrier.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
diff --git a/packages/kokkos/core/src/impl/Kokkos_HostBarrier.hpp b/packages/kokkos/core/src/impl/Kokkos_HostBarrier.hpp
index 49142940be34e5f5ca8666f5240f63c326cc4b35..76500bc56339088691952fcdfe1876edc960fd33 100644
--- a/packages/kokkos/core/src/impl/Kokkos_HostBarrier.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_HostBarrier.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_HOST_BARRIER_HPP
 #define KOKKOS_HOST_BARRIER_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_HostSharedPtr.hpp b/packages/kokkos/core/src/impl/Kokkos_HostSharedPtr.hpp
index a2a792a88ee678e077e1d324fee005d6f23e1242..de99947e12b83650aec0654a3f5070ab20daac80 100644
--- a/packages/kokkos/core/src/impl/Kokkos_HostSharedPtr.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_HostSharedPtr.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_HOST_SHARED_PTR_HPP
 #define KOKKOS_IMPL_HOST_SHARED_PTR_HPP
@@ -68,10 +40,8 @@ class HostSharedPtr {
   template <class Deleter>
   HostSharedPtr(T* element_ptr, const Deleter& deleter)
       : m_element_ptr(element_ptr) {
-#ifdef KOKKOS_ENABLE_CXX17
     static_assert(std::is_invocable_v<Deleter, T*> &&
                   std::is_copy_constructible_v<Deleter>);
-#endif
     if (element_ptr) {
       try {
         m_control = new Control{deleter, 1};
diff --git a/packages/kokkos/core/src/impl/Kokkos_HostSpace.cpp b/packages/kokkos/core/src/impl/Kokkos_HostSpace.cpp
index 4bf90489193e5e0938a30d1fb96751fc7bc87dea..b47ce3beecd797dcfab7af1a075dd1fde08896ca 100644
--- a/packages/kokkos/core/src/impl/Kokkos_HostSpace.cpp
+++ b/packages/kokkos/core/src/impl/Kokkos_HostSpace.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -260,12 +232,7 @@ SharedAllocationRecord<void, void>
     SharedAllocationRecord<Kokkos::HostSpace, void>::s_root_record;
 #endif
 
-SharedAllocationRecord<Kokkos::HostSpace, void>::~SharedAllocationRecord()
-#if defined( \
-    KOKKOS_IMPL_INTEL_WORKAROUND_NOEXCEPT_SPECIFICATION_VIRTUAL_FUNCTION)
-    noexcept
-#endif
-{
+SharedAllocationRecord<Kokkos::HostSpace, void>::~SharedAllocationRecord() {
   m_space.deallocate(m_label.c_str(),
                      SharedAllocationRecord<void, void>::m_alloc_ptr,
                      SharedAllocationRecord<void, void>::m_alloc_size,
diff --git a/packages/kokkos/core/src/impl/Kokkos_HostSpace_deepcopy.cpp b/packages/kokkos/core/src/impl/Kokkos_HostSpace_deepcopy.cpp
index e6ef73295420abe6b83bd9b8209d5bd35714cd99..096dfd6b7f3f8a5f9550fd5793f20bc0658bddcd 100644
--- a/packages/kokkos/core/src/impl/Kokkos_HostSpace_deepcopy.cpp
+++ b/packages/kokkos/core/src/impl/Kokkos_HostSpace_deepcopy.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
diff --git a/packages/kokkos/core/src/impl/Kokkos_HostSpace_deepcopy.hpp b/packages/kokkos/core/src/impl/Kokkos_HostSpace_deepcopy.hpp
index 88d37672d26433b5259fdae354068aa538550dac..2bb4c3e99b34fc4ef7fc6506fd42c61d1812b8c2 100644
--- a/packages/kokkos/core/src/impl/Kokkos_HostSpace_deepcopy.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_HostSpace_deepcopy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_HOSTSPACE_DEEPCOPY_HPP
 #define KOKKOS_IMPL_HOSTSPACE_DEEPCOPY_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_HostThreadTeam.cpp b/packages/kokkos/core/src/impl/Kokkos_HostThreadTeam.cpp
index 1f1acca5df7a6dfb1c78c193c0eb4d41be93a7d2..bfe5902bf7ffd7665e1db721fa5ae1a9fe2d6b0e 100644
--- a/packages/kokkos/core/src/impl/Kokkos_HostThreadTeam.cpp
+++ b/packages/kokkos/core/src/impl/Kokkos_HostThreadTeam.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
diff --git a/packages/kokkos/core/src/impl/Kokkos_HostThreadTeam.hpp b/packages/kokkos/core/src/impl/Kokkos_HostThreadTeam.hpp
index 7f39f188600297168242432e69c83b779dec20ef..1fec93237ac2c49b1d961d68fcbc45eca15db4a6 100644
--- a/packages/kokkos/core/src/impl/Kokkos_HostThreadTeam.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_HostThreadTeam.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_HOSTTHREADTEAM_HPP
 #define KOKKOS_IMPL_HOSTTHREADTEAM_HPP
@@ -420,6 +392,7 @@ class HostThreadTeamMember {
   using execution_space         = HostExecSpace;
   using thread_team_member      = HostThreadTeamMember;
   using host_thread_team_member = HostThreadTeamMember;
+  using team_handle             = HostThreadTeamMember;
 
  private:
   scratch_memory_space m_scratch;
@@ -498,7 +471,7 @@ class HostThreadTeamMember {
                                              const int source_team_rank) const
       noexcept {
     KOKKOS_IF_ON_HOST((if (1 < m_data.m_team_size) {
-      T volatile* const shared_value = (T*)m_data.team_reduce();
+      T* const shared_value = (T*)m_data.team_reduce();
 
       // Don't overwrite shared memory until all threads arrive
 
@@ -507,13 +480,15 @@ class HostThreadTeamMember {
         // only this thread returned from 'team_rendezvous'
         // with a return value of 'true'
 
-        *shared_value = value;
+        Kokkos::Impl::atomic_store(shared_value, value,
+                                   Kokkos::Impl::memory_order_release);
 
         m_data.team_rendezvous_release();
         // This thread released all other threads from 'team_rendezvous'
         // with a return value of 'false'
       } else {
-        value = *shared_value;
+        value = Kokkos::Impl::atomic_load(shared_value,
+                                          Kokkos::Impl::memory_order_acquire);
       }
     }))
 
@@ -528,7 +503,7 @@ class HostThreadTeamMember {
                                              const int source_team_rank) const
       noexcept {
     KOKKOS_IF_ON_HOST((
-        T volatile* const shared_value = (T*)m_data.team_reduce();
+        T* const shared_value = (T*)m_data.team_reduce();
 
         // Don't overwrite shared memory until all threads arrive
 
@@ -540,13 +515,17 @@ class HostThreadTeamMember {
           f(value);
 
           if (1 < m_data.m_team_size) {
-            *shared_value = value;
+            Kokkos::Impl::atomic_store(shared_value, value,
+                                       Kokkos::Impl::memory_order_release);
           }
 
           m_data.team_rendezvous_release();
           // This thread released all other threads from 'team_rendezvous'
           // with a return value of 'false'
-        } else { value = *shared_value; }))
+        } else {
+          value = Kokkos::Impl::atomic_load(shared_value,
+                                            Kokkos::Impl::memory_order_acquire);
+        }))
 
     KOKKOS_IF_ON_DEVICE(
         ((void)f; (void)value; (void)source_team_rank;
diff --git a/packages/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp b/packages/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp
index ceb35f0247f03ef571404d43d71f9ab13d54930d..ab4350f3a7a49d7b0448b32df05cb7555044dd8b 100644
--- a/packages/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp
@@ -1,53 +1,25 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_INITIALIZATION_SETTINGS_HPP
 #define KOKKOS_INITIALIZATION_SETTINGS_HPP
 
 #include <Kokkos_Macros.hpp>
 
-#include <climits>
+#include <optional>
 #include <string>
 
 namespace Kokkos {
@@ -78,63 +50,18 @@ struct InitArguments {
 };
 #endif
 
-namespace Impl {
-// FIXME_CXX17 replace with std::optional
-template <class>
-struct InitializationSettingsHelper;
-template <>
-struct InitializationSettingsHelper<int> {
-  using value_type   = int;
-  using storage_type = int;
-
-  static constexpr storage_type unspecified = INT_MIN;
-};
-template <>
-struct InitializationSettingsHelper<bool> {
-  using value_type   = bool;
-  using storage_type = char;
-
-  static constexpr storage_type unspecified = CHAR_MAX;
-  static_assert(static_cast<storage_type>(true) != unspecified &&
-                    static_cast<storage_type>(false) != unspecified,
-                "");
-};
-template <>
-struct InitializationSettingsHelper<std::string> {
-  using value_type   = std::string;
-  using storage_type = std::string;
-
-  static storage_type const unspecified;
-};
-}  // namespace Impl
-
 class InitializationSettings {
-#define KOKKOS_IMPL_INIT_ARGS_DATA_MEMBER(NAME) \
-  impl_do_not_use_i_really_mean_it_##NAME##_
-
-#define KOKKOS_IMPL_INIT_ARGS_DATA_MEMBER_TYPE(NAME) impl_##NAME##_type
-
-#define KOKKOS_IMPL_DECLARE(TYPE, NAME)                                      \
- private:                                                                    \
-  using KOKKOS_IMPL_INIT_ARGS_DATA_MEMBER_TYPE(NAME) = TYPE;                 \
-  Impl::InitializationSettingsHelper<TYPE>::storage_type                     \
-      KOKKOS_IMPL_INIT_ARGS_DATA_MEMBER(NAME) =                              \
-          Impl::InitializationSettingsHelper<TYPE>::unspecified;             \
-                                                                             \
- public:                                                                     \
-  InitializationSettings& set_##NAME(                                        \
-      Impl::InitializationSettingsHelper<TYPE>::value_type NAME) {           \
-    KOKKOS_IMPL_INIT_ARGS_DATA_MEMBER(NAME) = NAME;                          \
-    return *this;                                                            \
-  }                                                                          \
-  bool has_##NAME() const noexcept {                                         \
-    return KOKKOS_IMPL_INIT_ARGS_DATA_MEMBER(NAME) !=                        \
-           Impl::InitializationSettingsHelper<                               \
-               KOKKOS_IMPL_INIT_ARGS_DATA_MEMBER_TYPE(NAME)>::unspecified;   \
-  }                                                                          \
-  KOKKOS_IMPL_INIT_ARGS_DATA_MEMBER_TYPE(NAME) get_##NAME() const noexcept { \
-    return KOKKOS_IMPL_INIT_ARGS_DATA_MEMBER(NAME);                          \
-  }                                                                          \
+#define KOKKOS_IMPL_DECLARE(TYPE, NAME)                                    \
+ private:                                                                  \
+  std::optional<TYPE> m_##NAME;                                            \
+                                                                           \
+ public:                                                                   \
+  InitializationSettings& set_##NAME(TYPE NAME) {                          \
+    m_##NAME = NAME;                                                       \
+    return *this;                                                          \
+  }                                                                        \
+  bool has_##NAME() const noexcept { return static_cast<bool>(m_##NAME); } \
+  TYPE get_##NAME() const noexcept { return *m_##NAME; }                   \
   static_assert(true, "no-op to require trailing semicolon")
 
  public:
diff --git a/packages/kokkos/core/src/impl/Kokkos_LIFO.hpp b/packages/kokkos/core/src/impl/Kokkos_LIFO.hpp
index 286c56743af8f51cd5bca27b333db59ee8e6d911..da7b24352d9552e6e3adbcc03b15b3446de0f2ff 100644
--- a/packages/kokkos/core/src/impl/Kokkos_LIFO.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_LIFO.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // Experimental unified task-data parallel manycore LDRD
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_LinkedListNode.hpp b/packages/kokkos/core/src/impl/Kokkos_LinkedListNode.hpp
index 1ed502db5be61a2501b57f08969ff47ce12bdbe5..99f3d1e4fc8964319bd9cd6164f2373b8e9f8e00 100644
--- a/packages/kokkos/core/src/impl/Kokkos_LinkedListNode.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_LinkedListNode.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // Experimental unified task-data parallel manycore LDRD
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_MemoryPool.cpp b/packages/kokkos/core/src/impl/Kokkos_MemoryPool.cpp
index f82e88fad96bf04417b2481d616ca9096c5cc18a..ec004a36dad3efc34cc285c7cd5f0c1676ab851d 100644
--- a/packages/kokkos/core/src/impl/Kokkos_MemoryPool.cpp
+++ b/packages/kokkos/core/src/impl/Kokkos_MemoryPool.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -50,6 +22,7 @@
 
 #include <ostream>
 #include <sstream>
+#include <cstdint>
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
diff --git a/packages/kokkos/core/src/impl/Kokkos_MemoryPoolAllocator.hpp b/packages/kokkos/core/src/impl/Kokkos_MemoryPoolAllocator.hpp
index 7dede48a14da83be482a2c87ebd09b97d0e99333..69cb9ccd049664d633181f6aaaf54c121950af5c 100644
--- a/packages/kokkos/core/src/impl/Kokkos_MemoryPoolAllocator.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_MemoryPoolAllocator.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // Experimental unified task-data parallel manycore LDRD
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_MemorySpace.cpp b/packages/kokkos/core/src/impl/Kokkos_MemorySpace.cpp
index a80ea0a1dafafa8756bf7e223a366f1a634f39b3..2f0e01c5b28da1c4db310f7b4f6f095bd5626a91 100644
--- a/packages/kokkos/core/src/impl/Kokkos_MemorySpace.cpp
+++ b/packages/kokkos/core/src/impl/Kokkos_MemorySpace.cpp
@@ -1,45 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//              Copyright (2019) Sandia Corporation
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /** @file Kokkos_MemorySpace.cpp
  *
diff --git a/packages/kokkos/core/src/impl/Kokkos_MemorySpace.hpp b/packages/kokkos/core/src/impl/Kokkos_MemorySpace.hpp
index dee11bbdb42b7e8ea34be6424592146d697926c4..44956dd7c5d904af38bf3d64d32e15a4f6e9946d 100644
--- a/packages/kokkos/core/src/impl/Kokkos_MemorySpace.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_MemorySpace.hpp
@@ -1,45 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//              Copyright (2019) Sandia Corporation
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /** @file Kokkos_MemorySpace.hpp
  *
diff --git a/packages/kokkos/core/src/impl/Kokkos_Memory_Fence.hpp b/packages/kokkos/core/src/impl/Kokkos_Memory_Fence.hpp
index 1df5d13b957c8e5d29e0ad1bedb88054bac604a4..392116a56e50b83f03dc23c4eda6625400b2b542 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Memory_Fence.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Memory_Fence.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Macros.hpp>
 #if defined(KOKKOS_ATOMIC_HPP) && !defined(KOKKOS_MEMORY_FENCE_HPP)
diff --git a/packages/kokkos/core/src/impl/Kokkos_MultipleTaskQueue.hpp b/packages/kokkos/core/src/impl/Kokkos_MultipleTaskQueue.hpp
index 209ba1920039ff434a2cfd4390c322dd30647bf3..6895f4271f6a8614eddfc8f1b906cf11aea872be 100644
--- a/packages/kokkos/core/src/impl/Kokkos_MultipleTaskQueue.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_MultipleTaskQueue.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_MULTIPLETASKQUEUE_HPP
 #define KOKKOS_IMPL_MULTIPLETASKQUEUE_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_NumericTraits.cpp b/packages/kokkos/core/src/impl/Kokkos_NumericTraits.cpp
deleted file mode 100644
index 5ff094032faa37b906b835d1ff7b8bd2ec46de2a..0000000000000000000000000000000000000000
--- a/packages/kokkos/core/src/impl/Kokkos_NumericTraits.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-
-#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
-#define KOKKOS_IMPL_PUBLIC_INCLUDE
-#endif
-
-#include <Kokkos_NumericTraits.hpp>
-
-// NOTE These out-of class definitions are only required with C++14.  Since
-// C++17, a static data member declared constexpr is implicitly inline.
-
-#if !defined(KOKKOS_ENABLE_CXX17)
-namespace Kokkos {
-namespace Experimental {
-namespace Impl {
-#define OUT_OF_CLASS_DEFINITION_FLOATING_POINT(TRAIT) \
-  constexpr float TRAIT##_helper<float>::value;       \
-  constexpr double TRAIT##_helper<double>::value;     \
-  constexpr long double TRAIT##_helper<long double>::value
-
-#define OUT_OF_CLASS_DEFINITION_INTEGRAL(TRAIT)                         \
-  constexpr bool TRAIT##_helper<bool>::value;                           \
-  constexpr char TRAIT##_helper<char>::value;                           \
-  constexpr signed char TRAIT##_helper<signed char>::value;             \
-  constexpr unsigned char TRAIT##_helper<unsigned char>::value;         \
-  constexpr short TRAIT##_helper<short>::value;                         \
-  constexpr unsigned short TRAIT##_helper<unsigned short>::value;       \
-  constexpr int TRAIT##_helper<int>::value;                             \
-  constexpr unsigned int TRAIT##_helper<unsigned int>::value;           \
-  constexpr long int TRAIT##_helper<long int>::value;                   \
-  constexpr unsigned long int TRAIT##_helper<unsigned long int>::value; \
-  constexpr long long int TRAIT##_helper<long long int>::value;         \
-  constexpr unsigned long long int TRAIT##_helper<unsigned long long int>::value
-
-#define OUT_OF_CLASS_DEFINITION_FLOATING_POINT_2(TRAIT) \
-  constexpr int TRAIT##_helper<float>::value;           \
-  constexpr int TRAIT##_helper<double>::value;          \
-  constexpr int TRAIT##_helper<long double>::value
-
-#define OUT_OF_CLASS_DEFINITION_INTEGRAL_2(TRAIT)         \
-  constexpr int TRAIT##_helper<bool>::value;              \
-  constexpr int TRAIT##_helper<char>::value;              \
-  constexpr int TRAIT##_helper<signed char>::value;       \
-  constexpr int TRAIT##_helper<unsigned char>::value;     \
-  constexpr int TRAIT##_helper<short>::value;             \
-  constexpr int TRAIT##_helper<unsigned short>::value;    \
-  constexpr int TRAIT##_helper<int>::value;               \
-  constexpr int TRAIT##_helper<unsigned int>::value;      \
-  constexpr int TRAIT##_helper<long int>::value;          \
-  constexpr int TRAIT##_helper<unsigned long int>::value; \
-  constexpr int TRAIT##_helper<long long int>::value;     \
-  constexpr int TRAIT##_helper<unsigned long long int>::value
-
-OUT_OF_CLASS_DEFINITION_FLOATING_POINT(infinity);
-OUT_OF_CLASS_DEFINITION_FLOATING_POINT(epsilon);
-OUT_OF_CLASS_DEFINITION_FLOATING_POINT(round_error);
-OUT_OF_CLASS_DEFINITION_FLOATING_POINT(norm_min);
-OUT_OF_CLASS_DEFINITION_FLOATING_POINT(denorm_min);
-OUT_OF_CLASS_DEFINITION_FLOATING_POINT(reciprocal_overflow_threshold);
-OUT_OF_CLASS_DEFINITION_FLOATING_POINT(quiet_NaN);
-OUT_OF_CLASS_DEFINITION_FLOATING_POINT(signaling_NaN);
-
-OUT_OF_CLASS_DEFINITION_INTEGRAL(finite_min);
-OUT_OF_CLASS_DEFINITION_FLOATING_POINT(finite_min);
-OUT_OF_CLASS_DEFINITION_INTEGRAL(finite_max);
-OUT_OF_CLASS_DEFINITION_FLOATING_POINT(finite_max);
-
-OUT_OF_CLASS_DEFINITION_INTEGRAL_2(digits);
-OUT_OF_CLASS_DEFINITION_FLOATING_POINT_2(digits);
-OUT_OF_CLASS_DEFINITION_INTEGRAL_2(digits10);
-OUT_OF_CLASS_DEFINITION_FLOATING_POINT_2(digits10);
-OUT_OF_CLASS_DEFINITION_FLOATING_POINT_2(max_digits10);
-OUT_OF_CLASS_DEFINITION_INTEGRAL_2(radix);
-OUT_OF_CLASS_DEFINITION_FLOATING_POINT_2(radix);
-
-OUT_OF_CLASS_DEFINITION_FLOATING_POINT_2(min_exponent);
-OUT_OF_CLASS_DEFINITION_FLOATING_POINT_2(min_exponent10);
-OUT_OF_CLASS_DEFINITION_FLOATING_POINT_2(max_exponent);
-OUT_OF_CLASS_DEFINITION_FLOATING_POINT_2(max_exponent10);
-}  // namespace Impl
-}  // namespace Experimental
-}  // namespace Kokkos
-#endif
diff --git a/packages/kokkos/core/src/impl/Kokkos_OptionalRef.hpp b/packages/kokkos/core/src/impl/Kokkos_OptionalRef.hpp
index 1a3cbaba2859fdbd6b946a1e85422b5de7489ff3..4fc661344ba3568b9fbd5a1820b99c021578f46c 100644
--- a/packages/kokkos/core/src/impl/Kokkos_OptionalRef.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_OptionalRef.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // Experimental unified task-data parallel manycore LDRD
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_ParseCommandLineArgumentsAndEnvironmentVariables.hpp b/packages/kokkos/core/src/impl/Kokkos_ParseCommandLineArgumentsAndEnvironmentVariables.hpp
index 4fdb85b6a0ecc6dff59268637ebf8be7352a5500..a83d43a9bdc9f28e7fe00179f6fe4ef0408c65c4 100644
--- a/packages/kokkos/core/src/impl/Kokkos_ParseCommandLineArgumentsAndEnvironmentVariables.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_ParseCommandLineArgumentsAndEnvironmentVariables.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_PARSE_COMMAND_LINE_ARGUMENTS_AND_ENVIRONMENT_VARIABLES_HPP
 #define KOKKOS_PARSE_COMMAND_LINE_ARGUMENTS_AND_ENVIRONMENT_VARIABLES_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_Profiling.cpp b/packages/kokkos/core/src/impl/Kokkos_Profiling.cpp
index 480b1a392bf019b4c37c452a09801fe8ef8f3458..e3cfcb6a29e4cff19f398845e41774cbb1fe66f4 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Profiling.cpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Profiling.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -655,9 +627,9 @@ void initialize(const std::string& profileLibrary) {
 
   char* envProfileLibrary = const_cast<char*>(profileLibrary.c_str());
 
-  const auto envProfileCopy =
-      std::make_unique<char[]>(strlen(envProfileLibrary) + 1);
-  sprintf(envProfileCopy.get(), "%s", envProfileLibrary);
+  const size_t envProfileLen = strlen(envProfileLibrary) + 1;
+  const auto envProfileCopy  = std::make_unique<char[]>(envProfileLen);
+  snprintf(envProfileCopy.get(), envProfileLen, "%s", envProfileLibrary);
 
   char* profileLibraryName = strtok(envProfileCopy.get(), ";");
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_Profiling.hpp b/packages/kokkos/core/src/impl/Kokkos_Profiling.hpp
index cb17a0cd836167297621a751dc83991f7f4dc4fb..025d8d3d18e69c27dec7dd2e569bfcf530e48dc8 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Profiling.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Profiling.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_KOKKOS_PROFILING_HPP
 #define KOKKOS_IMPL_KOKKOS_PROFILING_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_Profiling_C_Interface.h b/packages/kokkos/core/src/impl/Kokkos_Profiling_C_Interface.h
index a069fb831b096035701ac40bce494de976e0ee76..731a11e917ad758759938531e52fddf7efd30533 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Profiling_C_Interface.h
+++ b/packages/kokkos/core/src/impl/Kokkos_Profiling_C_Interface.h
@@ -2,43 +2,17 @@
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
 */
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_Profiling_DeviceInfo.hpp b/packages/kokkos/core/src/impl/Kokkos_Profiling_DeviceInfo.hpp
index be6f756d0c2fc71976d48df2a76570b58ea8ee1b..1db44815c21910f43ff4dcfab8b3f57edfddc5b9 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Profiling_DeviceInfo.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Profiling_DeviceInfo.hpp
@@ -1,46 +1,18 @@
-/*
- //@HEADER
- // ************************************************************************
- //
- //                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
- //
- // Under the terms of Contract DE-NA0003525 with NTESS,
- // the U.S. Government retains certain rights in this software.
- //
- // Redistribution and use in source and binary forms, with or without
- // modification, are permitted provided that the following conditions are
- // met:
- //
- // 1. Redistributions of source code must retain the above copyright
- // notice, this list of conditions and the following disclaimer.
- //
- // 2. Redistributions in binary form must reproduce the above copyright
- // notice, this list of conditions and the following disclaimer in the
- // documentation and/or other materials provided with the distribution.
- //
- // 3. Neither the name of the Corporation nor the names of the
- // contributors may be used to endorse or promote products derived from
- // this software without specific prior written permission.
- //
- // THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
- // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
- // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- // 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 Christian R. Trott (crtrott@sandia.gov)
- //
- // ************************************************************************
- //@HEADER
-*/
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
 
 #ifndef KOKKOSP_DEVICE_INFO_HPP
 #define KOKKOSP_DEVICE_INFO_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_Profiling_Interface.hpp b/packages/kokkos/core/src/impl/Kokkos_Profiling_Interface.hpp
index 428a3cb17b7a941e843f4f90c01124a657282dd0..af71932e47beb57e8e4ed312e262ae8b8dc03597 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Profiling_Interface.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Profiling_Interface.hpp
@@ -1,46 +1,18 @@
-/*
- //@HEADER
- // ************************************************************************
- //
- //                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
- //
- // Under the terms of Contract DE-NA0003525 with NTESS,
- // the U.S. Government retains certain rights in this software.
- //
- // Redistribution and use in source and binary forms, with or without
- // modification, are permitted provided that the following conditions are
- // met:
- //
- // 1. Redistributions of source code must retain the above copyright
- // notice, this list of conditions and the following disclaimer.
- //
- // 2. Redistributions in binary form must reproduce the above copyright
- // notice, this list of conditions and the following disclaimer in the
- // documentation and/or other materials provided with the distribution.
- //
- // 3. Neither the name of the Corporation nor the names of the
- // contributors may be used to endorse or promote products derived from
- // this software without specific prior written permission.
- //
- // THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
- // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
- // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- // 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 Christian R. Trott (crtrott@sandia.gov)
- //
- // ************************************************************************
- //@HEADER
- */
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
 
 #ifndef KOKKOSP_INTERFACE_HPP
 #define KOKKOSP_INTERFACE_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_QuadPrecisionMath.hpp b/packages/kokkos/core/src/impl/Kokkos_QuadPrecisionMath.hpp
index c7936e950d7ebaec8c9987a65577b85f5952abf0..02e2936ddde269e8d626bc55c8bf6206ff9a0d01 100644
--- a/packages/kokkos/core/src/impl/Kokkos_QuadPrecisionMath.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_QuadPrecisionMath.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_QUAD_PRECISION_MATH_HPP
 #define KOKKOS_QUAD_PRECISION_MATH_HPP
@@ -50,6 +22,7 @@
 #if defined(KOKKOS_ENABLE_LIBQUADMATH)
 
 #include <Kokkos_NumericTraits.hpp>
+#include <Kokkos_ReductionIdentity.hpp>
 #include <Kokkos_MathematicalConstants.hpp>
 #include <Kokkos_MathematicalFunctions.hpp>
 
@@ -62,7 +35,6 @@
 //<editor-fold desc="numeric traits __float128 specializations">
 namespace Kokkos {
 namespace Experimental {
-#if defined(KOKKOS_ENABLE_CXX17)
 #define KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(TRAIT, TYPE, VALUE_TYPE, VALUE) \
   template <>                                                                \
   struct TRAIT<TYPE> {                                                       \
@@ -70,32 +42,18 @@ namespace Experimental {
   };                                                                         \
   template <>                                                                \
   inline constexpr auto TRAIT##_v<TYPE> = TRAIT<TYPE>::value;
-#else
-#define KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(TRAIT, TYPE, VALUE_TYPE, VALUE) \
-  template <>                                                                \
-  struct TRAIT<TYPE> {                                                       \
-    static constexpr VALUE_TYPE value = VALUE;                               \
-  };
-#endif
 
 // clang-format off
 // Numeric distinguished value traits
-// Workaround GCC bug https://godbolt.org/z/qWb5oe4dx
-// error: '__builtin_huge_valq()' is not a constant expression
-#if defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU >= 710)
 KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(infinity,       __float128, __float128, HUGE_VALQ)
-#endif
 KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(finite_min,     __float128, __float128, -FLT128_MAX)
 KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(finite_max,     __float128, __float128, FLT128_MAX)
 KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(epsilon,        __float128, __float128, FLT128_EPSILON)
 KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(round_error,    __float128, __float128, static_cast<__float128>(0.5))
 KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(norm_min,       __float128, __float128, FLT128_MIN)
 KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(denorm_min,     __float128, __float128, FLT128_DENORM_MIN)
-KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(reciprocal_overflow_threshold, __float128, __float128, FLT128_MIN)
-#if defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU >= 710)
 KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(quiet_NaN,      __float128, __float128, __builtin_nanq(""))
 KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(signaling_NaN,  __float128, __float128, __builtin_nansq(""))
-#endif
 
 // Numeric characteristics traits
 KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(digits,         __float128,        int, FLT128_MANT_DIG)
@@ -143,7 +101,7 @@ inline __float128 fabs(__float128 x) { return ::fabsq(x); }
 inline __float128 fmod(__float128 x, __float128 y) { return ::fmodq(x, y); }
 inline __float128 remainder(__float128 x, __float128 y) { return ::remainderq(x, y); }
 // remquo
-// fma
+inline __float128 fma(__float128 x, __float128 y, __float128 z) { return ::fmaq(x, y, z); }
 inline __float128 fmax(__float128 x, __float128 y) { return ::fmaxq(x, y); }
 inline __float128 fmin(__float128 x, __float128 y) { return ::fminq(x, y); }
 inline __float128 fdim(__float128 x, __float128 y) { return ::fdimq(x, y); }
@@ -201,9 +159,7 @@ inline __float128 nearbyint(__float128 x) { return ::nearbyintq(x); }
 // scalbn
 // scalbln
 // ilog
-#if defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU >= 610)
 inline __float128 logb(__float128 x) { return ::logbq(x); }
-#endif
 inline __float128 nextafter(__float128 x, __float128 y) { return ::nextafterq(x, y); }
 // nexttoward
 inline __float128 copysign(__float128 x, __float128 y) { return ::copysignq(x, y); }
@@ -225,8 +181,7 @@ inline bool signbit(__float128 x) { return ::signbitq(x); }
 //</editor-fold>
 
 //<editor-fold desc="Mathematical constants __float128 specializations">
-namespace Kokkos {
-namespace Experimental {
+namespace Kokkos::numbers {
 // clang-format off
 template <> constexpr __float128 e_v         <__float128> = 2.718281828459045235360287471352662498Q;
 template <> constexpr __float128 log2e_v     <__float128> = 1.442695040888963407359924681001892137Q;
@@ -242,8 +197,7 @@ template <> constexpr __float128 inv_sqrt3_v <__float128> = 0.577350269189625764
 template <> constexpr __float128 egamma_v    <__float128> = 0.577215664901532860606512090082402431Q;
 template <> constexpr __float128 phi_v       <__float128> = 1.618033988749894848204586834365638118Q;
 // clang-format on
-}  // namespace Experimental
-}  // namespace Kokkos
+}  // namespace Kokkos::numbers
 //</editor-fold>
 
 #endif
diff --git a/packages/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp b/packages/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp
index aff6332cc083ac9feff0e62185ddb21f84430474..ccc5b60f5fb32c230759b5ce23ae98eacaa55cce 100644
--- a/packages/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp
+++ b/packages/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
@@ -51,8 +23,6 @@
 namespace Kokkos {
 namespace Impl {
 
-thread_local int SharedAllocationRecord<void, void>::t_tracking_enabled = 1;
-
 #ifdef KOKKOS_ENABLE_DEBUG
 bool SharedAllocationRecord<void, void>::is_sane(
     SharedAllocationRecord<void, void>* arg_record) {
@@ -311,12 +281,14 @@ SharedAllocationRecord<void, void>* SharedAllocationRecord<
 void SharedAllocationRecord<void, void>::print_host_accessible_records(
     std::ostream& s, const char* const space_name,
     const SharedAllocationRecord* const root, const bool detail) {
-  const SharedAllocationRecord<void, void>* r = root;
+  // Print every node except the root, which does not represent an actual
+  // allocation.
+  const SharedAllocationRecord<void, void>* r = root->m_next;
 
   char buffer[256];
 
   if (detail) {
-    do {
+    while (r != root) {
       // Formatting dependent on sizeof(uintptr_t)
       const char* format_string;
 
@@ -339,28 +311,24 @@ void SharedAllocationRecord<void, void>::print_host_accessible_records(
                r->m_alloc_ptr->m_label);
       s << buffer;
       r = r->m_next;
-    } while (r != root);
+    }
   } else {
-    do {
-      if (r->m_alloc_ptr) {
-        // Formatting dependent on sizeof(uintptr_t)
-        const char* format_string;
-
-        if (sizeof(uintptr_t) == sizeof(unsigned long)) {
-          format_string = "%s [ 0x%.12lx + %ld ] %s\n";
-        } else if (sizeof(uintptr_t) == sizeof(unsigned long long)) {
-          format_string = "%s [ 0x%.12llx + %ld ] %s\n";
-        }
+    while (r != root) {
+      // Formatting dependent on sizeof(uintptr_t)
+      const char* format_string;
 
-        snprintf(buffer, 256, format_string, space_name,
-                 reinterpret_cast<uintptr_t>(r->data()), r->size(),
-                 r->m_alloc_ptr->m_label);
-      } else {
-        snprintf(buffer, 256, "%s [ 0 + 0 ]\n", space_name);
+      if (sizeof(uintptr_t) == sizeof(unsigned long)) {
+        format_string = "%s [ 0x%.12lx + %ld ] %s\n";
+      } else if (sizeof(uintptr_t) == sizeof(unsigned long long)) {
+        format_string = "%s [ 0x%.12llx + %ld ] %s\n";
       }
+
+      snprintf(buffer, 256, format_string, space_name,
+               reinterpret_cast<uintptr_t>(r->data()), r->size(),
+               r->m_alloc_ptr->m_label);
       s << buffer;
       r = r->m_next;
-    } while (r != root);
+    }
   }
 }
 #else
diff --git a/packages/kokkos/core/src/impl/Kokkos_SharedAlloc.hpp b/packages/kokkos/core/src/impl/Kokkos_SharedAlloc.hpp
index 02dcd1ec652efcd9b95e9e4902cd626ed16bb600..6bb87ca84b2f5089f1d7568fb09ebf3dcc2482c2 100644
--- a/packages/kokkos/core/src/impl/Kokkos_SharedAlloc.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_SharedAlloc.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SHARED_ALLOC_HPP
 #define KOKKOS_SHARED_ALLOC_HPP
@@ -65,7 +37,7 @@ class SharedAllocationHeader {
  private:
   using Record = SharedAllocationRecord<void, void>;
 
-#ifdef KOKKOS_ARCH_VEGA
+#if defined(KOKKOS_ARCH_VEGA) || defined(KOKKOS_ARCH_NAVI)
   static constexpr unsigned maximum_label_length =
       (1u << 8 /* 256 */) - sizeof(Record*);
 #else
@@ -98,7 +70,7 @@ class SharedAllocationHeader {
 template <>
 class SharedAllocationRecord<void, void> {
  protected:
-#ifdef KOKKOS_ARCH_VEGA
+#if defined(KOKKOS_ARCH_VEGA) || defined(KOKKOS_ARCH_NAVI)
   static_assert(sizeof(SharedAllocationHeader) == (1u << 8 /* 256 */),
                 "sizeof(SharedAllocationHeader) != 256");
 #else
@@ -141,7 +113,7 @@ class SharedAllocationRecord<void, void> {
       SharedAllocationHeader* arg_alloc_ptr, size_t arg_alloc_size,
       function_type arg_dealloc, const std::string& label);
  private:
-  static thread_local int t_tracking_enabled;
+  static inline thread_local int t_tracking_enabled = 1;
 
  public:
   virtual std::string get_label() const { return std::string("Unmanaged"); }
diff --git a/packages/kokkos/core/src/impl/Kokkos_SharedAlloc_timpl.hpp b/packages/kokkos/core/src/impl/Kokkos_SharedAlloc_timpl.hpp
index 276217c7d4f78cae7ac925e51d074cf3d60c195f..9aa96e27d150140c25a17a5e18e32e98303f095c 100644
--- a/packages/kokkos/core/src/impl/Kokkos_SharedAlloc_timpl.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_SharedAlloc_timpl.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (12/8/20) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_SHAREDALLOC_TIMPL_HPP
 #define KOKKOS_IMPL_SHAREDALLOC_TIMPL_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_SimpleTaskScheduler.hpp b/packages/kokkos/core/src/impl/Kokkos_SimpleTaskScheduler.hpp
index 06bfe276c73bc888fe2ae2ace36a93d3936f9101..268aaa5bd6eb7bc8ee82cbde1c6e90990d60f0a3 100644
--- a/packages/kokkos/core/src/impl/Kokkos_SimpleTaskScheduler.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_SimpleTaskScheduler.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SIMPLETASKSCHEDULER_HPP
 #define KOKKOS_SIMPLETASKSCHEDULER_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_SingleTaskQueue.hpp b/packages/kokkos/core/src/impl/Kokkos_SingleTaskQueue.hpp
index aa84fbbf6e2e3ea3b090a9b52afb90f51a042d1b..12ce75ea68dba09df192dd4aae1b71f4f69a80a4 100644
--- a/packages/kokkos/core/src/impl/Kokkos_SingleTaskQueue.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_SingleTaskQueue.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_SINGLETASKQUEUE_HPP
 #define KOKKOS_IMPL_SINGLETASKQUEUE_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_Spinwait.cpp b/packages/kokkos/core/src/impl/Kokkos_Spinwait.cpp
index d0954291fa9a119bf755625aa96dd749fb0e8875..0a7eda29bcf1b8862e8b97166865d995662ee893 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Spinwait.cpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Spinwait.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
diff --git a/packages/kokkos/core/src/impl/Kokkos_Spinwait.hpp b/packages/kokkos/core/src/impl/Kokkos_Spinwait.hpp
index 085157521d38cf7ea3266364097f2b89861f22b5..c57b17d646a2493cf11e94f8a396abe3ea54c256 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Spinwait.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Spinwait.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SPINWAIT_HPP
 #define KOKKOS_SPINWAIT_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_Stacktrace.cpp b/packages/kokkos/core/src/impl/Kokkos_Stacktrace.cpp
index e1f59c1d8666e951bcc4378b3effef541fb861dc..3b8dc4efc356d8beb8928b3d01a4577b6fdf9b86 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Stacktrace.cpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Stacktrace.cpp
@@ -1,3 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
diff --git a/packages/kokkos/core/src/impl/Kokkos_Stacktrace.hpp b/packages/kokkos/core/src/impl/Kokkos_Stacktrace.hpp
index b5cf4ee1b647f1cdf86bccfe3e73b68ec7127d7b..9dc0179a05cb3ed50547382a33913ced83d1a868 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Stacktrace.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Stacktrace.hpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #ifndef KOKKOS_STACKTRACE_HPP
 #define KOKKOS_STACKTRACE_HPP
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_StringManipulation.hpp b/packages/kokkos/core/src/impl/Kokkos_StringManipulation.hpp
index 644dcf7faaa3a6b1ba41349ad01ca512b26a0ac2..c7baf6d0c3df9016c90963e7c4355b908078ee5a 100644
--- a/packages/kokkos/core/src/impl/Kokkos_StringManipulation.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_StringManipulation.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_STRING_MANIPULATION_HPP
 #define KOKKOS_STRING_MANIPULATION_HPP
@@ -195,11 +167,7 @@ KOKKOS_FUNCTION constexpr to_chars_result to_chars_i(char *first, char *last,
   if (value == 0) {
     *first = '0';
     return {first + 1, {}};
-  } else if
-#ifdef KOKKOS_ENABLE_CXX17
-      constexpr
-#endif
-      (std::is_signed<Integral>::value) {
+  } else if constexpr (std::is_signed<Integral>::value) {
     if (value < 0) {
       *first++     = '-';
       unsigned_val = Unsigned(~value) + Unsigned(1);
diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskBase.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskBase.hpp
index bb89ab914471d61dde22a2009a57d41094428308..ac99d071594958a16689f9ebb435a8adeb164559 100644
--- a/packages/kokkos/core/src/impl/Kokkos_TaskBase.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_TaskBase.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // Experimental unified task-data parallel manycore LDRD
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskNode.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskNode.hpp
index 5e2ebb058aeaaaf79ae9e0916549d41e394fa97e..789ba1469697a50dd85707119c0daeb346ca0593 100644
--- a/packages/kokkos/core/src/impl/Kokkos_TaskNode.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_TaskNode.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // Experimental unified task-data parallel manycore LDRD
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskPolicyData.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskPolicyData.hpp
index 09113628a76f8c9282ae8d30e0f29e7c407ed962..9e6a55b3f6726c913f26040bd4bf746bf7ced1b2 100644
--- a/packages/kokkos/core/src/impl/Kokkos_TaskPolicyData.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_TaskPolicyData.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_TASKPOLICYDATA_HPP
 #define KOKKOS_IMPL_TASKPOLICYDATA_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskQueue.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskQueue.hpp
index 4f565f019ca16d40124a14fd5bf955dfbfe6321a..5f182dc33f2580ff9806ca612d071b8e07343fca 100644
--- a/packages/kokkos/core/src/impl/Kokkos_TaskQueue.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_TaskQueue.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // Experimental unified task-data parallel manycore LDRD
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskQueueCommon.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskQueueCommon.hpp
index 82af5625e87ecb77ca5070f2fce5b78c37ce0168..18dc3c757bf827766a06278caac8848b069ee614 100644
--- a/packages/kokkos/core/src/impl/Kokkos_TaskQueueCommon.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_TaskQueueCommon.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_TASKQUEUECOMMON_HPP
 #define KOKKOS_IMPL_TASKQUEUECOMMON_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskQueueMemoryManager.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskQueueMemoryManager.hpp
index c8039fa77dd1f7b94c7ee8073533a4bc8a390eab..aef919e8346e2456b61315a9f3f0736cd2b681d1 100644
--- a/packages/kokkos/core/src/impl/Kokkos_TaskQueueMemoryManager.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_TaskQueueMemoryManager.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_TASKQUEUEMEMORYMANAGER_HPP
 #define KOKKOS_IMPL_TASKQUEUEMEMORYMANAGER_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskQueueMultiple.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskQueueMultiple.hpp
index 31c737650abffa0ed4275e71a2d847ecdf9567a6..e653f70fe91bfed21e92798f67319f040388c5c3 100644
--- a/packages/kokkos/core/src/impl/Kokkos_TaskQueueMultiple.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_TaskQueueMultiple.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // Experimental unified task-data parallel manycore LDRD
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskQueueMultiple_impl.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskQueueMultiple_impl.hpp
index 1af97918b8a057444b9653202838a7dff06bb143..114483ca0a5b4d74367ac66211d8a3445f97b783 100644
--- a/packages/kokkos/core/src/impl/Kokkos_TaskQueueMultiple_impl.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_TaskQueueMultiple_impl.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_TASKQUEUEMULTIPLE_IMPL_HPP
 #define KOKKOS_IMPL_TASKQUEUEMULTIPLE_IMPL_HPP
@@ -58,13 +30,7 @@ namespace Impl {
 template <class ExecSpace, class MemorySpace>
 void TaskQueueMultiple<ExecSpace,
                        MemorySpace>::Destroy::destroy_shared_allocation() {
-// KOKKOS WORKAROUND for CUDA 10.1 with GCC 7.3.0
-#if (KOKKOS_COMPILER_CUDA_VERSION == 101) && defined(KOKKOS_COMPILER_NVCC) && \
-    (KOKKOS_COMPILER_GNU >= 730)
-  (*m_queue).get_team_queue(0).~TaskQueueMultiple();
-#else
   m_queue->get_team_queue(0).~TaskQueueMultiple();
-#endif
 }
 
 } /* namespace Impl */
diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskQueue_impl.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskQueue_impl.hpp
index 324227cf5e615f184492de9471fa0f78700ae11a..68ff36579fd7226cce83f9b4c04fa2d881cfa684 100644
--- a/packages/kokkos/core/src/impl/Kokkos_TaskQueue_impl.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_TaskQueue_impl.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_TASKQUEUE_IMPL_HPP
 #define KOKKOS_IMPL_TASKQUEUE_IMPL_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskResult.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskResult.hpp
index 7c893547d280afb1966c91825dff398ee233a65a..6161b945b495f53700913945b165ccbb79ea8216 100644
--- a/packages/kokkos/core/src/impl/Kokkos_TaskResult.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_TaskResult.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // Experimental unified task-data parallel manycore LDRD
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskTeamMember.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskTeamMember.hpp
index 1d6c766a75ef4b5345ba6d267f52bb7a814b0d25..7dc34cc065a1a5ce7a41b43da7273c7b36a12827 100644
--- a/packages/kokkos/core/src/impl/Kokkos_TaskTeamMember.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_TaskTeamMember.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TASKTEAMMEMBER_HPP
 #define KOKKOS_TASKTEAMMEMBER_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_TeamMDPolicy.hpp b/packages/kokkos/core/src/impl/Kokkos_TeamMDPolicy.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..5395c9cf4318d8ec7457526c9d70681541654a19
--- /dev/null
+++ b/packages/kokkos/core/src/impl/Kokkos_TeamMDPolicy.hpp
@@ -0,0 +1,278 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
+#include <Kokkos_Macros.hpp>
+static_assert(false,
+              "Including non-public Kokkos header files is not allowed.");
+#endif
+
+#ifndef KOKKOS_IMPL_TEAMMDPOLICY_HPP
+#define KOKKOS_IMPL_TEAMMDPOLICY_HPP
+
+namespace Kokkos {
+
+namespace Impl {
+
+// Tag class to choose the nested loop specialization
+//   - LastNestLevel means call the actual closure
+//   - ParThread means use TeamThreadRange
+//   - ParVector means use ThreadVectorRange
+template <TeamMDRangeLastNestLevel LastNestLevel,
+          TeamMDRangeParThread ParThread, TeamMDRangeParVector ParVector>
+struct TeamMDRangeMode {
+  static constexpr TeamMDRangeLastNestLevel last_nest_level = LastNestLevel;
+  static constexpr TeamMDRangeParThread par_thread          = ParThread;
+  static constexpr TeamMDRangeParVector par_vector          = ParVector;
+};
+
+// Tag class to keep track of the loop nest level and where to deploy thread and
+// vector parallelism
+//   - Rank is Kokkos::Rank<TotalNestLevel, Iter>
+//     - total_nest_level is the total number of loop nests
+//     - iter is whether to go forward or backward through ranks (i.e. the
+//       iteration order for MDRangePolicy)
+//   - ParThreadNestLevel is the nesting level on which to deploy thread
+//   parallelism
+//   - ParVectorNestLevel is the nesting level on which to deploy vector
+//   parallelism
+//   - CurrentNestLevel is the nest level of interest
+template <typename Rank, int ParThreadNestLevel, int ParVectorNestLevel,
+          int CurrentNestLevel>
+struct TeamMDRangeNestingTracker {
+  using NestLevelType                                  = int;
+  static constexpr Iterate iter                        = Rank::outer_direction;
+  static constexpr NestLevelType total_nest_level      = Rank::rank;
+  static constexpr NestLevelType par_thread_nest_level = ParThreadNestLevel;
+  static constexpr NestLevelType par_vector_nest_level = ParVectorNestLevel;
+  static constexpr NestLevelType current_nest_level    = CurrentNestLevel;
+
+  // We have to recursively process ranks [0..total_nest_level-1]
+  using RangeMode =
+      TeamMDRangeMode<(iter == Iterate::Right)
+                          ? static_cast<TeamMDRangeLastNestLevel>(
+                                current_nest_level == total_nest_level)
+                          : static_cast<TeamMDRangeLastNestLevel>(
+                                current_nest_level == -1),
+                      static_cast<TeamMDRangeParThread>(current_nest_level ==
+                                                        par_thread_nest_level),
+                      static_cast<TeamMDRangeParVector>(current_nest_level ==
+                                                        par_vector_nest_level)>;
+};
+
+// Structs to determine on which nested level parallelization happens.
+//   - Rank is Kokkos::Rank<TotalNestLevel, Iter>
+//     - TotalNestLevel is the total number of loop nests
+//     - Iter is whether to go forward or backward through ranks (i.e. the
+//       iteration order for MDRangePolicy)
+//   - ThreadAndVector determines whether both vector and thread parallelism is
+//     in use
+template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector>
+struct HostBasedNestLevel {
+  static constexpr bool is_direction_left =
+      (Rank::outer_direction == Iterate::Left);
+  static constexpr int par_rt  = is_direction_left ? Rank::rank - 1 : 0;
+  static constexpr int par_rv  = is_direction_left ? 0 : Rank::rank - 1;
+  static constexpr int invalid = -2;
+};
+
+template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector>
+struct AcceleratorBasedNestLevel {
+  static constexpr bool is_direction_left =
+      (Rank::outer_direction == Iterate::Left);
+
+  // If vector parallelism is in use, deploy thread parallelism on
+  // the second to the last nested level; otherwise, thread parallelism on the
+  // last nested level
+  static constexpr int left_par_rt =
+      (ThreadAndVector == TeamMDRangeThreadAndVector::Both) ? 1 : 0;
+
+  static constexpr int right_par_rt =
+      (ThreadAndVector == TeamMDRangeThreadAndVector::Both) ? Rank::rank - 2
+                                                            : Rank::rank - 1;
+
+  static constexpr int par_rt = is_direction_left ? left_par_rt : right_par_rt;
+
+  // Vector parallelism will always be on the last index
+  static constexpr int par_rv  = is_direction_left ? 0 : Rank::rank - 1;
+  static constexpr int invalid = -2;
+};
+
+template <typename TeamHandle>
+KOKKOS_INLINE_FUNCTION auto nested_policy(
+    TeamMDRangeMode<TeamMDRangeLastNestLevel::NotLastNestLevel,
+                    TeamMDRangeParThread::ParThread,
+                    TeamMDRangeParVector::NotParVector>,
+    TeamHandle const team, int count) {
+  return TeamThreadRange(team, count);
+}
+
+template <typename TeamHandle>
+KOKKOS_INLINE_FUNCTION auto nested_policy(
+    TeamMDRangeMode<TeamMDRangeLastNestLevel::NotLastNestLevel,
+                    TeamMDRangeParThread::NotParThread,
+                    TeamMDRangeParVector::ParVector>,
+    TeamHandle const team, int count) {
+  return ThreadVectorRange(team, count);
+}
+
+template <typename TeamHandle>
+KOKKOS_INLINE_FUNCTION auto nested_policy(
+    TeamMDRangeMode<TeamMDRangeLastNestLevel::NotLastNestLevel,
+                    TeamMDRangeParThread::ParThread,
+                    TeamMDRangeParVector::ParVector>,
+    TeamHandle const team, int count) {
+  return TeamVectorRange(team, count);
+}
+
+// TeamMDRangeNestingTracker is only needed to deduce template parameters
+template <typename Rank, int ParThreadNestLevel, int ParVectorNestLevel,
+          int CurrentNestLevel, typename Policy, typename Lambda,
+          typename... Args>
+KOKKOS_INLINE_FUNCTION void nested_loop(
+    TeamMDRangeMode<TeamMDRangeLastNestLevel::LastNestLevel,
+                    TeamMDRangeParThread::NotParThread,
+                    TeamMDRangeParVector::NotParVector> const,
+    TeamMDRangeNestingTracker<Rank, ParThreadNestLevel, ParVectorNestLevel,
+                              CurrentNestLevel>,
+    Policy const&, Lambda const& lambda, Impl::NoReductionTag&&, Args... args) {
+  lambda(args...);
+}
+
+template <typename Rank, int ParThreadNestLevel, int ParVectorNestLevel,
+          int CurrentNestLevel, typename Policy, typename Lambda,
+          typename ReducerValueType, typename... Args>
+KOKKOS_INLINE_FUNCTION void nested_loop(
+    TeamMDRangeMode<TeamMDRangeLastNestLevel::LastNestLevel,
+                    TeamMDRangeParThread::NotParThread,
+                    TeamMDRangeParVector::NotParVector> const,
+    TeamMDRangeNestingTracker<Rank, ParThreadNestLevel, ParVectorNestLevel,
+                              CurrentNestLevel>,
+    Policy const&, Lambda const& lambda, ReducerValueType& val, Args... args) {
+  lambda(args..., val);
+}
+
+// Nested loop for serial iteration
+template <typename Rank, int ParThreadNestLevel, int ParVectorNestLevel,
+          int CurrentNestLevel, typename Policy, typename Lambda,
+          typename ReducerValueType, typename... Args>
+KOKKOS_INLINE_FUNCTION void nested_loop(
+    TeamMDRangeMode<TeamMDRangeLastNestLevel::NotLastNestLevel,
+                    TeamMDRangeParThread::NotParThread,
+                    TeamMDRangeParVector::NotParVector> const,
+    TeamMDRangeNestingTracker<Rank, ParThreadNestLevel, ParVectorNestLevel,
+                              CurrentNestLevel>,
+    Policy const& policy, Lambda const& lambda, ReducerValueType&& val,
+    Args... args) {
+  constexpr int next_nest_level =
+      CurrentNestLevel + (Rank::outer_direction == Iterate::Right ? 1 : -1);
+  using NextNestingTracker =
+      TeamMDRangeNestingTracker<Rank, ParThreadNestLevel, ParVectorNestLevel,
+                                next_nest_level>;
+  using TeamMDNextMode = typename NextNestingTracker::RangeMode;
+
+  for (int i = 0; i != policy.boundaries[CurrentNestLevel]; ++i) {
+    if constexpr (Rank::outer_direction == Iterate::Right) {
+      nested_loop(TeamMDNextMode(), NextNestingTracker(), policy, lambda,
+                  std::forward<ReducerValueType>(val), args..., i);
+    } else {
+      nested_loop(TeamMDNextMode(), NextNestingTracker(), policy, lambda,
+                  std::forward<ReducerValueType>(val), i, args...);
+    }
+  }
+}
+
+template <TeamMDRangeParThread ParThread, TeamMDRangeParVector ParVector,
+          typename Rank, int ParThreadNestLevel, int ParVectorNestLevel,
+          int CurrentNestLevel, typename Policy, typename Lambda,
+          typename ReducerValueType, typename... Args>
+KOKKOS_INLINE_FUNCTION void nested_loop(
+    TeamMDRangeMode<TeamMDRangeLastNestLevel::NotLastNestLevel, ParThread,
+                    ParVector> const mode,
+    TeamMDRangeNestingTracker<Rank, ParThreadNestLevel, ParVectorNestLevel,
+                              CurrentNestLevel>,
+    Policy const& policy, Lambda const& lambda, ReducerValueType&& val,
+    Args... args) {
+  constexpr int next_nest_level =
+      CurrentNestLevel + (Rank::outer_direction == Iterate::Right ? 1 : -1);
+  using NextNestingTracker =
+      TeamMDRangeNestingTracker<Rank, ParThreadNestLevel, ParVectorNestLevel,
+                                next_nest_level>;
+  using TeamMDNextMode = typename NextNestingTracker::RangeMode;
+
+  // This recursively processes ranks from [0..TotalNestLevel-1]
+  // args... is passed by value because it should always be ints
+  parallel_for(
+      nested_policy(mode, policy.team, policy.boundaries[CurrentNestLevel]),
+      [&](int const& i) {
+        if constexpr (Rank::outer_direction == Iterate::Right) {
+          nested_loop(TeamMDNextMode(), NextNestingTracker(), policy, lambda,
+                      std::forward<ReducerValueType>(val), args..., i);
+        } else {
+          nested_loop(TeamMDNextMode(), NextNestingTracker(), policy, lambda,
+                      std::forward<ReducerValueType>(val), i, args...);
+        }
+      });
+}
+
+template <typename Rank, typename TeamMDPolicy, typename Lambda,
+          typename ReductionValueType>
+KOKKOS_INLINE_FUNCTION void md_parallel_impl(TeamMDPolicy const& policy,
+                                             Lambda const& lambda,
+                                             ReductionValueType&& val) {
+  static_assert(TeamMDPolicy::total_nest_level >= 2 &&
+                TeamMDPolicy::total_nest_level <= 8);
+
+  using TeamHandle = typename TeamMDPolicy::TeamHandleType;
+
+  constexpr auto total_nest_level = TeamMDPolicy::total_nest_level;
+  constexpr auto iter             = TeamMDPolicy::iter;
+  constexpr auto thread_and_vector =
+      ((TeamMDPolicy::par_thread == Impl::TeamMDRangeParThread::ParThread) &&
+       (TeamMDPolicy::par_vector == Impl::TeamMDRangeParVector::ParVector))
+          ? Impl::TeamMDRangeThreadAndVector::Both
+          : Impl::TeamMDRangeThreadAndVector::NotBoth;
+  constexpr auto begin_rank =
+      (iter == Iterate::Right) ? 0 : (total_nest_level - 1);
+
+  using ThreadAndVectorNestLevel =
+      Impl::ThreadAndVectorNestLevel<Rank, typename TeamHandle::execution_space,
+                                     thread_and_vector>;
+
+  constexpr auto par_thread_nest_level =
+      (TeamMDPolicy::par_thread == TeamMDRangeParThread::ParThread)
+          ? ThreadAndVectorNestLevel::par_rt
+          : ThreadAndVectorNestLevel::invalid;
+  constexpr auto par_vector_nest_level =
+      (TeamMDPolicy::par_vector == TeamMDRangeParVector::ParVector)
+          ? ThreadAndVectorNestLevel::par_rv
+          : ThreadAndVectorNestLevel::invalid;
+
+  using InitNestingTracker =
+      TeamMDRangeNestingTracker<Rank, par_thread_nest_level,
+                                par_vector_nest_level, begin_rank>;
+
+  using InitTeamMDMode = typename InitNestingTracker::RangeMode;
+
+  nested_loop(InitTeamMDMode(), InitNestingTracker(), policy, lambda,
+              std::forward<ReductionValueType>(val));
+}
+
+}  // namespace Impl
+
+}  // namespace Kokkos
+
+#endif
diff --git a/packages/kokkos/core/src/impl/Kokkos_Tools.hpp b/packages/kokkos/core/src/impl/Kokkos_Tools.hpp
index 8d6ec64685ee51ed2320e31bf7b8ee535d5f2c28..fbc648175d69e53356ff8ca12db4f79a77283ca9 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Tools.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Tools.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /**
  * Header file to include all of Kokkos Tooling support
diff --git a/packages/kokkos/core/src/impl/Kokkos_Tools_Generic.hpp b/packages/kokkos/core/src/impl/Kokkos_Tools_Generic.hpp
index 702fc0997bf96fb7a85b282c559ba57111b9faa0..4ccb64ce4f410ebfbf32341b2fd1272a9e954686 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Tools_Generic.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Tools_Generic.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_KOKKOS_TOOLS_GENERIC_HPP
 #define KOKKOS_IMPL_KOKKOS_TOOLS_GENERIC_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_Traits.hpp b/packages/kokkos/core/src/impl/Kokkos_Traits.hpp
index 38edc118db6e62d8a7602e90e6c3b18cd9dc8722..45ee60e931d882379900036669effe9d09120650 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Traits.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Traits.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOSTRAITS_HPP
 #define KOKKOSTRAITS_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_Utilities.hpp b/packages/kokkos/core/src/impl/Kokkos_Utilities.hpp
index 37b74103d3c6c1a158fe6d64da2a2aeb407902d4..c3504ffce5a783f9523cbaf40bb3149ace6934d4 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Utilities.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Utilities.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CORE_IMPL_UTILITIES_HPP
 #define KOKKOS_CORE_IMPL_UTILITIES_HPP
@@ -57,28 +29,25 @@
 namespace Kokkos {
 namespace Impl {
 
+template <typename... Is>
+struct always_true : std::true_type {};
+
+//==============================================================================
+
+#if defined(__cpp_lib_type_identity)
+// since C++20
+using std::type_identity;
+using std::type_identity_t;
+#else
 template <typename T>
-struct identity {
+struct type_identity {
   using type = T;
 };
 
 template <typename T>
-using identity_t = typename identity<T>::type;
-
-template <typename... Is>
-struct always_true : std::true_type {};
-
-#if defined(__cpp_lib_void_t)
-// since C++17
-using std::void_t;
-#else
-template <class...>
-using void_t = void;
+using type_identity_t = typename type_identity<T>::type;
 #endif
 
-//==============================================================================
-// <editor-fold desc="remove_cvref_t"> {{{1
-
 #if defined(__cpp_lib_remove_cvref)
 // since C++20
 using std::remove_cvref;
@@ -93,9 +62,6 @@ template <class T>
 using remove_cvref_t = typename remove_cvref<T>::type;
 #endif
 
-// </editor-fold> end remove_cvref_t }}}1
-//==============================================================================
-
 //==============================================================================
 // <editor-fold desc="is_specialization_of"> {{{1
 
@@ -108,26 +74,6 @@ struct is_specialization_of<Template<Args...>, Template> : std::true_type {};
 // </editor-fold> end is_specialization_of }}}1
 //==============================================================================
 
-//==============================================================================
-// <editor-fold desc="Folding emulation"> {{{1
-
-// acts like void for comma fold emulation
-struct _fold_comma_emulation_return {};
-
-template <class... Ts>
-constexpr KOKKOS_INLINE_FUNCTION _fold_comma_emulation_return
-emulate_fold_comma_operator(Ts&&...) noexcept {
-  return _fold_comma_emulation_return{};
-}
-
-#define KOKKOS_IMPL_FOLD_COMMA_OPERATOR(expr)                                \
-  ::Kokkos::Impl::emulate_fold_comma_operator(                               \
-      ::std::initializer_list<::Kokkos::Impl::_fold_comma_emulation_return>{ \
-          ((expr), ::Kokkos::Impl::_fold_comma_emulation_return{})...})
-
-// </editor-fold> end Folding emulation }}}1
-//==============================================================================
-
 //==============================================================================
 // destruct_delete is a unique_ptr deleter for objects
 // created by placement new into already allocated memory
@@ -176,7 +122,7 @@ struct _type_list_remove_first_impl<Entry, type_list<Entry, Ts...>,
 
 template <class Entry, class... OutTs>
 struct _type_list_remove_first_impl<Entry, type_list<>, type_list<OutTs...>>
-    : identity<type_list<OutTs...>> {};
+    : type_identity<type_list<OutTs...>> {};
 
 template <class Entry, class List>
 struct type_list_remove_first
@@ -191,23 +137,9 @@ struct type_list_remove_first
 template <template <class> class UnaryPred, class List>
 struct type_list_any;
 
-#ifdef KOKKOS_ENABLE_CXX17
 template <template <class> class UnaryPred, class... Ts>
 struct type_list_any<UnaryPred, type_list<Ts...>>
     : std::bool_constant<(UnaryPred<Ts>::value || ...)> {};
-#else
-template <template <class> class UnaryPred, class T, class... Ts>
-struct type_list_any<UnaryPred, type_list<T, Ts...>> {
-  using type = typename std::conditional_t<
-      UnaryPred<T>::value, std::true_type,
-      type_list_any<UnaryPred, type_list<Ts...>>>::type;
-  static constexpr auto value = type::value;
-};
-
-template <template <class> class UnaryPred>
-struct type_list_any<UnaryPred, type_list<>> : std::false_type {};
-
-#endif
 
 // </editor-fold> end type_list_any }}}2
 //------------------------------------------------------------------------------
@@ -263,6 +195,15 @@ using filter_type_list_t =
 // </editor-fold> end type_list }}}1
 //==============================================================================
 
+//==============================================================================
+// The weird !sizeof(F*) to express false is to make the
+// expression dependent on the type of F, and thus only applicable
+// at instantiation and not first-pass semantic analysis of the
+// template definition.
+template <typename T>
+constexpr bool dependent_false_v = !sizeof(T*);
+//==============================================================================
+
 }  // namespace Impl
 }  // namespace Kokkos
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_VLAEmulation.hpp b/packages/kokkos/core/src/impl/Kokkos_VLAEmulation.hpp
index 6773263340274928f1baa4bbe3308755ba2494e2..6009e132014569460334e11d0bd508e3d21a9299 100644
--- a/packages/kokkos/core/src/impl/Kokkos_VLAEmulation.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_VLAEmulation.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_VLAEMULATION_HPP
 #define KOKKOS_IMPL_VLAEMULATION_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_ViewArray.hpp b/packages/kokkos/core/src/impl/Kokkos_ViewArray.hpp
index 12a5fa288fdb1951ceed0a062387a80df45f2e89..c76bde49933442b9a6ef24905aeea5ab8dea41cf 100644
--- a/packages/kokkos/core/src/impl/Kokkos_ViewArray.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_ViewArray.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_EXPERIMENTAL_VIEW_ARRAY_MAPPING_HPP
 #define KOKKOS_EXPERIMENTAL_VIEW_ARRAY_MAPPING_HPP
@@ -356,6 +328,8 @@ class ViewMapping<Traits, Kokkos::Array<>> {
 
     using execution_space = typename alloc_prop::execution_space;
     using memory_space    = typename Traits::memory_space;
+    static_assert(
+        SpaceAccessibility<execution_space, memory_space>::accessible);
     using functor_type =
         ViewValueFunctor<typename Traits::device_type, scalar_type>;
     using record_type =
@@ -370,18 +344,11 @@ class ViewMapping<Traits, Kokkos::Array<>> {
     const size_t alloc_size =
         (m_impl_offset.span() * Array_N * MemorySpanSize + MemorySpanMask) &
         ~size_t(MemorySpanMask);
-    const auto &alloc_name =
-        static_cast<Kokkos::Impl::ViewCtorProp<void, std::string> const &>(
-            arg_prop)
-            .value;
+    const auto &alloc_name = Impl::get_property<Impl::LabelTag>(arg_prop);
     const execution_space &exec_space =
-        static_cast<Kokkos::Impl::ViewCtorProp<void, execution_space> const &>(
-            arg_prop)
-            .value;
+        Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop);
     const memory_space &mem_space =
-        static_cast<Kokkos::Impl::ViewCtorProp<void, memory_space> const &>(
-            arg_prop)
-            .value;
+        Impl::get_property<Impl::MemorySpaceTag>(arg_prop);
 
     // Allocate memory from the memory space and create tracking record.
     record_type *const record =
@@ -390,22 +357,36 @@ class ViewMapping<Traits, Kokkos::Array<>> {
                                     alloc_size)
             : record_type::allocate(mem_space, alloc_name, alloc_size);
 
-    if (alloc_size) {
-      m_impl_handle =
-          handle_type(reinterpret_cast<pointer_type>(record->data()));
-
-      if (alloc_prop::initialize) {
-        // The functor constructs and destroys
-        record->m_destroy =
-            execution_space_specified
-                ? functor_type(exec_space, (pointer_type)m_impl_handle,
-                               m_impl_offset.span() * Array_N, alloc_name)
-                : functor_type((pointer_type)m_impl_handle,
-                               m_impl_offset.span() * Array_N, alloc_name);
+    m_impl_handle = handle_type(reinterpret_cast<pointer_type>(record->data()));
 
+    functor_type functor =
+        execution_space_specified
+            ? functor_type(exec_space, (pointer_type)m_impl_handle,
+                           m_impl_offset.span() * Array_N, alloc_name)
+            : functor_type((pointer_type)m_impl_handle,
+                           m_impl_offset.span() * Array_N, alloc_name);
+
+#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \
+    defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENMPTARGET)
+    if (false) {
+      // Make sure the destroy functor gets instantiated.
+      // This avoids "cudaErrorInvalidDeviceFunction"-type errors.
+      functor.destroy_shared_allocation();
+    }
+#endif
+
+    //  Only initialize if the allocation is non-zero.
+    //  May be zero if one of the dimensions is zero.
+    if constexpr (alloc_prop::initialize)
+      if (alloc_size) {
+        // Assume destruction is only required when construction is requested.
+        // The ViewValueFunctor has both value construction and destruction
+        // operators.
+        record->m_destroy = std::move(functor);
+
+        // Construct values
         record->m_destroy.construct_shared_allocation();
       }
-    }
 
     return record;
   }
diff --git a/packages/kokkos/core/src/impl/Kokkos_ViewCtor.hpp b/packages/kokkos/core/src/impl/Kokkos_ViewCtor.hpp
index 8bc8f8686487212d5ac380f35447e2ad0d6a5752..92c17d0cf568b9a3dc179dec07f2dcd7c7c33b8d 100644
--- a/packages/kokkos/core/src/impl/Kokkos_ViewCtor.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_ViewCtor.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_EXPERIMENTAL_IMPL_VIEW_CTOR_PROP_HPP
 #define KOKKOS_EXPERIMENTAL_IMPL_VIEW_CTOR_PROP_HPP
@@ -102,27 +74,14 @@ struct ViewCtorProp<void, CommonViewAllocProp<Specialize, T>> {
 
   using type = CommonViewAllocProp<Specialize, T>;
 
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   ViewCtorProp(const type &arg) : value(arg) {}
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   ViewCtorProp(type &&arg) : value(arg) {}
 
   type value;
 };
 
-/*  std::integral_constant<unsigned,I> are dummy arguments
- *  that avoid duplicate base class errors
- */
-template <unsigned I>
-struct ViewCtorProp<void, std::integral_constant<unsigned, I>> {
-  ViewCtorProp()                     = default;
-  ViewCtorProp(const ViewCtorProp &) = default;
-  ViewCtorProp &operator=(const ViewCtorProp &) = default;
-
-  template <typename P>
-  KOKKOS_INLINE_FUNCTION ViewCtorProp(const P &) {}
-};
-
 /* Property flags have constexpr value */
 template <typename P>
 struct ViewCtorProp<
@@ -178,7 +137,7 @@ struct ViewCtorProp<void, T *> {
 
   using type = T *;
 
-  KOKKOS_INLINE_FUNCTION
+  KOKKOS_FUNCTION
   ViewCtorProp(const type arg) : value(arg) {}
 
   type value;
@@ -187,19 +146,20 @@ struct ViewCtorProp<void, T *> {
 // For some reason I don't understand I needed this specialization explicitly
 // for NVCC/MSVC
 template <typename T>
-struct ViewCtorProp<T *> {
-  ViewCtorProp()                     = default;
-  ViewCtorProp(const ViewCtorProp &) = default;
-  ViewCtorProp &operator=(const ViewCtorProp &) = default;
-
-  using type = T *;
-
-  KOKKOS_INLINE_FUNCTION
-  ViewCtorProp(const type arg) : value(arg) {}
-
-  enum : bool { has_pointer = true };
-  using pointer_type = type;
-  type value;
+struct ViewCtorProp<T *> : public ViewCtorProp<void, T *> {
+  static constexpr bool has_memory_space    = false;
+  static constexpr bool has_execution_space = false;
+  static constexpr bool has_pointer         = true;
+  static constexpr bool has_label           = false;
+  static constexpr bool allow_padding       = false;
+  static constexpr bool initialize          = true;
+
+  using memory_space    = void;
+  using execution_space = void;
+  using pointer_type    = T *;
+
+  KOKKOS_FUNCTION ViewCtorProp(const pointer_type arg)
+      : ViewCtorProp<void, pointer_type>(arg) {}
 };
 
 // If we use `ViewCtorProp<Args...>` and `ViewCtorProp<void, Args>...` directly
@@ -230,14 +190,15 @@ struct ViewCtorProp : public ViewCtorProp<void, P>... {
 
  public:
   /* Flags for the common properties */
-  enum { has_memory_space = var_memory_space::value };
-  enum { has_execution_space = var_execution_space::value };
-  enum { has_pointer = var_pointer::value };
-  enum { has_label = Kokkos::Impl::has_type<std::string, P...>::value };
-  enum { allow_padding = Kokkos::Impl::has_type<AllowPadding_t, P...>::value };
-  enum {
-    initialize = !Kokkos::Impl::has_type<WithoutInitializing_t, P...>::value
-  };
+  static constexpr bool has_memory_space    = var_memory_space::value;
+  static constexpr bool has_execution_space = var_execution_space::value;
+  static constexpr bool has_pointer         = var_pointer::value;
+  static constexpr bool has_label =
+      Kokkos::Impl::has_type<std::string, P...>::value;
+  static constexpr bool allow_padding =
+      Kokkos::Impl::has_type<AllowPadding_t, P...>::value;
+  static constexpr bool initialize =
+      !Kokkos::Impl::has_type<WithoutInitializing_t, P...>::value;
 
   using memory_space    = typename var_memory_space::type;
   using execution_space = typename var_execution_space::type;
@@ -250,12 +211,12 @@ struct ViewCtorProp : public ViewCtorProp<void, P>... {
   inline ViewCtorProp(Args const &... args) : ViewCtorProp<void, P>(args)... {}
 
   template <typename... Args>
-  KOKKOS_INLINE_FUNCTION ViewCtorProp(pointer_type arg0, Args const &... args)
+  KOKKOS_FUNCTION ViewCtorProp(pointer_type arg0, Args const &... args)
       : ViewCtorProp<void, pointer_type>(arg0),
         ViewCtorProp<void, typename ViewCtorProp<void, Args>::type>(args)... {}
 
   /* Copy from a matching property subset */
-  KOKKOS_INLINE_FUNCTION ViewCtorProp(pointer_type arg0)
+  KOKKOS_FUNCTION ViewCtorProp(pointer_type arg0)
       : ViewCtorProp<void, pointer_type>(arg0) {}
 
   // If we use `ViewCtorProp<Args...>` and `ViewCtorProp<void, Args>...` here
@@ -273,6 +234,117 @@ struct ViewCtorProp : public ViewCtorProp<void, P>... {
   }
 };
 
+template <typename... P>
+auto with_properties_if_unset(const ViewCtorProp<P...> &view_ctor_prop) {
+  return view_ctor_prop;
+}
+
+template <typename... P, typename Property, typename... Properties>
+auto with_properties_if_unset(const ViewCtorProp<P...> &view_ctor_prop,
+                              [[maybe_unused]] const Property &property,
+                              const Properties &... properties) {
+  if constexpr ((is_execution_space<Property>::value &&
+                 !ViewCtorProp<P...>::has_execution_space) ||
+                (is_memory_space<Property>::value &&
+                 !ViewCtorProp<P...>::has_memory_space) ||
+                (is_view_label<Property>::value &&
+                 !ViewCtorProp<P...>::has_label) ||
+                (std::is_same_v<Property, WithoutInitializing_t> &&
+                 ViewCtorProp<P...>::initialize)) {
+    using NewViewCtorProp = ViewCtorProp<P..., Property>;
+    NewViewCtorProp new_view_ctor_prop(view_ctor_prop);
+    static_cast<ViewCtorProp<void, Property> &>(new_view_ctor_prop).value =
+        property;
+    return with_properties_if_unset(new_view_ctor_prop, properties...);
+  } else
+    return with_properties_if_unset(view_ctor_prop, properties...);
+
+// A workaround placed to prevent spurious "missing return statement at the
+// end of non-void function" warnings from CUDA builds (issue #5470). Because
+// KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK removes [[noreturn]] attribute from
+// cuda_abort(), an unreachable while(true); is placed as a fallback method
+#if (defined(KOKKOS_COMPILER_NVCC) && (KOKKOS_COMPILER_NVCC < 1150)) || \
+    (defined(KOKKOS_COMPILER_INTEL) && (KOKKOS_COMPILER_INTEL <= 2100))
+  Kokkos::abort(
+      "Prevents an incorrect warning: missing return statement at end of "
+      "non-void function");
+#ifdef KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK
+  while (true)
+    ;
+#endif
+#endif
+}
+
+struct ExecutionSpaceTag {};
+struct MemorySpaceTag {};
+struct LabelTag {};
+struct PointerTag {};
+
+template <typename Tag, typename... P>
+KOKKOS_FUNCTION const auto &get_property(
+    const ViewCtorProp<P...> &view_ctor_prop) {
+  if constexpr (std::is_same_v<Tag, ExecutionSpaceTag>) {
+    static_assert(ViewCtorProp<P...>::has_execution_space);
+    using execution_space_type = typename ViewCtorProp<P...>::execution_space;
+    return static_cast<const ViewCtorProp<void, execution_space_type> &>(
+               view_ctor_prop)
+        .value;
+  } else if constexpr (std::is_same_v<Tag, MemorySpaceTag>) {
+    static_assert(ViewCtorProp<P...>::has_memory_space);
+    using memory_space_type = typename ViewCtorProp<P...>::memory_space;
+    return static_cast<const ViewCtorProp<void, memory_space_type> &>(
+               view_ctor_prop)
+        .value;
+  } else if constexpr (std::is_same_v<Tag, LabelTag>) {
+    static_assert(ViewCtorProp<P...>::has_label);
+    return static_cast<const ViewCtorProp<void, std::string> &>(view_ctor_prop)
+        .value;
+  } else if constexpr (std::is_same_v<Tag, PointerTag>) {
+    static_assert(ViewCtorProp<P...>::has_pointer);
+    using pointer_type = typename ViewCtorProp<P...>::pointer_type;
+    return static_cast<const ViewCtorProp<void, pointer_type> &>(view_ctor_prop)
+        .value;
+  } else {
+    static_assert(std::is_same_v<Tag, void>, "Invalid property tag!");
+    return view_ctor_prop;
+  }
+
+// A workaround placed to prevent spurious "missing return statement at the
+// end of non-void function" warnings from CUDA builds (issue #5470). Because
+// KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK removes [[noreturn]] attribute from
+// cuda_abort(), an unreachable while(true); is placed as a fallback method
+#if (defined(KOKKOS_COMPILER_NVCC) && (KOKKOS_COMPILER_NVCC < 1150)) || \
+    (defined(KOKKOS_COMPILER_INTEL) && (KOKKOS_COMPILER_INTEL <= 2100))
+  Kokkos::abort(
+      "Prevents an incorrect warning: missing return statement at end of "
+      "non-void function");
+#ifdef KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK
+  while (true)
+    ;
+#endif
+#endif
+}
+#if defined(KOKKOS_COMPILER_NVCC) && (KOKKOS_COMPILER_NVCC < 1150)
+// pragma pop is getting a warning from the underlying GCC
+// for unknown pragma if -pedantic is used
+#ifdef __CUDA_ARCH__
+#pragma pop
+#endif
+#endif
+#ifdef KOKKOS_IMPL_INTEL_BOGUS_MISSING_RETURN_STATEMENT_AT_END_OF_NON_VOID_FUNCTION
+#pragma warning(pop)
+#undef KOKKOS_IMPL_INTEL_BOGUS_MISSING_RETURN_STATEMENT_AT_END_OF_NON_VOID_FUNCTION
+#endif
+
+template <typename Tag, typename... P>
+KOKKOS_FUNCTION auto &get_property(ViewCtorProp<P...> &view_ctor_prop) {
+  // Avoid code duplication by deferring to the const-qualified overload and
+  // casting the const away from the return type
+  const auto &tmp = get_property<Tag>(
+      static_cast<const ViewCtorProp<P...> &>(view_ctor_prop));
+  return const_cast<std::decay_t<decltype(tmp)> &>(tmp);
+}
+
 } /* namespace Impl */
 } /* namespace Kokkos */
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_ViewLayoutTiled.hpp b/packages/kokkos/core/src/impl/Kokkos_ViewLayoutTiled.hpp
index 8d367cebab75bfb71cdcce5bf415fc0ae36642dc..957717f973d1218236e91ba625781f1c12c35209 100644
--- a/packages/kokkos/core/src/impl/Kokkos_ViewLayoutTiled.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_ViewLayoutTiled.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_EXPERIMENTAL_VIEWLAYOUTTILE_HPP
 #define KOKKOS_EXPERIMENTAL_VIEWLAYOUTTILE_HPP
@@ -184,7 +156,7 @@ struct ViewOffset<
 
   //----------------------------------------
 
-#define DEBUG_OUTPUT_CHECK 0
+#define KOKKOS_IMPL_DEBUG_OUTPUT_CHECK 0
 
   // Rank 2
   template <typename I0, typename I1>
@@ -201,7 +173,7 @@ struct ViewOffset<
                             : (((i0 & MASK_0) << SHIFT_1) + (i1 & MASK_1));
     //                     ( tile_dim[1] * li0         +  li1 )
 
-#if DEBUG_OUTPUT_CHECK
+#if KOKKOS_IMPL_DEBUG_OUTPUT_CHECK
     std::cout << "Am I Outer Left? "
               << (outer_pattern == (Kokkos::Iterate::Left)) << std::endl;
     std::cout << "Am I Inner Left? "
@@ -235,7 +207,7 @@ struct ViewOffset<
                             : (((i0 & MASK_0) << (SHIFT_2 + SHIFT_1)) +
                                ((i1 & MASK_1) << (SHIFT_2)) + (i2 & MASK_2));
 
-#if DEBUG_OUTPUT_CHECK
+#if KOKKOS_IMPL_DEBUG_OUTPUT_CHECK
     std::cout << "Am I Outer Left? "
               << (outer_pattern == (Kokkos::Iterate::Left)) << std::endl;
     std::cout << "Am I Inner Left? "
diff --git a/packages/kokkos/core/src/impl/Kokkos_ViewMapping.hpp b/packages/kokkos/core/src/impl/Kokkos_ViewMapping.hpp
index 994dd0b2adf65d9a2440abeb5c4930b43a662d54..3ab8237cd1501d66c37a8fb8093fb53e676ead91 100644
--- a/packages/kokkos/core/src/impl/Kokkos_ViewMapping.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_ViewMapping.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_EXPERIMENTAL_VIEW_MAPPING_HPP
 #define KOKKOS_EXPERIMENTAL_VIEW_MAPPING_HPP
@@ -2890,25 +2862,27 @@ struct ViewValueFunctor;
 
 template <class DeviceType, class ValueType>
 struct ViewValueFunctor<DeviceType, ValueType, false /* is_scalar */> {
-  using ExecSpace  = typename DeviceType::execution_space;
-  using PolicyType = Kokkos::RangePolicy<ExecSpace, Kokkos::IndexType<int64_t>>;
+  using ExecSpace = typename DeviceType::execution_space;
+
+  struct DestroyTag {};
+  struct ConstructTag {};
 
   ExecSpace space;
   ValueType* ptr;
   size_t n;
-  bool destroy;
   std::string name;
   bool default_exec_space;
 
+  template <class _ValueType = ValueType>
   KOKKOS_INLINE_FUNCTION
-  void operator()(const size_t i) const {
-    if (destroy) {
-      (ptr + i)->~ValueType();
-    }  // KOKKOS_IMPL_CUDA_CLANG_WORKAROUND this line causes ptax error
-       // __cxa_begin_catch in nested_view unit-test
-    else {
-      new (ptr + i) ValueType();
-    }
+      std::enable_if_t<std::is_default_constructible<_ValueType>::value>
+      operator()(ConstructTag const&, const size_t i) const {
+    new (ptr + i) ValueType();
+  }
+
+  KOKKOS_INLINE_FUNCTION void operator()(DestroyTag const&,
+                                         const size_t i) const {
+    (ptr + i)->~ValueType();
   }
 
   ViewValueFunctor()                        = default;
@@ -2920,18 +2894,20 @@ struct ViewValueFunctor<DeviceType, ValueType, false /* is_scalar */> {
       : space(arg_space),
         ptr(arg_ptr),
         n(arg_n),
-        destroy(false),
         name(std::move(arg_name)),
-        default_exec_space(false) {}
+        default_exec_space(false) {
+    functor_instantiate_workaround();
+  }
 
   ViewValueFunctor(ValueType* const arg_ptr, size_t const arg_n,
                    std::string arg_name)
       : space(ExecSpace{}),
         ptr(arg_ptr),
         n(arg_n),
-        destroy(false),
         name(std::move(arg_name)),
-        default_exec_space(true) {}
+        default_exec_space(true) {
+    functor_instantiate_workaround();
+  }
 
   template <typename Dummy = ValueType>
   std::enable_if_t<std::is_trivial<Dummy>::value &&
@@ -2966,7 +2942,7 @@ struct ViewValueFunctor<DeviceType, ValueType, false /* is_scalar */> {
         space.fence("Kokkos::Impl::ViewValueFunctor: View init/destroy fence");
     } else {
 #endif
-      parallel_for_implementation(false);
+      parallel_for_implementation<ConstructTag>();
 #ifndef KOKKOS_ARCH_A64FX
     }
 #endif
@@ -2976,22 +2952,24 @@ struct ViewValueFunctor<DeviceType, ValueType, false /* is_scalar */> {
   std::enable_if_t<!(std::is_trivial<Dummy>::value &&
                      std::is_trivially_copy_assignable<ValueType>::value)>
   construct_dispatch() {
-    parallel_for_implementation(false);
+    parallel_for_implementation<ConstructTag>();
   }
 
-  void parallel_for_implementation(bool arg) {
-    destroy = arg;
+  template <typename Tag>
+  void parallel_for_implementation() {
     if (!space.in_parallel()) {
-      PolicyType policy(0, n);
-      std::string functor_name;
+      using PolicyType =
+          Kokkos::RangePolicy<ExecSpace, Kokkos::IndexType<int64_t>, Tag>;
+      PolicyType policy(space, 0, n);
       uint64_t kpID = 0;
       if (Kokkos::Profiling::profileLibraryLoaded()) {
-        functor_name =
-            (destroy ? "Kokkos::View::destruction [" + functor_name + "]"
-                     : "Kokkos::View::initialization [" + functor_name + "]");
+        const std::string functor_name =
+            (std::is_same_v<Tag, DestroyTag>
+                 ? "Kokkos::View::destruction [" + name + "]"
+                 : "Kokkos::View::initialization [" + name + "]");
         Kokkos::Profiling::beginParallelFor(
-            "Kokkos::View::initialization [" + functor_name + "]",
-            Kokkos::Profiling::Experimental::device_id(space), &kpID);
+            functor_name, Kokkos::Profiling::Experimental::device_id(space),
+            &kpID);
       }
 
 #ifdef KOKKOS_ENABLE_CUDA
@@ -3003,19 +2981,33 @@ struct ViewValueFunctor<DeviceType, ValueType, false /* is_scalar */> {
       const Kokkos::Impl::ParallelFor<ViewValueFunctor, PolicyType> closure(
           *this, policy);
       closure.execute();
-      if (default_exec_space || destroy)
+      if (default_exec_space || std::is_same_v<Tag, DestroyTag>)
         space.fence("Kokkos::Impl::ViewValueFunctor: View init/destroy fence");
       if (Kokkos::Profiling::profileLibraryLoaded()) {
         Kokkos::Profiling::endParallelFor(kpID);
       }
     } else {
-      for (size_t i = 0; i < n; ++i) operator()(i);
+      for (size_t i = 0; i < n; ++i) operator()(Tag{}, i);
     }
   }
 
   void construct_shared_allocation() { construct_dispatch(); }
 
-  void destroy_shared_allocation() { parallel_for_implementation(true); }
+  void destroy_shared_allocation() {
+    parallel_for_implementation<DestroyTag>();
+  }
+
+  // This function is to ensure that the functor with DestroyTag is instantiated
+  // This is a workaround to avoid "cudaErrorInvalidDeviceFunction" error later
+  // when the function is queried with cudaFuncGetAttributes
+  void functor_instantiate_workaround() {
+#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \
+    defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENMPTARGET)
+    if (false) {
+      parallel_for_implementation<DestroyTag>();
+    }
+#endif
+  }
 };
 
 template <class DeviceType, class ValueType>
@@ -3103,8 +3095,7 @@ struct ViewValueFunctor<DeviceType, ValueType, true /* is_scalar */> {
   void parallel_for_implementation() {
     if (!space.in_parallel()) {
       PolicyType policy(0, n);
-      std::string functor_name = "Kokkos::View::initialization [" + name + "]";
-      uint64_t kpID            = 0;
+      uint64_t kpID = 0;
       if (Kokkos::Profiling::profileLibraryLoaded()) {
         Kokkos::Profiling::beginParallelFor(
             "Kokkos::View::initialization [" + name + "]",
@@ -3392,9 +3383,7 @@ class ViewMapping<
   KOKKOS_INLINE_FUNCTION ViewMapping(
       Kokkos::Impl::ViewCtorProp<P...> const& arg_prop,
       typename Traits::array_layout const& arg_layout)
-      : m_impl_handle(
-            ((Kokkos::Impl::ViewCtorProp<void, pointer_type> const&)arg_prop)
-                .value),
+      : m_impl_handle(Impl::get_property<Impl::PointerTag>(arg_prop)),
         m_impl_offset(std::integral_constant<unsigned, 0>(), arg_layout) {}
 
   /**\brief  Assign data */
@@ -3417,7 +3406,9 @@ class ViewMapping<
 
     using execution_space = typename alloc_prop::execution_space;
     using memory_space    = typename Traits::memory_space;
-    using value_type      = typename Traits::value_type;
+    static_assert(
+        SpaceAccessibility<execution_space, memory_space>::accessible);
+    using value_type = typename Traits::value_type;
     using functor_type =
         ViewValueFunctor<Kokkos::Device<execution_space, memory_space>,
                          value_type>;
@@ -3436,17 +3427,11 @@ class ViewMapping<
         (m_impl_offset.span() * MemorySpanSize + MemorySpanMask) &
         ~size_t(MemorySpanMask);
     const std::string& alloc_name =
-        static_cast<Kokkos::Impl::ViewCtorProp<void, std::string> const&>(
-            arg_prop)
-            .value;
+        Impl::get_property<Impl::LabelTag>(arg_prop);
     const execution_space& exec_space =
-        static_cast<Kokkos::Impl::ViewCtorProp<void, execution_space> const&>(
-            arg_prop)
-            .value;
+        Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop);
     const memory_space& mem_space =
-        static_cast<Kokkos::Impl::ViewCtorProp<void, memory_space> const&>(
-            arg_prop)
-            .value;
+        Impl::get_property<Impl::MemorySpaceTag>(arg_prop);
 
     // Create shared memory tracking record with allocate memory from the memory
     // space
@@ -3458,22 +3443,25 @@ class ViewMapping<
 
     m_impl_handle = handle_type(reinterpret_cast<pointer_type>(record->data()));
 
+    functor_type functor =
+        execution_space_specified
+            ? functor_type(exec_space, (value_type*)m_impl_handle,
+                           m_impl_offset.span(), alloc_name)
+            : functor_type((value_type*)m_impl_handle, m_impl_offset.span(),
+                           alloc_name);
+
     //  Only initialize if the allocation is non-zero.
     //  May be zero if one of the dimensions is zero.
-    if (alloc_size && alloc_prop::initialize) {
-      // Assume destruction is only required when construction is requested.
-      // The ViewValueFunctor has both value construction and destruction
-      // operators.
-      record->m_destroy =
-          execution_space_specified
-              ? functor_type(exec_space, (value_type*)m_impl_handle,
-                             m_impl_offset.span(), alloc_name)
-              : functor_type((value_type*)m_impl_handle, m_impl_offset.span(),
-                             alloc_name);
-
-      // Construct values
-      record->m_destroy.construct_shared_allocation();
-    }
+    if constexpr (alloc_prop::initialize)
+      if (alloc_size) {
+        // Assume destruction is only required when construction is requested.
+        // The ViewValueFunctor has both value construction and destruction
+        // operators.
+        record->m_destroy = std::move(functor);
+
+        // Construct values
+        record->m_destroy.construct_shared_allocation();
+      }
 
     return record;
   }
diff --git a/packages/kokkos/core/src/impl/Kokkos_ViewTracker.hpp b/packages/kokkos/core/src/impl/Kokkos_ViewTracker.hpp
index cfa30f6e7b053acc6af07b95e27d5e851613e8f7..43958db3900de84a925be1307fba59de59dcc353 100644
--- a/packages/kokkos/core/src/impl/Kokkos_ViewTracker.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_ViewTracker.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_VIEW_TRACKER_HPP
 #define KOKKOS_VIEW_TRACKER_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_ViewUniformType.hpp b/packages/kokkos/core/src/impl/Kokkos_ViewUniformType.hpp
index 13ed4df6a2f5d3aae474d45869482e98519df8df..7de2869a0d884c5f641ecfbbea345c27bb664df6 100644
--- a/packages/kokkos/core/src/impl/Kokkos_ViewUniformType.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_ViewUniformType.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_EXPERIMENTAL_VIEWUNIFORMTYPE_HPP
 #define KOKKOS_EXPERIMENTAL_VIEWUNIFORMTYPE_HPP
diff --git a/packages/kokkos/core/src/impl/Kokkos_Volatile_Load.hpp b/packages/kokkos/core/src/impl/Kokkos_Volatile_Load.hpp
index 4af26dcc91db449b58d460ef9f1e809da2bc5b9d..fa8dac4089b641ec8aeb5dbbe01bc07a659ed443 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Volatile_Load.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Volatile_Load.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Macros.hpp>
 
diff --git a/packages/kokkos/core/src/impl/Kokkos_hwloc.cpp b/packages/kokkos/core/src/impl/Kokkos_hwloc.cpp
index a0d1bc4cb446f706671fca7c6526bacdc2533168..230322177e8adc81f442d11021557637d1dafd0c 100644
--- a/packages/kokkos/core/src/impl/Kokkos_hwloc.cpp
+++ b/packages/kokkos/core/src/impl/Kokkos_hwloc.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
diff --git a/packages/kokkos/core/src/setup/Kokkos_Setup_Cuda.hpp b/packages/kokkos/core/src/setup/Kokkos_Setup_Cuda.hpp
index 983a71a561ec5da83311c83f3b005fc41259e872..d774914d9f4fa908d67d343ee2d539a871269f7e 100644
--- a/packages/kokkos/core/src/setup/Kokkos_Setup_Cuda.hpp
+++ b/packages/kokkos/core/src/setup/Kokkos_Setup_Cuda.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_CUDA_SETUP_HPP_
 #define KOKKOS_CUDA_SETUP_HPP_
@@ -84,18 +56,12 @@
 #ifdef KOKKOS_ENABLE_CUDA_LAMBDA
 #define KOKKOS_LAMBDA [=] __host__ __device__
 
-#if defined(KOKKOS_ENABLE_CXX17) || defined(KOKKOS_ENABLE_CXX20)
 #define KOKKOS_CLASS_LAMBDA [ =, *this ] __host__ __device__
-#endif
 
 #else  // !defined(KOKKOS_ENABLE_CUDA_LAMBDA)
 #undef KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA
 #endif  // !defined(KOKKOS_ENABLE_CUDA_LAMBDA)
 
-#if (10000 > CUDA_VERSION)
-#define KOKKOS_ENABLE_PRE_CUDA_10_DEPRECATION_API
-#endif
-
 #if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 700)
 // PTX atomics with memory order semantics are only available on volta and later
 #if !defined(KOKKOS_DISABLE_CUDA_ASM)
@@ -115,19 +81,5 @@
 #define KOKKOS_IMPL_FUNCTION __device__ __host__
 #define KOKKOS_IMPL_HOST_FUNCTION __host__
 #define KOKKOS_IMPL_DEVICE_FUNCTION __device__
-#if defined(KOKKOS_COMPILER_NVCC)
-#define KOKKOS_INLINE_FUNCTION_DELETED inline
-#else
-#define KOKKOS_INLINE_FUNCTION_DELETED __device__ __host__ inline
-#endif
-#if (CUDA_VERSION < 10000)
-#define KOKKOS_DEFAULTED_FUNCTION __host__ __device__ inline
-#else
-#define KOKKOS_DEFAULTED_FUNCTION inline
-#endif
-
-#if (CUDA_VERSION >= 10000)
-#define KOKKOS_CUDA_ENABLE_GRAPHS
-#endif
 
 #endif /* KOKKOS_CUDA_SETUP_HPP_ */
diff --git a/packages/kokkos/core/src/setup/Kokkos_Setup_HIP.hpp b/packages/kokkos/core/src/setup/Kokkos_Setup_HIP.hpp
index f1df2f87bb0a7911949442622e27cadaef466c1d..7b0186610707a1b561fdee79d100b9ba7d5d682e 100644
--- a/packages/kokkos/core/src/setup/Kokkos_Setup_HIP.hpp
+++ b/packages/kokkos/core/src/setup/Kokkos_Setup_HIP.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SETUP_HIP_HPP_
 #define KOKKOS_SETUP_HIP_HPP_
@@ -49,19 +21,14 @@
 
 #define KOKKOS_IMPL_HIP_CLANG_WORKAROUND
 
-#define HIP_ENABLE_PRINTF
 #include <hip/hip_runtime.h>
 #include <hip/hip_runtime_api.h>
 
 #define KOKKOS_LAMBDA [=] __host__ __device__
-#if defined(KOKKOS_ENABLE_CXX17) || defined(KOKKOS_ENABLE_CXX20)
 #define KOKKOS_CLASS_LAMBDA [ =, *this ] __host__ __device__
-#endif
 
 #define KOKKOS_IMPL_FORCEINLINE_FUNCTION __device__ __host__ __forceinline__
 #define KOKKOS_IMPL_INLINE_FUNCTION __device__ __host__ inline
-#define KOKKOS_DEFAULTED_FUNCTION __device__ __host__ inline
-#define KOKKOS_INLINE_FUNCTION_DELETED __device__ __host__ inline
 #define KOKKOS_IMPL_FUNCTION __device__ __host__
 #define KOKKOS_IMPL_HOST_FUNCTION __host__
 #define KOKKOS_IMPL_DEVICE_FUNCTION __device__
diff --git a/packages/kokkos/core/src/setup/Kokkos_Setup_SYCL.hpp b/packages/kokkos/core/src/setup/Kokkos_Setup_SYCL.hpp
index b203e9afb27b1c0d5b18b2a25c93e5d65a0d8e80..417f80f7f4df258679e03ed354ef1d51df4446f5 100644
--- a/packages/kokkos/core/src/setup/Kokkos_Setup_SYCL.hpp
+++ b/packages/kokkos/core/src/setup/Kokkos_Setup_SYCL.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SETUP_SYCL_HPP_
 #define KOKKOS_SETUP_SYCL_HPP_
@@ -54,7 +26,12 @@
 #define SYCL_FALLBACK_ASSERT 1
 #endif
 
+// FIXME_SYCL
+#if __has_include(<sycl/sycl.hpp>)
+#include <sycl/sycl.hpp>
+#else
 #include <CL/sycl.hpp>
+#endif
 
 #ifdef __SYCL_DEVICE_ONLY__
 #define KOKKOS_IMPL_DO_NOT_USE_PRINTF(format, ...)                \
diff --git a/packages/kokkos/core/src/traits/Kokkos_ExecutionSpaceTrait.hpp b/packages/kokkos/core/src/traits/Kokkos_ExecutionSpaceTrait.hpp
index cb2808698a279fbe9718d149d44af20c5a8dd0ef..a5c8ce1d3f38ea443683bb148f94cf8ca7661d04 100644
--- a/packages/kokkos/core/src/traits/Kokkos_ExecutionSpaceTrait.hpp
+++ b/packages/kokkos/core/src/traits/Kokkos_ExecutionSpaceTrait.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_EXECUTIONSPACETRAIT_HPP
 #define KOKKOS_KOKKOS_EXECUTIONSPACETRAIT_HPP
diff --git a/packages/kokkos/core/src/traits/Kokkos_GraphKernelTrait.hpp b/packages/kokkos/core/src/traits/Kokkos_GraphKernelTrait.hpp
index b16a7777cd598bf4326627346886b65cd22c45fe..64c469805bdd1fd267fcbbe6a0060f14504cc161 100644
--- a/packages/kokkos/core/src/traits/Kokkos_GraphKernelTrait.hpp
+++ b/packages/kokkos/core/src/traits/Kokkos_GraphKernelTrait.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_GRAPHKERNELTRAIT_HPP
 #define KOKKOS_KOKKOS_GRAPHKERNELTRAIT_HPP
diff --git a/packages/kokkos/core/src/traits/Kokkos_IndexTypeTrait.hpp b/packages/kokkos/core/src/traits/Kokkos_IndexTypeTrait.hpp
index 57f74d521b8e181ad3a1f3f7896c92d577a16f7c..91820fbccacfdf36f5e2aea36f056a915681d6a3 100644
--- a/packages/kokkos/core/src/traits/Kokkos_IndexTypeTrait.hpp
+++ b/packages/kokkos/core/src/traits/Kokkos_IndexTypeTrait.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_INDEXTYPETRAIT_HPP
 #define KOKKOS_KOKKOS_INDEXTYPETRAIT_HPP
diff --git a/packages/kokkos/core/src/traits/Kokkos_IterationPatternTrait.hpp b/packages/kokkos/core/src/traits/Kokkos_IterationPatternTrait.hpp
index 3c8ba47417252f35a31995fe4c671482c11b5756..2949d969ee01b2aefeca8ad14aebaf162ba9ae8b 100644
--- a/packages/kokkos/core/src/traits/Kokkos_IterationPatternTrait.hpp
+++ b/packages/kokkos/core/src/traits/Kokkos_IterationPatternTrait.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_ITERATIONPATTERNTRAIT_HPP
 #define KOKKOS_KOKKOS_ITERATIONPATTERNTRAIT_HPP
diff --git a/packages/kokkos/core/src/traits/Kokkos_LaunchBoundsTrait.hpp b/packages/kokkos/core/src/traits/Kokkos_LaunchBoundsTrait.hpp
index c20a883ddab7298b76c709e064134e0cefc95366..24bedbcc60da50b93d71c003b8af2aa4ebbaaec8 100644
--- a/packages/kokkos/core/src/traits/Kokkos_LaunchBoundsTrait.hpp
+++ b/packages/kokkos/core/src/traits/Kokkos_LaunchBoundsTrait.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_LAUNCHBOUNDSTRAIT_HPP
 #define KOKKOS_KOKKOS_LAUNCHBOUNDSTRAIT_HPP
diff --git a/packages/kokkos/core/src/traits/Kokkos_OccupancyControlTrait.hpp b/packages/kokkos/core/src/traits/Kokkos_OccupancyControlTrait.hpp
index b3328f8120cfce8018b579c3281ea3173cff24da..dadf582c3728fb0b241514b4af21ffd9b0ea1c1f 100644
--- a/packages/kokkos/core/src/traits/Kokkos_OccupancyControlTrait.hpp
+++ b/packages/kokkos/core/src/traits/Kokkos_OccupancyControlTrait.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_OCCUPANCYCONTROLTRAIT_HPP
 #define KOKKOS_KOKKOS_OCCUPANCYCONTROLTRAIT_HPP
@@ -102,10 +74,9 @@ struct OccupancyControlTrait : TraitSpecificationBase<OccupancyControlTrait> {
   using mixin_matching_trait =
       OccupancyControlPolicyMixin<OccControl, AnalyzeNextTrait>;
   template <class T>
-  using trait_matches_specification = std::integral_constant<
-      bool,
+  using trait_matches_specification = std::bool_constant<
       std::is_same<T, Kokkos::Experimental::DesiredOccupancy>::value ||
-          std::is_same<T, Kokkos::Experimental::MaximizeOccupancy>::value>;
+      std::is_same<T, Kokkos::Experimental::MaximizeOccupancy>::value>;
 };
 
 // </editor-fold> end Occupancy control trait specification }}}1
diff --git a/packages/kokkos/core/src/traits/Kokkos_PolicyTraitAdaptor.hpp b/packages/kokkos/core/src/traits/Kokkos_PolicyTraitAdaptor.hpp
index e500dd4e831abaa03479e9fb1e2fb67595107a9e..578e9e762adb7c0f2eef9fdd28f0aa0c80edb5d1 100644
--- a/packages/kokkos/core/src/traits/Kokkos_PolicyTraitAdaptor.hpp
+++ b/packages/kokkos/core/src/traits/Kokkos_PolicyTraitAdaptor.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <impl/Kokkos_Utilities.hpp>  // type_list
 
diff --git a/packages/kokkos/core/src/traits/Kokkos_PolicyTraitMatcher.hpp b/packages/kokkos/core/src/traits/Kokkos_PolicyTraitMatcher.hpp
index 31927320bf6fe77cc133e49a80e7f741574165a8..090022ec739803338dc9b6b20026d78c22fb5f81 100644
--- a/packages/kokkos/core/src/traits/Kokkos_PolicyTraitMatcher.hpp
+++ b/packages/kokkos/core/src/traits/Kokkos_PolicyTraitMatcher.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <impl/Kokkos_Utilities.hpp>  // type_list
 
diff --git a/packages/kokkos/core/src/traits/Kokkos_ScheduleTrait.hpp b/packages/kokkos/core/src/traits/Kokkos_ScheduleTrait.hpp
index 311ab1a47d798d40f4d916f49d37b60b59f0fb0b..86130025530516d4a8a1937b60310fb443943606 100644
--- a/packages/kokkos/core/src/traits/Kokkos_ScheduleTrait.hpp
+++ b/packages/kokkos/core/src/traits/Kokkos_ScheduleTrait.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_SCHEDULETRAIT_HPP
 #define KOKKOS_KOKKOS_SCHEDULETRAIT_HPP
diff --git a/packages/kokkos/core/src/traits/Kokkos_Traits_fwd.hpp b/packages/kokkos/core/src/traits/Kokkos_Traits_fwd.hpp
index c6b4fe41d90f618c20b42727195d569b8cc54d9e..7d9c215be3f876ee26a8cd28d1f50601587cae38 100644
--- a/packages/kokkos/core/src/traits/Kokkos_Traits_fwd.hpp
+++ b/packages/kokkos/core/src/traits/Kokkos_Traits_fwd.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_TRAITS_FWD_HPP
 #define KOKKOS_KOKKOS_TRAITS_FWD_HPP
diff --git a/packages/kokkos/core/src/traits/Kokkos_WorkItemPropertyTrait.hpp b/packages/kokkos/core/src/traits/Kokkos_WorkItemPropertyTrait.hpp
index edc488a548bb1cbf920344f898e35228d9c7bea3..8f95385c851748a1e578edc54e8875672128a9ce 100644
--- a/packages/kokkos/core/src/traits/Kokkos_WorkItemPropertyTrait.hpp
+++ b/packages/kokkos/core/src/traits/Kokkos_WorkItemPropertyTrait.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_WORKITEMPROPERTYTRAIT_HPP
 #define KOKKOS_KOKKOS_WORKITEMPROPERTYTRAIT_HPP
diff --git a/packages/kokkos/core/src/traits/Kokkos_WorkTagTrait.hpp b/packages/kokkos/core/src/traits/Kokkos_WorkTagTrait.hpp
index f306e43a031bdd3a55e3a150dddb87aec9e994f1..6eda78f838dc9a9ac914557e8c12be573b9528fb 100644
--- a/packages/kokkos/core/src/traits/Kokkos_WorkTagTrait.hpp
+++ b/packages/kokkos/core/src/traits/Kokkos_WorkTagTrait.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_KOKKOS_WORKTAGTRAIT_HPP
 #define KOKKOS_KOKKOS_WORKTAGTRAIT_HPP
@@ -108,15 +80,10 @@ struct WorkTagTrait : TraitSpecificationBase<WorkTagTrait> {
   //   old code that just did a big long series of nested std::conditionals, but
   //   we should benchmark this assumption if it becomes a problem.
   template <class T>
-  using trait_matches_specification = std::integral_constant<
-      bool,
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
+  using trait_matches_specification = std::bool_constant<
       std::is_empty<T>::value &&
-#else
-      !std::is_void<T>::value &&
-#endif
-          !type_list_any<_trait_matches_spec_predicate<T>::template apply,
-                         _exec_policy_traits_without_work_tag>::value>;
+      !type_list_any<_trait_matches_spec_predicate<T>::template apply,
+                     _exec_policy_traits_without_work_tag>::value>;
 };
 
 // </editor-fold> end trait specification }}}1
diff --git a/packages/kokkos/core/unit_test/CMakeLists.txt b/packages/kokkos/core/unit_test/CMakeLists.txt
index 16fdb39d1a36e9dd8b7d65bbe846c28b37fcf496..8019e5f3bbfb38740cf8213bc8a19f7e09f941cf 100644
--- a/packages/kokkos/core/unit_test/CMakeLists.txt
+++ b/packages/kokkos/core/unit_test/CMakeLists.txt
@@ -38,7 +38,7 @@ ENDIF()
 SET(KOKKOS_CUDA_FEATURE_LEVEL 999)
 SET(KOKKOS_CUDA_NAME Cuda)
 SET(KOKKOS_HIP_FEATURE_LEVEL 999)
-SET(KOKKOS_HIP_NAME Experimental::HIP)
+SET(KOKKOS_HIP_NAME HIP)
 SET(KOKKOS_HPX_FEATURE_LEVEL 999)
 SET(KOKKOS_HPX_NAME Experimental::HPX)
 SET(KOKKOS_OPENMP_FEATURE_LEVEL 999)
@@ -58,7 +58,7 @@ SET(KOKKOS_SYCL_FEATURE_LEVEL 999)
 SET(KOKKOS_SYCL_NAME Experimental::SYCL)
 SET(KOKKOS_THREADS_FEATURE_LEVEL 999)
 SET(KOKKOS_THREADS_NAME Threads)
-SET(KOKKOS_OPENACC_FEATURE_LEVEL 3)
+SET(KOKKOS_OPENACC_FEATURE_LEVEL 11)
 SET(KOKKOS_OPENACC_NAME Experimental::OpenACC)
 
 
@@ -76,11 +76,18 @@ SET(COMPILE_ONLY_SOURCES
   TestCreateMirror.cpp
   TestDetectionIdiom.cpp
   TestInterOp.cpp
-  TestLegionInteroperability.cpp
   TestStringManipulation.cpp
+  TestViewTypeTraits.cpp
   TestTypeList.cpp
+  view/TestExtentsDatatypeConversion.cpp
 )
-# TestInterOp has a dependency on containers
+
+#testing if windows.h and Kokkos_Core.hpp can be included
+if(WIN32)
+  LIST(APPEND COMPILE_ONLY_SOURCES TestWindowsInclude.cpp)
+endif()
+
+#TestInterOp has a dependency on containers
 IF(KOKKOS_HAS_TRILINOS)
   LIST(REMOVE_ITEM COMPILE_ONLY_SOURCES TestInterOp.cpp)
 ENDIF()
@@ -91,7 +98,7 @@ KOKKOS_ADD_EXECUTABLE(
   ${COMPILE_ONLY_SOURCES}
 )
 
-foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;OpenMPTarget;HIP;SYCL)
+foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;OpenMPTarget;OpenACC;HIP;SYCL)
   string(TOUPPER ${Tag} DEVICE)
   string(TOLOWER ${Tag} dir)
 
@@ -159,15 +166,22 @@ foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;OpenMPTarget;HIP;SYCL)
         Other
         RangePolicy
         RangePolicyRequire
+        CommonPolicyConstructors
+        RangePolicyConstructors
+        TeamPolicyConstructors
+        MDRangePolicyConstructors
+        CommonPolicyInterface
         Reductions
         Reducers_a
         Reducers_b
         Reducers_c
         Reducers_d
         Reducers_e
+        ReducerCTADs
         Reductions_DeviceView
         Scan
         SharedAlloc
+        TeamMDRange
         ViewMapping_a
         )
       set(file ${dir}/Test${Tag}_${Name}.cpp)
@@ -181,8 +195,10 @@ foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;OpenMPTarget;HIP;SYCL)
       list(APPEND ${Tag}_SOURCES1B ${file})
     endforeach()
 
-    SET(SOURCES2A_NAME_LIST
+    SET(${Tag}_SOURCES2A)
+    foreach(Name
       Abort
+      MDSpan
       TeamBasic
       TeamReductionScan
       TeamScan
@@ -208,16 +224,7 @@ foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;OpenMPTarget;HIP;SYCL)
       View_64bit
       WorkGraph
       WithoutInitializing
-    )
-    IF(KOKKOS_HAS_TRILINOS)
-      LIST(REMOVE_ITEM SOURCES2A_NAME_LIST
-        Abort
-        ViewMemoryAccessViolation
       )
-    ENDIF()
-
-    SET(${Tag}_SOURCES2A)
-    foreach(Name ${SOURCES2A_NAME_LIST})
       set(file ${dir}/Test${Tag}_${Name}.cpp)
       # Write to a temporary intermediate file and call configure_file to avoid
       # updating timestamps triggering unnecessary rebuilds on subsequent cmake runs.
@@ -339,26 +346,44 @@ foreach(PairDeviceSpace HIP-HostPinned;HIP-Managed;Cuda-HostPinned;Cuda-UVM;SYCL
   endif()
 endforeach()
 
+
 if(Kokkos_ENABLE_OPENMPTARGET)
   list(REMOVE_ITEM OpenMPTarget_SOURCES
-    ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_AtomicOperations_complexfloat.cpp
-    ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_AtomicOperations_complexdouble.cpp
-    ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_Crs.cpp
-    ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_LocalDeepCopy.cpp
     ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_Other.cpp
     ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_TeamReductionScan.cpp
-    ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_TeamScan.cpp
-    ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_ViewAPI_e.cpp
-    ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_ViewCopy_a.cpp
-    ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_ViewCopy_b.cpp
-    ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_ViewMapping_subview.cpp
-    ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_ViewOfClass.cpp
     ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_WorkGraph.cpp
     )
 endif()
 
+if(Kokkos_ENABLE_OPENACC)
+  list(REMOVE_ITEM OpenACC_SOURCES
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_complexfloat.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_complexdouble.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Crs.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_LocalDeepCopy.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Other.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamReductionScan.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamScan.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewAPI_e.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewCopy_a.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewCopy_b.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewMapping_subview.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewOfClass.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_WorkGraph.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamVectorRange.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_JoinBackwardCompatibility.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_CommonPolicyConstructors.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_RangePolicyConstructors.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamPolicyConstructors.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MDRangePolicyConstructors.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_CommonPolicyInterface.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamMDRange.cpp
+  )
+endif()
+
 # FIXME_OPENMPTARGET - Comment non-passing tests with amdclang++
-IF(KOKKOS_ARCH_VEGA906 OR KOKKOS_ARCH_VEGA908 OR KOKKOS_ARCH_VEGA90A)
+# FIXME_OPENMPTARGET - Need to check on NAVI architecture
+IF(KOKKOS_ARCH_VEGA)
   SET(KOKKOS_AMDGPU_ARCH TRUE)
 ENDIF()
 IF(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL Clang AND KOKKOS_AMDGPU_ARCH)
@@ -366,6 +391,13 @@ IF(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL Clang AND KOKK
     ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_Reducers_e.cpp
   )
 ENDIF()
+# FIXME_OPENMPTARGET This test causes internal compiler errors as of 09/01/22
+# when compiling for Intel's Xe-HP GPUs.
+IF(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM)
+  LIST(REMOVE_ITEM OpenMPTarget_SOURCES
+    ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_TeamVectorRange.cpp
+  )
+ENDIF()
 
 # FIXME_OPENMPTARGET - Comment non-passing tests with the NVIDIA HPC compiler nvc++
 IF(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC)
@@ -433,6 +465,96 @@ IF(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC)
     ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_ViewResize.cpp
     ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_RangePolicyRequire.cpp
     ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_RangePolicy.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_CommonPolicyConstructors.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_RangePolicyConstructors.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_TeamPolicyConstructors.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_MDRangePolicyConstructors.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_CommonPolicyInterface.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/default/TestDefaultDeviceType_a1.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/default/TestDefaultDeviceType_b1.cpp
+    )
+endif()
+
+# FIXME_OPENACC - Comment non-passing tests with the NVIDIA HPC compiler nvc++
+IF(KOKKOS_ENABLE_OPENACC AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC)
+  list(REMOVE_ITEM OpenACC_SOURCES
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_int64_t_reduce.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_int64_t_reduce_dynamic.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_int64_t_reduce_dynamic_view.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_double_reduce.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_double_reduce_dynamic.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamTeamSize.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Reductions_DeviceView.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamVectorRange.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_UniqueToken.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_HostSharedPtr.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_HostSharedPtrAccessOnDevice.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamScratch.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TestScan.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TestTeamScan.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TestTeamReductionScan.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Atomics.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_float.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_int.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_longint.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_longlongint.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_double.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_unsignedint.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_unsignedlongint.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_shared.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicViews.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_BlockSizeDeduction.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Reductions.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Reduce.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Reducers_a.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Reducers_b.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Reducers_c.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Reducers_d.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Reducers_e.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewMapping_b.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamBasic.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Scan.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_NumericTraits.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_DeepCopyAlignment.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MathematicalFunctions.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MathematicalFunctions1.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MathematicalFunctions2.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_a.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_b.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c01.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c02.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c03.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c04.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c05.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c06.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c07.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c08.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c09.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c10.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c11.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c12.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c13.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MDRange_a.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MDRange_b.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MDRange_c.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MDRange_d.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MDRange_e.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MDRange_f.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MDRange_g.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewAPI_a.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewAPI_b.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewAPI_c.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewAPI_d.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewAPI_f.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewResize.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_RangePolicyRequire.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_RangePolicy.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_CommonPolicyConstructors.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_RangePolicyConstructors.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamPolicyConstructors.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MDRangePolicyConstructors.cpp
+    ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_CommonPolicyInterface.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/default/TestDefaultDeviceType_a1.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/default/TestDefaultDeviceType_b1.cpp
     )
@@ -473,9 +595,6 @@ if (Kokkos_ENABLE_OPENMP)
     openmp/TestOpenMP_Task.cpp
     openmp/TestOpenMP_PartitionMaster.cpp
   )
-  if (Kokkos_ENABLE_DEPRECATED_CODE_3)
-    list(APPEND OpenMP_EXTRA_SOURCES openmp/TestOpenMP_Task.cpp)
-  endif ()
   KOKKOS_ADD_EXECUTABLE_AND_TEST(
     UnitTest_OpenMP
     SOURCES
@@ -531,6 +650,15 @@ if(Kokkos_ENABLE_OPENMPTARGET)
   )
 endif()
 
+if(Kokkos_ENABLE_OPENACC)
+  KOKKOS_ADD_EXECUTABLE_AND_TEST(
+    UnitTest_OpenACC
+    SOURCES
+    UnitTestMainInit.cpp
+    ${OpenACC_SOURCES}
+  )
+endif()
+
 if(Kokkos_ENABLE_CUDA)
     KOKKOS_ADD_EXECUTABLE_AND_TEST(
     UnitTest_Cuda1
@@ -555,7 +683,8 @@ if(Kokkos_ENABLE_CUDA)
       cuda/TestCuda_TeamScratchStreams.cpp
       ${Cuda_SOURCES3}
       cuda/TestCuda_Spaces.cpp
-  )
+      ${Cuda_SOURCES_SHAREDSPACE}
+    )
 
     KOKKOS_ADD_EXECUTABLE_AND_TEST(
     UnitTest_CudaTimingBased
@@ -695,32 +824,43 @@ if(Kokkos_ENABLE_SYCL)
   )
 endif()
 
-# FIXME_OPENMPTARGET - Comment non-passing tests with the NVIDIA HPC compiler nvc++
-if (KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC)
-  SET(DEFAULT_DEVICE_SOURCES
-    UnitTestMainInit.cpp
-    TestInitializationSettings.cpp
-    TestParseCmdLineArgsAndEnvVars.cpp
-    default/TestDefaultDeviceType.cpp
-  )
-else()
+SET(DEFAULT_DEVICE_SOURCES
+  UnitTestMainInit.cpp
+  TestInitializationSettings.cpp
+  TestParseCmdLineArgsAndEnvVars.cpp
+  TestSharedSpace.cpp
+  TestSharedHostPinnedSpace.cpp
+  default/TestDefaultDeviceType.cpp
+  default/TestDefaultDeviceType_a1.cpp
+  default/TestDefaultDeviceType_b1.cpp
+  default/TestDefaultDeviceType_c1.cpp
+  default/TestDefaultDeviceType_a2.cpp
+  default/TestDefaultDeviceType_b2.cpp
+  default/TestDefaultDeviceType_c2.cpp
+  default/TestDefaultDeviceType_a3.cpp
+  default/TestDefaultDeviceType_b3.cpp
+  default/TestDefaultDeviceType_c3.cpp
+  default/TestDefaultDeviceType_d.cpp
+  default/TestDefaultDeviceTypeResize.cpp
+  default/TestDefaultDeviceTypeViewAPI.cpp
+)
+# FIXME_OPENMPTARGET and FIXME_OPENACC do not provide a MemorySpace that can be accessed from all ExecSpaces
+# FIXME_SYCL clock_tic does not give the correct timings for cloc_tic
+if (KOKKOS_ENABLE_OPENACC OR KOKKOS_ENABLE_OPENMPTARGET OR KOKKOS_ENABLE_SYCL)
+  LIST(REMOVE_ITEM DEFAULT_DEVICE_SOURCES TestSharedSpace.cpp)
+endif()
+# FIXME_OPENMPTARGET and FIXME_OPENACC do not provide a HostPinnedMemorySpace that can be accessed from all ExecSpaces
+if (KOKKOS_ENABLE_OPENACC OR KOKKOS_ENABLE_OPENMPTARGET)
+  LIST(REMOVE_ITEM DEFAULT_DEVICE_SOURCES TestSharedHostPinnedSpace.cpp)
+endif()
+
+# FIXME_OPENMPTARGET, FIXME_OPENACC - Comment non-passing tests with the NVIDIA HPC compiler nvc++
+if ((KOKKOS_ENABLE_OPENMPTARGET OR KOKKOS_ENABLE_OPENACC) AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC)
   SET(DEFAULT_DEVICE_SOURCES
     UnitTestMainInit.cpp
     TestInitializationSettings.cpp
     TestParseCmdLineArgsAndEnvVars.cpp
     default/TestDefaultDeviceType.cpp
-    default/TestDefaultDeviceType_a1.cpp
-    default/TestDefaultDeviceType_b1.cpp
-    default/TestDefaultDeviceType_c1.cpp
-    default/TestDefaultDeviceType_a2.cpp
-    default/TestDefaultDeviceType_b2.cpp
-    default/TestDefaultDeviceType_c2.cpp
-    default/TestDefaultDeviceType_a3.cpp
-    default/TestDefaultDeviceType_b3.cpp
-    default/TestDefaultDeviceType_c3.cpp
-    default/TestDefaultDeviceType_d.cpp
-    default/TestDefaultDeviceTypeResize.cpp
-    default/TestDefaultDeviceTypeViewAPI.cpp
   )
 endif()
 
@@ -729,6 +869,13 @@ KOKKOS_ADD_EXECUTABLE_AND_TEST(
   SOURCES ${DEFAULT_DEVICE_SOURCES}
 )
 
+KOKKOS_ADD_EXECUTABLE_AND_TEST(
+  UnitTest_LegionInitialization
+  SOURCES
+    UnitTestMain.cpp
+    TestLegionInitialization.cpp
+)
+
 KOKKOS_ADD_EXECUTABLE_AND_TEST(
   UnitTest_PushFinalizeHook
   SOURCES
@@ -778,23 +925,31 @@ KOKKOS_ADD_ADVANCED_TEST( UnitTest_PushFinalizeHook_terminate
       tools/TestCategoricalTuner.cpp
     )
   endif()
-  if(NOT Kokkos_ENABLE_OPENMPTARGET)
+  if((NOT Kokkos_ENABLE_OPENMPTARGET) AND (NOT Kokkos_ENABLE_OPENACC))
   KOKKOS_ADD_EXECUTABLE_AND_TEST(
     UnitTest_LogicalSpaces
     SOURCES
       tools/TestLogicalSpaces.cpp
   )
   endif()
-  if(NOT (KOKKOS_CXX_COMPILER_ID STREQUAL Intel AND KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 18.0.0))
-  KOKKOS_ADD_EXECUTABLE_AND_TEST(
-    UnitTest_KokkosP
-    SOURCES
+  SET(KOKKOSP_SOURCES
     UnitTestMainInit.cpp
     tools/TestEventCorrectness.cpp
     tools/TestWithoutInitializing.cpp
     tools/TestProfilingSection.cpp
-  )
+    )
+
+  # FIXME_OPENMPTARGET This test causes internal compiler errors as of 09/01/22
+  # when compiling for Intel's Xe-HP GPUs.
+  if(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM)
+    list(REMOVE_ITEM KOKKOSP_SOURCES tools/TestEventCorrectness.cpp)
   endif()
+
+  KOKKOS_ADD_EXECUTABLE_AND_TEST(
+    UnitTest_KokkosP
+    SOURCES
+    ${KOKKOSP_SOURCES}
+  )
   if(KOKKOS_ENABLE_LIBDL)
     KOKKOS_ADD_EXECUTABLE_AND_TEST(
       UnitTest_ToolIndependence
@@ -968,6 +1123,29 @@ KOKKOS_ADD_EXECUTABLE_AND_TEST(
   ARGS "one 2 THREE"
 )
 
+# This test is not properly set up to run within Trilinos
+if (NOT KOKKOS_HAS_TRILINOS)
+  add_executable(KokkosCore_UnitTest_DeviceAndThreads UnitTest_DeviceAndThreads.cpp)
+  target_link_libraries(KokkosCore_UnitTest_DeviceAndThreads Kokkos::kokkoscore)
+  find_package(Python3 COMPONENTS Interpreter)
+  if(Python3_Interpreter_FOUND AND Python3_VERSION VERSION_GREATER_EQUAL 3.7)
+    if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
+      set(USE_SOURCE_PERMISSIONS_WHEN_SUPPORTED USE_SOURCE_PERMISSIONS)
+    endif()
+    file(GENERATE
+      OUTPUT $<TARGET_FILE_DIR:KokkosCore_UnitTest_DeviceAndThreads>/TestDeviceAndThreads.py
+      INPUT TestDeviceAndThreads.py
+      ${USE_SOURCE_PERMISSIONS_WHEN_SUPPORTED}
+    )
+    if(NOT Kokkos_ENABLE_OPENMPTARGET)  # FIXME_OPENMPTARGET does not select the right device
+      add_test(
+        NAME KokkosCore_UnitTest_DeviceAndThreads
+        COMMAND ${Python3_EXECUTABLE} -m unittest -v $<TARGET_FILE_DIR:KokkosCore_UnitTest_DeviceAndThreads>/TestDeviceAndThreads.py
+      )
+    endif()
+  endif()
+endif()
+
 if (KOKKOS_ENABLE_HEADER_SELF_CONTAINMENT_TESTS AND NOT KOKKOS_HAS_TRILINOS AND NOT WIN32)
   add_subdirectory(headers_self_contained)
 endif()
diff --git a/packages/kokkos/core/unit_test/IncrementalTest.cpp.in b/packages/kokkos/core/unit_test/IncrementalTest.cpp.in
index e4358efe9dd8683e025b5a2be67a4e9bd83e7552..b12182e988e3cf58c73ffba69564101ac8d41b03 100644
--- a/packages/kokkos/core/unit_test/IncrementalTest.cpp.in
+++ b/packages/kokkos/core/unit_test/IncrementalTest.cpp.in
@@ -1,43 +1,17 @@
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
 
 #ifndef KOKKOS_TEST_@BACK_END_NAME@_@CURRENT_TEST_NAME@
diff --git a/packages/kokkos/core/unit_test/Makefile b/packages/kokkos/core/unit_test/Makefile
index 0c3e1ee4767e1b70664de385eef8c2cd2c023243..05be2252658682cc3bc716b2f292910639cf3c5f 100644
--- a/packages/kokkos/core/unit_test/Makefile
+++ b/packages/kokkos/core/unit_test/Makefile
@@ -409,15 +409,6 @@ TEST_TARGETS += test-stack-trace
 TEST_TARGETS += test-stack-trace-terminate
 TEST_TARGETS += test-stack-trace-generic-term
 
-ifneq ($(KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE), 1)
-NUM_INITTESTS = 16
-INITTESTS_NUMBERS := $(shell seq 1 ${NUM_INITTESTS})
-INITTESTS_TARGETS := $(addprefix KokkosCore_UnitTest_DefaultDeviceTypeInit_,${INITTESTS_NUMBERS})
-TARGETS += ${INITTESTS_TARGETS}
-INITTESTS_TEST_TARGETS := $(addprefix test-default-init-,${INITTESTS_NUMBERS})
-TEST_TARGETS += ${INITTESTS_TEST_TARGETS}
-endif
-
 KokkosCore_UnitTest_Cuda: $(OBJ_CUDA) $(KOKKOS_LINK_DEPENDS)
 	$(LINK) $(EXTRA_PATH) $(OBJ_CUDA) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosCore_UnitTest_Cuda
 
@@ -465,10 +456,6 @@ KokkosCore_UnitTest_PushFinalizeHook: $(OBJ_DEFAULT) $(KOKKOS_LINK_DEPENDS)
 KokkosCore_UnitTest_PushFinalizeHook_terminate: $(OBJ_DEFAULT) $(KOKKOS_LINK_DEPENDS)
 	$(LINK) $(EXTRA_PATH) $(OBJ_DEFAULT) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosCore_UnitTest_PushFinalizeHook_terminate
 
-
-${INITTESTS_TARGETS}: KokkosCore_UnitTest_DefaultDeviceTypeInit_%: TestDefaultDeviceTypeInit_%.o UnitTestMain.o gtest-all.o $(KOKKOS_LINK_DEPENDS)
-	$(LINK) $(EXTRA_PATH) TestDefaultDeviceTypeInit_$*.o UnitTestMain.o gtest-all.o $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosCore_UnitTest_DefaultDeviceTypeInit_$*
-
 KokkosCore_UnitTest_StackTraceTestExec: TestStackTrace.o  TestStackTrace_f0.o TestStackTrace_f1.o TestStackTrace_f2.o TestStackTrace_f3.o TestStackTrace_f4.o $(KOKKOS_LINK_DEPENDS) gtest-all.o
 	$(LINK) $(EXTRA_PATH) TestStackTrace.o TestStackTrace_f0.o TestStackTrace_f1.o TestStackTrace_f2.o TestStackTrace_f3.o TestStackTrace_f4.o gtest-all.o $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosCore_UnitTest_StackTraceTestExec
 
@@ -521,10 +508,6 @@ test-stack-trace-terminate: KokkosCore_UnitTest_StackTraceTestExec
 test-stack-trace-generic-term: KokkosCore_UnitTest_StackTraceTestExec
 	./KokkosCore_UnitTest_StackTraceTestExec --gtest_filter=*generic_term$(STACK_TRACE_TERMINATE_FILTER)
 
-
-${INITTESTS_TEST_TARGETS}: test-default-init-%: KokkosCore_UnitTest_DefaultDeviceTypeInit_%
-	./KokkosCore_UnitTest_DefaultDeviceTypeInit_$*
-
 build_all: $(TARGETS)
 
 test: $(TEST_TARGETS)
diff --git a/packages/kokkos/core/unit_test/TestAbort.hpp b/packages/kokkos/core/unit_test/TestAbort.hpp
index 58da329c39930822a53ffa0f87bcf56040c71b96..63e9bdc6e23606398b5a2bc9d32c927cf8d5c950 100644
--- a/packages/kokkos/core/unit_test/TestAbort.hpp
+++ b/packages/kokkos/core/unit_test/TestAbort.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
@@ -119,13 +91,6 @@ void test_abort_from_device() {
   } else {
     TestAbortCausingAbnormalProgramTerminationAndPrinting<ExecutionSpace>();
   }
-#elif defined(KOKKOS_IMPL_HIP_ABORT_DOES_NOT_PRINT_MESSAGE)
-  if (std::is_same<ExecutionSpace, Kokkos::Experimental::HIP>::value) {
-    TestAbortCausingAbnormalProgramTerminationButIgnoringErrorMessage<
-        ExecutionSpace>();
-  } else {
-    TestAbortCausingAbnormalProgramTerminationAndPrinting<ExecutionSpace>();
-  }
 #else
   TestAbortCausingAbnormalProgramTerminationAndPrinting<ExecutionSpace>();
 #endif
diff --git a/packages/kokkos/core/unit_test/TestAggregate.hpp b/packages/kokkos/core/unit_test/TestAggregate.hpp
index d21e6f46da8d253671b6fac73d4d028cc0ee9cf2..23cc5860ac906b9777cb7d8a2c9747709c817735 100644
--- a/packages/kokkos/core/unit_test/TestAggregate.hpp
+++ b/packages/kokkos/core/unit_test/TestAggregate.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef TEST_AGGREGATE_HPP
 #define TEST_AGGREGATE_HPP
diff --git a/packages/kokkos/core/unit_test/TestArray.cpp b/packages/kokkos/core/unit_test/TestArray.cpp
index ca93918e062718a82a9d86022055e8e501f362f1..d3bdc4f93f7b81c2c78d69a51ed4739ecd641935 100644
--- a/packages/kokkos/core/unit_test/TestArray.cpp
+++ b/packages/kokkos/core/unit_test/TestArray.cpp
@@ -1,69 +1,38 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Array.hpp>
 
 namespace {
 
-#define STATIC_ASSERT(cond) static_assert(cond, "")
-
 KOKKOS_FUNCTION constexpr bool test_array() {
   constexpr Kokkos::Array<int, 3> a{{1, 2}};
 
-  STATIC_ASSERT(!a.empty());
-  STATIC_ASSERT(a.size() == 3);
-  STATIC_ASSERT(a.max_size() == 3);
+  static_assert(!a.empty());
+  static_assert(a.size() == 3);
+  static_assert(a.max_size() == 3);
 
-  STATIC_ASSERT(*a.data() == 1);
-  STATIC_ASSERT(a[1] == 2);
+  static_assert(*a.data() == 1);
+  static_assert(a[1] == 2);
 
   return true;
 }
 
-STATIC_ASSERT(test_array());
+static_assert(test_array());
 
-#ifdef KOKKOS_ENABLE_CXX17
 KOKKOS_FUNCTION constexpr bool test_array_structured_binding_support() {
   constexpr Kokkos::Array<float, 2> a{};
   auto& [xr, yr] = a;
@@ -78,7 +47,6 @@ KOKKOS_FUNCTION constexpr bool test_array_structured_binding_support() {
   return true;
 }
 
-STATIC_ASSERT(test_array_structured_binding_support());
-#endif
+static_assert(test_array_structured_binding_support());
 
 }  // namespace
diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations.hpp
index ab9b970be126b83a90c84a9f1b6ba05b2f2c78d0..b8940378bdf769dd251855087ac629c54f54c867 100644
--- a/packages/kokkos/core/unit_test/TestAtomicOperations.hpp
+++ b/packages/kokkos/core/unit_test/TestAtomicOperations.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_complexdouble.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_complexdouble.hpp
index 612247d03fa7f823bbe7699b15d5a0bf65fe2db6..9f55aa947b3d5ce006c859965eabf172bfb529c1 100644
--- a/packages/kokkos/core/unit_test/TestAtomicOperations_complexdouble.hpp
+++ b/packages/kokkos/core/unit_test/TestAtomicOperations_complexdouble.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestAtomicOperations.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_complexfloat.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_complexfloat.hpp
index e812d32074c0213c8547fed4353e0d3898b2adeb..b23e55a339ee45de4353683b8cd3e4194966a86b 100644
--- a/packages/kokkos/core/unit_test/TestAtomicOperations_complexfloat.hpp
+++ b/packages/kokkos/core/unit_test/TestAtomicOperations_complexfloat.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestAtomicOperations.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_double.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_double.hpp
index 303f5b6eb9f77c3767056ac2639122d4b01b9d7a..0dea91f4165a400e9b80a7bac14684ca365b4e1d 100644
--- a/packages/kokkos/core/unit_test/TestAtomicOperations_double.hpp
+++ b/packages/kokkos/core/unit_test/TestAtomicOperations_double.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestAtomicOperations.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_float.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_float.hpp
index d3d4916b4ea6d623b010834627f41ebf65161ff7..23348f20ec9fcdd7be42977080fe4b25c2a9cb4a 100644
--- a/packages/kokkos/core/unit_test/TestAtomicOperations_float.hpp
+++ b/packages/kokkos/core/unit_test/TestAtomicOperations_float.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestAtomicOperations.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_int.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_int.hpp
index e5f2f334fc2b07e24ed5f77d75a64947c2117e21..31cddf20baa438fcd5330b7e5b3ffa39db951a80 100644
--- a/packages/kokkos/core/unit_test/TestAtomicOperations_int.hpp
+++ b/packages/kokkos/core/unit_test/TestAtomicOperations_int.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestAtomicOperations.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_longint.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_longint.hpp
index d4fda70e80cff156aa58bc0294c66be38729f745..3171e61018f337185c7335f076b7eca8b2d576e1 100644
--- a/packages/kokkos/core/unit_test/TestAtomicOperations_longint.hpp
+++ b/packages/kokkos/core/unit_test/TestAtomicOperations_longint.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestAtomicOperations.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_longlongint.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_longlongint.hpp
index b7fb0cdae5f99f6704dbdd18c2554bcb6b3e5ddf..f7bef416d6344ef2f0df6158b99b28d5331f5a85 100644
--- a/packages/kokkos/core/unit_test/TestAtomicOperations_longlongint.hpp
+++ b/packages/kokkos/core/unit_test/TestAtomicOperations_longlongint.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestAtomicOperations.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_shared.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_shared.hpp
index 08f4782ce18e9b9f774aa891f9878da3be6d12ef..90b3e23c3c24148d579b9a15d6f9c7877ac7c011 100644
--- a/packages/kokkos/core/unit_test/TestAtomicOperations_shared.hpp
+++ b/packages/kokkos/core/unit_test/TestAtomicOperations_shared.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_unsignedint.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_unsignedint.hpp
index 75b354c7a3e0e8ea2db6e9b0fc1ef9e89cf941bc..31b2693d64871c90d29a5f13fac940836cb1732b 100644
--- a/packages/kokkos/core/unit_test/TestAtomicOperations_unsignedint.hpp
+++ b/packages/kokkos/core/unit_test/TestAtomicOperations_unsignedint.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestAtomicOperations.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_unsignedlongint.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_unsignedlongint.hpp
index d7e90033c378790f7dc0aec6126840988605590a..98c2d28b20d7c3a5c207e3789eb8c9322406115a 100644
--- a/packages/kokkos/core/unit_test/TestAtomicOperations_unsignedlongint.hpp
+++ b/packages/kokkos/core/unit_test/TestAtomicOperations_unsignedlongint.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestAtomicOperations.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestAtomicViews.hpp b/packages/kokkos/core/unit_test/TestAtomicViews.hpp
index 916dc949bcfb2140197d213fe3a52e4239f19f76..7f50b6dd717c58065eba606e2fb78fe270435e0b 100644
--- a/packages/kokkos/core/unit_test/TestAtomicViews.hpp
+++ b/packages/kokkos/core/unit_test/TestAtomicViews.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestAtomics.hpp b/packages/kokkos/core/unit_test/TestAtomics.hpp
index 0db2c735a78e6dc888e6f2a7388b027994317af2..e5866bb89baf229d5347c9e9903382571ac0574d 100644
--- a/packages/kokkos/core/unit_test/TestAtomics.hpp
+++ b/packages/kokkos/core/unit_test/TestAtomics.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestBlockSizeDeduction.hpp b/packages/kokkos/core/unit_test/TestBlockSizeDeduction.hpp
index d29e3737c6ee84eaccab66634430f0b4b058b3bc..43cee3cd5ef40763c58b89fafc25357cde4f450d 100644
--- a/packages/kokkos/core/unit_test/TestBlockSizeDeduction.hpp
+++ b/packages/kokkos/core/unit_test/TestBlockSizeDeduction.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef TEST_BLOCK_SIZE_DEDUCTION_HPP
 #define TEST_BLOCK_SIZE_DEDUCTION_HPP
@@ -62,7 +34,7 @@ void test_bug_pr_3103() {
   using Policy =
       Kokkos::TeamPolicy<ExecutionSpace, Kokkos::LaunchBounds<32, 1>>;
   int const league_size   = 1;
-  int const team_size     = std::min(32, ExecutionSpace::concurrency());
+  int const team_size     = std::min(32, ExecutionSpace().concurrency());
   int const vector_length = 1;
 
   Kokkos::parallel_for(Policy(league_size, team_size, vector_length),
diff --git a/packages/kokkos/core/unit_test/TestCTestDevice.cpp b/packages/kokkos/core/unit_test/TestCTestDevice.cpp
index 247981c5ce5ed5d486084a77ca290b170a91e1ab..5be4714f9eaf9e60a2d3d491954589097f17b9d8 100644
--- a/packages/kokkos/core/unit_test/TestCTestDevice.cpp
+++ b/packages/kokkos/core/unit_test/TestCTestDevice.cpp
@@ -1,12 +1,22 @@
-#include <gtest/gtest.h>
-
-namespace Kokkos {
-namespace Impl {
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
 
-int get_ctest_gpu(const char *local_rank_str);
+#include <gtest/gtest.h>
 
-}  // namespace Impl
-}  // namespace Kokkos
+#include <impl/Kokkos_DeviceManagement.hpp>  // get_ctest_gpu
 
 #ifdef _WIN32
 int setenv(const char *name, const char *value, int overwrite) {
@@ -68,60 +78,60 @@ void ctest_environment::SetUp() {
 
 TEST_F(ctest_environment, no_device_type) {
   unsetenv("CTEST_KOKKOS_DEVICE_TYPE");
-  EXPECT_EQ(Kokkos::Impl::get_ctest_gpu("0"), 0);
+  EXPECT_EQ(Kokkos::Impl::get_ctest_gpu(0), 0);
 }
 
 TEST_F(ctest_environment, no_process_count) {
   unsetenv("CTEST_RESOURCE_GROUP_COUNT");
-  EXPECT_EQ(Kokkos::Impl::get_ctest_gpu("0"), 0);
+  EXPECT_EQ(Kokkos::Impl::get_ctest_gpu(0), 0);
 }
 
 TEST_F(ctest_environment, invalid_rank) {
   EXPECT_THROW_WITH_MESSAGE(
-      Kokkos::Impl::get_ctest_gpu("10"), std::runtime_error,
+      Kokkos::Impl::get_ctest_gpu(10), std::runtime_error,
       "Error: local rank 10 is outside the bounds of resource groups provided "
       "by CTest.");
 }
 
 TEST_F(ctest_environment, no_type_str) {
   EXPECT_THROW_WITH_MESSAGE(
-      Kokkos::Impl::get_ctest_gpu("0"), std::runtime_error,
+      Kokkos::Impl::get_ctest_gpu(0), std::runtime_error,
       "Error: CTEST_RESOURCE_GROUP_0 is not specified. Raised by "
       "Kokkos::Impl::get_ctest_gpu().");
 }
 
 TEST_F(ctest_environment, missing_type) {
   EXPECT_THROW_WITH_MESSAGE(
-      Kokkos::Impl::get_ctest_gpu("1"), std::runtime_error,
+      Kokkos::Impl::get_ctest_gpu(1), std::runtime_error,
       "Error: device type 'gpus' not included in CTEST_RESOURCE_GROUP_1. "
       "Raised by Kokkos::Impl::get_ctest_gpu().");
   EXPECT_THROW_WITH_MESSAGE(
-      Kokkos::Impl::get_ctest_gpu("2"), std::runtime_error,
+      Kokkos::Impl::get_ctest_gpu(2), std::runtime_error,
       "Error: device type 'gpus' not included in CTEST_RESOURCE_GROUP_2. "
       "Raised by Kokkos::Impl::get_ctest_gpu().");
 }
 
 TEST_F(ctest_environment, no_id_str) {
   EXPECT_THROW_WITH_MESSAGE(
-      Kokkos::Impl::get_ctest_gpu("3"), std::runtime_error,
+      Kokkos::Impl::get_ctest_gpu(3), std::runtime_error,
       "Error: CTEST_RESOURCE_GROUP_3_GPUS is not specified. Raised by "
       "Kokkos::Impl::get_ctest_gpu().");
 }
 
 TEST_F(ctest_environment, invalid_id_str) {
   EXPECT_THROW_WITH_MESSAGE(
-      Kokkos::Impl::get_ctest_gpu("4"), std::runtime_error,
+      Kokkos::Impl::get_ctest_gpu(4), std::runtime_error,
       "Error: invalid value of CTEST_RESOURCE_GROUP_4_GPUS: 'id:2'. Raised by "
       "Kokkos::Impl::get_ctest_gpu().");
   EXPECT_THROW_WITH_MESSAGE(
-      Kokkos::Impl::get_ctest_gpu("5"), std::runtime_error,
+      Kokkos::Impl::get_ctest_gpu(5), std::runtime_error,
       "Error: invalid value of CTEST_RESOURCE_GROUP_5_GPUS: 'slots:1,id:2'. "
       "Raised by Kokkos::Impl::get_ctest_gpu().");
 }
 
 TEST_F(ctest_environment, good) {
-  EXPECT_EQ(Kokkos::Impl::get_ctest_gpu("6"), 2);
-  EXPECT_EQ(Kokkos::Impl::get_ctest_gpu("7"), 3);
-  EXPECT_EQ(Kokkos::Impl::get_ctest_gpu("8"), 1);
-  EXPECT_EQ(Kokkos::Impl::get_ctest_gpu("9"), 4);
+  EXPECT_EQ(Kokkos::Impl::get_ctest_gpu(6), 2);
+  EXPECT_EQ(Kokkos::Impl::get_ctest_gpu(7), 3);
+  EXPECT_EQ(Kokkos::Impl::get_ctest_gpu(8), 1);
+  EXPECT_EQ(Kokkos::Impl::get_ctest_gpu(9), 4);
 }
diff --git a/packages/kokkos/core/unit_test/TestCXX11.hpp b/packages/kokkos/core/unit_test/TestCXX11.hpp
index 3dbce28ad1065768d3d8e18096c74053c0653a6c..b35de9a3a04fde59a9591aee190fe6c0c960343b 100644
--- a/packages/kokkos/core/unit_test/TestCXX11.hpp
+++ b/packages/kokkos/core/unit_test/TestCXX11.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestCXX11Deduction.hpp b/packages/kokkos/core/unit_test/TestCXX11Deduction.hpp
index c7efab2711f283c02fad350bd5a8163ebc4b3a91..758d76996b57ae4eb339bc7d3de81b43474b1a7c 100644
--- a/packages/kokkos/core/unit_test/TestCXX11Deduction.hpp
+++ b/packages/kokkos/core/unit_test/TestCXX11Deduction.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestCommonPolicyConstructors.hpp b/packages/kokkos/core/unit_test/TestCommonPolicyConstructors.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..ec5d1ae0f46fad54a228f08c8caa052408259be5
--- /dev/null
+++ b/packages/kokkos/core/unit_test/TestCommonPolicyConstructors.hpp
@@ -0,0 +1,113 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#include <Kokkos_Core.hpp>
+
+namespace {
+
+// Dummy policy for testing base class.
+template <class... Args>
+struct DummyPolicy : Kokkos::Impl::PolicyTraits<Args...> {
+  using execution_policy = DummyPolicy;
+};
+
+// Asserts that a policy constructor is semiregular.
+// Semiregular is copyable and default initializable
+// (regular requires equality comparable).
+template <class Policy>
+constexpr bool check_semiregular() {
+  static_assert(std::is_default_constructible_v<Policy>);
+  static_assert(std::is_copy_constructible_v<Policy>);
+  static_assert(std::is_move_constructible_v<Policy>);
+  static_assert(std::is_copy_assignable_v<Policy>);
+  static_assert(std::is_move_assignable_v<Policy>);
+  static_assert(std::is_destructible_v<Policy>);
+
+  return true;
+}
+
+static_assert(check_semiregular<DummyPolicy<>>());
+static_assert(check_semiregular<Kokkos::RangePolicy<>>());
+static_assert(check_semiregular<Kokkos::TeamPolicy<>>());
+static_assert(check_semiregular<Kokkos::MDRangePolicy<Kokkos::Rank<2>>>());
+
+// Assert that occupancy conversion and hints work properly.
+template <class Policy>
+void test_prefer_desired_occupancy() {
+  Policy policy;
+
+  using Kokkos::Experimental::DesiredOccupancy;
+  using Kokkos::Experimental::MaximizeOccupancy;
+  using Kokkos::Experimental::prefer;
+  using Kokkos::Experimental::WorkItemProperty;
+
+  static_assert(!Policy::experimental_contains_desired_occupancy);
+
+  // MaximizeOccupancy -> MaximizeOccupancy
+  auto const policy_still_no_occ = prefer(policy, MaximizeOccupancy{});
+  static_assert(
+      !decltype(policy_still_no_occ)::experimental_contains_desired_occupancy);
+
+  // MaximizeOccupancy -> DesiredOccupancy
+  auto const policy_with_occ =
+      prefer(policy_still_no_occ, DesiredOccupancy{33});
+  static_assert(
+      decltype(policy_with_occ)::experimental_contains_desired_occupancy);
+  EXPECT_EQ(policy_with_occ.impl_get_desired_occupancy().value(), 33);
+
+  // DesiredOccupancy -> DesiredOccupancy
+  auto const policy_change_occ = prefer(policy_with_occ, DesiredOccupancy{24});
+  static_assert(
+      decltype(policy_change_occ)::experimental_contains_desired_occupancy);
+  EXPECT_EQ(policy_change_occ.impl_get_desired_occupancy().value(), 24);
+
+  // DesiredOccupancy -> DesiredOccupancy w/ hint
+  auto policy_with_occ_and_hint = Kokkos::Experimental::require(
+      policy_change_occ,
+      Kokkos::Experimental::WorkItemProperty::HintLightWeight);
+  EXPECT_EQ(policy_with_occ_and_hint.impl_get_desired_occupancy().value(), 24);
+
+  // DesiredOccupancy -> MaximizeOccupancy
+  auto const policy_drop_occ =
+      prefer(policy_with_occ_and_hint, MaximizeOccupancy{});
+  static_assert(
+      !decltype(policy_drop_occ)::experimental_contains_desired_occupancy);
+}
+
+TEST(TEST_CATEGORY, execution_policy_occupancy_and_hint) {
+  test_prefer_desired_occupancy<DummyPolicy<>>();
+  test_prefer_desired_occupancy<Kokkos::RangePolicy<>>();
+  test_prefer_desired_occupancy<Kokkos::TeamPolicy<>>();
+  test_prefer_desired_occupancy<Kokkos::MDRangePolicy<Kokkos::Rank<2>>>();
+}
+
+// Check that the policy size does not increase if the user does not specify the
+// occupancy (only pay for what you use).
+// Disabling since EBO was not working with VS 16.11.3 and CUDA 11.4.2
+#if !(defined(_WIN32) && defined(KOKKOS_ENABLE_CUDA))
+constexpr bool test_empty_base_optimization() {
+  DummyPolicy<> policy;
+  static_assert(sizeof(decltype(policy)) == 1);
+  using Kokkos::Experimental::DesiredOccupancy;
+  using Kokkos::Experimental::prefer;
+  static_assert(sizeof(decltype(prefer(policy, DesiredOccupancy{33}))) ==
+                sizeof(DesiredOccupancy));
+  return true;
+}
+static_assert(test_empty_base_optimization());
+#endif
+
+}  // namespace
diff --git a/packages/kokkos/core/unit_test/TestCommonPolicyInterface.hpp b/packages/kokkos/core/unit_test/TestCommonPolicyInterface.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..1828e99b0b308739f6f304fd7b04fcb44ee7ef96
--- /dev/null
+++ b/packages/kokkos/core/unit_test/TestCommonPolicyInterface.hpp
@@ -0,0 +1,111 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#include <Kokkos_Core.hpp>
+
+namespace {
+
+template <typename Policy, typename ExpectedExecutionSpace,
+          typename ExpectedIndexType, typename ExpectedScheduleType,
+          typename ExpectedWorkTag>
+constexpr bool compile_time_test() {
+  using execution_space = typename Policy::execution_space;
+  using index_type      = typename Policy::index_type;
+  using schedule_type   = typename Policy::schedule_type;
+  using work_tag        = typename Policy::work_tag;
+
+  static_assert(std::is_same_v<execution_space, ExpectedExecutionSpace>);
+  static_assert(std::is_same_v<index_type, ExpectedIndexType>);
+  static_assert(std::is_same_v<schedule_type, ExpectedScheduleType>);
+  static_assert(std::is_same_v<work_tag, ExpectedWorkTag>);
+
+  return true;
+}
+
+// Separate class type from class template args so that different
+// combinations of template args can be used, while still including
+// any necessary templates args (stored in "Args...").
+// Example: MDRangePolicy required an iteration pattern be included.
+template <template <class...> class PolicyType, class... Args>
+constexpr bool test_compile_time_parameters() {
+  struct SomeTag {};
+
+  using TestExecSpace    = TEST_EXECSPACE;
+  using DefaultExecSpace = Kokkos::DefaultExecutionSpace;
+  using TestIndex        = TestExecSpace::size_type;
+  using DefaultIndex     = DefaultExecSpace::size_type;
+  using LongIndex        = Kokkos::IndexType<long>;
+  using StaticSchedule   = Kokkos::Schedule<Kokkos::Static>;
+  using DynamicSchedule  = Kokkos::Schedule<Kokkos::Dynamic>;
+
+  // clang-format off
+  compile_time_test<PolicyType<                                                            Args...>, DefaultExecSpace, DefaultIndex, StaticSchedule,  void   >();
+  compile_time_test<PolicyType<TestExecSpace,                                              Args...>, TestExecSpace,    TestIndex,    StaticSchedule,  void   >();
+  compile_time_test<PolicyType<DynamicSchedule,                                            Args...>, DefaultExecSpace, DefaultIndex, DynamicSchedule, void   >();
+  compile_time_test<PolicyType<TestExecSpace,   DynamicSchedule,                           Args...>, TestExecSpace,    TestIndex,    DynamicSchedule, void   >();
+  compile_time_test<PolicyType<DynamicSchedule, LongIndex,                                 Args...>, DefaultExecSpace, long,         DynamicSchedule, void   >();
+  compile_time_test<PolicyType<LongIndex,       DynamicSchedule,                           Args...>, DefaultExecSpace, long,         DynamicSchedule, void   >();
+  compile_time_test<PolicyType<TestExecSpace,   DynamicSchedule, LongIndex,                Args...>, TestExecSpace,    long,         DynamicSchedule, void   >();
+  compile_time_test<PolicyType<LongIndex,       TestExecSpace,   DynamicSchedule,          Args...>, TestExecSpace,    long,         DynamicSchedule, void   >();
+  compile_time_test<PolicyType<DynamicSchedule, LongIndex,       SomeTag,                  Args...>, DefaultExecSpace, long,         DynamicSchedule, SomeTag>();
+  compile_time_test<PolicyType<SomeTag,         DynamicSchedule, LongIndex,                Args...>, DefaultExecSpace, long,         DynamicSchedule, SomeTag>();
+  compile_time_test<PolicyType<TestExecSpace,   DynamicSchedule, LongIndex, SomeTag,       Args...>, TestExecSpace,    long,         DynamicSchedule, SomeTag>();
+  compile_time_test<PolicyType<DynamicSchedule, TestExecSpace,   LongIndex, SomeTag,       Args...>, TestExecSpace,    long,         DynamicSchedule, SomeTag>();
+  compile_time_test<PolicyType<SomeTag,         DynamicSchedule, LongIndex, TestExecSpace, Args...>, TestExecSpace,    long,         DynamicSchedule, SomeTag>();
+  // clang-format on
+
+  return true;
+}
+
+static_assert(test_compile_time_parameters<Kokkos::RangePolicy>());
+static_assert(test_compile_time_parameters<Kokkos::TeamPolicy>());
+static_assert(
+    test_compile_time_parameters<Kokkos::MDRangePolicy, Kokkos::Rank<2>>());
+
+// Asserts that worktag conversion works properly.
+template <class Policy>
+constexpr bool test_worktag() {
+  struct WorkTag1 {};
+  struct WorkTag2 {};
+
+  // Apply WorkTag1
+  using PolicyWithWorkTag1 =
+      Kokkos::Impl::WorkTagTrait::policy_with_trait<Policy, WorkTag1>;
+  // Swap for WorkTag2
+  using PolicyWithWorkTag2 =
+      Kokkos::Impl::WorkTagTrait::policy_with_trait<PolicyWithWorkTag1,
+                                                    WorkTag2>;
+
+  static_assert(std::is_void_v<typename Policy::work_tag>);
+  static_assert(
+      std::is_same_v<typename PolicyWithWorkTag1::work_tag, WorkTag1>);
+  static_assert(
+      std::is_same_v<typename PolicyWithWorkTag2::work_tag, WorkTag2>);
+
+  // Currently not possible to remove the work tag from a policy.
+  // Uncomment the line below to see the compile error.
+  // using PolicyRemoveWorkTag =
+  // Kokkos::Impl::WorkTagTrait::policy_with_trait<PolicyWithWorkTag2, void>;
+  // static_assert(std::is_void_v<PolicyRemoveWorkTag::work_tag>);
+
+  return true;
+}
+
+static_assert(test_worktag<Kokkos::RangePolicy<>>());
+static_assert(test_worktag<Kokkos::TeamPolicy<>>());
+static_assert(test_worktag<Kokkos::MDRangePolicy<Kokkos::Rank<2>>>());
+
+}  // namespace
diff --git a/packages/kokkos/core/unit_test/TestCompileMain.cpp b/packages/kokkos/core/unit_test/TestCompileMain.cpp
index 237c8ce181774d991a9dbdd8cacf1a5fb9f199f1..fe164b5ba81e800e28eeba16670a9463de53cacb 100644
--- a/packages/kokkos/core/unit_test/TestCompileMain.cpp
+++ b/packages/kokkos/core/unit_test/TestCompileMain.cpp
@@ -1 +1,17 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 int main() {}
diff --git a/packages/kokkos/core/unit_test/TestCompilerMacros.hpp b/packages/kokkos/core/unit_test/TestCompilerMacros.hpp
index 273e87ccc3f140b2648b78de49a7ab512d26cd6b..9d22c4b0a777038df4bf8662fb0c7ac582f42d58 100644
--- a/packages/kokkos/core/unit_test/TestCompilerMacros.hpp
+++ b/packages/kokkos/core/unit_test/TestCompilerMacros.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 
@@ -80,11 +52,6 @@ struct AddFunctor {
 #endif
 #ifdef KOKKOS_ENABLE_PRAGMA_LOOPCOUNT
 #pragma loop count(128)
-#endif
-#ifndef KOKKOS_ENABLE_DEBUG
-#ifdef KOKKOS_ENABLE_PRAGMA_SIMD
-#pragma simd
-#endif
 #endif
     for (int j = 0; j < length; j++) {
       a(i, j) += b(i, j);
diff --git a/packages/kokkos/core/unit_test/TestComplex.hpp b/packages/kokkos/core/unit_test/TestComplex.hpp
index cd4298f8e016922dd3f98e53d79094f6a9d28020..87085f3648e58ca9e4f8d1b086b90e19d8fba797 100644
--- a/packages/kokkos/core/unit_test/TestComplex.hpp
+++ b/packages/kokkos/core/unit_test/TestComplex.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <cstdio>
@@ -112,9 +84,9 @@ struct TestComplexConstruction {
     d_results(2)              = c;
     Kokkos::complex<double> d(3.5);
     d_results(3) = d;
-    volatile Kokkos::complex<double> a_v(4.5, 5.5);
+    Kokkos::complex<double> a_v(4.5, 5.5);
     d_results(4) = a_v;
-    volatile Kokkos::complex<double> b_v(a);
+    Kokkos::complex<double> b_v(a);
     d_results(5) = b_v;
     Kokkos::complex<double> e(a_v);
     d_results(6) = e;
@@ -425,15 +397,11 @@ TEST(TEST_CATEGORY, complex_io) { testComplexIO(); }
 TEST(TEST_CATEGORY, complex_trivially_copyable) {
   // Kokkos::complex<RealType> is trivially copyable when RealType is
   // trivially copyable
-  // Simply disable the check for IBM's XL compiler since we can't reliably
-  // check for a version that defines relevant functions.
-#if !defined(__ibmxl__)
   using RealType = double;
   // clang claims compatibility with gcc 4.2.1 but all versions tested know
   // about std::is_trivially_copyable.
   ASSERT_TRUE(std::is_trivially_copyable<Kokkos::complex<RealType>>::value ||
               !std::is_trivially_copyable<RealType>::value);
-#endif
 }
 
 template <class ExecSpace>
@@ -527,26 +495,24 @@ TEST(TEST_CATEGORY, complex_issue_3867) {
 #endif
 
 TEST(TEST_CATEGORY, complex_operations_arithmetic_types_overloads) {
-#define STATIC_ASSERT(cond) static_assert(cond, "")
-
-  STATIC_ASSERT(Kokkos::real(1) == 1.);
-  STATIC_ASSERT(Kokkos::real(2.f) == 2.f);
-  STATIC_ASSERT(Kokkos::real(3.) == 3.);
-  STATIC_ASSERT(Kokkos::real(4.l) == 4.l);
-  STATIC_ASSERT((std::is_same<decltype(Kokkos::real(1)), double>::value));
-  STATIC_ASSERT((std::is_same<decltype(Kokkos::real(2.f)), float>::value));
-  STATIC_ASSERT((std::is_same<decltype(Kokkos::real(3.)), double>::value));
-  STATIC_ASSERT(
+  static_assert(Kokkos::real(1) == 1.);
+  static_assert(Kokkos::real(2.f) == 2.f);
+  static_assert(Kokkos::real(3.) == 3.);
+  static_assert(Kokkos::real(4.l) == 4.l);
+  static_assert((std::is_same<decltype(Kokkos::real(1)), double>::value));
+  static_assert((std::is_same<decltype(Kokkos::real(2.f)), float>::value));
+  static_assert((std::is_same<decltype(Kokkos::real(3.)), double>::value));
+  static_assert(
       (std::is_same<decltype(Kokkos::real(4.l)), long double>::value));
 
-  STATIC_ASSERT(Kokkos::imag(1) == 0.);
-  STATIC_ASSERT(Kokkos::imag(2.f) == 0.f);
-  STATIC_ASSERT(Kokkos::imag(3.) == 0.);
-  STATIC_ASSERT(Kokkos::imag(4.l) == 0.l);
-  STATIC_ASSERT((std::is_same<decltype(Kokkos::imag(1)), double>::value));
-  STATIC_ASSERT((std::is_same<decltype(Kokkos::imag(2.f)), float>::value));
-  STATIC_ASSERT((std::is_same<decltype(Kokkos::imag(3.)), double>::value));
-  STATIC_ASSERT(
+  static_assert(Kokkos::imag(1) == 0.);
+  static_assert(Kokkos::imag(2.f) == 0.f);
+  static_assert(Kokkos::imag(3.) == 0.);
+  static_assert(Kokkos::imag(4.l) == 0.l);
+  static_assert((std::is_same<decltype(Kokkos::imag(1)), double>::value));
+  static_assert((std::is_same<decltype(Kokkos::imag(2.f)), float>::value));
+  static_assert((std::is_same<decltype(Kokkos::imag(3.)), double>::value));
+  static_assert(
       (std::is_same<decltype(Kokkos::real(4.l)), long double>::value));
 
   // FIXME in principle could be checked at compile time too
@@ -554,16 +520,14 @@ TEST(TEST_CATEGORY, complex_operations_arithmetic_types_overloads) {
   ASSERT_EQ(Kokkos::conj(2.f), Kokkos::complex<float>(2.f));
   ASSERT_EQ(Kokkos::conj(3.), Kokkos::complex<double>(3.));
   ASSERT_EQ(Kokkos::conj(4.l), Kokkos::complex<long double>(4.l));
-  STATIC_ASSERT((
+  static_assert((
       std::is_same<decltype(Kokkos::conj(1)), Kokkos::complex<double>>::value));
-  STATIC_ASSERT((std::is_same<decltype(Kokkos::conj(2.f)),
+  static_assert((std::is_same<decltype(Kokkos::conj(2.f)),
                               Kokkos::complex<float>>::value));
-  STATIC_ASSERT((std::is_same<decltype(Kokkos::conj(3.)),
+  static_assert((std::is_same<decltype(Kokkos::conj(3.)),
                               Kokkos::complex<double>>::value));
-  STATIC_ASSERT((std::is_same<decltype(Kokkos::conj(4.l)),
+  static_assert((std::is_same<decltype(Kokkos::conj(4.l)),
                               Kokkos::complex<long double>>::value));
-
-#undef STATIC_ASSERT
 }
 
 }  // namespace Test
diff --git a/packages/kokkos/core/unit_test/TestConcepts.hpp b/packages/kokkos/core/unit_test/TestConcepts.hpp
index 561302f2a0f863e5857727b821a9f07867058f53..476a8848325c0375cecaadffc773e623ac17f997 100644
--- a/packages/kokkos/core/unit_test/TestConcepts.hpp
+++ b/packages/kokkos/core/unit_test/TestConcepts.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 
@@ -78,10 +50,165 @@ static_assert(!Kokkos::is_space<ExecutionSpace &>{}, "");
 static_assert(!Kokkos::is_space<MemorySpace &>{}, "");
 static_assert(!Kokkos::is_space<DeviceType &>{}, "");
 
+static_assert(Kokkos::is_execution_space_v<ExecutionSpace>, "");
+static_assert(!Kokkos::is_execution_space_v<ExecutionSpace &>, "");
+
 static_assert(
     std::is_same<float, Kokkos::Impl::remove_cvref_t<float const &>>{}, "");
 static_assert(std::is_same<int, Kokkos::Impl::remove_cvref_t<int &>>{}, "");
 static_assert(std::is_same<int, Kokkos::Impl::remove_cvref_t<int const>>{}, "");
 static_assert(std::is_same<float, Kokkos::Impl::remove_cvref_t<float>>{}, "");
 
+/*-------------------------------------------------
+  begin test for team_handle concept
+
+  Here we also provide a complete trait that follows the full concept specified
+  in:
+    https://github.com/kokkos/kokkos/blob/61d7db55fceac3318c987a291f77b844fd94c165/core/src/Kokkos_Concepts.hpp#L160
+  but this is not used as implementation for performance reasons as discussed
+  in: https://github.com/kokkos/kokkos/pull/5375
+  ------------------------------------------------- */
+
+template <typename T>
+struct is_team_handle_complete_trait_check {
+ private:
+  struct TrivialFunctor {
+    void operator()(double &) {}
+  };
+  using test_value_type = double;
+  test_value_type lvalueForMethodsNeedingIt_;
+  test_value_type *ptrForMethodsNeedingIt_;
+  // we use Sum here but any other reducer can be used
+  // since we just want something that meets the ReducerConcept
+  using reduction_to_test_t = ::Kokkos::Sum<test_value_type>;
+
+  // nested aliases
+  template <class U>
+  using ExecutionSpaceArchetypeAlias = typename U::execution_space;
+  template <class U>
+  using ScratchMemorySpaceArchetypeAlias = typename U::scratch_memory_space;
+
+  // "indices" methods
+  template <class U>
+  using TeamRankArchetypeExpr = decltype(std::declval<U const &>().team_rank());
+
+  template <class U>
+  using TeamSizeArchetypeExpr = decltype(std::declval<U const &>().team_size());
+
+  template <class U>
+  using LeagueRankArchetypeExpr =
+      decltype(std::declval<U const &>().league_rank());
+
+  template <class U>
+  using LeagueSizeArchetypeExpr =
+      decltype(std::declval<U const &>().league_size());
+
+  // scratch space
+  template <class U>
+  using TeamShmemArchetypeExpr =
+      decltype(std::declval<U const &>().team_shmem());
+
+  template <class U>
+  using TeamScratchArchetypeExpr =
+      decltype(std::declval<U const &>().team_scratch(0));
+
+  template <class U>
+  using ThreadScracthArchetypeExpr =
+      decltype(std::declval<U const &>().thread_scratch(0));
+
+  // collectives
+  template <class U>
+  using TeamBarrierArchetypeExpr =
+      decltype(std::declval<U const &>().team_barrier());
+
+  template <class U>
+  using TeamBroadcastArchetypeExpr = decltype(
+      std::declval<U const &>().team_broadcast(lvalueForMethodsNeedingIt_, 0));
+
+  template <class U>
+  using TeamBroadcastAcceptClosureArchetypeExpr =
+      decltype(std::declval<U const &>().team_broadcast(
+          TrivialFunctor{}, lvalueForMethodsNeedingIt_, 0));
+
+  template <class U>
+  using TeamReducedArchetypeExpr =
+      decltype(std::declval<U const &>().team_reduce(
+          std::declval<reduction_to_test_t>()));
+
+  template <class U>
+  using TeamScanArchetypeExpr = decltype(std::declval<U const &>().team_scan(
+      lvalueForMethodsNeedingIt_, ptrForMethodsNeedingIt_));
+
+ public:
+  static constexpr bool value =
+      Kokkos::is_detected_v<ExecutionSpaceArchetypeAlias, T> &&
+      Kokkos::is_detected_v<ScratchMemorySpaceArchetypeAlias, T> &&
+      //
+      Kokkos::is_detected_exact_v<int, TeamRankArchetypeExpr, T> &&
+      Kokkos::is_detected_exact_v<int, TeamSizeArchetypeExpr, T> &&
+      Kokkos::is_detected_exact_v<int, LeagueRankArchetypeExpr, T> &&
+      Kokkos::is_detected_exact_v<int, LeagueSizeArchetypeExpr, T> &&
+      //
+      Kokkos::is_detected_exact_v<
+          Kokkos::detected_t<ScratchMemorySpaceArchetypeAlias, T> const &,
+          TeamShmemArchetypeExpr, T> &&
+      Kokkos::is_detected_exact_v<
+          Kokkos::detected_t<ScratchMemorySpaceArchetypeAlias, T> const &,
+          TeamScratchArchetypeExpr, T> &&
+      Kokkos::is_detected_exact_v<
+          Kokkos::detected_t<ScratchMemorySpaceArchetypeAlias, T> const &,
+          ThreadScracthArchetypeExpr, T> &&
+      //
+      Kokkos::is_detected_exact_v<void, TeamBarrierArchetypeExpr, T> &&
+      Kokkos::is_detected_exact_v<void, TeamBroadcastArchetypeExpr, T> &&
+      Kokkos::is_detected_exact_v<void, TeamBroadcastAcceptClosureArchetypeExpr,
+                                  T> &&
+      Kokkos::is_detected_exact_v<void, TeamReducedArchetypeExpr, T> &&
+      Kokkos::is_detected_exact_v<test_value_type, TeamScanArchetypeExpr, T>;
+  constexpr operator bool() const noexcept { return value; }
+};
+
+template <class T>
+inline constexpr bool is_team_handle_complete_trait_check_v =
+    is_team_handle_complete_trait_check<T>::value;
+
+// actual test begins here
+
+/*
+  FIXME_OPENMPTARGET
+  https://github.com/kokkos/kokkos/blob/2d6cbad7e079eb45ae69ac6a59929d9fcf10409a/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.hpp#L860-L864
+
+  FIXME_OPENACC
+  OpenACCTeamMember is missing the following method:
+    template <typename ReducerType>
+    KOKKOS_INLINE_FUNCTION std::enable_if_t<is_reducer<ReducerType>::value>
+    team_reduce(ReducerType const& reducer) const noexcept;
+*/
+
+#if !defined(KOKKOS_ENABLE_OPENMPTARGET) && !defined(KOKKOS_ENABLE_OPENACC)
+using space_t  = TEST_EXECSPACE;
+using policy_t = Kokkos::TeamPolicy<space_t>;
+using member_t = typename policy_t::member_type;
+
+// is_team_handle uses the actual core implementation
+static_assert(Kokkos::is_team_handle<member_t>::value);
+static_assert(Kokkos::is_team_handle_v<member_t>);
+static_assert(Kokkos::is_team_handle_v<member_t const>);
+static_assert(!Kokkos::is_team_handle_v<member_t &>);
+static_assert(!Kokkos::is_team_handle_v<member_t const &>);
+static_assert(!Kokkos::is_team_handle_v<member_t *>);
+static_assert(!Kokkos::is_team_handle_v<member_t const *>);
+static_assert(!Kokkos::is_team_handle_v<member_t *const>);
+
+// is_team_handle_complete_trait_check uses the FULL trait class above
+static_assert(is_team_handle_complete_trait_check<member_t>::value);
+static_assert(is_team_handle_complete_trait_check_v<member_t>);
+static_assert(is_team_handle_complete_trait_check_v<member_t const>);
+static_assert(!is_team_handle_complete_trait_check_v<member_t &>);
+static_assert(!is_team_handle_complete_trait_check_v<member_t const &>);
+static_assert(!is_team_handle_complete_trait_check_v<member_t *>);
+static_assert(!is_team_handle_complete_trait_check_v<member_t const *>);
+static_assert(!is_team_handle_complete_trait_check_v<member_t *const>);
+#endif
+
 }  // namespace TestConcept
diff --git a/packages/kokkos/core/unit_test/TestConcurrentBitset.hpp b/packages/kokkos/core/unit_test/TestConcurrentBitset.hpp
index 9feac14d43c00331cc0d5bbeda63b6d85d3d834a..6d084ced86addfdcdfb6ff86917eb4fa67345e6d 100644
--- a/packages/kokkos/core/unit_test/TestConcurrentBitset.hpp
+++ b/packages/kokkos/core/unit_test/TestConcurrentBitset.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef TEST_CONCURRENTBITSET_HPP
 #define TEST_CONCURRENTBITSET_HPP
diff --git a/packages/kokkos/core/unit_test/TestCreateMirror.cpp b/packages/kokkos/core/unit_test/TestCreateMirror.cpp
index e8b3b6ea105950267a862a78ebcb632120e74f66..ae74c5e0da4189d66c215250cdfbe8f3341ac401 100644
--- a/packages/kokkos/core/unit_test/TestCreateMirror.cpp
+++ b/packages/kokkos/core/unit_test/TestCreateMirror.cpp
@@ -1,53 +1,24 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 
 template <typename TestView, typename MemorySpace>
 void check_memory_space(TestView, MemorySpace) {
-  static_assert(
-      std::is_same<typename TestView::memory_space, MemorySpace>::value, "");
+  static_assert(std::is_same_v<typename TestView::memory_space, MemorySpace>);
 }
 
 template <class View>
@@ -90,16 +61,16 @@ void test_create_mirror_properties(const View& view) {
   check_memory_space(create_mirror_view(view_alloc(                     DeviceMemorySpace{}), view), DeviceMemorySpace{});
 
   // create_mirror view_alloc + execution space
-  check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{}, WithoutInitializing),                        view), host_mirror_test_space(view));
-  check_memory_space(create_mirror(view_alloc(DefaultHostExecutionSpace{}),                                         view), host_mirror_test_space(view));
-  check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{},   WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{});
-  check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{},                        DeviceMemorySpace{}), view), DeviceMemorySpace{});
+  check_memory_space(create_mirror(view_alloc(DefaultHostExecutionSpace{}, WithoutInitializing),                      view), host_mirror_test_space(view));
+  check_memory_space(create_mirror(view_alloc(DefaultHostExecutionSpace{}),                                           view), host_mirror_test_space(view));
+  check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{},     WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{});
+  check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{},                          DeviceMemorySpace{}), view), DeviceMemorySpace{});
 
   // create_mirror_view view_alloc + execution space
-  check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{}, WithoutInitializing),                        view), host_mirror_test_space(view));
-  check_memory_space(create_mirror_view(view_alloc(DefaultHostExecutionSpace{}),                                         view), host_mirror_test_space(view));
-  check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{},   WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{});
-  check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{},                        DeviceMemorySpace{}), view), DeviceMemorySpace{});
+  check_memory_space(create_mirror_view(view_alloc(DefaultHostExecutionSpace{}, WithoutInitializing),                      view), host_mirror_test_space(view));
+  check_memory_space(create_mirror_view(view_alloc(DefaultHostExecutionSpace{}),                                           view), host_mirror_test_space(view));
+  check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{},     WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{});
+  check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{},                          DeviceMemorySpace{}), view), DeviceMemorySpace{});
 
   // create_mirror_view_and_copy
   check_memory_space(create_mirror_view_and_copy(HostSpace{},         view), HostSpace{});
diff --git a/packages/kokkos/core/unit_test/TestCrs.hpp b/packages/kokkos/core/unit_test/TestCrs.hpp
index 78208c911606379ff2635ddfdf940d6251973d9f..34fc4d05141ffd4f0d690d4e86abd443b0429935 100644
--- a/packages/kokkos/core/unit_test/TestCrs.hpp
+++ b/packages/kokkos/core/unit_test/TestCrs.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <vector>
 
diff --git a/packages/kokkos/core/unit_test/TestDeepCopyAlignment.hpp b/packages/kokkos/core/unit_test/TestDeepCopyAlignment.hpp
index 4500bd83bba75d7ac3c4de1b4e61cb7e1f8d6111..b7e6a8778643efd00a3383847a0975352e84cdec 100644
--- a/packages/kokkos/core/unit_test/TestDeepCopyAlignment.hpp
+++ b/packages/kokkos/core/unit_test/TestDeepCopyAlignment.hpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #include <Kokkos_Core.hpp>
 #include <cstddef>
 
diff --git a/packages/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp b/packages/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp
index d915b7e4728dacec80ebc3ae1fad87b30cf7e51a..7ae73b14d3a085870055147264b4d6147432a9af 100644
--- a/packages/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp
+++ b/packages/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
@@ -69,9 +41,10 @@ char** init_kokkos_args(bool do_threads, bool do_numa, bool do_device,
   nargs = (do_threads ? 1 : 0) + (do_numa ? 1 : 0) + (do_device ? 1 : 0) +
           (do_other ? 4 : 0) + (do_tune ? 1 : 0);
 
-  char** args_kokkos = new char*[nargs];
+  char** args_kokkos      = new char*[nargs];
+  const int max_args_size = 45;
   for (int i = 0; i < nargs; i++) {
-    args_kokkos[i] = new char[45];
+    args_kokkos[i] = new char[max_args_size];
     delete_these.insert(args_kokkos[i]);
   }
 
@@ -112,7 +85,7 @@ char** init_kokkos_args(bool do_threads, bool do_numa, bool do_device,
 #endif
 
     init_args.num_threads = nthreads;
-    sprintf(args_kokkos[threads_idx], "--threads=%i", nthreads);
+    snprintf(args_kokkos[threads_idx], max_args_size, "--threads=%i", nthreads);
   }
 
   if (do_numa) {
@@ -130,24 +103,27 @@ char** init_kokkos_args(bool do_threads, bool do_numa, bool do_device,
 #endif
 
     init_args.num_numa = numa;
-    sprintf(args_kokkos[numa_idx], "--numa=%i", numa);
+    snprintf(args_kokkos[numa_idx], max_args_size, "--numa=%i", numa);
   }
 
   if (do_device) {
     init_args.device_id = 0;
-    sprintf(args_kokkos[device_idx], "--device-id=%i", 0);
+    snprintf(args_kokkos[device_idx], max_args_size, "--device-id=%i", 0);
   }
 
   if (do_other) {
-    sprintf(args_kokkos[0], "--dummyarg=1");
-    sprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0)], "--dummy2arg");
-    sprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0) + 1], "dummy3arg");
-    sprintf(args_kokkos[device_idx + (do_device ? 1 : 0)], "dummy4arg=1");
+    snprintf(args_kokkos[0], max_args_size, "--dummyarg=1");
+    snprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0)], max_args_size,
+             "--dummy2arg");
+    snprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0) + 1], max_args_size,
+             "dummy3arg");
+    snprintf(args_kokkos[device_idx + (do_device ? 1 : 0)], max_args_size,
+             "dummy4arg=1");
   }
 
   if (do_tune) {
     init_args.tune_internals = true;
-    sprintf(args_kokkos[tune_idx], "--kokkos-tune-internals");
+    snprintf(args_kokkos[tune_idx], max_args_size, "--kokkos-tune-internals");
   }
 
   return args_kokkos;
diff --git a/packages/kokkos/core/unit_test/TestDetectionIdiom.cpp b/packages/kokkos/core/unit_test/TestDetectionIdiom.cpp
index 23da339cae03246084c0e67e8781d08972fb864e..66fdecabaa285f8bd48184f61dcd8c166e49efb9 100644
--- a/packages/kokkos/core/unit_test/TestDetectionIdiom.cpp
+++ b/packages/kokkos/core/unit_test/TestDetectionIdiom.cpp
@@ -1,64 +1,30 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_DetectionIdiom.hpp>
 
-#define STATIC_ASSERT(cond) static_assert(cond, "");
-
 void test_nonesuch() {
   using Kokkos::nonesuch;
-  STATIC_ASSERT(!std::is_constructible<nonesuch>::value);
-  STATIC_ASSERT(!std::is_destructible<nonesuch>::value);
-  STATIC_ASSERT(!std::is_copy_constructible<nonesuch>::value);
-  STATIC_ASSERT(!std::is_move_constructible<nonesuch>::value);
-#ifdef KOKKOS_ENABLE_CXX17
-  STATIC_ASSERT(!std::is_aggregate<nonesuch>::value);
-#endif
+  static_assert(!std::is_constructible<nonesuch>::value);
+  static_assert(!std::is_destructible<nonesuch>::value);
+  static_assert(!std::is_copy_constructible<nonesuch>::value);
+  static_assert(!std::is_move_constructible<nonesuch>::value);
+  static_assert(!std::is_aggregate<nonesuch>::value);
 }
 
-#undef STATIC_ASSERT
-
 namespace Example {
 // Example from https://en.cppreference.com/w/cpp/experimental/is_detected
 template <class T>
diff --git a/packages/kokkos/core/unit_test/TestDeviceAndThreads.py b/packages/kokkos/core/unit_test/TestDeviceAndThreads.py
new file mode 100644
index 0000000000000000000000000000000000000000..fd70e3ff681d74e26473f93e1083807c8ad112e4
--- /dev/null
+++ b/packages/kokkos/core/unit_test/TestDeviceAndThreads.py
@@ -0,0 +1,92 @@
+#@HEADER
+# ************************************************************************
+
+#                        Kokkos v. 4.0
+#       Copyright (2022) National Technology & Engineering
+#               Solutions of Sandia, LLC (NTESS).
+
+# Under the terms of Contract DE-NA0003525 with NTESS,
+# the U.S. Government retains certain rights in this software.
+
+# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+# ************************************************************************
+# @HEADER
+
+import unittest
+import subprocess
+
+PREFIX = "$<TARGET_FILE_DIR:KokkosCore_UnitTest_DeviceAndThreads>"
+EXECUTABLE = "$<TARGET_FILE_NAME:KokkosCore_UnitTest_DeviceAndThreads>"
+COMMAND = "/".join([PREFIX, EXECUTABLE])
+
+
+def GetFlag(flag, *extra_args):
+    p = subprocess.run([COMMAND, flag, *extra_args], capture_output=True)
+    if p.returncode != 0:
+        raise Exception(p.stderr.decode("utf-8"))
+    return int(p.stdout)
+
+def GetNumThreads(max_threads):
+    for x in [1, 2, 3, 5, 7]:
+        if x >= max_threads:
+            break
+        yield x
+    yield max_threads
+
+class KokkosInitializationTestCase(unittest.TestCase):
+    def test_num_threads(self):
+        max_threads = GetFlag("max_threads")
+        if max_threads == 1:
+            self.skipTest("no host parallel backend enabled")
+        for num_threads in GetNumThreads(max_threads):
+            self.assertEqual(
+                num_threads,
+                GetFlag(
+                    "num_threads",
+                    "--kokkos-num-threads={}".format(num_threads)))
+
+    def test_device_id(self):
+        device_count = GetFlag("device_count")
+        if device_count == 0:
+            self.skipTest("no device detected")
+        # by default use the first GPU available for execution
+        self.assertEqual(0, GetFlag("device_id"))
+        for device_id in range(device_count):
+            self.assertEqual(
+                device_id,
+                GetFlag(
+                    "device_id",
+                    "--kokkos-device-id={}".format(device_id)))
+
+    def test_disable_warnings(self):
+        self.assertEqual(0, GetFlag("disable_warnings"))
+        self.assertEqual(
+            0,
+            GetFlag(
+                "disable_warnings",
+                "--kokkos-disable-warnings=0"))
+        self.assertEqual(
+            1,
+            GetFlag(
+                "disable_warnings",
+                "--kokkos-disable-warnings=1"))
+
+    def test_tune_internals(self):
+        self.assertEqual(0, GetFlag("tune_internals"))
+        self.assertEqual(
+            0,
+            GetFlag(
+                "tune_internals",
+                "--kokkos-tune-internals=0"))
+        self.assertEqual(
+            1,
+            GetFlag(
+                "tune_internals",
+                "--kokkos-tune-internals=1"))
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/packages/kokkos/core/unit_test/TestExecSpacePartitioning.hpp b/packages/kokkos/core/unit_test/TestExecSpacePartitioning.hpp
index 82228476e712a4c1cc834fccff6289945f9bb279..0b02a5e36f13119c7e2a3035d2a08dbcd8571f2e 100644
--- a/packages/kokkos/core/unit_test/TestExecSpacePartitioning.hpp
+++ b/packages/kokkos/core/unit_test/TestExecSpacePartitioning.hpp
@@ -1,50 +1,23 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <cstdio>
 #include <sstream>
 #include <iostream>
+#include <thread>
 
 #include <Kokkos_Core.hpp>
 
@@ -64,8 +37,7 @@ void check_distinctive(Kokkos::Cuda exec1, Kokkos::Cuda exec2) {
 }
 #endif
 #ifdef KOKKOS_ENABLE_HIP
-void check_distinctive(Kokkos::Experimental::HIP exec1,
-                       Kokkos::Experimental::HIP exec2) {
+void check_distinctive(Kokkos::HIP exec1, Kokkos::HIP exec2) {
   ASSERT_NE(exec1.hip_stream(), exec2.hip_stream());
 }
 #endif
@@ -76,23 +48,60 @@ void check_distinctive(Kokkos::Experimental::SYCL exec1,
             *exec2.impl_internal_space_instance()->m_queue);
 }
 #endif
+#ifdef KOKKOS_ENABLE_OPENMP
+void check_distinctive(Kokkos::OpenMP exec1, Kokkos::OpenMP exec2) {
+  ASSERT_NE(exec1, exec2);
+}
+#endif
 }  // namespace
 
+#ifdef KOKKOS_ENABLE_OPENMP
+template <class Lambda1, class Lambda2>
+void run_threaded_test(const Lambda1 l1, const Lambda2 l2) {
+#pragma omp parallel num_threads(2)
+  {
+    if (omp_get_thread_num() == 0) l1();
+    if (omp_get_thread_num() == 1) l2();
+  }
+}
+// We cannot run the multithreaded test when threads or HPX is enabled because
+// we cannot launch a thread from inside another thread
+#elif !defined(KOKKOS_ENABLE_THREADS) && !defined(KOKKOS_ENABLE_HPX)
+template <class Lambda1, class Lambda2>
+void run_threaded_test(const Lambda1 l1, const Lambda2 l2) {
+  std::thread t1(std::move(l1));
+  std::thread t2(std::move(l2));
+  t1.join();
+  t2.join();
+}
+#else
+template <class Lambda1, class Lambda2>
+void run_threaded_test(const Lambda1 l1, const Lambda2 l2) {
+  l1();
+  l2();
+}
+#endif
+
 void test_partitioning(std::vector<TEST_EXECSPACE>& instances) {
   check_distinctive(instances[0], instances[1]);
   int sum1, sum2;
   int N = 3910;
-  Kokkos::parallel_reduce(
-      Kokkos::RangePolicy<TEST_EXECSPACE>(instances[0], 0, N), SumFunctor(),
-      sum1);
-  Kokkos::parallel_reduce(
-      Kokkos::RangePolicy<TEST_EXECSPACE>(instances[1], 0, N), SumFunctor(),
-      sum2);
+  run_threaded_test(
+      [&]() {
+        Kokkos::parallel_reduce(
+            Kokkos::RangePolicy<TEST_EXECSPACE>(instances[0], 0, N),
+            SumFunctor(), sum1);
+      },
+      [&]() {
+        Kokkos::parallel_reduce(
+            Kokkos::RangePolicy<TEST_EXECSPACE>(instances[1], 0, N),
+            SumFunctor(), sum2);
+      });
   ASSERT_EQ(sum1, sum2);
   ASSERT_EQ(sum1, N * (N - 1) / 2);
 
 #if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \
-    defined(KOKKOS_ENABLE_SYCL)
+    defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENMP)
   // Eliminate unused function warning
   // (i.e. when compiling for Serial and CUDA, during Serial compilation the
   // Cuda overload is unused ...)
@@ -101,11 +110,14 @@ void test_partitioning(std::vector<TEST_EXECSPACE>& instances) {
     check_distinctive(Kokkos::Cuda(), Kokkos::Cuda());
 #endif
 #ifdef KOKKOS_ENABLE_HIP
-    check_distinctive(Kokkos::Experimental::HIP(), Kokkos::Experimental::HIP());
+    check_distinctive(Kokkos::HIP(), Kokkos::HIP());
 #endif
 #ifdef KOKKOS_ENABLE_SYCL
     check_distinctive(Kokkos::Experimental::SYCL(),
                       Kokkos::Experimental::SYCL());
+#endif
+#ifdef KOKKOS_ENABLE_OPENMP
+    check_distinctive(Kokkos::OpenMP(), Kokkos::OpenMP());
 #endif
   }
 #endif
@@ -113,7 +125,7 @@ void test_partitioning(std::vector<TEST_EXECSPACE>& instances) {
 
 TEST(TEST_CATEGORY, partitioning_by_args) {
   auto instances =
-      Kokkos::Experimental::partition_space(TEST_EXECSPACE(), 1, 1.);
+      Kokkos::Experimental::partition_space(TEST_EXECSPACE(), 1, 1);
   ASSERT_EQ(int(instances.size()), 2);
   test_partitioning(instances);
 }
diff --git a/packages/kokkos/core/unit_test/TestExecutionSpace.hpp b/packages/kokkos/core/unit_test/TestExecutionSpace.hpp
index c9d2d275bfe4b1f73a990a6f9f83242cb970946c..6f0f159c1740546d5d664fef74abf1f689e8a55b 100644
--- a/packages/kokkos/core/unit_test/TestExecutionSpace.hpp
+++ b/packages/kokkos/core/unit_test/TestExecutionSpace.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
@@ -54,10 +26,9 @@ struct CheckClassWithExecutionSpaceAsDataMemberIsCopyable {
   Kokkos::DefaultHostExecutionSpace host;
 
   KOKKOS_FUNCTION void operator()(int, int& e) const {
-    auto copy = *this;
     // not actually doing anything useful, mostly checking that
     // ExecutionSpace::in_parallel() is callable
-    if (static_cast<int>(copy.device.in_parallel()) < 0) {
+    if (static_cast<int>(device.in_parallel()) < 0) {
       ++e;
     }
   }
diff --git a/packages/kokkos/core/unit_test/TestFunctorAnalysis.hpp b/packages/kokkos/core/unit_test/TestFunctorAnalysis.hpp
index 5e0910b523d1361652f5ad8fc02f20a82953d220..9ebb9c066a2767d2c3593efdb7bd1daa05db5b25 100644
--- a/packages/kokkos/core/unit_test/TestFunctorAnalysis.hpp
+++ b/packages/kokkos/core/unit_test/TestFunctorAnalysis.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef TEST_FUNCTOR_ANALYSIS_HPP
 #define TEST_FUNCTOR_ANALYSIS_HPP
diff --git a/packages/kokkos/core/unit_test/TestGraph.hpp b/packages/kokkos/core/unit_test/TestGraph.hpp
index d012da47be08e95c012d9c02e467da7420fc42ad..9a36d08f445aa12841b3d1723729a9c518573379 100644
--- a/packages/kokkos/core/unit_test/TestGraph.hpp
+++ b/packages/kokkos/core/unit_test/TestGraph.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <Kokkos_Graph.hpp>
diff --git a/packages/kokkos/core/unit_test/TestHWLOC.cpp b/packages/kokkos/core/unit_test/TestHWLOC.cpp
index 428a67048451a6adbfbf77ab94bcf7a1ced910dc..d68c8ccf18815aa2f241839f2c5d4700608e33ca 100644
--- a/packages/kokkos/core/unit_test/TestHWLOC.cpp
+++ b/packages/kokkos/core/unit_test/TestHWLOC.cpp
@@ -1,51 +1,24 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
 #include <iostream>
 
+#define KOKKOS_IMPL_PUBLIC_INCLUDE
 #include <Kokkos_hwloc.hpp>
 
 namespace Test {
diff --git a/packages/kokkos/core/unit_test/TestHalfConversion.hpp b/packages/kokkos/core/unit_test/TestHalfConversion.hpp
index 872e3ef8bdf40faaa677f7cb1805ebf224e5fa15..acefac2692c2e3f54ede4485bfc6fe020985aba8 100644
--- a/packages/kokkos/core/unit_test/TestHalfConversion.hpp
+++ b/packages/kokkos/core/unit_test/TestHalfConversion.hpp
@@ -1,47 +1,18 @@
-
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef TESTHALFCONVERSION_HPP_
 #define TESTHALFCONVERSION_HPP_
diff --git a/packages/kokkos/core/unit_test/TestHalfOperators.hpp b/packages/kokkos/core/unit_test/TestHalfOperators.hpp
index 977a704657c7bb6f350143e31c577738de4ff192..6a2bc359e5bf915c033db5c5ab40a98946267de3 100644
--- a/packages/kokkos/core/unit_test/TestHalfOperators.hpp
+++ b/packages/kokkos/core/unit_test/TestHalfOperators.hpp
@@ -1,47 +1,18 @@
-
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef TESTHALFOPERATOR_HPP_
 #define TESTHALFOPERATOR_HPP_
@@ -272,6 +243,8 @@ enum OP_TESTS {
   N_OP_TESTS
 };
 
+// volatile-qualified parameter type 'volatile half_type' is deprecated
+#if !defined(KOKKOS_ENABLE_CXX20) && !defined(KOKKOS_ENABLE_CXX23)
 template <class view_type, class half_type>
 struct Functor_TestHalfVolatileOperators {
   volatile half_type h_lhs, h_rhs;
@@ -358,6 +331,7 @@ struct Functor_TestHalfVolatileOperators {
     expected_lhs(CDIV_H_H) /= d_rhs;
   }
 };
+#endif
 
 template <class view_type, class half_type>
 struct Functor_TestHalfOperators {
@@ -961,6 +935,8 @@ void __test_half_operators(half_type h_lhs, half_type h_rhs) {
                 epsilon);
   }
 
+// volatile-qualified parameter type 'volatile half_type' is deprecated
+#if !defined(KOKKOS_ENABLE_CXX20) && !defined(KOKKOS_ENABLE_CXX23)
   // Test partial volatile support
   volatile half_type _h_lhs = h_lhs;
   volatile half_type _h_rhs = h_rhs;
@@ -984,6 +960,7 @@ void __test_half_operators(half_type h_lhs, half_type h_rhs) {
                   epsilon);
     }
   }
+#endif
 
   // is_trivially_copyable is false with the addition of explicit
   // copy constructors that are required for supporting reductions
diff --git a/packages/kokkos/core/unit_test/TestHostSharedPtr.hpp b/packages/kokkos/core/unit_test/TestHostSharedPtr.hpp
index 29bc45592b0287c5671daaac6db983905beaf5c0..5b185ee3ed154c38f92c21a8b19bd9d581da29fe 100644
--- a/packages/kokkos/core/unit_test/TestHostSharedPtr.hpp
+++ b/packages/kokkos/core/unit_test/TestHostSharedPtr.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <impl/Kokkos_HostSharedPtr.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestHostSharedPtrAccessOnDevice.hpp b/packages/kokkos/core/unit_test/TestHostSharedPtrAccessOnDevice.hpp
index 9a4da5dddebc95a5e24521d6c70a9a22d6063fe6..8cf25cef847f6ae7e5b57a7d421e7ca6238d79fe 100644
--- a/packages/kokkos/core/unit_test/TestHostSharedPtrAccessOnDevice.hpp
+++ b/packages/kokkos/core/unit_test/TestHostSharedPtrAccessOnDevice.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <impl/Kokkos_StringManipulation.hpp>
 #include <impl/Kokkos_HostSharedPtr.hpp>
@@ -136,6 +108,12 @@ TEST(TEST_CATEGORY, host_shared_ptr_dereference_on_device) {
       static_cast<T*>(Kokkos::kokkos_malloc<MemorySpace>(sizeof(T))),
       [](T* p) { Kokkos::kokkos_free<MemorySpace>(p); });
 
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<TEST_EXECSPACE, Kokkos::Cuda>) {
+    GTEST_SKIP() << "FIXME wrong result";
+  }
+#endif
   check_access_stored_pointer_and_dereference_on_device(device_ptr);
 }
 
@@ -277,13 +255,11 @@ TEST(TEST_CATEGORY, host_shared_ptr_tracking) {
         Kokkos::Experimental::SYCLSharedUSMSpace>();
 #endif
 #ifdef KOKKOS_ENABLE_HIP
-  if (std::is_same<TEST_EXECSPACE, Kokkos::Experimental::HIP>::value) {
-    host_shared_ptr_test_reference_counting<
-        Kokkos::Experimental::HIPHostPinnedSpace,
-        Kokkos::Experimental::HIPHostPinnedSpace>();
-    host_shared_ptr_test_reference_counting<
-        Kokkos::Experimental::HIPManagedSpace,
-        Kokkos::Experimental::HIPManagedSpace>();
+  if (std::is_same<TEST_EXECSPACE, Kokkos::HIP>::value) {
+    host_shared_ptr_test_reference_counting<Kokkos::HIPHostPinnedSpace,
+                                            Kokkos::HIPHostPinnedSpace>();
+    host_shared_ptr_test_reference_counting<Kokkos::HIPManagedSpace,
+                                            Kokkos::HIPManagedSpace>();
   }
 #endif
 }
diff --git a/packages/kokkos/core/unit_test/TestInit.hpp b/packages/kokkos/core/unit_test/TestInit.hpp
index 20536b0d35f44a14bc392c4302072c59cf710772..7be9ef5f12a3ef0329c8204b11a4a6e6dbd5a2cf 100644
--- a/packages/kokkos/core/unit_test/TestInit.hpp
+++ b/packages/kokkos/core/unit_test/TestInit.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <cstdio>
 #include <sstream>
@@ -70,4 +42,3 @@ TEST(TEST_CATEGORY, dispatch) { test_dispatch<TEST_EXECSPACE>(); }
 }  // namespace Test
 
 #include <TestCompilerMacros.hpp>
-#include <TestPolicyConstruction.hpp>
diff --git a/packages/kokkos/core/unit_test/TestInitializationSettings.cpp b/packages/kokkos/core/unit_test/TestInitializationSettings.cpp
index a5b11c5a30d049df4fb590b0838f10fabb9e8ae5..f5be0e47aab47f0e050c799e5a47867da65e2de4 100644
--- a/packages/kokkos/core/unit_test/TestInitializationSettings.cpp
+++ b/packages/kokkos/core/unit_test/TestInitializationSettings.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
@@ -91,15 +63,13 @@ TEST(defaultdevicetype, initialization_settings) {
   EXPECT_FALSE(settings.has_tools_args());
 }
 
-#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, "")  // FIXME C++17
-
 constexpr bool test_initialization_settings_getter() {
 #define CHECK_INITIALIZATION_SETTINGS_GETTER_RETURN_TYPE(NAME, TYPE)           \
-  STATIC_ASSERT(std::is_same<                                                  \
+  static_assert(std::is_same<                                                  \
                 decltype(std::declval<Kokkos::InitializationSettings const&>() \
                              .has_##NAME()),                                   \
                 bool>::value);                                                 \
-  STATIC_ASSERT(std::is_same<                                                  \
+  static_assert(std::is_same<                                                  \
                 decltype(std::declval<Kokkos::InitializationSettings const&>() \
                              .get_##NAME()),                                   \
                 TYPE>::value);
@@ -116,9 +86,9 @@ constexpr bool test_initialization_settings_getter() {
   return true;
 }
 
-STATIC_ASSERT(test_initialization_settings_getter());
+static_assert(test_initialization_settings_getter());
 
-STATIC_ASSERT(
+static_assert(
     std::is_default_constructible<Kokkos::InitializationSettings>::value);
 
 }  // namespace
diff --git a/packages/kokkos/core/unit_test/TestInterOp.cpp b/packages/kokkos/core/unit_test/TestInterOp.cpp
index 50238a93a5a8ea9b1125e42cb0d60ab8dc762e16..b183b13403aab33b7a3341a5d1cff09b2e7f4b02 100644
--- a/packages/kokkos/core/unit_test/TestInterOp.cpp
+++ b/packages/kokkos/core/unit_test/TestInterOp.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <Kokkos_DynRankView.hpp>
diff --git a/packages/kokkos/core/unit_test/TestIrregularLayout.hpp b/packages/kokkos/core/unit_test/TestIrregularLayout.hpp
index af4fd22452fa0427c3d0536e0a45168503b00677..c04d2cca3ee65ea16da20af5afc9296f55492f29 100644
--- a/packages/kokkos/core/unit_test/TestIrregularLayout.hpp
+++ b/packages/kokkos/core/unit_test/TestIrregularLayout.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 #include <Kokkos_Core.hpp>
diff --git a/packages/kokkos/core/unit_test/TestJoinBackwardCompatibility.hpp b/packages/kokkos/core/unit_test/TestJoinBackwardCompatibility.hpp
index ab5ccd0039583a3e3d626f7b7bd789e783b3b66e..60da9e0713f0da4df94aa81e3a1778ba99ae28db 100644
--- a/packages/kokkos/core/unit_test/TestJoinBackwardCompatibility.hpp
+++ b/packages/kokkos/core/unit_test/TestJoinBackwardCompatibility.hpp
@@ -1,57 +1,32 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <gtest/gtest.h>
 
+#ifndef KOKKOS_ENABLE_OPENACC  // FIXME_OPENACC - temporarily disabled due to
+                               // unimplemented reduction features
 namespace {
 
 enum MyErrorCode {
   no_error                           = 0b000,
   error_operator_plus_equal          = 0b001,
   error_operator_plus_equal_volatile = 0b010,
-  error_join_volatile                = 0b100
+  error_join_volatile                = 0b100,
+  expected_join_volatile             = 0b1000
 
 };
 
@@ -114,7 +89,7 @@ struct ReducerWithJoinThatTakesVolatileQualifiedArgs {
   using value_type = MyJoinBackCompatValueType;
   KOKKOS_FUNCTION void join(MyJoinBackCompatValueType volatile &x,
                             MyJoinBackCompatValueType const volatile &y) const {
-    x.err = x.err | y.err;
+    x.err = x.err | y.err | expected_join_volatile;
   }
   KOKKOS_FUNCTION void operator()(int, MyJoinBackCompatValueType &) const {}
   KOKKOS_FUNCTION ReducerWithJoinThatTakesVolatileQualifiedArgs() {}
@@ -124,12 +99,6 @@ void test_join_backward_compatibility() {
   MyJoinBackCompatValueType result;
   Kokkos::RangePolicy<> policy(0, 1);
 
-#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3
-  Kokkos::parallel_reduce(
-      policy, ReducerWithJoinThatTakesVolatileQualifiedArgs{}, result);
-  ASSERT_EQ(result.err, no_error);
-#endif
-
   Kokkos::parallel_reduce(
       policy, ReducerWithJoinThatTakesBothVolatileAndNonVolatileQualifiedArgs{},
       result);
@@ -145,10 +114,28 @@ void test_join_backward_compatibility() {
       static_cast<MyJoinBackCompatValueType const volatile &>(result);
   ASSERT_EQ(result.err,
             error_operator_plus_equal | error_operator_plus_equal_volatile);
+
+  MyJoinBackCompatValueType result2;
+  volatile MyJoinBackCompatValueType vol_result;
+  ReducerWithJoinThatTakesVolatileQualifiedArgs my_red;
+  my_red.join(vol_result, result2);
+  ASSERT_EQ(vol_result.err, expected_join_volatile);
+
+#if defined(KOKKOS_ENABLE_DEPRECATED_CODE_3)
+  MyJoinBackCompatValueType result3;
+  Kokkos::parallel_reduce(
+      policy, ReducerWithJoinThatTakesVolatileQualifiedArgs{}, result3);
+  ASSERT_EQ(result3.err, expected_join_volatile);
+#endif
 }
 
 TEST(TEST_CATEGORY, join_backward_compatibility) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  GTEST_SKIP() << "FIXME wrong result";
+#endif
   test_join_backward_compatibility();
 }
 
 }  // namespace
+#endif
diff --git a/packages/kokkos/core/unit_test/TestLegionInitialization.cpp b/packages/kokkos/core/unit_test/TestLegionInitialization.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c3967d302590ba3035c5943d54be46097e578f26
--- /dev/null
+++ b/packages/kokkos/core/unit_test/TestLegionInitialization.cpp
@@ -0,0 +1,65 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#include <Kokkos_Core.hpp>
+#include <gtest/gtest.h>
+
+namespace {
+
+struct ReductionFunctor {
+  Kokkos::View<int*> d;
+
+  KOKKOS_FUNCTION void operator()(int i, int& sum) const { sum += d(i); }
+};
+
+// The purpose of this test is to mimic Legion's use case of initializing and
+// finalizing individual backends
+TEST(initialization, legion_initialization) {
+  Kokkos::InitializationSettings kokkos_init_settings;
+
+  Kokkos::Impl::pre_initialize(kokkos_init_settings);
+
+  // We need to have a host execution space initialized first.
+  Kokkos::DefaultHostExecutionSpace::impl_initialize(kokkos_init_settings);
+
+  if (!std::is_same_v<Kokkos::DefaultExecutionSpace,
+                      Kokkos::DefaultHostExecutionSpace>)
+    Kokkos::DefaultExecutionSpace::impl_initialize(kokkos_init_settings);
+
+  Kokkos::Impl::post_initialize(kokkos_init_settings);
+
+  EXPECT_TRUE(Kokkos::is_initialized());
+
+  {
+    Kokkos::View<int*> d("d", 1000);
+    Kokkos::deep_copy(d, 1);
+    int result;
+    Kokkos::parallel_reduce("TestRed", d.extent(0), ReductionFunctor{d},
+                            result);
+    EXPECT_EQ(result, d.extent_int(0));
+  }
+
+  Kokkos::Impl::pre_finalize();
+  if (!std::is_same_v<Kokkos::DefaultExecutionSpace,
+                      Kokkos::DefaultHostExecutionSpace>)
+    Kokkos::DefaultExecutionSpace::impl_finalize();
+  Kokkos::DefaultHostExecutionSpace::impl_finalize();
+  Kokkos::Impl::post_finalize();
+
+  EXPECT_FALSE(Kokkos::is_initialized());
+  EXPECT_TRUE(Kokkos::is_finalized());
+}
+}  // namespace
diff --git a/packages/kokkos/core/unit_test/TestLegionInteroperability.cpp b/packages/kokkos/core/unit_test/TestLegionInteroperability.cpp
deleted file mode 100644
index 1838558451d52dbb3d0bc26d46cb50621d00343c..0000000000000000000000000000000000000000
--- a/packages/kokkos/core/unit_test/TestLegionInteroperability.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
-//               Solutions of Sandia, LLC (NTESS).
-//
-// Under the terms of Contract DE-NA0003525 with NTESS,
-// the U.S. Government retains certain rights in this software.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
-//@HEADER
-*/
-
-#include <Kokkos_Core.hpp>
-
-#if defined(KOKKOS_COMPILER_INTEL) && (KOKKOS_COMPILER_INTEL < 1800)
-
-namespace {
-
-// error: expression must have a constant value
-//   std::enable_if_t<!has_deprecated_cuda_impl_initialize_v<T>>
-constexpr bool
-test_compiler_upgrade_needed_for_detection_idiom_and_variable_template() {
-  return true;
-}
-static_assert(
-    test_compiler_upgrade_needed_for_detection_idiom_and_variable_template(),
-    "Intel C++ compiler is awesome");
-
-}  // namespace
-
-#else
-
-// The purpose of this compile-only test is twofold:
-// 1. mimic Legion's use of Kokkos implementation details for initializing the
-//    exectution environment
-// 2. demonstrate how to leverage SFINAE to support Kokkos version through the
-//    ExecutionSpace::impl_initialize breaking change before release 3.7
-namespace {
-#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, "")  // FIXME C++17
-
-#ifdef KOKKOS_ENABLE_CUDA
-template <class T>
-using deprecated_cuda_impl_initialize_t =
-    decltype(T::impl_initialize(typename T::SelectDevice(0), 1));
-
-template <class T>
-constexpr bool has_deprecated_cuda_impl_initialize_v =
-    Kokkos::is_detected<deprecated_cuda_impl_initialize_t, T>::value;
-
-template <class T>
-std::enable_if_t<has_deprecated_cuda_impl_initialize_v<T> >
-legion_initialize_kokkos_cuda() {
-  int cuda_device_id = 0;
-  int num_instances  = 1;
-  T::impl_initialize(typename T::SelectDevice(cuda_device_id), num_instances);
-}
-
-template <class T>
-std::enable_if_t<!has_deprecated_cuda_impl_initialize_v<T> >
-legion_initialize_kokkos_cuda() {
-  int cuda_device_id = 0;
-  auto const settings =
-      Kokkos::InitializationSettings().set_device_id(cuda_device_id);
-  T::impl_initialize(settings);
-}
-
-STATIC_ASSERT(std::is_void<
-              decltype(legion_initialize_kokkos_cuda<Kokkos::Cuda>())>::value);
-#endif
-
-#ifdef KOKKOS_ENABLE_OPENMP
-template <class T>
-using deprecated_openmp_impl_initialize_t = decltype(T::impl_initialize(0));
-
-template <class T>
-constexpr bool has_deprecated_openmp_impl_initialize_v =
-    Kokkos::is_detected<deprecated_openmp_impl_initialize_t, T>::value;
-
-template <class T>
-std::enable_if_t<has_deprecated_openmp_impl_initialize_v<T> >
-legion_initialize_kokkos_openmp() {
-  int thread_count = -1;
-  T::impl_initialize(thread_count);
-}
-
-template <class T>
-std::enable_if_t<!has_deprecated_openmp_impl_initialize_v<T> >
-legion_initialize_kokkos_openmp() {
-  int thread_count = -1;
-  auto const settings =
-      Kokkos::InitializationSettings().set_num_threads(thread_count);
-  T::impl_initialize(settings);
-}
-
-STATIC_ASSERT(std::is_void<decltype(
-                  legion_initialize_kokkos_openmp<Kokkos::OpenMP>())>::value);
-
-#endif
-
-#ifdef KOKKOS_ENABLE_SERIAL
-template <class T>
-using deprecated_serial_impl_initialize_t = decltype(T::impl_initialize());
-
-template <class T>
-constexpr bool has_deprecated_serial_impl_initialize_v =
-    Kokkos::is_detected<deprecated_serial_impl_initialize_t, T>::value;
-
-template <class T>
-std::enable_if_t<has_deprecated_serial_impl_initialize_v<T> >
-legion_initialize_kokkos_serial() {
-  T::impl_initialize();
-}
-
-template <class T>
-std::enable_if_t<!has_deprecated_serial_impl_initialize_v<T> >
-legion_initialize_kokkos_serial() {
-  Kokkos::InitializationSettings settings;
-  T::impl_initialize(settings);
-}
-
-STATIC_ASSERT(std::is_void<decltype(
-                  legion_initialize_kokkos_serial<Kokkos::Serial>())>::value);
-#endif
-
-}  // namespace
-
-#endif
diff --git a/packages/kokkos/core/unit_test/TestLocalDeepCopy.hpp b/packages/kokkos/core/unit_test/TestLocalDeepCopy.hpp
index cdb14fec54291c745ad266f37a9dd846f0921d7a..60cb02b7f0577c1a5325210d8f15ed8945568e9a 100644
--- a/packages/kokkos/core/unit_test/TestLocalDeepCopy.hpp
+++ b/packages/kokkos/core/unit_test/TestLocalDeepCopy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/TestMDRange.hpp b/packages/kokkos/core/unit_test/TestMDRange.hpp
index e0a880a7a1435bc6879fc67c7e7b53876e81bb74..3e80e7a01bf0331bbaadbdb963fa5bea97ca7779 100644
--- a/packages/kokkos/core/unit_test/TestMDRange.hpp
+++ b/packages/kokkos/core/unit_test/TestMDRange.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <cstdio>
 
@@ -109,12 +81,6 @@ struct TestMDRange_ReduceArray_2D {
       parallel_for(range_init, functor);  // Init the view to 3's
 
       double sums[array_size];
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-      double *sums_ptr = sums;
-      parallel_reduce(range, functor, sums_ptr);
-      ASSERT_EQ(sums[0], 6 * N0 * N1);
-      ASSERT_EQ(sums[1], 3 * N0 * N1);
-#endif
       Kokkos::fence("Fence before accessing result on the host");
       parallel_reduce(range, functor, sums);
 
diff --git a/packages/kokkos/core/unit_test/TestMDRangePolicyConstructors.hpp b/packages/kokkos/core/unit_test/TestMDRangePolicyConstructors.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..9eeaba9fd44609cebc129900d81ffcc67ede34c1
--- /dev/null
+++ b/packages/kokkos/core/unit_test/TestMDRangePolicyConstructors.hpp
@@ -0,0 +1,100 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#include <gtest/gtest.h>
+
+#include <Kokkos_Core.hpp>
+
+namespace {
+
+template <class IndexType>
+void construct_mdrange_policy_variable_type() {
+  (void)Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>{
+      Kokkos::Array<IndexType, 2>{}, Kokkos::Array<IndexType, 2>{}};
+
+  (void)Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>{
+      {{IndexType(0), IndexType(0)}}, {{IndexType(2), IndexType(2)}}};
+
+  (void)Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>{
+      {IndexType(0), IndexType(0)}, {IndexType(2), IndexType(2)}};
+}
+
+TEST(TEST_CATEGORY, md_range_policy_construction_from_arrays) {
+  {
+    // Check that construction from Kokkos::Array of the specified index type
+    // works.
+    using IndexType = unsigned long long;
+    Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>,
+                          Kokkos::IndexType<IndexType>>
+        p1(Kokkos::Array<IndexType, 2>{{0, 1}},
+           Kokkos::Array<IndexType, 2>{{2, 3}});
+    Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>,
+                          Kokkos::IndexType<IndexType>>
+        p2(Kokkos::Array<IndexType, 2>{{0, 1}},
+           Kokkos::Array<IndexType, 2>{{2, 3}});
+    Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>,
+                          Kokkos::IndexType<IndexType>>
+        p3(Kokkos::Array<IndexType, 2>{{0, 1}},
+           Kokkos::Array<IndexType, 2>{{2, 3}},
+           Kokkos::Array<IndexType, 1>{{4}});
+  }
+  {
+    // Check that construction from double-braced initializer list
+    // works.
+    using index_type = unsigned long long;
+    Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>> p1({{0, 1}},
+                                                              {{2, 3}});
+    Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>,
+                          Kokkos::IndexType<index_type>>
+        p2({{0, 1}}, {{2, 3}});
+  }
+  {
+    // Check that construction from Kokkos::Array of long compiles for backwards
+    // compability.  This was broken in
+    // https://github.com/kokkos/kokkos/pull/3527/commits/88ea8eec6567c84739d77bdd25fdbc647fae28bb#r512323639
+    Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>> p1(
+        Kokkos::Array<long, 2>{{0, 1}}, Kokkos::Array<long, 2>{{2, 3}});
+    Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>> p2(
+        Kokkos::Array<long, 2>{{0, 1}}, Kokkos::Array<long, 2>{{2, 3}});
+    Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>> p3(
+        Kokkos::Array<long, 2>{{0, 1}}, Kokkos::Array<long, 2>{{2, 3}},
+        Kokkos::Array<long, 1>{{4}});
+  }
+
+  // Check that construction from various index types works.
+  construct_mdrange_policy_variable_type<char>();
+  construct_mdrange_policy_variable_type<int>();
+  construct_mdrange_policy_variable_type<unsigned long>();
+  construct_mdrange_policy_variable_type<std::int64_t>();
+}
+
+#ifndef KOKKOS_COMPILER_NVHPC       // FIXME_NVHPC
+#ifndef KOKKOS_ENABLE_OPENMPTARGET  // FIXME_OPENMPTARGET
+TEST(TEST_CATEGORY_DEATH, policy_bounds_unsafe_narrowing_conversions) {
+  using Policy = Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>,
+                                       Kokkos::IndexType<unsigned>>;
+
+  ::testing::FLAGS_gtest_death_test_style = "threadsafe";
+  ASSERT_DEATH(
+      {
+        (void)Policy({-1, 0}, {2, 3});
+      },
+      "unsafe narrowing conversion");
+}
+#endif
+#endif
+
+}  // namespace
diff --git a/packages/kokkos/core/unit_test/TestMDRange_a.hpp b/packages/kokkos/core/unit_test/TestMDRange_a.hpp
index 0f2abd6d65e921bf07b512984b17ac3d5f5fe67c..e88ebb6ddca4dc1142131711ef94b21426789f76 100644
--- a/packages/kokkos/core/unit_test/TestMDRange_a.hpp
+++ b/packages/kokkos/core/unit_test/TestMDRange_a.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestMDRange.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestMDRange_b.hpp b/packages/kokkos/core/unit_test/TestMDRange_b.hpp
index 85410d5c27fa6ba60c5d8034efa0d30bb1f6db7a..fea6283811612985ac582ee2cc4bf49e3c365283 100644
--- a/packages/kokkos/core/unit_test/TestMDRange_b.hpp
+++ b/packages/kokkos/core/unit_test/TestMDRange_b.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestMDRange.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestMDRange_c.hpp b/packages/kokkos/core/unit_test/TestMDRange_c.hpp
index 9f597ec54b5777fe1df4f7e831c20e9eb1eab38d..1c796bffe8d53b51c5315d4eee6f356351a6b9ce 100644
--- a/packages/kokkos/core/unit_test/TestMDRange_c.hpp
+++ b/packages/kokkos/core/unit_test/TestMDRange_c.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestMDRange.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestMDRange_d.hpp b/packages/kokkos/core/unit_test/TestMDRange_d.hpp
index 5ca57ccf483710bdfb7907bcd4e10d03d13ecc39..39a5927f2ec5e8a080151b7fcfceacb93d7e0ac1 100644
--- a/packages/kokkos/core/unit_test/TestMDRange_d.hpp
+++ b/packages/kokkos/core/unit_test/TestMDRange_d.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestMDRange.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestMDRange_e.hpp b/packages/kokkos/core/unit_test/TestMDRange_e.hpp
index b9754e63d56bacb497fec4f932eb348c38f6c79f..ed08ca44fa77a8aef440e7f76787ee37c8056e85 100644
--- a/packages/kokkos/core/unit_test/TestMDRange_e.hpp
+++ b/packages/kokkos/core/unit_test/TestMDRange_e.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestMDRange.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestMDRange_f.hpp b/packages/kokkos/core/unit_test/TestMDRange_f.hpp
index 2cef1324d7c75059dfa50417d940bd7bf40a9763..6e0695111e77deb2f088cee3fa870053b6c326e0 100644
--- a/packages/kokkos/core/unit_test/TestMDRange_f.hpp
+++ b/packages/kokkos/core/unit_test/TestMDRange_f.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestMDRange.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestMDRange_g.hpp b/packages/kokkos/core/unit_test/TestMDRange_g.hpp
index c097b2961d4c6f8bf7561d043e359ab635b8a0d2..aaa9a91acce7c13f4fb85ff90c0114f2702e3af8 100644
--- a/packages/kokkos/core/unit_test/TestMDRange_g.hpp
+++ b/packages/kokkos/core/unit_test/TestMDRange_g.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 //#include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/TestMDSpan.hpp b/packages/kokkos/core/unit_test/TestMDSpan.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..6359bd447d3a53c682870dbb156fbcec006f335e
--- /dev/null
+++ b/packages/kokkos/core/unit_test/TestMDSpan.hpp
@@ -0,0 +1,65 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_UNITTEST_MDSPAN_HPP
+#define KOKKOS_UNITTEST_MDSPAN_HPP
+
+#include <Kokkos_Core.hpp>
+#include <gtest/gtest.h>
+
+#ifdef KOKKOS_ENABLE_IMPL_MDSPAN
+
+namespace {
+void test_mdspan_minimal_functional() {
+  int N = 100;
+  Kokkos::View<int*, TEST_EXECSPACE> a("A", N);
+  Kokkos::parallel_for(
+      "FillSequence", Kokkos::RangePolicy<TEST_EXECSPACE>(0, N),
+      KOKKOS_LAMBDA(int i) { a(i) = i; });
+
+  mdspan_ns::mdspan<int, mdspan_ns::dextents<int, 1>> a_mds(a.data(), N);
+  int errors;
+  Kokkos::parallel_reduce(
+      "CheckMinimalMDSpan", Kokkos::RangePolicy<TEST_EXECSPACE>(0, N),
+      KOKKOS_LAMBDA(int i, int& err) {
+        mdspan_ns::mdspan<int, mdspan_ns::dextents<int, 1>> b_mds(a.data(), N);
+#ifdef KOKKOS_ENABLE_CXX23
+        if (a_mds[i] != i) err++;
+        if (b_mds[i] != i) err++;
+#else
+        if (a_mds(i) != i) err++;
+        if (b_mds(i) != i) err++;
+#endif
+      },
+      errors);
+  ASSERT_EQ(errors, 0);
+}
+}  // namespace
+#endif
+
+namespace {
+
+TEST(TEST_CATEGORY, mdspan_minimal_functional) {
+#ifndef KOKKOS_ENABLE_IMPL_MDSPAN
+  GTEST_SKIP() << "mdspan not enabled";
+#else
+  test_mdspan_minimal_functional();
+#endif
+}
+
+}  // namespace
+
+#endif
diff --git a/packages/kokkos/core/unit_test/TestMathematicalConstants.hpp b/packages/kokkos/core/unit_test/TestMathematicalConstants.hpp
index 2043d727074eb81c8962748061f93bab27cd9d7e..f52bfeaff7d97f35f6892d3e96a624a698707763 100644
--- a/packages/kokkos/core/unit_test/TestMathematicalConstants.hpp
+++ b/packages/kokkos/core/unit_test/TestMathematicalConstants.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 #include <Kokkos_Core.hpp>
@@ -53,33 +25,11 @@ KOKKOS_FUNCTION T *take_address_of(T &arg) {
 template <class T>
 KOKKOS_FUNCTION void take_by_value(T) {}
 
-#if defined(KOKKOS_ENABLE_CXX17)
-#define DEFINE_MATH_CONSTANT_TRAIT(TRAIT)                          \
-  template <class T>                                               \
-  struct TRAIT {                                                   \
-    static constexpr T value = Kokkos::Experimental::TRAIT##_v<T>; \
+#define DEFINE_MATH_CONSTANT_TRAIT(TRAIT)                     \
+  template <class T>                                          \
+  struct TRAIT {                                              \
+    static constexpr T value = Kokkos::numbers::TRAIT##_v<T>; \
   }
-#else
-#define DEFINE_MATH_CONSTANT_TRAIT(TRAIT)                                    \
-  template <class>                                                           \
-  struct TRAIT;                                                              \
-  template <>                                                                \
-  struct TRAIT<float> {                                                      \
-    static constexpr float value = Kokkos::Experimental::TRAIT##_v<float>;   \
-  };                                                                         \
-  template <>                                                                \
-  struct TRAIT<double> {                                                     \
-    static constexpr double value = Kokkos::Experimental::TRAIT##_v<double>; \
-  };                                                                         \
-  template <>                                                                \
-  struct TRAIT<long double> {                                                \
-    static constexpr long double value =                                     \
-        Kokkos::Experimental::TRAIT##_v<long double>;                        \
-  };                                                                         \
-  constexpr float TRAIT<float>::value;                                       \
-  constexpr double TRAIT<double>::value;                                     \
-  constexpr long double TRAIT<long double>::value
-#endif
 
 DEFINE_MATH_CONSTANT_TRAIT(e);
 DEFINE_MATH_CONSTANT_TRAIT(log2e);
@@ -112,7 +62,8 @@ struct TestMathematicalConstants {
   KOKKOS_FUNCTION void operator()(Trait, int, int &) const { use_on_device(); }
 
   KOKKOS_FUNCTION void use_on_device() const {
-#if defined(KOKKOS_COMPILER_NVCC) || defined(KOKKOS_ENABLE_OPENMPTARGET)
+#if defined(KOKKOS_COMPILER_NVCC) || defined(KOKKOS_ENABLE_OPENMPTARGET) || \
+    defined(KOKKOS_ENABLE_OPENACC)
     take_by_value(Trait::value);
 #else
     (void)take_address_of(Trait::value);
@@ -120,8 +71,9 @@ struct TestMathematicalConstants {
   }
 };
 
-#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \
-    defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENMPTARGET)
+#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) ||          \
+    defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENMPTARGET) || \
+    defined(KOKKOS_ENABLE_OPENACC)
 #define TEST_MATH_CONSTANT(TRAIT)                               \
   TEST(TEST_CATEGORY, mathematical_constants_##TRAIT) {         \
     TestMathematicalConstants<TEST_EXECSPACE, TRAIT<float>>();  \
diff --git a/packages/kokkos/core/unit_test/TestMathematicalFunctions.hpp b/packages/kokkos/core/unit_test/TestMathematicalFunctions.hpp
index 7294f8e62e2ccf5c9fcd6106f424f00e2e221862..b198006cbb4bd2cb53ff7c373f039f64204d9a52 100644
--- a/packages/kokkos/core/unit_test/TestMathematicalFunctions.hpp
+++ b/packages/kokkos/core/unit_test/TestMathematicalFunctions.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
@@ -224,6 +196,9 @@ template <> struct math_binary_function_return_type<unsigned long long,        l
 template <class T, class U>
 using math_binary_function_return_type_t = typename math_binary_function_return_type<T, U>::type;
 // clang-format on
+template <class T, class U, class V>
+using math_ternary_function_return_type_t = math_binary_function_return_type_t<
+    T, math_binary_function_return_type_t<U, V>>;
 
 struct FloatingPointComparison {
  private:
@@ -292,29 +267,29 @@ struct FloatingPointComparison {
 template <class>
 struct math_function_name;
 
-#define DEFINE_UNARY_FUNCTION_EVAL(FUNC, ULP_FACTOR)                           \
-  struct MathUnaryFunction_##FUNC {                                            \
-    template <typename T>                                                      \
-    static KOKKOS_FUNCTION auto eval(T x) {                                    \
-      static_assert(std::is_same<decltype(Kokkos::FUNC((T)0)),                 \
-                                 math_unary_function_return_type_t<T>>::value, \
-                    "");                                                       \
-      return Kokkos::FUNC(x);                                                  \
-    }                                                                          \
-    template <typename T>                                                      \
-    static auto eval_std(T x) {                                                \
-      static_assert(std::is_same<decltype(std::FUNC((T)0)),                    \
-                                 math_unary_function_return_type_t<T>>::value, \
-                    "");                                                       \
-      return std::FUNC(x);                                                     \
-    }                                                                          \
-    static KOKKOS_FUNCTION double ulp_factor() { return ULP_FACTOR; }          \
-  };                                                                           \
-  using kk_##FUNC = MathUnaryFunction_##FUNC;                                  \
-  template <>                                                                  \
-  struct math_function_name<MathUnaryFunction_##FUNC> {                        \
-    static constexpr char name[] = #FUNC;                                      \
-  };                                                                           \
+#define DEFINE_UNARY_FUNCTION_EVAL(FUNC, ULP_FACTOR)                  \
+  struct MathUnaryFunction_##FUNC {                                   \
+    template <typename T>                                             \
+    static KOKKOS_FUNCTION auto eval(T x) {                           \
+      static_assert(                                                  \
+          std::is_same<decltype(Kokkos::FUNC((T)0)),                  \
+                       math_unary_function_return_type_t<T>>::value); \
+      return Kokkos::FUNC(x);                                         \
+    }                                                                 \
+    template <typename T>                                             \
+    static auto eval_std(T x) {                                       \
+      static_assert(                                                  \
+          std::is_same<decltype(std::FUNC((T)0)),                     \
+                       math_unary_function_return_type_t<T>>::value); \
+      return std::FUNC(x);                                            \
+    }                                                                 \
+    static KOKKOS_FUNCTION double ulp_factor() { return ULP_FACTOR; } \
+  };                                                                  \
+  using kk_##FUNC = MathUnaryFunction_##FUNC;                         \
+  template <>                                                         \
+  struct math_function_name<MathUnaryFunction_##FUNC> {               \
+    static constexpr char name[] = #FUNC;                             \
+  };                                                                  \
   constexpr char math_function_name<MathUnaryFunction_##FUNC>::name[]
 
 #ifndef KOKKOS_MATHEMATICAL_FUNCTIONS_SKIP_1
@@ -380,31 +355,29 @@ DEFINE_UNARY_FUNCTION_EVAL(logb, 2);
 
 #undef DEFINE_UNARY_FUNCTION_EVAL
 
-#define DEFINE_BINARY_FUNCTION_EVAL(FUNC, ULP_FACTOR)                    \
-  struct MathBinaryFunction_##FUNC {                                     \
-    template <typename T, typename U>                                    \
-    static KOKKOS_FUNCTION auto eval(T x, U y) {                         \
-      static_assert(                                                     \
-          std::is_same<decltype(Kokkos::FUNC((T)0, (U)0)),               \
-                       math_binary_function_return_type_t<T, U>>::value, \
-          "");                                                           \
-      return Kokkos::FUNC(x, y);                                         \
-    }                                                                    \
-    template <typename T, typename U>                                    \
-    static auto eval_std(T x, U y) {                                     \
-      static_assert(                                                     \
-          std::is_same<decltype(std::FUNC((T)0, (U)0)),                  \
-                       math_binary_function_return_type_t<T, U>>::value, \
-          "");                                                           \
-      return std::FUNC(x, y);                                            \
-    }                                                                    \
-    static KOKKOS_FUNCTION double ulp_factor() { return ULP_FACTOR; }    \
-  };                                                                     \
-  using kk_##FUNC = MathBinaryFunction_##FUNC;                           \
-  template <>                                                            \
-  struct math_function_name<MathBinaryFunction_##FUNC> {                 \
-    static constexpr char name[] = #FUNC;                                \
-  };                                                                     \
+#define DEFINE_BINARY_FUNCTION_EVAL(FUNC, ULP_FACTOR)                     \
+  struct MathBinaryFunction_##FUNC {                                      \
+    template <typename T, typename U>                                     \
+    static KOKKOS_FUNCTION auto eval(T x, U y) {                          \
+      static_assert(                                                      \
+          std::is_same<decltype(Kokkos::FUNC((T)0, (U)0)),                \
+                       math_binary_function_return_type_t<T, U>>::value); \
+      return Kokkos::FUNC(x, y);                                          \
+    }                                                                     \
+    template <typename T, typename U>                                     \
+    static auto eval_std(T x, U y) {                                      \
+      static_assert(                                                      \
+          std::is_same<decltype(std::FUNC((T)0, (U)0)),                   \
+                       math_binary_function_return_type_t<T, U>>::value); \
+      return std::FUNC(x, y);                                             \
+    }                                                                     \
+    static KOKKOS_FUNCTION double ulp_factor() { return ULP_FACTOR; }     \
+  };                                                                      \
+  using kk_##FUNC = MathBinaryFunction_##FUNC;                            \
+  template <>                                                             \
+  struct math_function_name<MathBinaryFunction_##FUNC> {                  \
+    static constexpr char name[] = #FUNC;                                 \
+  };                                                                      \
   constexpr char math_function_name<MathBinaryFunction_##FUNC>::name[]
 
 #ifndef KOKKOS_MATHEMATICAL_FUNCTIONS_SKIP_1
@@ -418,6 +391,38 @@ DEFINE_BINARY_FUNCTION_EVAL(copysign, 1);
 
 #undef DEFINE_BINARY_FUNCTION_EVAL
 
+#define DEFINE_TERNARY_FUNCTION_EVAL(FUNC, ULP_FACTOR)                        \
+  struct MathTernaryFunction_##FUNC {                                         \
+    template <typename T, typename U, typename V>                             \
+    static KOKKOS_FUNCTION auto eval(T x, U y, V z) {                         \
+      static_assert(                                                          \
+          std::is_same<decltype(Kokkos::FUNC((T)0, (U)0, (V)0)),              \
+                       math_ternary_function_return_type_t<T, U, V>>::value); \
+      return Kokkos::FUNC(x, y, z);                                           \
+    }                                                                         \
+    template <typename T, typename U, typename V>                             \
+    static auto eval_std(T x, U y, V z) {                                     \
+      static_assert(                                                          \
+          std::is_same<decltype(std::FUNC((T)0, (U)0, (V)0)),                 \
+                       math_ternary_function_return_type_t<T, U, V>>::value); \
+      return std::FUNC(x, y, z);                                              \
+    }                                                                         \
+    static KOKKOS_FUNCTION double ulp_factor() { return ULP_FACTOR; }         \
+  };                                                                          \
+  using kk3_##FUNC = MathTernaryFunction_##FUNC;                              \
+  template <>                                                                 \
+  struct math_function_name<MathTernaryFunction_##FUNC> {                     \
+    static constexpr char name[] = #FUNC;                                     \
+  };                                                                          \
+  constexpr char math_function_name<MathTernaryFunction_##FUNC>::name[]
+
+#ifndef KOKKOS_MATHEMATICAL_FUNCTIONS_SKIP_1
+DEFINE_TERNARY_FUNCTION_EVAL(hypot, 2);
+DEFINE_TERNARY_FUNCTION_EVAL(fma, 2);
+#endif
+
+#undef DEFINE_TERNARY_FUNCTION_EVAL
+
 // clang-format off
 template <class>
 struct type_helper;
@@ -509,6 +514,49 @@ void do_test_math_binary_function(Arg1 arg1, Arg2 arg2) {
       (TestMathBinaryFunction<Space, Func, Arg1, Arg2>(arg1, arg2), 0)...};
 }
 
+template <class Space, class Func, class Arg1, class Arg2, class Arg3,
+          class Ret = math_ternary_function_return_type_t<Arg1, Arg2, Arg3>>
+struct TestMathTernaryFunction : FloatingPointComparison {
+  Arg1 val1_;
+  Arg2 val2_;
+  Arg3 val3_;
+  Ret res_;
+  TestMathTernaryFunction(Arg1 val1, Arg2 val2, Arg3 val3)
+      : val1_(val1),
+        val2_(val2),
+        val3_(val3),
+        res_(Func::eval_std(val1, val2, val3)) {
+    run();
+  }
+  void run() {
+    int errors = 0;
+    Kokkos::parallel_reduce(Kokkos::RangePolicy<Space>(0, 1), *this, errors);
+    ASSERT_EQ(errors, 0) << "Failed check no error for "
+                         << math_function_name<Func>::name << "("
+                         << type_helper<Arg1>::name() << ", "
+                         << type_helper<Arg1>::name() << ", "
+                         << type_helper<Arg3>::name() << ")";
+  }
+  KOKKOS_FUNCTION void operator()(int, int& e) const {
+    bool ar =
+        compare(Func::eval(val1_, val2_, val3_), res_, Func::ulp_factor());
+    if (!ar) {
+      ++e;
+      KOKKOS_IMPL_DO_NOT_USE_PRINTF(
+          "value at %f, %f, %f which is %f was expected to be %f\n",
+          (double)val1_, (double)val2_, (double)val3_,
+          (double)Func::eval(val1_, val2_, val3_), (double)res_);
+    }
+  }
+};
+
+template <class Space, class... Func, class Arg1, class Arg2, class Arg3>
+void do_test_math_ternary_function(Arg1 arg1, Arg2 arg2, Arg3 arg3) {
+  (void)std::initializer_list<int>{
+      (TestMathTernaryFunction<Space, Func, Arg1, Arg2, Arg3>(arg1, arg2, arg3),
+       0)...};
+}
+
 #ifndef KOKKOS_MATHEMATICAL_FUNCTIONS_SKIP_1
 
 TEST(TEST_CATEGORY, mathematical_functions_trigonometric_functions) {
@@ -631,6 +679,24 @@ TEST(TEST_CATEGORY, mathematical_functions_power_functions) {
 #if !(defined(KOKKOS_ARCH_POWER8) || defined(KOKKOS_ARCH_POWER9))
   do_test_math_binary_function<TEST_EXECSPACE, kk_hypot>(2.l, 3.l);
 #endif
+#endif
+
+  do_test_math_ternary_function<TEST_EXECSPACE, kk3_hypot>(2.f, 3.f, 4.f);
+  do_test_math_ternary_function<TEST_EXECSPACE, kk3_hypot>(2., 3., 4.);
+  do_test_math_ternary_function<TEST_EXECSPACE, kk3_hypot>(2, 3.f, 4.);
+#ifdef MATHEMATICAL_FUNCTIONS_HAVE_LONG_DOUBLE_OVERLOADS
+#if !(defined(KOKKOS_ARCH_POWER8) || defined(KOKKOS_ARCH_POWER9))
+  do_test_math_ternary_function<TEST_EXECSPACE, kk3_hypot>(2.l, 3.l, 4.l);
+#endif
+#endif
+}
+
+TEST(TEST_CATEGORY, mathematical_functions_fma) {
+  do_test_math_ternary_function<TEST_EXECSPACE, kk3_fma>(2.f, 3.f, 4.f);
+  do_test_math_ternary_function<TEST_EXECSPACE, kk3_fma>(2., 3., 4.);
+  do_test_math_ternary_function<TEST_EXECSPACE, kk3_fma>(2, 3.f, 4.);
+#ifdef MATHEMATICAL_FUNCTIONS_HAVE_LONG_DOUBLE_OVERLOADS
+  do_test_math_ternary_function<TEST_EXECSPACE, kk3_fma>(2.l, 3.l, 4.l);
 #endif
 }
 
@@ -1047,8 +1113,10 @@ struct TestIsNaN {
     }
     if (isnan(3.)
 #ifndef KOKKOS_IMPL_WORKAROUND_INTEL_LLVM_DEFAULT_FLOATING_POINT_MODEL
+#ifndef KOKKOS_COMPILER_NVHPC  // FIXME_NVHPC
         || !isnan(quiet_NaN<double>::value) ||
         !isnan(signaling_NaN<double>::value)
+#endif
 #endif
     ) {
       ++e;
diff --git a/packages/kokkos/core/unit_test/TestMathematicalFunctions1.hpp b/packages/kokkos/core/unit_test/TestMathematicalFunctions1.hpp
index 0fd56a5ac91c2a5ed01fccf5e6534a0afa814e58..d902a04422d5b1c19d401476de6d3e6faada1fca 100644
--- a/packages/kokkos/core/unit_test/TestMathematicalFunctions1.hpp
+++ b/packages/kokkos/core/unit_test/TestMathematicalFunctions1.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #define KOKKOS_MATHEMATICAL_FUNCTIONS_SKIP_2
 #include "TestMathematicalFunctions.hpp"
diff --git a/packages/kokkos/core/unit_test/TestMathematicalFunctions2.hpp b/packages/kokkos/core/unit_test/TestMathematicalFunctions2.hpp
index 74e7443b1306c1ee4a26ba9e4890cf8a26c195e8..58572ebe6fe1dc73cbce9aabb6f1263cf5d4a6b9 100644
--- a/packages/kokkos/core/unit_test/TestMathematicalFunctions2.hpp
+++ b/packages/kokkos/core/unit_test/TestMathematicalFunctions2.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #define KOKKOS_MATHEMATICAL_FUNCTIONS_SKIP_1
 #include "TestMathematicalFunctions.hpp"
diff --git a/packages/kokkos/core/unit_test/TestMathematicalSpecialFunctions.hpp b/packages/kokkos/core/unit_test/TestMathematicalSpecialFunctions.hpp
index 26f237a71d7c1667062f27c93e1b58fd83d3e44b..7ae202770583a45a82925c50f1a43232b104274b 100644
--- a/packages/kokkos/core/unit_test/TestMathematicalSpecialFunctions.hpp
+++ b/packages/kokkos/core/unit_test/TestMathematicalSpecialFunctions.hpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #include <fstream>
 #include <gtest/gtest.h>
 #include "Kokkos_Core.hpp"
@@ -489,7 +505,13 @@ struct TestComplexBesselJ0Y0Function {
     Kokkos::deep_copy(d_z, h_z);
 
     // Call Bessel functions
-    Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace>(0, N), *this);
+#if (HIP_VERSION_MAJOR == 5) && (HIP_VERSION_MINOR == 4)
+    using Property =
+        Kokkos::Experimental::WorkItemProperty::ImplForceGlobalLaunch_t;
+#else
+    using Property = Kokkos::Experimental::WorkItemProperty::None_t;
+#endif
+    Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, Property>(0, N), *this);
     Kokkos::fence();
 
     Kokkos::deep_copy(h_cbj0, d_cbj0);
@@ -618,8 +640,8 @@ struct TestComplexBesselJ0Y0Function {
 
     Kokkos::deep_copy(d_z_large, h_z_large);
 
-    Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, TestLargeArgTag>(0, 1),
-                         *this);
+    Kokkos::parallel_for(
+        Kokkos::RangePolicy<ExecSpace, Property, TestLargeArgTag>(0, 1), *this);
     Kokkos::fence();
 
     Kokkos::deep_copy(h_cbj0_large, d_cbj0_large);
@@ -779,7 +801,13 @@ struct TestComplexBesselJ1Y1Function {
     Kokkos::deep_copy(d_z, h_z);
 
     // Call Bessel functions
-    Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace>(0, N), *this);
+#if (HIP_VERSION_MAJOR == 5) && (HIP_VERSION_MINOR == 4)
+    using Property =
+        Kokkos::Experimental::WorkItemProperty::ImplForceGlobalLaunch_t;
+#else
+    using Property = Kokkos::Experimental::WorkItemProperty::None_t;
+#endif
+    Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, Property>(0, N), *this);
     Kokkos::fence();
 
     Kokkos::deep_copy(h_cbj1, d_cbj1);
@@ -908,8 +936,8 @@ struct TestComplexBesselJ1Y1Function {
 
     Kokkos::deep_copy(d_z_large, h_z_large);
 
-    Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, TestLargeArgTag>(0, 1),
-                         *this);
+    Kokkos::parallel_for(
+        Kokkos::RangePolicy<ExecSpace, Property, TestLargeArgTag>(0, 1), *this);
     Kokkos::fence();
 
     Kokkos::deep_copy(h_cbj1_large, d_cbj1_large);
@@ -1067,7 +1095,13 @@ struct TestComplexBesselI0K0Function {
     Kokkos::deep_copy(d_z, h_z);
 
     // Call Bessel functions
-    Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace>(0, N), *this);
+#if (HIP_VERSION_MAJOR == 5) && (HIP_VERSION_MINOR == 4)
+    using Property =
+        Kokkos::Experimental::WorkItemProperty::ImplForceGlobalLaunch_t;
+#else
+    using Property = Kokkos::Experimental::WorkItemProperty::None_t;
+#endif
+    Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, Property>(0, N), *this);
     Kokkos::fence();
 
     Kokkos::deep_copy(h_cbi0, d_cbi0);
@@ -1189,8 +1223,8 @@ struct TestComplexBesselI0K0Function {
 
     Kokkos::deep_copy(d_z_large, h_z_large);
 
-    Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, TestLargeArgTag>(0, 1),
-                         *this);
+    Kokkos::parallel_for(
+        Kokkos::RangePolicy<ExecSpace, Property, TestLargeArgTag>(0, 1), *this);
     Kokkos::fence();
 
     Kokkos::deep_copy(h_cbi0_large, d_cbi0_large);
@@ -1302,7 +1336,13 @@ struct TestComplexBesselI1K1Function {
     Kokkos::deep_copy(d_z, h_z);
 
     // Call Bessel functions
-    Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace>(0, N), *this);
+#if (HIP_VERSION_MAJOR == 5) && (HIP_VERSION_MINOR == 4)
+    using Property =
+        Kokkos::Experimental::WorkItemProperty::ImplForceGlobalLaunch_t;
+#else
+    using Property = Kokkos::Experimental::WorkItemProperty::None_t;
+#endif
+    Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, Property>(0, N), *this);
     Kokkos::fence();
 
     Kokkos::deep_copy(h_cbi1, d_cbi1);
@@ -1424,8 +1464,8 @@ struct TestComplexBesselI1K1Function {
 
     Kokkos::deep_copy(d_z_large, h_z_large);
 
-    Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, TestLargeArgTag>(0, 1),
-                         *this);
+    Kokkos::parallel_for(
+        Kokkos::RangePolicy<ExecSpace, Property, TestLargeArgTag>(0, 1), *this);
     Kokkos::fence();
 
     Kokkos::deep_copy(h_cbi1_large, d_cbi1_large);
@@ -1533,7 +1573,13 @@ struct TestComplexBesselH1Function {
     Kokkos::deep_copy(d_z, h_z);
 
     // Call Hankel functions
-    Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace>(0, N), *this);
+#if (HIP_VERSION_MAJOR == 5) && (HIP_VERSION_MINOR == 4)
+    using Property =
+        Kokkos::Experimental::WorkItemProperty::ImplForceGlobalLaunch_t;
+#else
+    using Property = Kokkos::Experimental::WorkItemProperty::None_t;
+#endif
+    Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, Property>(0, N), *this);
     Kokkos::fence();
 
     Kokkos::deep_copy(h_ch10, d_ch10);
diff --git a/packages/kokkos/core/unit_test/TestMemoryPool.hpp b/packages/kokkos/core/unit_test/TestMemoryPool.hpp
index 75deae13a108aa40833836eef30502560ed07933..f0bf1182924c9e2ac57fea092d3f1c5b7d4eac18 100644
--- a/packages/kokkos/core/unit_test/TestMemoryPool.hpp
+++ b/packages/kokkos/core/unit_test/TestMemoryPool.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_UNITTEST_MEMPOOL_HPP
 #define KOKKOS_UNITTEST_MEMPOOL_HPP
diff --git a/packages/kokkos/core/unit_test/TestMinMaxClamp.hpp b/packages/kokkos/core/unit_test/TestMinMaxClamp.hpp
index 42f83f348ef41eeec96d2bccb6e8e9e22a068b4b..7ed2c6d3bacececde0c538163dc45abf473ad40c 100644
--- a/packages/kokkos/core/unit_test/TestMinMaxClamp.hpp
+++ b/packages/kokkos/core/unit_test/TestMinMaxClamp.hpp
@@ -1,53 +1,22 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 #include <Kokkos_Core.hpp>
 
-// FIXME C++17
-#define STATIC_ASSERT(cond) static_assert(cond, "");
-
 namespace Test {
 template <class T>
 struct Greater {
@@ -80,15 +49,15 @@ TEST(TEST_CATEGORY, max) {
   b = 1;
   EXPECT_EQ(Kokkos::max(a, b), 3);
 
-  STATIC_ASSERT(Kokkos::max(1, 2) == 2);
-  STATIC_ASSERT(Kokkos::max(1, 2, ::Test::Greater<int>{}) == 1);
+  static_assert(Kokkos::max(1, 2) == 2);
+  static_assert(Kokkos::max(1, 2, ::Test::Greater<int>{}) == 1);
 
   EXPECT_EQ(Kokkos::max({3.f, -1.f, 0.f}), 3.f);
 
-  STATIC_ASSERT(Kokkos::max({3, -1, 0}) == 3);
-  STATIC_ASSERT(Kokkos::max({3, -1, 0}, ::Test::Greater<int>{}) == -1);
+  static_assert(Kokkos::max({3, -1, 0}) == 3);
+  static_assert(Kokkos::max({3, -1, 0}, ::Test::Greater<int>{}) == -1);
 
-  STATIC_ASSERT(Kokkos::max({
+  static_assert(Kokkos::max({
                                 ::Test::PairIntCompareFirst{255, 0},
                                 ::Test::PairIntCompareFirst{255, 1},
                                 ::Test::PairIntCompareFirst{0, 2},
@@ -141,15 +110,15 @@ TEST(TEST_CATEGORY, min) {
   b = 2;
   EXPECT_EQ(Kokkos::min(a, b), 2);
 
-  STATIC_ASSERT(Kokkos::min(3.f, 2.f) == 2.f);
-  STATIC_ASSERT(Kokkos::min(3.f, 2.f, ::Test::Greater<int>{}) == 3.f);
+  static_assert(Kokkos::min(3.f, 2.f) == 2.f);
+  static_assert(Kokkos::min(3.f, 2.f, ::Test::Greater<int>{}) == 3.f);
 
   EXPECT_EQ(Kokkos::min({3.f, -1.f, 0.f}), -1.f);
 
-  STATIC_ASSERT(Kokkos::min({3, -1, 0}) == -1);
-  STATIC_ASSERT(Kokkos::min({3, -1, 0}, ::Test::Greater<int>{}) == 3);
+  static_assert(Kokkos::min({3, -1, 0}) == -1);
+  static_assert(Kokkos::min({3, -1, 0}, ::Test::Greater<int>{}) == 3);
 
-  STATIC_ASSERT(Kokkos::min({
+  static_assert(Kokkos::min({
                                 ::Test::PairIntCompareFirst{255, 0},
                                 ::Test::PairIntCompareFirst{255, 1},
                                 ::Test::PairIntCompareFirst{0, 2},
@@ -207,21 +176,21 @@ TEST(TEST_CATEGORY, minmax) {
 
 #ifndef KOKKOS_COMPILER_NVHPC  // FIXME_NVHPC nvhpc can't deal with device side
                                // constexpr constructors so I removed the
-                               // constexpr in pair, which makes STATIC_ASSERT
+                               // constexpr in pair, which makes static_assert
                                // here fail
-  STATIC_ASSERT((Kokkos::pair<float, float>(Kokkos::minmax(3.f, 2.f)) ==
+  static_assert((Kokkos::pair<float, float>(Kokkos::minmax(3.f, 2.f)) ==
                  Kokkos::make_pair(2.f, 3.f)));
-  STATIC_ASSERT(
+  static_assert(
       (Kokkos::pair<float, float>(Kokkos::minmax(
            3.f, 2.f, ::Test::Greater<int>{})) == Kokkos::make_pair(3.f, 2.f)));
 
   EXPECT_EQ(Kokkos::minmax({3.f, -1.f, 0.f}), Kokkos::make_pair(-1.f, 3.f));
 
-  STATIC_ASSERT(Kokkos::minmax({3, -1, 0}) == Kokkos::make_pair(-1, 3));
-  STATIC_ASSERT(Kokkos::minmax({3, -1, 0}, ::Test::Greater<int>{}) ==
+  static_assert(Kokkos::minmax({3, -1, 0}) == Kokkos::make_pair(-1, 3));
+  static_assert(Kokkos::minmax({3, -1, 0}, ::Test::Greater<int>{}) ==
                 Kokkos::make_pair(3, -1));
 
-  STATIC_ASSERT(Kokkos::minmax({
+  static_assert(Kokkos::minmax({
                                    ::Test::PairIntCompareFirst{255, 0},
                                    ::Test::PairIntCompareFirst{255, 1},
                                    ::Test::PairIntCompareFirst{0, 2},
@@ -230,7 +199,7 @@ TEST(TEST_CATEGORY, minmax) {
                                    ::Test::PairIntCompareFirst{0, 5},
                                })
                     .first.second == 2);  // leftmost
-  STATIC_ASSERT(Kokkos::minmax({
+  static_assert(Kokkos::minmax({
                                    ::Test::PairIntCompareFirst{255, 0},
                                    ::Test::PairIntCompareFirst{255, 1},
                                    ::Test::PairIntCompareFirst{0, 2},
diff --git a/packages/kokkos/core/unit_test/TestNonTrivialScalarTypes.hpp b/packages/kokkos/core/unit_test/TestNonTrivialScalarTypes.hpp
index 02064d2fc3debc09aa0fcbfed16e6366fc9cd14f..eaf7a4125cc3ca23f4b26b60a6a602a7d0cf7a89 100644
--- a/packages/kokkos/core/unit_test/TestNonTrivialScalarTypes.hpp
+++ b/packages/kokkos/core/unit_test/TestNonTrivialScalarTypes.hpp
@@ -1,47 +1,18 @@
-
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef TESTNONTRIVIALSCALARTYPES_HPP_
 #define TESTNONTRIVIALSCALARTYPES_HPP_
diff --git a/packages/kokkos/core/unit_test/TestNumericTraits.hpp b/packages/kokkos/core/unit_test/TestNumericTraits.hpp
index 0f34ff436f0fe21b0e38e2055fde34e7a5e60b0b..9146297cd8a2f0438649820ce512b9573f4b16df 100644
--- a/packages/kokkos/core/unit_test/TestNumericTraits.hpp
+++ b/packages/kokkos/core/unit_test/TestNumericTraits.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
@@ -81,7 +53,6 @@ struct FiniteMax { template <class T> using trait = Kokkos::Experimental::finite
 struct RoundError { template <class T> using trait = Kokkos::Experimental::round_error<T>; };
 struct NormMin { template <class T> using trait = Kokkos::Experimental::norm_min<T>; };
 struct DenormMin { template <class T> using trait = Kokkos::Experimental::denorm_min<T>; };
-struct ReciprocalOverflowThreshold { template <class T> using trait = Kokkos::Experimental::reciprocal_overflow_threshold<T>; };
 struct Digits { template <class T> using trait = Kokkos::Experimental::digits<T>; };
 struct Digits10 { template <class T> using trait = Kokkos::Experimental::digits10<T>; };
 struct MaxDigits10 { template <class T> using trait = Kokkos::Experimental::max_digits10<T>; };
@@ -152,18 +123,6 @@ struct TestNumericTraits {
     use_on_device();
   }
 
-  KOKKOS_FUNCTION void operator()(ReciprocalOverflowThreshold, int,
-                                  int& e) const {
-    using Kokkos::Experimental::reciprocal_overflow_threshold;
-    auto const inv = 1 / reciprocal_overflow_threshold<T>::value;
-    if (inv + inv == inv && inv != 0) {
-      KOKKOS_IMPL_DO_NOT_USE_PRINTF(
-          "inverse of reciprocal overflow threshold is inf\n");
-      ++e;
-    }
-    use_on_device();
-  }
-
   // clang-format off
   KOKKOS_FUNCTION void operator()(FiniteMax, int, int&) const { use_on_device(); }
   KOKKOS_FUNCTION void operator()(RoundError, int, int&) const { use_on_device(); }
@@ -239,9 +198,8 @@ struct TestNumericTraits<
 TEST(TEST_CATEGORY, numeric_traits_infinity) {
   TestNumericTraits<TEST_EXECSPACE, float, Infinity>();
   TestNumericTraits<TEST_EXECSPACE, double, Infinity>();
-  // fails with XL 16.1.1 see issue #4100
   // FIXME_NVHPC long double not supported
-#if !defined(KOKKOS_COMPILER_IBM) && !defined(KOKKOS_COMPILER_NVHPC)
+#if !defined(KOKKOS_COMPILER_NVHPC)
   TestNumericTraits<TEST_EXECSPACE, long double, Infinity>();
 #endif
 }
@@ -249,9 +207,8 @@ TEST(TEST_CATEGORY, numeric_traits_infinity) {
 TEST(TEST_CATEGORY, numeric_traits_epsilon) {
   TestNumericTraits<TEST_EXECSPACE, float, Epsilon>();
   TestNumericTraits<TEST_EXECSPACE, double, Epsilon>();
-  // fails with XL 16.1.1 see issue #4100
   // FIXME_NVHPC long double not supported
-#if !defined(KOKKOS_COMPILER_IBM) && !defined(KOKKOS_COMPILER_NVHPC)
+#if !defined(KOKKOS_COMPILER_NVHPC)
   TestNumericTraits<TEST_EXECSPACE, long double, Epsilon>();
 #endif
 }
@@ -286,16 +243,6 @@ TEST(TEST_CATEGORY, numeric_traits_denorm_min) {
 #endif
 }
 
-TEST(TEST_CATEGORY, numeric_traits_reciprocal_overflow_threshold) {
-  TestNumericTraits<TEST_EXECSPACE, float, ReciprocalOverflowThreshold>();
-  TestNumericTraits<TEST_EXECSPACE, double, ReciprocalOverflowThreshold>();
-#ifndef KOKKOS_COMPILER_NVHPC  // FIXME_NVHPC:
-  // nvc++-Fatal-/home/projects/x86-64/nvidia/hpc_sdk/Linux_x86_64/22.3/compilers/bin/tools/cpp2
-  // TERMINATED by signal 11
-  TestNumericTraits<TEST_EXECSPACE, long double, ReciprocalOverflowThreshold>();
-#endif
-}
-
 TEST(TEST_CATEGORY, numeric_traits_finite_min_max) {
   TestNumericTraits<TEST_EXECSPACE, char, FiniteMin>();
   TestNumericTraits<TEST_EXECSPACE, char, FiniteMax>();
@@ -528,17 +475,13 @@ CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(double, infinity);
 CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(long double, infinity);
 CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(float, epsilon);
 CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(double, epsilon);
-#ifndef KOKKOS_COMPILER_IBM  // fails with XL 16.1.1
 CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(long double, epsilon);
-#endif
 CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(float, round_error);
 CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(double, round_error);
 CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(long double, round_error);
 CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(float, denorm_min);
 CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(double, denorm_min);
 CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(long double, denorm_min);
-// NOTE reciprocal_overflow_threshold purposefully omitted since it does not
-// exist in std::numeric_limits
 // clang-format off
 static_assert(Kokkos::Experimental::norm_min<float      >::value == std::numeric_limits<      float>::min(), "");
 static_assert(Kokkos::Experimental::norm_min<double     >::value == std::numeric_limits<     double>::min(), "");
@@ -703,8 +646,6 @@ CHECK_INSTANTIATED_ON_CV_QUALIFIED_TYPES_INTEGRAL(finite_max);
 CHECK_INSTANTIATED_ON_CV_QUALIFIED_TYPES_FLOATING_POINT(epsilon);
 CHECK_INSTANTIATED_ON_CV_QUALIFIED_TYPES_FLOATING_POINT(round_error);
 CHECK_INSTANTIATED_ON_CV_QUALIFIED_TYPES_FLOATING_POINT(norm_min);
-CHECK_INSTANTIATED_ON_CV_QUALIFIED_TYPES_FLOATING_POINT(
-    reciprocal_overflow_threshold);
 
 CHECK_INSTANTIATED_ON_CV_QUALIFIED_TYPES_FLOATING_POINT(digits);
 CHECK_INSTANTIATED_ON_CV_QUALIFIED_TYPES_INTEGRAL(digits);
diff --git a/packages/kokkos/core/unit_test/TestOther.hpp b/packages/kokkos/core/unit_test/TestOther.hpp
index 5596f373bf2d45636c6d03562886c50bf22fb435..5d118ce9b0225f3a35ee4d3877247bffed1e9a75 100644
--- a/packages/kokkos/core/unit_test/TestOther.hpp
+++ b/packages/kokkos/core/unit_test/TestOther.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_OTHER_HPP
 #define KOKKOS_TEST_OTHER_HPP
diff --git a/packages/kokkos/core/unit_test/TestParseCmdLineArgsAndEnvVars.cpp b/packages/kokkos/core/unit_test/TestParseCmdLineArgsAndEnvVars.cpp
index 11684f8a80abc9d6f6010f2f3d6b40287d513cdc..176ce9b5fed40ebe925cd65b0fc1cb3ecdce738f 100644
--- a/packages/kokkos/core/unit_test/TestParseCmdLineArgsAndEnvVars.cpp
+++ b/packages/kokkos/core/unit_test/TestParseCmdLineArgsAndEnvVars.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/TestPolicyConstruction.hpp b/packages/kokkos/core/unit_test/TestPolicyConstruction.hpp
deleted file mode 100644
index b25acb455518493761029f1f1c3453a7e180171c..0000000000000000000000000000000000000000
--- a/packages/kokkos/core/unit_test/TestPolicyConstruction.hpp
+++ /dev/null
@@ -1,922 +0,0 @@
-/*
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
-//               Solutions of Sandia, LLC (NTESS).
-//
-// Under the terms of Contract DE-NA0003525 with NTESS,
-// the U.S. Government retains certain rights in this software.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
-//@HEADER
-*/
-
-#include <gtest/gtest.h>
-
-#include <Kokkos_Core.hpp>
-#include <sstream>
-#include <iostream>
-#include <type_traits>
-
-namespace Test {
-struct SomeTag {};
-
-template <class ExecutionSpace>
-class TestRangePolicyConstruction {
- public:
-  TestRangePolicyConstruction() {
-    test_compile_time_parameters();
-    test_runtime_parameters();
-  }
-
- private:
-  void test_compile_time_parameters() {
-    {
-      using policy_t        = Kokkos::RangePolicy<>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((
-          std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type,
-                                typename execution_space::size_type>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Static>>::value));
-      ASSERT_TRUE((std::is_void<work_tag>::value));
-    }
-
-    {
-      using policy_t        = Kokkos::RangePolicy<ExecutionSpace>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type,
-                                typename execution_space::size_type>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Static>>::value));
-      ASSERT_TRUE((std::is_void<work_tag>::value));
-    }
-
-    {
-      using policy_t        = Kokkos::RangePolicy<ExecutionSpace,
-                                           Kokkos::Schedule<Kokkos::Dynamic>>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type,
-                                typename execution_space::size_type>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_void<work_tag>::value));
-    }
-
-    {
-      using policy_t =
-          Kokkos::RangePolicy<ExecutionSpace, Kokkos::Schedule<Kokkos::Dynamic>,
-                              Kokkos::IndexType<long>>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_void<work_tag>::value));
-    }
-
-    {
-      using policy_t =
-          Kokkos::RangePolicy<Kokkos::IndexType<long>, ExecutionSpace,
-                              Kokkos::Schedule<Kokkos::Dynamic>>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_void<work_tag>::value));
-    }
-
-    {
-      using policy_t =
-          Kokkos::RangePolicy<ExecutionSpace, Kokkos::Schedule<Kokkos::Dynamic>,
-                              Kokkos::IndexType<long>, SomeTag>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value));
-    }
-
-    {
-      using policy_t =
-          Kokkos::RangePolicy<Kokkos::Schedule<Kokkos::Dynamic>, ExecutionSpace,
-                              Kokkos::IndexType<long>, SomeTag>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value));
-    }
-
-    {
-      using policy_t =
-          Kokkos::RangePolicy<SomeTag, Kokkos::Schedule<Kokkos::Dynamic>,
-                              Kokkos::IndexType<long>, ExecutionSpace>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value));
-    }
-
-    {
-      using policy_t = Kokkos::RangePolicy<Kokkos::Schedule<Kokkos::Dynamic>>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((
-          std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type,
-                                typename execution_space::size_type>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_void<work_tag>::value));
-    }
-
-    {
-      using policy_t = Kokkos::RangePolicy<Kokkos::Schedule<Kokkos::Dynamic>,
-                                           Kokkos::IndexType<long>>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((
-          std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_void<work_tag>::value));
-    }
-
-    {
-      using policy_t        = Kokkos::RangePolicy<Kokkos::IndexType<long>,
-                                           Kokkos::Schedule<Kokkos::Dynamic>>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((
-          std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_void<work_tag>::value));
-    }
-
-    {
-      using policy_t = Kokkos::RangePolicy<Kokkos::Schedule<Kokkos::Dynamic>,
-                                           Kokkos::IndexType<long>, SomeTag>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((
-          std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value));
-    }
-
-    {
-      using policy_t = Kokkos::RangePolicy<Kokkos::Schedule<Kokkos::Dynamic>,
-                                           Kokkos::IndexType<long>, SomeTag>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((
-          std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value));
-    }
-
-    {
-      using policy_t =
-          Kokkos::RangePolicy<SomeTag, Kokkos::Schedule<Kokkos::Dynamic>,
-                              Kokkos::IndexType<long>>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((
-          std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value));
-    }
-  }
-  void test_runtime_parameters() {
-    using policy_t     = Kokkos::RangePolicy<>;
-    using index_t      = policy_t::index_type;
-    index_t work_begin = 5;
-    index_t work_end   = 15;
-    index_t chunk_size = 10;
-    {
-      policy_t p(work_begin, work_end);
-      ASSERT_EQ(p.begin(), work_begin);
-      ASSERT_EQ(p.end(), work_end);
-    }
-    {
-      policy_t p(Kokkos::DefaultExecutionSpace(), work_begin, work_end);
-      ASSERT_EQ(p.begin(), work_begin);
-      ASSERT_EQ(p.end(), work_end);
-    }
-    {
-      policy_t p(work_begin, work_end, Kokkos::ChunkSize(chunk_size));
-      ASSERT_EQ(p.begin(), work_begin);
-      ASSERT_EQ(p.end(), work_end);
-      ASSERT_EQ(p.chunk_size(), chunk_size);
-    }
-    {
-      policy_t p(Kokkos::DefaultExecutionSpace(), work_begin, work_end,
-                 Kokkos::ChunkSize(chunk_size));
-      ASSERT_EQ(p.begin(), work_begin);
-      ASSERT_EQ(p.end(), work_end);
-      ASSERT_EQ(p.chunk_size(), chunk_size);
-    }
-    {
-      policy_t p;
-      ASSERT_EQ(p.begin(), index_t(0));
-      ASSERT_EQ(p.end(), index_t(0));
-      p = policy_t(work_begin, work_end, Kokkos::ChunkSize(chunk_size));
-      ASSERT_EQ(p.begin(), work_begin);
-      ASSERT_EQ(p.end(), work_end);
-      ASSERT_EQ(p.chunk_size(), chunk_size);
-    }
-  }
-};
-
-template <class ExecutionSpace>
-class TestTeamPolicyConstruction {
- public:
-  TestTeamPolicyConstruction() {
-    test_compile_time_parameters();
-    test_run_time_parameters();
-  }
-
- private:
-  void test_compile_time_parameters() {
-    {
-      using policy_t        = Kokkos::TeamPolicy<>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((
-          std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type,
-                                typename execution_space::size_type>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Static>>::value));
-      ASSERT_TRUE((std::is_void<work_tag>::value));
-    }
-
-    {
-      using policy_t        = Kokkos::TeamPolicy<ExecutionSpace>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type,
-                                typename execution_space::size_type>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Static>>::value));
-      ASSERT_TRUE((std::is_void<work_tag>::value));
-    }
-
-    {
-      using policy_t =
-          Kokkos::TeamPolicy<ExecutionSpace, Kokkos::Schedule<Kokkos::Dynamic>>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type,
-                                typename execution_space::size_type>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_void<work_tag>::value));
-    }
-
-    {
-      using policy_t =
-          Kokkos::TeamPolicy<ExecutionSpace, Kokkos::Schedule<Kokkos::Dynamic>,
-                             Kokkos::IndexType<long>>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_void<work_tag>::value));
-    }
-
-    {
-      using policy_t =
-          Kokkos::TeamPolicy<Kokkos::IndexType<long>, ExecutionSpace,
-                             Kokkos::Schedule<Kokkos::Dynamic>>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_void<work_tag>::value));
-    }
-
-    {
-      using policy_t =
-          Kokkos::TeamPolicy<ExecutionSpace, Kokkos::Schedule<Kokkos::Dynamic>,
-                             Kokkos::IndexType<long>, SomeTag>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value));
-    }
-
-    {
-      using policy_t =
-          Kokkos::TeamPolicy<Kokkos::Schedule<Kokkos::Dynamic>, ExecutionSpace,
-                             Kokkos::IndexType<long>, SomeTag>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value));
-    }
-
-    {
-      using policy_t =
-          Kokkos::TeamPolicy<SomeTag, Kokkos::Schedule<Kokkos::Dynamic>,
-                             Kokkos::IndexType<long>, ExecutionSpace>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value));
-    }
-
-    {
-      using policy_t = Kokkos::TeamPolicy<Kokkos::Schedule<Kokkos::Dynamic>>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((
-          std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type,
-                                typename execution_space::size_type>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_void<work_tag>::value));
-    }
-
-    {
-      using policy_t = Kokkos::TeamPolicy<Kokkos::Schedule<Kokkos::Dynamic>,
-                                          Kokkos::IndexType<long>>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((
-          std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_void<work_tag>::value));
-    }
-
-    {
-      using policy_t        = Kokkos::TeamPolicy<Kokkos::IndexType<long>,
-                                          Kokkos::Schedule<Kokkos::Dynamic>>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((
-          std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_void<work_tag>::value));
-    }
-
-    {
-      using policy_t = Kokkos::TeamPolicy<Kokkos::Schedule<Kokkos::Dynamic>,
-                                          Kokkos::IndexType<long>, SomeTag>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((
-          std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value));
-    }
-
-    {
-      using policy_t = Kokkos::TeamPolicy<Kokkos::Schedule<Kokkos::Dynamic>,
-                                          Kokkos::IndexType<long>, SomeTag>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((
-          std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value));
-    }
-
-    {
-      using policy_t =
-          Kokkos::TeamPolicy<SomeTag, Kokkos::Schedule<Kokkos::Dynamic>,
-                             Kokkos::IndexType<long>>;
-      using execution_space = typename policy_t::execution_space;
-      using index_type      = typename policy_t::index_type;
-      using schedule_type   = typename policy_t::schedule_type;
-      using work_tag        = typename policy_t::work_tag;
-
-      ASSERT_TRUE((
-          std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value));
-      ASSERT_TRUE((std::is_same<index_type, long>::value));
-      ASSERT_TRUE((std::is_same<schedule_type,
-                                Kokkos::Schedule<Kokkos::Dynamic>>::value));
-      ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value));
-    }
-  }
-
-  template <class policy_t>
-  void test_run_time_parameters_type() {
-    int league_size = 131;
-    int team_size   = 4 < policy_t::execution_space::concurrency()
-                        ? 4
-                        : policy_t::execution_space::concurrency();
-#ifdef KOKKOS_ENABLE_HPX
-    team_size = 1;
-#endif
-#ifdef KOKKOS_ENABLE_OPENMPTARGET
-    if (std::is_same<typename policy_t::execution_space,
-                     Kokkos::Experimental::OpenMPTarget>::value)
-      team_size = 32;
-#endif
-    int chunk_size         = 4;
-    int per_team_scratch   = 1024;
-    int per_thread_scratch = 16;
-    int scratch_size       = per_team_scratch + per_thread_scratch * team_size;
-
-    policy_t p1(league_size, team_size);
-    ASSERT_EQ(p1.league_size(), league_size);
-    ASSERT_EQ(p1.team_size(), team_size);
-    ASSERT_GT(p1.chunk_size(), 0);
-    ASSERT_EQ(size_t(p1.scratch_size(0)), 0u);
-
-    policy_t p2 = p1.set_chunk_size(chunk_size);
-    ASSERT_EQ(p1.league_size(), league_size);
-    ASSERT_EQ(p1.team_size(), team_size);
-    ASSERT_EQ(p1.chunk_size(), chunk_size);
-    ASSERT_EQ(size_t(p1.scratch_size(0)), 0u);
-
-    ASSERT_EQ(p2.league_size(), league_size);
-    ASSERT_EQ(p2.team_size(), team_size);
-    ASSERT_EQ(p2.chunk_size(), chunk_size);
-    ASSERT_EQ(size_t(p2.scratch_size(0)), 0u);
-
-    policy_t p3 = p2.set_scratch_size(0, Kokkos::PerTeam(per_team_scratch));
-    ASSERT_EQ(p2.league_size(), league_size);
-    ASSERT_EQ(p2.team_size(), team_size);
-    ASSERT_EQ(p2.chunk_size(), chunk_size);
-    ASSERT_EQ(size_t(p2.scratch_size(0)), size_t(per_team_scratch));
-    ASSERT_EQ(p3.league_size(), league_size);
-    ASSERT_EQ(p3.team_size(), team_size);
-    ASSERT_EQ(p3.chunk_size(), chunk_size);
-    ASSERT_EQ(size_t(p3.scratch_size(0)), size_t(per_team_scratch));
-
-    policy_t p4 = p2.set_scratch_size(0, Kokkos::PerThread(per_thread_scratch));
-    ASSERT_EQ(p2.league_size(), league_size);
-    ASSERT_EQ(p2.team_size(), team_size);
-    ASSERT_EQ(p2.chunk_size(), chunk_size);
-    ASSERT_EQ(size_t(p2.scratch_size(0)), size_t(scratch_size));
-    ASSERT_EQ(p4.league_size(), league_size);
-    ASSERT_EQ(p4.team_size(), team_size);
-    ASSERT_EQ(p4.chunk_size(), chunk_size);
-    ASSERT_EQ(size_t(p4.scratch_size(0)), size_t(scratch_size));
-
-    policy_t p5 = p2.set_scratch_size(0, Kokkos::PerThread(per_thread_scratch),
-                                      Kokkos::PerTeam(per_team_scratch));
-    ASSERT_EQ(p2.league_size(), league_size);
-    ASSERT_EQ(p2.team_size(), team_size);
-    ASSERT_EQ(p2.chunk_size(), chunk_size);
-    ASSERT_EQ(size_t(p2.scratch_size(0)), size_t(scratch_size));
-    ASSERT_EQ(p5.league_size(), league_size);
-    ASSERT_EQ(p5.team_size(), team_size);
-    ASSERT_EQ(p5.chunk_size(), chunk_size);
-    ASSERT_EQ(size_t(p5.scratch_size(0)), size_t(scratch_size));
-
-    policy_t p6 = p2.set_scratch_size(0, Kokkos::PerTeam(per_team_scratch),
-                                      Kokkos::PerThread(per_thread_scratch));
-    ASSERT_EQ(p2.league_size(), league_size);
-    ASSERT_EQ(p2.team_size(), team_size);
-    ASSERT_EQ(p2.chunk_size(), chunk_size);
-    ASSERT_EQ(size_t(p2.scratch_size(0)), size_t(scratch_size));
-    ASSERT_EQ(p6.league_size(), league_size);
-    ASSERT_EQ(p6.team_size(), team_size);
-    ASSERT_EQ(p6.chunk_size(), chunk_size);
-    ASSERT_EQ(size_t(p6.scratch_size(0)), size_t(scratch_size));
-
-    policy_t p7 = p3.set_scratch_size(0, Kokkos::PerTeam(per_team_scratch),
-                                      Kokkos::PerThread(per_thread_scratch));
-    ASSERT_EQ(p3.league_size(), league_size);
-    ASSERT_EQ(p3.team_size(), team_size);
-    ASSERT_EQ(p3.chunk_size(), chunk_size);
-    ASSERT_EQ(size_t(p3.scratch_size(0)), size_t(scratch_size));
-    ASSERT_EQ(p7.league_size(), league_size);
-    ASSERT_EQ(p7.team_size(), team_size);
-    ASSERT_EQ(p7.chunk_size(), chunk_size);
-    ASSERT_EQ(size_t(p7.scratch_size(0)), size_t(scratch_size));
-
-    policy_t p8;  // default constructed
-    ASSERT_EQ(p8.league_size(), 0);
-    ASSERT_EQ(size_t(p8.scratch_size(0)), 0u);
-    p8 = p3;  // call assignment operator
-    ASSERT_EQ(p3.league_size(), league_size);
-    ASSERT_EQ(p3.team_size(), team_size);
-    ASSERT_EQ(p3.chunk_size(), chunk_size);
-    ASSERT_EQ(size_t(p3.scratch_size(0)), size_t(scratch_size));
-    ASSERT_EQ(p8.league_size(), league_size);
-    ASSERT_EQ(p8.team_size(), team_size);
-    ASSERT_EQ(p8.chunk_size(), chunk_size);
-    ASSERT_EQ(size_t(p8.scratch_size(0)), size_t(scratch_size));
-  }
-
-  void test_run_time_parameters() {
-    test_run_time_parameters_type<Kokkos::TeamPolicy<ExecutionSpace>>();
-    test_run_time_parameters_type<
-        Kokkos::TeamPolicy<ExecutionSpace, Kokkos::Schedule<Kokkos::Dynamic>,
-                           Kokkos::IndexType<long>>>();
-    test_run_time_parameters_type<
-        Kokkos::TeamPolicy<Kokkos::IndexType<long>, ExecutionSpace,
-                           Kokkos::Schedule<Kokkos::Dynamic>>>();
-    test_run_time_parameters_type<
-        Kokkos::TeamPolicy<Kokkos::Schedule<Kokkos::Dynamic>,
-                           Kokkos::IndexType<long>, ExecutionSpace, SomeTag>>();
-  }
-};
-
-// semiregular is copyable and default initializable
-// (regular requires equality comparable)
-template <class Policy>
-void check_semiregular() {
-  static_assert(std::is_default_constructible<Policy>::value, "");
-  static_assert(std::is_copy_constructible<Policy>::value, "");
-  static_assert(std::is_move_constructible<Policy>::value, "");
-  static_assert(std::is_copy_assignable<Policy>::value, "");
-  static_assert(std::is_move_assignable<Policy>::value, "");
-  static_assert(std::is_destructible<Policy>::value, "");
-}
-
-TEST(TEST_CATEGORY, policy_construction) {
-  check_semiregular<Kokkos::RangePolicy<TEST_EXECSPACE>>();
-  check_semiregular<Kokkos::TeamPolicy<TEST_EXECSPACE>>();
-  check_semiregular<Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>>();
-
-  TestRangePolicyConstruction<TEST_EXECSPACE>();
-  TestTeamPolicyConstruction<TEST_EXECSPACE>();
-}
-
-template <template <class...> class Policy, class... Args>
-void check_converting_constructor_add_work_tag(Policy<Args...> const& policy) {
-  // Not the greatest but at least checking it compiles
-  struct WorkTag {};
-  Policy<Args..., WorkTag> policy_with_tag = policy;
-  (void)policy_with_tag;
-}
-
-TEST(TEST_CATEGORY, policy_converting_constructor_from_other_policy) {
-  check_converting_constructor_add_work_tag(
-      Kokkos::RangePolicy<TEST_EXECSPACE>{});
-  check_converting_constructor_add_work_tag(
-      Kokkos::TeamPolicy<TEST_EXECSPACE>{});
-  check_converting_constructor_add_work_tag(
-      Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>{});
-}
-
-#ifndef KOKKOS_COMPILER_NVHPC       // FIXME_NVHPC
-#ifndef KOKKOS_ENABLE_OPENMPTARGET  // FIXME_OPENMPTARGET
-TEST(TEST_CATEGORY_DEATH, policy_bounds_unsafe_narrowing_conversions) {
-  using Policy = Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>,
-                                       Kokkos::IndexType<unsigned>>;
-
-  ::testing::FLAGS_gtest_death_test_style = "threadsafe";
-  ASSERT_DEATH(
-      {
-        (void)Policy({-1, 0}, {2, 3});
-      },
-      "unsafe narrowing conversion");
-}
-#endif
-#endif
-
-template <class Policy>
-void test_prefer_desired_occupancy(Policy const& policy) {
-  static_assert(!Policy::experimental_contains_desired_occupancy, "");
-
-  // MaximizeOccupancy -> MaximizeOccupancy
-  auto const policy_still_no_occ = Kokkos::Experimental::prefer(
-      policy, Kokkos::Experimental::MaximizeOccupancy{});
-  static_assert(
-      !decltype(policy_still_no_occ)::experimental_contains_desired_occupancy,
-      "");
-
-  // MaximizeOccupancy -> DesiredOccupancy
-  auto const policy_with_occ = Kokkos::Experimental::prefer(
-      policy, Kokkos::Experimental::DesiredOccupancy{33});
-  static_assert(
-      decltype(policy_with_occ)::experimental_contains_desired_occupancy, "");
-  EXPECT_EQ(policy_with_occ.impl_get_desired_occupancy().value(), 33);
-
-  // DesiredOccupancy -> DesiredOccupancy
-  auto const policy_change_occ = Kokkos::Experimental::prefer(
-      policy_with_occ, Kokkos::Experimental::DesiredOccupancy{24});
-  static_assert(
-      decltype(policy_change_occ)::experimental_contains_desired_occupancy, "");
-  EXPECT_EQ(policy_change_occ.impl_get_desired_occupancy().value(), 24);
-
-  // DesiredOccupancy -> MaximizeOccupancy
-  auto const policy_drop_occ = Kokkos::Experimental::prefer(
-      policy_with_occ, Kokkos::Experimental::MaximizeOccupancy{});
-  static_assert(
-      !decltype(policy_drop_occ)::experimental_contains_desired_occupancy, "");
-}
-
-template <class... Args>
-struct DummyPolicy : Kokkos::Impl::PolicyTraits<Args...> {
-  using execution_policy = DummyPolicy;
-
-  using base_t = Kokkos::Impl::PolicyTraits<Args...>;
-  using base_t::base_t;
-};
-
-TEST(TEST_CATEGORY, desired_occupancy_prefer) {
-  test_prefer_desired_occupancy(DummyPolicy<TEST_EXECSPACE>{});
-  test_prefer_desired_occupancy(Kokkos::RangePolicy<TEST_EXECSPACE>{});
-  test_prefer_desired_occupancy(
-      Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>{});
-  test_prefer_desired_occupancy(Kokkos::TeamPolicy<TEST_EXECSPACE>{});
-}
-
-// For a more informative static assertion:
-template <size_t>
-struct static_assert_dummy_policy_must_be_size_one;
-template <>
-struct static_assert_dummy_policy_must_be_size_one<1> {};
-template <size_t, size_t>
-struct static_assert_dummy_policy_must_be_size_of_desired_occupancy;
-template <>
-struct static_assert_dummy_policy_must_be_size_of_desired_occupancy<
-    sizeof(Kokkos::Experimental::DesiredOccupancy),
-    sizeof(Kokkos::Experimental::DesiredOccupancy)> {};
-
-// EBO failure with VS 16.11.3 and CUDA 11.4.2
-#if !(defined(_WIN32) && defined(KOKKOS_ENABLE_CUDA))
-TEST(TEST_CATEGORY, desired_occupancy_empty_base_optimization) {
-  DummyPolicy<TEST_EXECSPACE> const policy{};
-  static_assert(sizeof(decltype(policy)) == 1, "");
-  static_assert_dummy_policy_must_be_size_one<sizeof(decltype(policy))>
-      _assert1{};
-  (void)&_assert1;  // avoid unused variable warning
-
-  using Kokkos::Experimental::DesiredOccupancy;
-  auto policy_with_occ =
-      Kokkos::Experimental::prefer(policy, DesiredOccupancy{50});
-  static_assert(sizeof(decltype(policy_with_occ)) == sizeof(DesiredOccupancy),
-                "");
-  static_assert_dummy_policy_must_be_size_of_desired_occupancy<
-      sizeof(decltype(policy_with_occ)), sizeof(DesiredOccupancy)>
-      _assert2{};
-  (void)&_assert2;  // avoid unused variable warning
-}
-#endif
-
-template <typename Policy>
-void test_desired_occupancy_converting_constructors(Policy const& policy) {
-  auto policy_with_occ = Kokkos::Experimental::prefer(
-      policy, Kokkos::Experimental::DesiredOccupancy{50});
-  EXPECT_EQ(policy_with_occ.impl_get_desired_occupancy().value(), 50);
-
-  auto policy_with_hint = Kokkos::Experimental::require(
-      policy_with_occ, Kokkos::Experimental::WorkItemProperty::HintLightWeight);
-  EXPECT_EQ(policy_with_hint.impl_get_desired_occupancy().value(), 50);
-}
-
-TEST(TEST_CATEGORY, desired_occupancy_converting_constructors) {
-  test_desired_occupancy_converting_constructors(
-      Kokkos::RangePolicy<TEST_EXECSPACE>{});
-  test_desired_occupancy_converting_constructors(
-      Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>{});
-  test_desired_occupancy_converting_constructors(
-      Kokkos::TeamPolicy<TEST_EXECSPACE>{});
-}
-
-template <class T>
-void more_md_range_policy_construction_test() {
-  (void)Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>{
-      Kokkos::Array<T, 2>{}, Kokkos::Array<T, 2>{}};
-
-  (void)Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>{{{T(0), T(0)}},
-                                                               {{T(2), T(2)}}};
-
-  (void)Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>{{T(0), T(0)},
-                                                               {T(2), T(2)}};
-}
-
-TEST(TEST_CATEGORY, md_range_policy_construction_from_arrays) {
-  {
-    // Check that construction from Kokkos::Array of long compiles for backwards
-    // compability.  This was broken in
-    // https://github.com/kokkos/kokkos/pull/3527/commits/88ea8eec6567c84739d77bdd25fdbc647fae28bb#r512323639
-    Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>> p1(
-        Kokkos::Array<long, 2>{{0, 1}}, Kokkos::Array<long, 2>{{2, 3}});
-    Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>> p2(
-        Kokkos::Array<long, 2>{{0, 1}}, Kokkos::Array<long, 2>{{2, 3}});
-    Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>> p3(
-        Kokkos::Array<long, 2>{{0, 1}}, Kokkos::Array<long, 2>{{2, 3}},
-        Kokkos::Array<long, 1>{{4}});
-  }
-  {
-    // Check that construction from Kokkos::Array of the specified index type
-    // works.
-    using index_type = unsigned long long;
-    Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>,
-                          Kokkos::IndexType<index_type>>
-        p1(Kokkos::Array<index_type, 2>{{0, 1}},
-           Kokkos::Array<index_type, 2>{{2, 3}});
-    Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>,
-                          Kokkos::IndexType<index_type>>
-        p2(Kokkos::Array<index_type, 2>{{0, 1}},
-           Kokkos::Array<index_type, 2>{{2, 3}});
-    Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>,
-                          Kokkos::IndexType<index_type>>
-        p3(Kokkos::Array<index_type, 2>{{0, 1}},
-           Kokkos::Array<index_type, 2>{{2, 3}},
-           Kokkos::Array<index_type, 1>{{4}});
-  }
-  {
-    // Check that construction from double-braced initliazer list
-    // works.
-    using index_type = unsigned long long;
-    Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>> p1({{0, 1}},
-                                                              {{2, 3}});
-    Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>,
-                          Kokkos::IndexType<index_type>>
-        p2({{0, 1}}, {{2, 3}});
-  }
-
-  more_md_range_policy_construction_test<char>();
-  more_md_range_policy_construction_test<int>();
-  more_md_range_policy_construction_test<unsigned long>();
-  more_md_range_policy_construction_test<std::int64_t>();
-}
-
-template <class WorkTag, class Policy>
-constexpr auto set_worktag(Policy const& policy) {
-  static_assert(Kokkos::is_execution_policy<Policy>::value, "");
-  using PolicyWithWorkTag =
-      Kokkos::Impl::WorkTagTrait::policy_with_trait<Policy, WorkTag>;
-  return PolicyWithWorkTag{policy};
-}
-
-TEST(TEST_CATEGORY, policy_set_worktag) {
-  struct SomeWorkTag {};
-  struct OtherWorkTag {};
-
-  Kokkos::RangePolicy<> p1;
-  static_assert(std::is_void<decltype(p1)::work_tag>::value, "");
-
-  auto p2 = set_worktag<SomeWorkTag>(p1);
-  static_assert(std::is_same<decltype(p2)::work_tag, SomeWorkTag>::value, "");
-
-  auto p3 = set_worktag<OtherWorkTag>(p2);
-  static_assert(std::is_same<decltype(p3)::work_tag, OtherWorkTag>::value, "");
-
-  // NOTE this does not currently compile
-  // auto p4 = set_worktag<void>(p3);
-  // static_assert(std::is_void<decltype(p4)::work_tag>::value, "");
-}
-}  // namespace Test
diff --git a/packages/kokkos/core/unit_test/TestQuadPrecisionMath.hpp b/packages/kokkos/core/unit_test/TestQuadPrecisionMath.hpp
index 3be6b70ecf0cc165b73d4f1a947e8d276f0222c2..3801acd4a2a315e27dfbe9e51f87009d73589d50 100644
--- a/packages/kokkos/core/unit_test/TestQuadPrecisionMath.hpp
+++ b/packages/kokkos/core/unit_test/TestQuadPrecisionMath.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Macros.hpp>
 #ifdef KOKKOS_ENABLE_LIBQUADMATH
@@ -108,33 +80,31 @@ TEST(TEST_CATEGORY, quad_precision_common_math_functions) {
       });
 }
 
-#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, "")  // FIXME C++17
-
 constexpr bool test_quad_precision_promotion_traits() {
-  STATIC_ASSERT(
+  static_assert(
       std::is_same<__float128, decltype(Kokkos::pow(__float128(1), 2))>::value);
-  STATIC_ASSERT(std::is_same<__float128,
+  static_assert(std::is_same<__float128,
                              decltype(Kokkos::hypot(3, __float128(4)))>::value);
   return true;
 }
 
-STATIC_ASSERT(test_quad_precision_promotion_traits());
+static_assert(test_quad_precision_promotion_traits());
 
 constexpr bool test_quad_precision_math_constants() {
   // compare to mathematical constants defined in libquadmath when available
   // clang-format off
-  STATIC_ASSERT(Kokkos::Experimental::e_v     <__float128> == M_Eq);
-  STATIC_ASSERT(Kokkos::Experimental::log2e_v <__float128> == M_LOG2Eq);
-  STATIC_ASSERT(Kokkos::Experimental::log10e_v<__float128> == M_LOG10Eq);
-  STATIC_ASSERT(Kokkos::Experimental::pi_v    <__float128> == M_PIq);
+  static_assert(Kokkos::numbers::e_v     <__float128> == M_Eq);
+  static_assert(Kokkos::numbers::log2e_v <__float128> == M_LOG2Eq);
+  static_assert(Kokkos::numbers::log10e_v<__float128> == M_LOG10Eq);
+  static_assert(Kokkos::numbers::pi_v    <__float128> == M_PIq);
 #if defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU >= 930)
-  STATIC_ASSERT(Kokkos::Experimental::inv_pi_v<__float128> == M_1_PIq);
+  static_assert(Kokkos::::inv_pi_v<__float128> == M_1_PIq);
 #endif
   // inv_sqrtpi_v
-  STATIC_ASSERT(Kokkos::Experimental::ln2_v   <__float128> == M_LN2q);
-  STATIC_ASSERT(Kokkos::Experimental::ln10_v  <__float128> == M_LN10q);
+  static_assert(Kokkos::numbers::ln2_v   <__float128> == M_LN2q);
+  static_assert(Kokkos::numbers::ln10_v  <__float128> == M_LN10q);
 #if defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU >= 930)
-  STATIC_ASSERT(Kokkos::Experimental::sqrt2_v <__float128> == M_SQRT2q);
+  static_assert(Kokkos::numbers::sqrt2_v <__float128> == M_SQRT2q);
 #endif
   // sqrt3_v
   // inv_sqrt3_v
@@ -144,7 +114,7 @@ constexpr bool test_quad_precision_math_constants() {
   return true;
 }
 
-STATIC_ASSERT(test_quad_precision_math_constants());
+static_assert(test_quad_precision_math_constants());
 
 }  // namespace
 
diff --git a/packages/kokkos/core/unit_test/TestRange.hpp b/packages/kokkos/core/unit_test/TestRange.hpp
index d6b5d8fecc86173d3fa438cbca5b8242b48ddb36..0c465bdc1cfee80f2904a7083f1fcab67e138d7e 100644
--- a/packages/kokkos/core/unit_test/TestRange.hpp
+++ b/packages/kokkos/core/unit_test/TestRange.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <cstdio>
 
@@ -285,10 +257,11 @@ struct TestRange {
     auto const N_no_implicit_capture = N;
     using policy_t =
         Kokkos::RangePolicy<ExecSpace, Kokkos::Schedule<Kokkos::Dynamic> >;
+    int const concurrency = ExecSpace().concurrency();
 
     {
       Kokkos::View<size_t *, ExecSpace, Kokkos::MemoryTraits<Kokkos::Atomic> >
-          count("Count", ExecSpace::concurrency());
+          count("Count", concurrency);
       Kokkos::View<int *, ExecSpace> a("A", N);
 
       Kokkos::parallel_for(
@@ -309,17 +282,16 @@ struct TestRange {
           error);
       ASSERT_EQ(error, 0);
 
-      if ((ExecSpace::concurrency() > (int)1) &&
-          (N > static_cast<int>(4 * ExecSpace::concurrency()))) {
+      if ((concurrency > 1) && (N > 4 * concurrency)) {
         size_t min = N;
         size_t max = 0;
-        for (int t = 0; t < ExecSpace::concurrency(); t++) {
+        for (int t = 0; t < concurrency; t++) {
           if (count(t) < min) min = count(t);
           if (count(t) > max) max = count(t);
         }
         ASSERT_LT(min, max);
 
-        // if ( ExecSpace::concurrency() > 2 ) {
+        // if ( concurrency > 2 ) {
         //  ASSERT_LT( 2 * min, max );
         //}
       }
@@ -327,7 +299,7 @@ struct TestRange {
 
     {
       Kokkos::View<size_t *, ExecSpace, Kokkos::MemoryTraits<Kokkos::Atomic> >
-          count("Count", ExecSpace::concurrency());
+          count("Count", concurrency);
       Kokkos::View<int *, ExecSpace> a("A", N);
 
       value_type sum = 0;
@@ -353,17 +325,16 @@ struct TestRange {
           error);
       ASSERT_EQ(error, 0);
 
-      if ((ExecSpace::concurrency() > (int)1) &&
-          (N > static_cast<int>(4 * ExecSpace::concurrency()))) {
+      if ((concurrency > 1) && (N > 4 * concurrency)) {
         size_t min = N;
         size_t max = 0;
-        for (int t = 0; t < ExecSpace::concurrency(); t++) {
+        for (int t = 0; t < concurrency; t++) {
           if (count(t) < min) min = count(t);
           if (count(t) > max) max = count(t);
         }
         ASSERT_LT(min, max);
 
-        // if ( ExecSpace::concurrency() > 2 ) {
+        // if ( concurrency > 2 ) {
         //  ASSERT_LT( 2 * min, max );
         //}
       }
diff --git a/packages/kokkos/core/unit_test/TestRangePolicy.hpp b/packages/kokkos/core/unit_test/TestRangePolicy.hpp
index 3f40e24d1c8c912a5fb600aa3569f5a27515565b..c612d367430a2144cc0876e0d36e4c017e15122a 100644
--- a/packages/kokkos/core/unit_test/TestRangePolicy.hpp
+++ b/packages/kokkos/core/unit_test/TestRangePolicy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_RANGEPOLICY_HPP
 #define KOKKOS_TEST_RANGEPOLICY_HPP
diff --git a/packages/kokkos/core/unit_test/TestRangePolicyConstructors.hpp b/packages/kokkos/core/unit_test/TestRangePolicyConstructors.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..0a7e59ed980c4b47ba965c02c07d2c378453689e
--- /dev/null
+++ b/packages/kokkos/core/unit_test/TestRangePolicyConstructors.hpp
@@ -0,0 +1,73 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#include <gtest/gtest.h>
+
+#include <Kokkos_Core.hpp>
+
+namespace {
+
+TEST(TEST_CATEGORY, range_policy_runtime_parameters) {
+  using Policy     = Kokkos::RangePolicy<>;
+  using Index      = Policy::index_type;
+  Index work_begin = 5;
+  Index work_end   = 15;
+  Index chunk_size = 10;
+  {
+    Policy p(work_begin, work_end);
+    ASSERT_EQ(p.begin(), work_begin);
+    ASSERT_EQ(p.end(), work_end);
+  }
+  {
+    Policy p(Kokkos::DefaultExecutionSpace(), work_begin, work_end);
+    ASSERT_EQ(p.begin(), work_begin);
+    ASSERT_EQ(p.end(), work_end);
+  }
+  {
+    Policy p(work_begin, work_end, Kokkos::ChunkSize(chunk_size));
+    ASSERT_EQ(p.begin(), work_begin);
+    ASSERT_EQ(p.end(), work_end);
+    ASSERT_EQ(p.chunk_size(), chunk_size);
+  }
+  {
+    Policy p(Kokkos::DefaultExecutionSpace(), work_begin, work_end,
+             Kokkos::ChunkSize(chunk_size));
+    ASSERT_EQ(p.begin(), work_begin);
+    ASSERT_EQ(p.end(), work_end);
+    ASSERT_EQ(p.chunk_size(), chunk_size);
+  }
+  {
+    Policy p;  // default-constructed
+    ASSERT_EQ(p.begin(), Index(0));
+    ASSERT_EQ(p.end(), Index(0));
+    ASSERT_EQ(p.chunk_size(), Index(0));
+
+    // copy-assigned
+    p = Policy(work_begin, work_end, Kokkos::ChunkSize(chunk_size));
+    ASSERT_EQ(p.begin(), work_begin);
+    ASSERT_EQ(p.end(), work_end);
+    ASSERT_EQ(p.chunk_size(), chunk_size);
+  }
+  {
+    Policy p1(work_begin, work_end, Kokkos::ChunkSize(chunk_size));
+    Policy p2(p1);  // copy-constructed
+    ASSERT_EQ(p1.begin(), p2.begin());
+    ASSERT_EQ(p1.end(), p2.end());
+    ASSERT_EQ(p1.chunk_size(), p2.chunk_size());
+  }
+}
+
+}  // namespace
diff --git a/packages/kokkos/core/unit_test/TestRangePolicyRequire.hpp b/packages/kokkos/core/unit_test/TestRangePolicyRequire.hpp
index 508b7192cb29aa87d3d28930d0babe0be1024432..749f8b97d2b59e53c486d220c013f7ed2537adea 100644
--- a/packages/kokkos/core/unit_test/TestRangePolicyRequire.hpp
+++ b/packages/kokkos/core/unit_test/TestRangePolicyRequire.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <cstdio>
 
@@ -277,10 +249,11 @@ struct TestRangeRequire {
     auto const N_no_implicit_capture = N;
     using policy_t =
         Kokkos::RangePolicy<ExecSpace, Kokkos::Schedule<Kokkos::Dynamic> >;
+    int const concurrency = ExecSpace().concurrency();
 
     {
       Kokkos::View<size_t *, ExecSpace, Kokkos::MemoryTraits<Kokkos::Atomic> >
-          count("Count", ExecSpace::concurrency());
+          count("Count", concurrency);
       Kokkos::View<int *, ExecSpace> a("A", N);
 
       Kokkos::parallel_for(
@@ -301,17 +274,16 @@ struct TestRangeRequire {
           error);
       ASSERT_EQ(error, 0);
 
-      if ((ExecSpace::concurrency() > (int)1) &&
-          (N > static_cast<int>(4 * ExecSpace::concurrency()))) {
+      if ((concurrency > 1) && (N > 4 * concurrency)) {
         size_t min = N;
         size_t max = 0;
-        for (int t = 0; t < ExecSpace::concurrency(); t++) {
+        for (int t = 0; t < concurrency; t++) {
           if (count(t) < min) min = count(t);
           if (count(t) > max) max = count(t);
         }
         ASSERT_LT(min, max);
 
-        // if ( ExecSpace::concurrency() > 2 ) {
+        // if ( concurrency > 2 ) {
         //  ASSERT_LT( 2 * min, max );
         //}
       }
@@ -319,7 +291,7 @@ struct TestRangeRequire {
 
     {
       Kokkos::View<size_t *, ExecSpace, Kokkos::MemoryTraits<Kokkos::Atomic> >
-          count("Count", ExecSpace::concurrency());
+          count("Count", concurrency);
       Kokkos::View<int *, ExecSpace> a("A", N);
 
       int sum = 0;
@@ -345,17 +317,16 @@ struct TestRangeRequire {
           error);
       ASSERT_EQ(error, 0);
 
-      if ((ExecSpace::concurrency() > (int)1) &&
-          (N > static_cast<int>(4 * ExecSpace::concurrency()))) {
+      if ((concurrency > 1) && (N > 4 * concurrency)) {
         size_t min = N;
         size_t max = 0;
-        for (int t = 0; t < ExecSpace::concurrency(); t++) {
+        for (int t = 0; t < concurrency; t++) {
           if (count(t) < min) min = count(t);
           if (count(t) > max) max = count(t);
         }
         ASSERT_LT(min, max);
 
-        // if ( ExecSpace::concurrency() > 2 ) {
+        // if ( concurrency > 2 ) {
         //  ASSERT_LT( 2 * min, max );
         //}
       }
diff --git a/packages/kokkos/core/unit_test/TestRealloc.hpp b/packages/kokkos/core/unit_test/TestRealloc.hpp
index 3de42070e7d14b87e63f4dbea891c1cdd3f15693..2c9dc5ee47322d375caab016b733216f88fb240b 100644
--- a/packages/kokkos/core/unit_test/TestRealloc.hpp
+++ b/packages/kokkos/core/unit_test/TestRealloc.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 #ifndef TESTREALLOC_HPP_
 #define TESTREALLOC_HPP_
 
diff --git a/packages/kokkos/core/unit_test/TestReduce.hpp b/packages/kokkos/core/unit_test/TestReduce.hpp
index c136b409b1ed6d82e4f1a67856348328176562e1..4cf30f6fbed47fb05a4f4fed5b83eff542ba04d7 100644
--- a/packages/kokkos/core/unit_test/TestReduce.hpp
+++ b/packages/kokkos/core/unit_test/TestReduce.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <sstream>
 #include <iostream>
@@ -518,22 +490,6 @@ class TestReduceDynamicView {
       // Test result to host pointer:
 
       std::string str("TestKernelReduce");
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-      if (count % 2 == 0) {
-        Kokkos::parallel_reduce(nw, functor_type(nw, count),
-                                host_result.data());
-      } else {
-        Kokkos::parallel_reduce(str, nw, functor_type(nw, count),
-                                host_result.data());
-      }
-
-      for (unsigned j = 0; j < count; ++j) {
-        const uint64_t correct = 0 == j % 3 ? nw : nsum;
-        ASSERT_EQ(host_result(j), (ScalarType)correct);
-        host_result(j) = 0;
-      }
-#endif
-
       if (count % 2 == 0) {
         Kokkos::parallel_reduce(nw, functor_type(nw, count), host_result);
       } else {
diff --git a/packages/kokkos/core/unit_test/TestReduceCombinatorical.hpp b/packages/kokkos/core/unit_test/TestReduceCombinatorical.hpp
index 2217b9b8a3f46fc28c19d9cc1479e716a9e32903..c6b6249bdf1b869917054d61460d292f5732f04c 100644
--- a/packages/kokkos/core/unit_test/TestReduceCombinatorical.hpp
+++ b/packages/kokkos/core/unit_test/TestReduceCombinatorical.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <sstream>
 #include <iostream>
@@ -415,11 +387,11 @@ struct TestReduceCombinatoricalInstantiation {
 #ifndef KOKKOS_ENABLE_OPENMPTARGET
     CallParallelReduce(args...,
                        Test::ReduceCombinatorical::AddPlus<double>(value));
-    if ((Kokkos::DefaultExecutionSpace::concurrency() > 1) &&
-        (ExecSpace::concurrency() > 1) && (expected_result > 0)) {
+    if ((Kokkos::DefaultExecutionSpace().concurrency() > 1) &&
+        (ExecSpace().concurrency() > 1) && (expected_result > 0)) {
       ASSERT_LT(expected_result, value);
-    } else if (((Kokkos::DefaultExecutionSpace::concurrency() > 1) ||
-                (ExecSpace::concurrency() > 1)) &&
+    } else if (((Kokkos::DefaultExecutionSpace().concurrency() > 1) ||
+                (ExecSpace().concurrency() > 1)) &&
                (expected_result > 0)) {
       ASSERT_LE(expected_result, value);
     } else {
@@ -429,11 +401,11 @@ struct TestReduceCombinatoricalInstantiation {
     value = 99;
     Test::ReduceCombinatorical::AddPlus<double> add(value);
     CallParallelReduce(args..., add);
-    if ((Kokkos::DefaultExecutionSpace::concurrency() > 1) &&
-        (ExecSpace::concurrency() > 1) && (expected_result > 0)) {
+    if ((Kokkos::DefaultExecutionSpace().concurrency() > 1) &&
+        (ExecSpace().concurrency() > 1) && (expected_result > 0)) {
       ASSERT_LT(expected_result, value);
-    } else if (((Kokkos::DefaultExecutionSpace::concurrency() > 1) ||
-                (ExecSpace::concurrency() > 1)) &&
+    } else if (((Kokkos::DefaultExecutionSpace().concurrency() > 1) ||
+                (ExecSpace().concurrency() > 1)) &&
                (expected_result > 0)) {
       ASSERT_LE(expected_result, value);
     } else {
diff --git a/packages/kokkos/core/unit_test/TestReducerCTADs.hpp b/packages/kokkos/core/unit_test/TestReducerCTADs.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..3b90c2a7e09ae02c36313a3c8034584f0168a20f
--- /dev/null
+++ b/packages/kokkos/core/unit_test/TestReducerCTADs.hpp
@@ -0,0 +1,421 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#include <Kokkos_Core.hpp>
+
+namespace {
+
+struct TestReducerCTADS {
+  using execspace   = TEST_EXECSPACE;
+  using scalar_type = double;
+  using index_type  = int;
+  using memspace    = execspace::memory_space;
+
+  struct CustomComparator {
+    bool operator()(scalar_type, scalar_type) const;
+  };
+  static CustomComparator comparator;
+
+  struct TestSum {
+    static Kokkos::View<scalar_type, memspace> view;
+    static Kokkos::View<scalar_type, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::Sum<scalar_type, memspace> rt;
+
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::Sum(view))>);
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::Sum(rt))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::Sum(std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::Sum(unmanaged))>);
+  };
+
+  struct TestProd {
+    static Kokkos::View<scalar_type, memspace> view;
+    static Kokkos::View<scalar_type, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::Prod<scalar_type, memspace> rt;
+
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::Prod(view))>);
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::Prod(rt))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::Prod(std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::Prod(unmanaged))>);
+  };
+
+  struct TestMin {
+    static Kokkos::View<scalar_type, memspace> view;
+    static Kokkos::View<scalar_type, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::Min<scalar_type, memspace> rt;
+
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::Min(view))>);
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::Min(rt))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::Min(std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::Min(unmanaged))>);
+  };
+
+  struct TestMax {
+    static Kokkos::View<scalar_type, memspace> view;
+    static Kokkos::View<scalar_type, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::Max<scalar_type, memspace> rt;
+
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::Max(view))>);
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::Max(rt))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::Max(std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::Max(unmanaged))>);
+  };
+
+  struct TestLAnd {
+    static Kokkos::View<scalar_type, memspace> view;
+    static Kokkos::View<scalar_type, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::LAnd<scalar_type, memspace> rt;
+
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::LAnd(view))>);
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::LAnd(rt))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::LAnd(std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::LAnd(unmanaged))>);
+  };
+
+  struct TestLOr {
+    static Kokkos::View<scalar_type, memspace> view;
+    static Kokkos::View<scalar_type, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::LOr<scalar_type, memspace> rt;
+
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::LOr(view))>);
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::LOr(rt))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::LOr(std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::LOr(unmanaged))>);
+  };
+
+  struct TestBAnd {
+    static Kokkos::View<scalar_type, memspace> view;
+    static Kokkos::View<scalar_type, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::BAnd<scalar_type, memspace> rt;
+
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::BAnd(view))>);
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::BAnd(rt))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::BAnd(std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::BAnd(unmanaged))>);
+  };
+
+  struct TestBOr {
+    static Kokkos::View<scalar_type, memspace> view;
+    static Kokkos::View<scalar_type, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::BOr<scalar_type, memspace> rt;
+
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::BOr(view))>);
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::BOr(rt))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::BOr(std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::BOr(unmanaged))>);
+  };
+
+  struct TestMinLoc {
+    static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace>
+        view;
+    static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::MinLoc<scalar_type, index_type, memspace> rt;
+
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::MinLoc(view))>);
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::MinLoc(rt))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::MinLoc(std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::MinLoc(unmanaged))>);
+  };
+
+  struct TestMaxLoc {
+    static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace>
+        view;
+    static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::MaxLoc<scalar_type, index_type, memspace> rt;
+
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::MaxLoc(view))>);
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::MaxLoc(rt))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::MaxLoc(std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::MaxLoc(unmanaged))>);
+  };
+
+  struct TestMinMax {
+    static Kokkos::View<Kokkos::MinMaxScalar<scalar_type>, memspace> view;
+    static Kokkos::View<Kokkos::MinMaxScalar<scalar_type>, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::MinMax<scalar_type, memspace> rt;
+
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::MinMax(view))>);
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::MinMax(rt))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::MinMax(std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::MinMax(unmanaged))>);
+  };
+
+  struct TestMinMaxLoc {
+    static Kokkos::View<Kokkos::MinMaxLocScalar<scalar_type, index_type>,
+                        memspace>
+        view;
+    static Kokkos::View<Kokkos::MinMaxLocScalar<scalar_type, index_type>,
+                        memspace, Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::MinMaxLoc<scalar_type, index_type, memspace> rt;
+
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::MinMaxLoc(view))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::MinMaxLoc(rt))>);
+    static_assert(std::is_same_v<decltype(rt),
+                                 decltype(Kokkos::MinMaxLoc(std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::MinMaxLoc(unmanaged))>);
+  };
+
+  struct TestMaxFirstLoc {
+    static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace>
+        view;
+    static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::MaxFirstLoc<scalar_type, index_type, memspace> rt;
+
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::MaxFirstLoc(view))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::MaxFirstLoc(rt))>);
+    static_assert(std::is_same_v<decltype(rt),
+                                 decltype(Kokkos::MaxFirstLoc(std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::MaxFirstLoc(unmanaged))>);
+  };
+
+  struct TestMaxFirstLocCustomComparator {
+    static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace>
+        view;
+    static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::MaxFirstLocCustomComparator<scalar_type, index_type,
+                                               CustomComparator, memspace>
+        rt;
+
+    static_assert(std::is_same_v<decltype(rt),
+                                 decltype(Kokkos::MaxFirstLocCustomComparator(
+                                     view, comparator))>);
+    static_assert(
+        std::is_same_v<decltype(rt),
+                       decltype(Kokkos::MaxFirstLocCustomComparator(rt))>);
+    static_assert(std::is_same_v<decltype(rt),
+                                 decltype(Kokkos::MaxFirstLocCustomComparator(
+                                     std::move(rt)))>);
+    static_assert(std::is_same_v<decltype(rt),
+                                 decltype(Kokkos::MaxFirstLocCustomComparator(
+                                     unmanaged, comparator))>);
+  };
+
+  struct TestMinFirstLoc {
+    static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace>
+        view;
+    static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::MinFirstLoc<scalar_type, index_type, memspace> rt;
+
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::MinFirstLoc(view))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::MinFirstLoc(rt))>);
+    static_assert(std::is_same_v<decltype(rt),
+                                 decltype(Kokkos::MinFirstLoc(std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::MinFirstLoc(unmanaged))>);
+  };
+
+  struct TestMinFirstLocCustomComparator {
+    static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace>
+        view;
+    static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::MinFirstLocCustomComparator<scalar_type, index_type,
+                                               CustomComparator, memspace>
+        rt;
+
+    static_assert(std::is_same_v<decltype(rt),
+                                 decltype(Kokkos::MinFirstLocCustomComparator(
+                                     view, comparator))>);
+    static_assert(
+        std::is_same_v<decltype(rt),
+                       decltype(Kokkos::MinFirstLocCustomComparator(rt))>);
+    static_assert(std::is_same_v<decltype(rt),
+                                 decltype(Kokkos::MinFirstLocCustomComparator(
+                                     std::move(rt)))>);
+    static_assert(std::is_same_v<decltype(rt),
+                                 decltype(Kokkos::MinFirstLocCustomComparator(
+                                     unmanaged, comparator))>);
+  };
+
+  struct TestMinMaxFirstLastLoc {
+    static Kokkos::View<Kokkos::MinMaxLocScalar<scalar_type, index_type>,
+                        memspace>
+        view;
+    static Kokkos::View<Kokkos::MinMaxLocScalar<scalar_type, index_type>,
+                        memspace, Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::MinMaxFirstLastLoc<scalar_type, index_type, memspace> rt;
+
+    static_assert(std::is_same_v<decltype(rt),
+                                 decltype(Kokkos::MinMaxFirstLastLoc(view))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::MinMaxFirstLastLoc(rt))>);
+    static_assert(
+        std::is_same_v<decltype(rt),
+                       decltype(Kokkos::MinMaxFirstLastLoc(std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt),
+                       decltype(Kokkos::MinMaxFirstLastLoc(unmanaged))>);
+  };
+
+  struct TestMinMaxFirstLastLocCustomComparator {
+    static Kokkos::View<Kokkos::MinMaxLocScalar<scalar_type, index_type>,
+                        memspace>
+        view;
+    static Kokkos::View<Kokkos::MinMaxLocScalar<scalar_type, index_type>,
+                        memspace, Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::MinMaxFirstLastLocCustomComparator<
+        scalar_type, index_type, CustomComparator, memspace>
+        rt;
+
+    static_assert(
+        std::is_same_v<decltype(rt),
+                       decltype(Kokkos::MinMaxFirstLastLocCustomComparator(
+                           view, comparator))>);
+    static_assert(std::is_same_v<
+                  decltype(rt),
+                  decltype(Kokkos::MinMaxFirstLastLocCustomComparator(rt))>);
+    static_assert(
+        std::is_same_v<decltype(rt),
+                       decltype(Kokkos::MinMaxFirstLastLocCustomComparator(
+                           std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt),
+                       decltype(Kokkos::MinMaxFirstLastLocCustomComparator(
+                           unmanaged, comparator))>);
+  };
+
+  struct TestFirstLoc {
+    static Kokkos::View<Kokkos::FirstLocScalar<index_type>, memspace> view;
+    static Kokkos::View<Kokkos::FirstLocScalar<index_type>, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::FirstLoc<index_type, memspace> rt;
+
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::FirstLoc(view))>);
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::FirstLoc(rt))>);
+    static_assert(std::is_same_v<decltype(rt),
+                                 decltype(Kokkos::FirstLoc(std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::FirstLoc(unmanaged))>);
+  };
+
+  struct TestLastLoc {
+    static Kokkos::View<Kokkos::LastLocScalar<index_type>, memspace> view;
+    static Kokkos::View<Kokkos::LastLocScalar<index_type>, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::LastLoc<index_type, memspace> rt;
+
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::LastLoc(view))>);
+    static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::LastLoc(rt))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::LastLoc(std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::LastLoc(unmanaged))>);
+  };
+
+  struct TestStdIsPartitioned {
+    static Kokkos::View<Kokkos::StdIsPartScalar<index_type>, memspace> view;
+    static Kokkos::View<Kokkos::StdIsPartScalar<index_type>, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::StdIsPartitioned<index_type, memspace> rt;
+
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::StdIsPartitioned(view))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::StdIsPartitioned(rt))>);
+    static_assert(
+        std::is_same_v<decltype(rt),
+                       decltype(Kokkos::StdIsPartitioned(std::move(rt)))>);
+    static_assert(std::is_same_v<
+                  decltype(rt), decltype(Kokkos::StdIsPartitioned(unmanaged))>);
+  };
+
+  struct TestStdPartitionPoint {
+    static Kokkos::View<Kokkos::StdPartPointScalar<index_type>, memspace> view;
+    static Kokkos::View<Kokkos::StdPartPointScalar<index_type>, memspace,
+                        Kokkos::MemoryTraits<Kokkos::Unmanaged>>
+        unmanaged;
+    static Kokkos::StdPartitionPoint<index_type, memspace> rt;
+
+    static_assert(std::is_same_v<decltype(rt),
+                                 decltype(Kokkos::StdPartitionPoint(view))>);
+    static_assert(
+        std::is_same_v<decltype(rt), decltype(Kokkos::StdPartitionPoint(rt))>);
+    static_assert(
+        std::is_same_v<decltype(rt),
+                       decltype(Kokkos::StdPartitionPoint(std::move(rt)))>);
+    static_assert(
+        std::is_same_v<decltype(rt),
+                       decltype(Kokkos::StdPartitionPoint(unmanaged))>);
+  };
+};
+
+}  // namespace
diff --git a/packages/kokkos/core/unit_test/TestReducers.hpp b/packages/kokkos/core/unit_test/TestReducers.hpp
index 10e0f3e9544fc2344b3b9c8387cd34ed1d5a70d3..633b203afe73138b8e7b5857b8e3430b34bbc534 100644
--- a/packages/kokkos/core/unit_test/TestReducers.hpp
+++ b/packages/kokkos/core/unit_test/TestReducers.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <sstream>
 #include <iostream>
diff --git a/packages/kokkos/core/unit_test/TestReducers_a.hpp b/packages/kokkos/core/unit_test/TestReducers_a.hpp
index 4efc4f645064c7e01f501101ff9b42ca8e686309..7d6345d69caf5c26d260a0fbbd0e6c2bc7d3909f 100644
--- a/packages/kokkos/core/unit_test/TestReducers_a.hpp
+++ b/packages/kokkos/core/unit_test/TestReducers_a.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestReducers.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestReducers_b.hpp b/packages/kokkos/core/unit_test/TestReducers_b.hpp
index 57aa0f3b7661659acd04ccdb8fe171954e258eb9..a55870776e4f731a45dc94d9350c3707f2ce9bbe 100644
--- a/packages/kokkos/core/unit_test/TestReducers_b.hpp
+++ b/packages/kokkos/core/unit_test/TestReducers_b.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestReducers.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestReducers_c.hpp b/packages/kokkos/core/unit_test/TestReducers_c.hpp
index d1353b1f647e43c698adf994240be1086a9a5da3..9797fb3ef5886f1e8a559f640d92da5af4545e82 100644
--- a/packages/kokkos/core/unit_test/TestReducers_c.hpp
+++ b/packages/kokkos/core/unit_test/TestReducers_c.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestReducers.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestReducers_d.hpp b/packages/kokkos/core/unit_test/TestReducers_d.hpp
index a84a6e20f0456c367a6f49a335db0f71a7a9e6bb..19eaa6d70002e60b5eec78c57f0759c469f9494a 100644
--- a/packages/kokkos/core/unit_test/TestReducers_d.hpp
+++ b/packages/kokkos/core/unit_test/TestReducers_d.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestReducers.hpp>
@@ -87,11 +59,11 @@ TEST(TEST_CATEGORY, reducers_bhalf_t) {
   TestReducers<ThisTestType, TEST_EXECSPACE>::test_sum(50);
   TestReducers<ThisTestType, TEST_EXECSPACE>::test_sum(51);
 
+  TestReducers<ThisTestType, TEST_EXECSPACE>::test_prod(1);
+  TestReducers<ThisTestType, TEST_EXECSPACE>::test_prod(2);
+  TestReducers<ThisTestType, TEST_EXECSPACE>::test_prod(3);
+  TestReducers<ThisTestType, TEST_EXECSPACE>::test_prod(4);
   TestReducers<ThisTestType, TEST_EXECSPACE>::test_prod(5);
-  TestReducers<ThisTestType, TEST_EXECSPACE>::test_prod(10);
-  TestReducers<ThisTestType, TEST_EXECSPACE>::test_prod(15);
-  TestReducers<ThisTestType, TEST_EXECSPACE>::test_prod(20);
-  TestReducers<ThisTestType, TEST_EXECSPACE>::test_prod(25);
 }
 
 TEST(TEST_CATEGORY, reducers_int8_t) {
diff --git a/packages/kokkos/core/unit_test/TestReducers_e.hpp b/packages/kokkos/core/unit_test/TestReducers_e.hpp
index e8a01e350f7cf6ae8531bb2d3a2570c85222e969..6b94aaaab50ab6e39aa92c3939ce644201279961 100644
--- a/packages/kokkos/core/unit_test/TestReducers_e.hpp
+++ b/packages/kokkos/core/unit_test/TestReducers_e.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestReducers.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestReductions.hpp b/packages/kokkos/core/unit_test/TestReductions.hpp
index 1fa8a2e92e68f7c3bf34e6cc4cc96b29b73071f3..a4c277cb0bfbec4e6b579d459de57188e22ab1b2 100644
--- a/packages/kokkos/core/unit_test/TestReductions.hpp
+++ b/packages/kokkos/core/unit_test/TestReductions.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_REDUCTIONS_HPP
 #define KOKKOS_TEST_REDUCTIONS_HPP
diff --git a/packages/kokkos/core/unit_test/TestReductions_DeviceView.hpp b/packages/kokkos/core/unit_test/TestReductions_DeviceView.hpp
index c1d6c5cec10596fd1b355f6588e4987cd1a96ca7..f9f9f251495f240afd87e3ea4587684568b77e2a 100644
--- a/packages/kokkos/core/unit_test/TestReductions_DeviceView.hpp
+++ b/packages/kokkos/core/unit_test/TestReductions_DeviceView.hpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #include <Kokkos_Core.hpp>
 
 namespace Test {
diff --git a/packages/kokkos/core/unit_test/TestResize.hpp b/packages/kokkos/core/unit_test/TestResize.hpp
index cd1fde4a9da716b39723a5755209f5d831215927..13d7e16d5890ca170683f98471c2b8af41b6f7a4 100644
--- a/packages/kokkos/core/unit_test/TestResize.hpp
+++ b/packages/kokkos/core/unit_test/TestResize.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 #ifndef TESTRESIZE_HPP_
 #define TESTRESIZE_HPP_
 
diff --git a/packages/kokkos/core/unit_test/TestScan.hpp b/packages/kokkos/core/unit_test/TestScan.hpp
index 356ffde9565aaf40035e033748056cbb3028f678..8c6a02f31fe3b5ff0dae001a50391993259cdaab 100644
--- a/packages/kokkos/core/unit_test/TestScan.hpp
+++ b/packages/kokkos/core/unit_test/TestScan.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <cstdio>
@@ -100,15 +72,51 @@ struct TestScan {
     Kokkos::deep_copy(errors_a, 0);
     errors = errors_a;
 
-    Kokkos::parallel_scan(N, *this);
+    {
+      Kokkos::parallel_scan(N, *this);
+      check_error();
+    }
+
+    {
+      Kokkos::deep_copy(errors_a, 0);
+      value_type total = 0;
+      Kokkos::parallel_scan(N, *this, total);
+
+      // We can't return a value in a constructor so use a lambda as wrapper to
+      // ignore it.
+      [&] { ASSERT_EQ(size_t((N + 1) * N / 2), size_t(total)); }();
+      check_error();
+    }
 
-    value_type total = 0;
-    Kokkos::parallel_scan(N, *this, total);
+    {
+      Kokkos::deep_copy(errors_a, 0);
+      Kokkos::View<value_type, Kokkos::HostSpace> total_view("total");
+      Kokkos::parallel_scan(N, *this, total_view);
+      Kokkos::fence();
 
-    // We can't return a value in a constructor so use a lambda as wrapper to
-    // ignore it.
-    [&] { ASSERT_EQ(size_t((N + 1) * N / 2), size_t(total)); }();
-    check_error();
+      // We can't return a value in a constructor so use a lambda as wrapper to
+      // ignore it.
+      [&] { ASSERT_EQ(size_t((N + 1) * N / 2), size_t(total_view())); }();
+      check_error();
+    }
+
+    {
+      Kokkos::deep_copy(errors_a, 0);
+      Kokkos::View<value_type, typename Device::memory_space> total_view(
+          "total");
+      typename Device::execution_space exec;
+      Kokkos::parallel_scan(
+          Kokkos::RangePolicy<typename Device::execution_space>(exec, 0, N),
+          *this, total_view);
+      value_type total;
+      Kokkos::deep_copy(exec, total, total_view);
+      exec.fence();
+
+      // We can't return a value in a constructor so use a lambda as wrapper to
+      // ignore it.
+      [&] { ASSERT_EQ(size_t((N + 1) * N / 2), size_t(total)); }();
+      check_error();
+    }
   }
 
   TestScan(const size_t Start, const size_t N) {
diff --git a/packages/kokkos/core/unit_test/TestSharedAlloc.hpp b/packages/kokkos/core/unit_test/TestSharedAlloc.hpp
index f66b35dc9f9de2a8b3eabc0338683f3875dbd2b1..c7b0f380231e571a5c3f6aae864c91a43ace8977 100644
--- a/packages/kokkos/core/unit_test/TestSharedAlloc.hpp
+++ b/packages/kokkos/core/unit_test/TestSharedAlloc.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
@@ -91,7 +63,7 @@ void test_shared_alloc() {
     // Since always executed on host space, leave [=]
     Kokkos::parallel_for(range, [=](int i) {
       char name[64];
-      sprintf(name, "test_%.2d", i);
+      snprintf(name, 64, "test_%.2d", i);
 
       r[i] = RecordMemS::allocate(s, name, size * (i + 1));
       h[i] = Header::get_header(r[i]->data());
@@ -135,7 +107,7 @@ void test_shared_alloc() {
 
     Kokkos::parallel_for(range, [=](size_t i) {
       char name[64];
-      sprintf(name, "test_%.2d", int(i));
+      snprintf(name, 64, "test_%.2d", int(i));
 
       RecordFull* rec = RecordFull::allocate(s, name, size * (i + 1));
 
@@ -241,11 +213,13 @@ TEST(TEST_CATEGORY, impl_shared_alloc) {
 #elif (TEST_CATEGORY_NUMBER == 5)  // cuda
   test_shared_alloc<Kokkos::CudaSpace, Kokkos::DefaultHostExecutionSpace>();
 #elif (TEST_CATEGORY_NUMBER == 6)  // hip
-  test_shared_alloc<Kokkos::Experimental::HIPSpace,
-                    Kokkos::DefaultHostExecutionSpace>();
+  test_shared_alloc<Kokkos::HIPSpace, Kokkos::DefaultHostExecutionSpace>();
 #elif (TEST_CATEGORY_NUMBER == 7)  // sycl
   test_shared_alloc<Kokkos::Experimental::SYCLDeviceUSMSpace,
                     Kokkos::DefaultHostExecutionSpace>();
+#elif (TEST_CATEGORY_NUMBER == 8)  // openacc
+  test_shared_alloc<Kokkos::Experimental::OpenACCSpace,
+                    Kokkos::DefaultHostExecutionSpace>();
 #endif
 #else
   test_shared_alloc<TEST_EXECSPACE, Kokkos::DefaultHostExecutionSpace>();
diff --git a/packages/kokkos/core/unit_test/TestSharedHostPinnedSpace.cpp b/packages/kokkos/core/unit_test/TestSharedHostPinnedSpace.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4d59fb1a442ebad8e407257e8350dc6f93f2e251
--- /dev/null
+++ b/packages/kokkos/core/unit_test/TestSharedHostPinnedSpace.cpp
@@ -0,0 +1,105 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+#include <gtest/gtest.h>
+#include <Kokkos_Core.hpp>
+
+namespace {
+
+template <typename ViewType>
+struct Increment {
+  ViewType view_;
+
+  template <typename ExecutionSpace>
+  explicit Increment(ExecutionSpace, ViewType view) : view_(view) {
+    Kokkos::parallel_for(
+        "increment",
+        Kokkos::RangePolicy<ExecutionSpace, Kokkos::IndexType<size_t>>{
+            0, view_.size()},
+        *this);
+  }
+
+  KOKKOS_FUNCTION
+  void operator()(const size_t idx) const { ++view_(idx); }
+};
+
+template <typename ViewType>
+struct CheckResult {
+  ViewType view_;
+  int targetVal_;
+  unsigned numErrors = 0;
+
+  template <typename ExecutionSpace>
+  CheckResult(ExecutionSpace, ViewType view, int targetVal)
+      : view_(view), targetVal_(targetVal) {
+    Kokkos::parallel_reduce(
+        "check",
+        Kokkos::RangePolicy<ExecutionSpace, Kokkos::IndexType<size_t>>{
+            0, view_.size()},
+        *this, Kokkos::Sum<unsigned>(numErrors));
+  }
+
+  KOKKOS_FUNCTION
+  void operator()(const size_t idx, unsigned& errors) const {
+    if (view_(idx) != targetVal_) ++errors;
+  }
+};
+
+TEST(defaultdevicetype, shared_host_pinned_space) {
+  ASSERT_TRUE(Kokkos::has_shared_host_pinned_space);
+
+  if constexpr (std::is_same_v<Kokkos::DefaultExecutionSpace,
+                               Kokkos::DefaultHostExecutionSpace>)
+    GTEST_SKIP() << "Skipping as host and device are the same space";
+
+  const unsigned int numDeviceHostCycles = 3;
+  size_t numInts                         = 1024;
+
+  using DeviceExecutionSpace = Kokkos::DefaultExecutionSpace;
+  using HostExecutionSpace   = Kokkos::DefaultHostExecutionSpace;
+
+  // ALLOCATION
+  Kokkos::View<int*, Kokkos::SharedHostPinnedSpace> sharedData("sharedData",
+                                                               numInts);
+  // MAIN LOOP
+  unsigned incrementCount = 0;
+
+  for (unsigned i = 0; i < numDeviceHostCycles; ++i) {
+    // INCREMENT DEVICE
+    Increment incrementOnDevice(DeviceExecutionSpace{}, sharedData);
+    ++incrementCount;
+    Kokkos::fence();
+    // CHECK RESULTS HOST
+    ASSERT_EQ(
+        CheckResult(HostExecutionSpace{}, sharedData, incrementCount).numErrors,
+        0u)
+        << "Changes to SharedHostPinnedSpace made on device not visible to "
+           "host. Iteration "
+        << i << " of " << numDeviceHostCycles;
+
+    // INCREMENT HOST
+    Increment incrementOnHost(HostExecutionSpace{}, sharedData);
+    ++incrementCount;
+    Kokkos::fence();
+    // CHECK RESULTS Device
+    ASSERT_EQ(CheckResult(DeviceExecutionSpace{}, sharedData, incrementCount)
+                  .numErrors,
+              0u)
+        << "Changes to SharedHostPinnedSpace made on host not visible to "
+           "device. Iteration "
+        << i << " of " << numDeviceHostCycles;
+  }
+}
+}  // namespace
diff --git a/packages/kokkos/core/unit_test/TestSharedSpace.cpp b/packages/kokkos/core/unit_test/TestSharedSpace.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..8112c956db42ffb95cf791e722136333dedb15a4
--- /dev/null
+++ b/packages/kokkos/core/unit_test/TestSharedSpace.cpp
@@ -0,0 +1,218 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+#include <gtest/gtest.h>
+#include <Kokkos_Core.hpp>
+
+#if defined(_WIN32)
+#include <windows.h>
+unsigned getBytesPerPage() {
+  SYSTEM_INFO si;
+  GetSystemInfo(&si);
+  return si.dwPageSize;
+}
+
+#else  // unix/posix system
+#include <unistd.h>
+unsigned getBytesPerPage() { return sysconf(_SC_PAGESIZE); }
+#endif
+
+#include <algorithm>
+#include <numeric>
+#include <iostream>
+
+namespace {
+void printTimings(std::ostream& out, std::vector<uint64_t> const& tr,
+                  uint64_t threshold = (std::numeric_limits<uint64_t>::max)()) {
+  out << "TimingResult contains " << tr.size() << " results:\n";
+  for (auto it = tr.begin(); it != tr.end(); ++it) {
+    out << "Duration of loop " << it - tr.begin() << " is " << *it
+        << " clock cycles. ";
+    if ((*it) > threshold) out << "Migration assumed.";
+
+    out << "\n";
+  }
+}
+
+template <typename T>
+T computeMean(std::vector<T> const& results) {
+  return std::accumulate(results.begin(), results.end(), T{}) / results.size();
+}
+
+template <typename ViewType>
+class IncrementFunctor {
+ private:
+  using index_type = decltype(std::declval<ViewType>().size());
+  ViewType view_;
+
+ public:
+  IncrementFunctor() = delete;
+
+  explicit IncrementFunctor(ViewType view) : view_(view) {}
+
+  KOKKOS_INLINE_FUNCTION
+  void operator()(const index_type idx, uint64_t& clockTics) const {
+    uint64_t start = Kokkos::Impl::clock_tic();
+    ++view_(idx);
+    clockTics += Kokkos::Impl::clock_tic() - start;
+  }
+};
+
+// TIMING CAPTURED KERNEL
+// PREMISE: This kernel should always be memory bound, as we are measuring
+// memory access times. The compute load of an increment is small enough on
+// current hardware but this could be different for new hardware. As we count
+// the clocks in the kernel, the core frequency of the device has to be fast
+// enough to guarante that the kernel stays memory bound.
+template <typename ExecSpace, typename ViewType>
+std::vector<uint64_t> incrementInLoop(ViewType& view,
+                                      unsigned int numRepetitions) {
+  using index_type = decltype(view.size());
+  std::vector<uint64_t> results;
+
+  Kokkos::fence();
+  for (unsigned i = 0; i < numRepetitions; ++i) {
+    uint64_t sum_clockTics;
+    IncrementFunctor<ViewType> func(view);
+    Kokkos::parallel_reduce(
+        "increment",
+        Kokkos::RangePolicy<ExecSpace, Kokkos::IndexType<index_type>>{
+            0, view.size()},
+        func, sum_clockTics);
+    Kokkos::fence();
+    results.push_back(sum_clockTics / view.size());
+  }
+  return results;
+}
+
+TEST(defaultdevicetype, shared_space) {
+  ASSERT_TRUE(Kokkos::has_shared_space);
+
+  if constexpr (std::is_same_v<Kokkos::DefaultExecutionSpace,
+                               Kokkos::DefaultHostExecutionSpace>)
+    GTEST_SKIP() << "Skipping as host and device are the same space";
+
+#if defined(KOKKOS_ARCH_VEGA906) || defined(KOKKOS_ARCH_VEGA908) || \
+    defined(KOKKOS_ARCH_NAVI)
+  GTEST_SKIP()
+      << "skipping because specified arch does not support page migration";
+#endif
+#if defined(KOKKOS_ENABLE_SYCL) && !defined(KOKKOS_ARCH_INTEL_GPU)
+  GTEST_SKIP()
+      << "skipping because clock_tic is only defined for sycl+intel gpu";
+#endif
+
+  const unsigned int numRepetitions      = 10;
+  const unsigned int numDeviceHostCycles = 3;
+  double threshold                       = 1.5;
+  unsigned int numPages                  = 100;
+  size_t numBytes                        = numPages * getBytesPerPage();
+
+  using DeviceExecutionSpace = Kokkos::DefaultExecutionSpace;
+  using HostExecutionSpace   = Kokkos::DefaultHostExecutionSpace;
+
+  // ALLOCATION
+  Kokkos::View<int*, Kokkos::SharedSpace> sharedData("sharedData",
+                                                     numBytes / sizeof(int));
+  Kokkos::View<int*, DeviceExecutionSpace::memory_space> deviceData(
+      "deviceData", numBytes / sizeof(int));
+  Kokkos::View<int*, HostExecutionSpace::memory_space> hostData(
+      "hostData", numBytes / sizeof(int));
+  Kokkos::fence();
+
+  // GET DEFAULT EXECSPACE LOCAL TIMINGS
+  auto deviceLocalTimings =
+      incrementInLoop<DeviceExecutionSpace>(deviceData, numRepetitions);
+
+  // GET DEFAULT HOSTEXECSPACE LOCAL TIMINGS
+  auto hostLocalTimings =
+      incrementInLoop<HostExecutionSpace>(hostData, numRepetitions);
+
+  // GET PAGE MIGRATING TIMINGS DATA
+  std::vector<decltype(deviceLocalTimings)> deviceSharedTimings{};
+  std::vector<decltype(hostLocalTimings)> hostSharedTimings{};
+  for (unsigned i = 0; i < numDeviceHostCycles; ++i) {
+    // GET RESULTS DEVICE
+    deviceSharedTimings.push_back(
+        incrementInLoop<DeviceExecutionSpace>(sharedData, numRepetitions));
+
+    // GET RESULTS HOST
+    hostSharedTimings.push_back(
+        incrementInLoop<HostExecutionSpace>(sharedData, numRepetitions));
+  }
+
+  // COMPUTE STATISTICS OF HOST AND DEVICE LOCAL KERNELS
+  auto deviceLocalMean = computeMean(deviceLocalTimings);
+  auto hostLocalMean   = computeMean(hostLocalTimings);
+
+  // ASSESS RESULTS
+  bool fastAsLocalOnRepeatedAccess = true;
+
+  for (unsigned cycle = 0; cycle < numDeviceHostCycles; ++cycle) {
+    std::for_each(std::next(deviceSharedTimings[cycle].begin()),
+                  deviceSharedTimings[cycle].end(), [&](const uint64_t timing) {
+                    (timing < threshold * deviceLocalMean)
+                        ? fastAsLocalOnRepeatedAccess &= true
+                        : fastAsLocalOnRepeatedAccess &= false;
+                  });
+
+    std::for_each(std::next(hostSharedTimings[cycle].begin()),
+                  hostSharedTimings[cycle].end(), [&](const uint64_t timing) {
+                    (timing < threshold * hostLocalMean)
+                        ? fastAsLocalOnRepeatedAccess &= true
+                        : fastAsLocalOnRepeatedAccess &= false;
+                  });
+  }
+
+  // CHECK IF PASSED
+  bool passed = (fastAsLocalOnRepeatedAccess);
+
+  // PRINT IF NOT PASSED
+  if (!passed) {
+    std::cout << "Page size as reported by os: " << getBytesPerPage()
+              << " bytes \n";
+    std::cout << "Allocating " << numPages
+              << " pages of memory in SharedSpace.\n";
+
+    std::cout << "Behavior found: \n";
+    std::cout << "SharedSpace is as fast as local space on repeated access: "
+              << fastAsLocalOnRepeatedAccess << ", we expect true \n\n";
+
+    std::cout
+        << "Please look at the following timings. The first access in a "
+           "different ExecutionSpace is not evaluated for the test. As we "
+           "expect the memory to migrate during the first access it might have "
+           "a higher cycle count than subsequent accesses, depending on your "
+           "hardware. If the cycles are more than "
+        << threshold
+        << " times the cycles for pure local memory access, we assume a page "
+           "migration happened.\n\n";
+
+    std::cout << "################SHARED SPACE####################\n";
+    for (unsigned cycle = 0; cycle < numDeviceHostCycles; ++cycle) {
+      std::cout << "DeviceExecutionSpace timings of run " << cycle << ":\n";
+      printTimings(std::cout, deviceSharedTimings[cycle],
+                   threshold * deviceLocalMean);
+      std::cout << "HostExecutionSpace timings of run " << cycle << ":\n";
+      printTimings(std::cout, hostSharedTimings[cycle],
+                   threshold * hostLocalMean);
+    }
+    std::cout << "################LOCAL SPACE####################\n";
+    printTimings(std::cout, deviceLocalTimings);
+    printTimings(std::cout, hostLocalTimings);
+  }
+  ASSERT_TRUE(passed);
+}
+}  // namespace
diff --git a/packages/kokkos/core/unit_test/TestStackTrace.cpp b/packages/kokkos/core/unit_test/TestStackTrace.cpp
index 76ab7e3ebe56292125214b07fb09ea20a4abd0c4..fe06ae58d0a4a54fd813bab8cad60f22ec23e923 100644
--- a/packages/kokkos/core/unit_test/TestStackTrace.cpp
+++ b/packages/kokkos/core/unit_test/TestStackTrace.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <iostream>
 #include "Kokkos_Core.hpp"
diff --git a/packages/kokkos/core/unit_test/TestStackTrace.hpp b/packages/kokkos/core/unit_test/TestStackTrace.hpp
index d34d0f92e959277e7f6a66c0718ce381cd794e61..f5a0b95a02d33082a38846d3eb684c739593da8b 100644
--- a/packages/kokkos/core/unit_test/TestStackTrace.hpp
+++ b/packages/kokkos/core/unit_test/TestStackTrace.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 #include <iostream>
 #include <gtest/gtest.h>
 #include "Kokkos_Core.hpp"
diff --git a/packages/kokkos/core/unit_test/TestStackTrace_f0.cpp b/packages/kokkos/core/unit_test/TestStackTrace_f0.cpp
index 1514600f7d1f300cfaa076790e3f3e4dbfe52e0d..123713d5ec5dee9a68872843f2f8b34a55e2048c 100644
--- a/packages/kokkos/core/unit_test/TestStackTrace_f0.cpp
+++ b/packages/kokkos/core/unit_test/TestStackTrace_f0.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <iostream>
 #include "Kokkos_Core.hpp"
diff --git a/packages/kokkos/core/unit_test/TestStackTrace_f1.cpp b/packages/kokkos/core/unit_test/TestStackTrace_f1.cpp
index b10c574c9bd0d7f8a82ff2fa3ead8b5204cf179f..158a7adef4f0179694585f62da7c4c90e99c8430 100644
--- a/packages/kokkos/core/unit_test/TestStackTrace_f1.cpp
+++ b/packages/kokkos/core/unit_test/TestStackTrace_f1.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <iostream>
 #include "Kokkos_Core.hpp"
diff --git a/packages/kokkos/core/unit_test/TestStackTrace_f2.cpp b/packages/kokkos/core/unit_test/TestStackTrace_f2.cpp
index 23c1895e6946b2ef45caf7ed8d5a30e808089290..6cc4af411bcc9137448f6d1d58367873f017d10c 100644
--- a/packages/kokkos/core/unit_test/TestStackTrace_f2.cpp
+++ b/packages/kokkos/core/unit_test/TestStackTrace_f2.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <iostream>
 #include "Kokkos_Core.hpp"
diff --git a/packages/kokkos/core/unit_test/TestStackTrace_f3.cpp b/packages/kokkos/core/unit_test/TestStackTrace_f3.cpp
index ac004243f11e52c21d15bd04a6f246148e2962d2..830556324ffe06ae3b9d73f4490a3679bfc09351 100644
--- a/packages/kokkos/core/unit_test/TestStackTrace_f3.cpp
+++ b/packages/kokkos/core/unit_test/TestStackTrace_f3.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <iostream>
 #include "Kokkos_Core.hpp"
diff --git a/packages/kokkos/core/unit_test/TestStackTrace_f4.cpp b/packages/kokkos/core/unit_test/TestStackTrace_f4.cpp
index afae98a2a8fe70f1d0d9fa49709646bb70b9ce18..d5e1f38e78bbef52098cef7a0456816963e2a322 100644
--- a/packages/kokkos/core/unit_test/TestStackTrace_f4.cpp
+++ b/packages/kokkos/core/unit_test/TestStackTrace_f4.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <iostream>
 #include "Kokkos_Core.hpp"
diff --git a/packages/kokkos/core/unit_test/TestStringManipulation.cpp b/packages/kokkos/core/unit_test/TestStringManipulation.cpp
index 92b2afa475f1a5274cd3bbf80e4834542f7c7dd7..4b929edb940557f5a2369a0b09a8c2c95b95fb7f 100644
--- a/packages/kokkos/core/unit_test/TestStringManipulation.cpp
+++ b/packages/kokkos/core/unit_test/TestStringManipulation.cpp
@@ -1,63 +1,33 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <impl/Kokkos_StringManipulation.hpp>
 #include <climits>
 
 namespace {
 
-#define STATIC_ASSERT(cond) static_assert(cond, "")
-
 KOKKOS_FUNCTION constexpr bool test_strlen() {
   using Kokkos::Impl::strlen;
   constexpr char str[] = "How many characters does this string contain?";
-  STATIC_ASSERT(strlen(str) == 45);  // without null character
-  STATIC_ASSERT(sizeof str == 46);   // with null character
-  STATIC_ASSERT(strlen("") == 0);
+  static_assert(strlen(str) == 45);  // without null character
+  static_assert(sizeof str == 46);   // with null character
+  static_assert(strlen("") == 0);
   return true;
 }
-STATIC_ASSERT(test_strlen());
+static_assert(test_strlen());
 
 KOKKOS_FUNCTION constexpr bool test_strcmp() {
   using Kokkos::Impl::strcmp;
@@ -65,44 +35,38 @@ KOKKOS_FUNCTION constexpr bool test_strcmp() {
   constexpr char cat2[] = "Snagglepuss";
   constexpr char cat3[] = "Hobbes";
   constexpr char cat4[] = "Garfield";
-  STATIC_ASSERT(strcmp(cat1, cat1) == 0);
+  static_assert(strcmp(cat1, cat1) == 0);
 #if (!defined(KOKKOS_COMPILER_NVCC) ||                                 \
      ((__CUDACC_VER_MAJOR__ >= 11) && (__CUDACC_VER_MINOR__ >= 3))) && \
     (!defined(__INTEL_COMPILER_BUILD_DATE) ||                          \
      (__INTEL_COMPILER_BUILD_DATE >= 20210228))
-  STATIC_ASSERT(strcmp(cat1, cat2) < 0);
-  STATIC_ASSERT(strcmp(cat1, cat3) < 0);
+  static_assert(strcmp(cat1, cat2) < 0);
+  static_assert(strcmp(cat1, cat3) < 0);
 #endif
-  STATIC_ASSERT(strcmp(cat1, cat4) > 0);
-  STATIC_ASSERT(strcmp(cat2, cat2) == 0);
-  STATIC_ASSERT(strcmp(cat2, cat3) > 0);
-  STATIC_ASSERT(strcmp(cat2, cat4) > 0);
-  STATIC_ASSERT(strcmp(cat3, cat3) == 0);
-  STATIC_ASSERT(strcmp(cat3, cat4) > 0);
-  STATIC_ASSERT(strcmp(cat4, cat4) == 0);
+  static_assert(strcmp(cat1, cat4) > 0);
+  static_assert(strcmp(cat2, cat2) == 0);
+  static_assert(strcmp(cat2, cat3) > 0);
+  static_assert(strcmp(cat2, cat4) > 0);
+  static_assert(strcmp(cat3, cat3) == 0);
+  static_assert(strcmp(cat3, cat4) > 0);
+  static_assert(strcmp(cat4, cat4) == 0);
   return true;
 }
-STATIC_ASSERT(test_strcmp());
+static_assert(test_strcmp());
 
 KOKKOS_FUNCTION constexpr bool test_strncmp() {
   using Kokkos::Impl::strncmp;
   constexpr char greet1[] = "Hello, world!";
   constexpr char greet2[] = "Hello, everybody!";
   constexpr char greet3[] = "Hello, somebody!";
-  STATIC_ASSERT(strncmp(greet1, greet2, 13) > 0);
-  STATIC_ASSERT(strncmp(greet2, greet1, 13) < 0);
-  STATIC_ASSERT(strncmp(greet2, greet1, 7) == 0);
-#if defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU < 610)
-  (void)greet3;
-#elif defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU < 710)
-  STATIC_ASSERT(strncmp(&greet2[12], &greet3[11], 5) == 0);
-#else
-  STATIC_ASSERT(strncmp(greet2 + 12, greet3 + 11, 5) == 0);
-#endif
-  STATIC_ASSERT(strncmp(greet1, greet2, 0) == 0);
+  static_assert(strncmp(greet1, greet2, 13) > 0);
+  static_assert(strncmp(greet2, greet1, 13) < 0);
+  static_assert(strncmp(greet2, greet1, 7) == 0);
+  static_assert(strncmp(greet2 + 12, greet3 + 11, 5) == 0);
+  static_assert(strncmp(greet1, greet2, 0) == 0);
   return true;
 }
-STATIC_ASSERT(test_strncmp());
+static_assert(test_strncmp());
 
 KOKKOS_FUNCTION constexpr bool strcpy_helper(const char* dest, const char* src,
                                              const char* ref) {
@@ -115,10 +79,10 @@ KOKKOS_FUNCTION constexpr bool strcpy_helper(const char* dest, const char* src,
 }
 
 KOKKOS_FUNCTION constexpr bool test_strcpy() {
-  STATIC_ASSERT(strcpy_helper("abcdef", "hi", "hi\0\0\0f"));
+  static_assert(strcpy_helper("abcdef", "hi", "hi\0\0\0f"));
   return true;
 }
-STATIC_ASSERT(test_strcpy());
+static_assert(test_strcpy());
 
 KOKKOS_FUNCTION constexpr bool strncpy_helper(const char* dest, const char* src,
                                               std::size_t count,
@@ -133,11 +97,11 @@ KOKKOS_FUNCTION constexpr bool strncpy_helper(const char* dest, const char* src,
 }
 
 KOKKOS_FUNCTION constexpr bool test_strncpy() {
-  STATIC_ASSERT(strncpy_helper("abcdef", "hi", 5, "hi\0\0\0f"));
-  STATIC_ASSERT(strncpy_helper("abcdef", "hi", 0, "abcdef"));
+  static_assert(strncpy_helper("abcdef", "hi", 5, "hi\0\0\0f"));
+  static_assert(strncpy_helper("abcdef", "hi", 0, "abcdef"));
   return true;
 }
-STATIC_ASSERT(test_strncpy());
+static_assert(test_strncpy());
 
 KOKKOS_FUNCTION constexpr bool strcat_helper(const char* dest, const char* src,
                                              const char* ref) {
@@ -150,12 +114,12 @@ KOKKOS_FUNCTION constexpr bool strcat_helper(const char* dest, const char* src,
 }
 
 KOKKOS_FUNCTION constexpr bool test_strcat() {
-  STATIC_ASSERT(strcat_helper("Hello ", "World!", "Hello World!"));
-  STATIC_ASSERT(strcat_helper("Hello World!", " Goodbye World!",
+  static_assert(strcat_helper("Hello ", "World!", "Hello World!"));
+  static_assert(strcat_helper("Hello World!", " Goodbye World!",
                               "Hello World! Goodbye World!"));
   return true;
 }
-STATIC_ASSERT(test_strcat());
+static_assert(test_strcat());
 
 KOKKOS_FUNCTION constexpr bool strncat_helper(const char* dest, const char* src,
                                               std::size_t count,
@@ -170,15 +134,14 @@ KOKKOS_FUNCTION constexpr bool strncat_helper(const char* dest, const char* src,
 }
 
 KOKKOS_FUNCTION constexpr bool test_strncat() {
-  STATIC_ASSERT(
+  static_assert(
       strncat_helper("Hello World!", " Goodbye World!", 3, "Hello World! Go"));
-  STATIC_ASSERT(
+  static_assert(
       strncat_helper("Hello World!", " Goodbye World!", 0, "Hello World!"));
   return true;
 }
-STATIC_ASSERT(test_strncat());
+static_assert(test_strncat());
 
-#if !defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU >= 540)
 template <class Integral>
 KOKKOS_FUNCTION constexpr bool to_chars_helper(Integral val, char const* ref) {
   using Kokkos::Impl::strcmp;
@@ -192,26 +155,25 @@ KOKKOS_FUNCTION constexpr bool to_chars_helper(Integral val, char const* ref) {
 }
 
 KOKKOS_FUNCTION constexpr bool test_to_chars() {
-  STATIC_ASSERT(to_chars_helper(0, "0"));
-  STATIC_ASSERT(to_chars_helper(123, "123"));
-  STATIC_ASSERT(to_chars_helper(-456, "-456"));
-  STATIC_ASSERT(to_chars_helper(INT_MAX, "2147483647"));
-  STATIC_ASSERT(to_chars_helper(INT_MIN, "-2147483648"));
+  static_assert(to_chars_helper(0, "0"));
+  static_assert(to_chars_helper(123, "123"));
+  static_assert(to_chars_helper(-456, "-456"));
+  static_assert(to_chars_helper(INT_MAX, "2147483647"));
+  static_assert(to_chars_helper(INT_MIN, "-2147483648"));
 
-  STATIC_ASSERT(to_chars_helper(0u, "0"));
-  STATIC_ASSERT(to_chars_helper(78u, "78"));
-  STATIC_ASSERT(to_chars_helper(UINT_MAX, "4294967295"));
+  static_assert(to_chars_helper(0u, "0"));
+  static_assert(to_chars_helper(78u, "78"));
+  static_assert(to_chars_helper(UINT_MAX, "4294967295"));
 
-  STATIC_ASSERT(to_chars_helper(0ll, "0"));
-  STATIC_ASSERT(to_chars_helper(LLONG_MAX, "9223372036854775807"));
-  STATIC_ASSERT(to_chars_helper(LLONG_MIN, "-9223372036854775808"));
+  static_assert(to_chars_helper(0ll, "0"));
+  static_assert(to_chars_helper(LLONG_MAX, "9223372036854775807"));
+  static_assert(to_chars_helper(LLONG_MIN, "-9223372036854775808"));
 
-  STATIC_ASSERT(to_chars_helper(0ull, "0"));
-  STATIC_ASSERT(to_chars_helper(ULLONG_MAX, "18446744073709551615"));
+  static_assert(to_chars_helper(0ull, "0"));
+  static_assert(to_chars_helper(ULLONG_MAX, "18446744073709551615"));
 
   return true;
 }
-STATIC_ASSERT(test_to_chars());
-#endif
+static_assert(test_to_chars());
 
 }  // namespace
diff --git a/packages/kokkos/core/unit_test/TestSubView_a.hpp b/packages/kokkos/core/unit_test/TestSubView_a.hpp
index ecfc96f82497d2e487b506da40d4b23cbd2f8978..6ce680200c963d4c22827d9865ceedfee2811e18 100644
--- a/packages/kokkos/core/unit_test/TestSubView_a.hpp
+++ b/packages/kokkos/core/unit_test/TestSubView_a.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SUBVIEW_A_HPP
 #define KOKKOS_TEST_SUBVIEW_A_HPP
diff --git a/packages/kokkos/core/unit_test/TestSubView_b.hpp b/packages/kokkos/core/unit_test/TestSubView_b.hpp
index d83b7c832766660ff2fdba44b9a9b4a8a8fcdc1b..814faed010aaf2d8477ce8de297bf4f771d65e66 100644
--- a/packages/kokkos/core/unit_test/TestSubView_b.hpp
+++ b/packages/kokkos/core/unit_test/TestSubView_b.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SUBVIEW_B_HPP
 #define KOKKOS_TEST_SUBVIEW_B_HPP
diff --git a/packages/kokkos/core/unit_test/TestSubView_c01.hpp b/packages/kokkos/core/unit_test/TestSubView_c01.hpp
index 03e19768d2331a784b5cf62cb86cd12da3cfd47a..7f9588fdb4ffa1f58d1d9d675efc0b3ee7a167b1 100644
--- a/packages/kokkos/core/unit_test/TestSubView_c01.hpp
+++ b/packages/kokkos/core/unit_test/TestSubView_c01.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SUBVIEW_C01_HPP
 #define KOKKOS_TEST_SUBVIEW_C01_HPP
diff --git a/packages/kokkos/core/unit_test/TestSubView_c02.hpp b/packages/kokkos/core/unit_test/TestSubView_c02.hpp
index 9fba8dbfd81101b439ac0ccd66747d0b1f12653e..5587a53b640d54556d4819ec01aaa3f96277ea1f 100644
--- a/packages/kokkos/core/unit_test/TestSubView_c02.hpp
+++ b/packages/kokkos/core/unit_test/TestSubView_c02.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SUBVIEW_C02_HPP
 #define KOKKOS_TEST_SUBVIEW_C02_HPP
diff --git a/packages/kokkos/core/unit_test/TestSubView_c03.hpp b/packages/kokkos/core/unit_test/TestSubView_c03.hpp
index 04391b8920b85b8947e7b013c1b9d7d68a793dc7..53452960a20df037913ef6cd660a2acdf85455ad 100644
--- a/packages/kokkos/core/unit_test/TestSubView_c03.hpp
+++ b/packages/kokkos/core/unit_test/TestSubView_c03.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SUBVIEW_C03_HPP
 #define KOKKOS_TEST_SUBVIEW_C03_HPP
diff --git a/packages/kokkos/core/unit_test/TestSubView_c04.hpp b/packages/kokkos/core/unit_test/TestSubView_c04.hpp
index 64d5d4b406db3acb156aa10faad3ed9aa59ba056..c2c1669e82b1477b19b723959b87a418982070cf 100644
--- a/packages/kokkos/core/unit_test/TestSubView_c04.hpp
+++ b/packages/kokkos/core/unit_test/TestSubView_c04.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SUBVIEW_C04_HPP
 #define KOKKOS_TEST_SUBVIEW_C04_HPP
diff --git a/packages/kokkos/core/unit_test/TestSubView_c05.hpp b/packages/kokkos/core/unit_test/TestSubView_c05.hpp
index ffc07800d13aebcae50fbc3d323fbfdc2eedd6f8..c861ab18f352e03ee7a18675eb7cc5186be0f193 100644
--- a/packages/kokkos/core/unit_test/TestSubView_c05.hpp
+++ b/packages/kokkos/core/unit_test/TestSubView_c05.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SUBVIEW_C05_HPP
 #define KOKKOS_TEST_SUBVIEW_C05_HPP
diff --git a/packages/kokkos/core/unit_test/TestSubView_c06.hpp b/packages/kokkos/core/unit_test/TestSubView_c06.hpp
index f7f066f102f550b47a2b2ffbf885b5947094b896..50693663ac375ef1ba37879c2b0af143a3b7bdf9 100644
--- a/packages/kokkos/core/unit_test/TestSubView_c06.hpp
+++ b/packages/kokkos/core/unit_test/TestSubView_c06.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SUBVIEW_C06_HPP
 #define KOKKOS_TEST_SUBVIEW_C06_HPP
diff --git a/packages/kokkos/core/unit_test/TestSubView_c07.hpp b/packages/kokkos/core/unit_test/TestSubView_c07.hpp
index 87b5022826e5b05c6fbfd9ed03c9a0ee202fcb41..2dd02e552e237c81b76850f57b62e04774ab33a3 100644
--- a/packages/kokkos/core/unit_test/TestSubView_c07.hpp
+++ b/packages/kokkos/core/unit_test/TestSubView_c07.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SUBVIEW_C07_HPP
 #define KOKKOS_TEST_SUBVIEW_C07_HPP
diff --git a/packages/kokkos/core/unit_test/TestSubView_c08.hpp b/packages/kokkos/core/unit_test/TestSubView_c08.hpp
index d18d4c1b7d0778a58ce2a795bfa47c598d2829d4..1d360669bfb34e3ee8183b97ab6ff77b02806f90 100644
--- a/packages/kokkos/core/unit_test/TestSubView_c08.hpp
+++ b/packages/kokkos/core/unit_test/TestSubView_c08.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SUBVIEW_C08_HPP
 #define KOKKOS_TEST_SUBVIEW_C08_HPP
diff --git a/packages/kokkos/core/unit_test/TestSubView_c09.hpp b/packages/kokkos/core/unit_test/TestSubView_c09.hpp
index 8f7ece4d298691541f2bc232597309dd72942667..fc18786f10aad16b6ba6f181965e03841c1a5513 100644
--- a/packages/kokkos/core/unit_test/TestSubView_c09.hpp
+++ b/packages/kokkos/core/unit_test/TestSubView_c09.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SUBVIEW_C09_HPP
 #define KOKKOS_TEST_SUBVIEW_C09_HPP
diff --git a/packages/kokkos/core/unit_test/TestSubView_c10.hpp b/packages/kokkos/core/unit_test/TestSubView_c10.hpp
index 0a0358b56f959aeb6bd45a595ede5a981f6644bb..036d41e0a79f9066055dd3cd8206b6b4519a5a3b 100644
--- a/packages/kokkos/core/unit_test/TestSubView_c10.hpp
+++ b/packages/kokkos/core/unit_test/TestSubView_c10.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SUBVIEW_C10_HPP
 #define KOKKOS_TEST_SUBVIEW_C10_HPP
diff --git a/packages/kokkos/core/unit_test/TestSubView_c11.hpp b/packages/kokkos/core/unit_test/TestSubView_c11.hpp
index bb0b34a646daf69dfdca5edee6cb3cc773dd68f2..592b384dec70a50bb9a5a63ec40bc34e2bcd645d 100644
--- a/packages/kokkos/core/unit_test/TestSubView_c11.hpp
+++ b/packages/kokkos/core/unit_test/TestSubView_c11.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SUBVIEW_C11_HPP
 #define KOKKOS_TEST_SUBVIEW_C11_HPP
diff --git a/packages/kokkos/core/unit_test/TestSubView_c12.hpp b/packages/kokkos/core/unit_test/TestSubView_c12.hpp
index b3af606771caf81c820126677de68067128e296d..be469114dba3535885500b9043a14dc59ab2a01b 100644
--- a/packages/kokkos/core/unit_test/TestSubView_c12.hpp
+++ b/packages/kokkos/core/unit_test/TestSubView_c12.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SUBVIEW_C12_HPP
 #define KOKKOS_TEST_SUBVIEW_C12_HPP
diff --git a/packages/kokkos/core/unit_test/TestSubView_c13.hpp b/packages/kokkos/core/unit_test/TestSubView_c13.hpp
index 05c4767368c5b9813a140f76cd20b2044273c3a8..c3efe87a4d10dde7f66aa5e687bb5ae599f964ae 100644
--- a/packages/kokkos/core/unit_test/TestSubView_c13.hpp
+++ b/packages/kokkos/core/unit_test/TestSubView_c13.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SUBVIEW_C13_HPP
 #define KOKKOS_TEST_SUBVIEW_C13_HPP
diff --git a/packages/kokkos/core/unit_test/TestSubView_c14.hpp b/packages/kokkos/core/unit_test/TestSubView_c14.hpp
index e6510c83a603481a9b8de0367894ec98407faba3..6055fc5050aa0f368d6c594c431200aa0b181dea 100644
--- a/packages/kokkos/core/unit_test/TestSubView_c14.hpp
+++ b/packages/kokkos/core/unit_test/TestSubView_c14.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SUBVIEW_C14_HPP
 #define KOKKOS_TEST_SUBVIEW_C14_HPP
diff --git a/packages/kokkos/core/unit_test/TestTaskScheduler.hpp b/packages/kokkos/core/unit_test/TestTaskScheduler.hpp
index 62fd68b6cb70c3c387fee6d1f8175ef212cfdb79..5a0394f6c180ea6b3176bf6e6fa15ca66b768b30 100644
--- a/packages/kokkos/core/unit_test/TestTaskScheduler.hpp
+++ b/packages/kokkos/core/unit_test/TestTaskScheduler.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_UNITTEST_TASKSCHEDULER_HPP
 #define KOKKOS_UNITTEST_TASKSCHEDULER_HPP
diff --git a/packages/kokkos/core/unit_test/TestTaskScheduler_single.hpp b/packages/kokkos/core/unit_test/TestTaskScheduler_single.hpp
index c5d05382f8f26cd6c55d02a53ae4f3c16c45bf50..14b442ee8fc1ac82878ecf7f2e4bc5c1bd87e0fa 100644
--- a/packages/kokkos/core/unit_test/TestTaskScheduler_single.hpp
+++ b/packages/kokkos/core/unit_test/TestTaskScheduler_single.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 namespace Test {
 
diff --git a/packages/kokkos/core/unit_test/TestTeam.hpp b/packages/kokkos/core/unit_test/TestTeam.hpp
index 3f05b2ef66a04783a94f854259253cb984411819..0f86f9f3697b77187f173fb5b5564b2ab2d0ab49 100644
--- a/packages/kokkos/core/unit_test/TestTeam.hpp
+++ b/packages/kokkos/core/unit_test/TestTeam.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <cstdio>
 #include <sstream>
@@ -655,8 +627,9 @@ struct TestLambdaSharedTeam {
 
     Kokkos::TeamPolicy<ScheduleType, ExecSpace> team_exec(8192 / team_size,
                                                           team_size);
-    team_exec = team_exec.set_scratch_size(
-        0, Kokkos::PerTeam(SHARED_COUNT * 2 * sizeof(int)));
+
+    int scratch_size = shared_int_array_type::shmem_size(SHARED_COUNT) * 2;
+    team_exec = team_exec.set_scratch_size(0, Kokkos::PerTeam(scratch_size));
 
     typename Functor::value_type error_count = 0;
 
@@ -1025,8 +998,8 @@ struct ClassNoShmemSizeFunction {
 #else
     int team_size      = 8;
 #endif
-    if (team_size > ExecSpace::concurrency())
-      team_size = ExecSpace::concurrency();
+    int const concurrency = ExecSpace().concurrency();
+    if (team_size > concurrency) team_size = concurrency;
     {
       Kokkos::TeamPolicy<TagFor, ExecSpace, ScheduleType> policy(10, team_size,
                                                                  16);
@@ -1098,8 +1071,9 @@ struct ClassWithShmemSizeFunction {
                      Kokkos::MemoryTraits<Kokkos::Unmanaged>>::shmem_size(1600);
 
     int team_size = 8;
-    if (team_size > ExecSpace::concurrency())
-      team_size = ExecSpace::concurrency();
+
+    int const concurrency = ExecSpace().concurrency();
+    if (team_size > concurrency) team_size = concurrency;
 
     {
       Kokkos::TeamPolicy<TagFor, ExecSpace, ScheduleType> policy(10, team_size,
@@ -1173,8 +1147,8 @@ void test_team_mulit_level_scratch_test_lambda() {
 #else
   int team_size = 8;
 #endif
-  if (team_size > ExecSpace::concurrency())
-    team_size = ExecSpace::concurrency();
+  int const concurrency = ExecSpace().concurrency();
+  if (team_size > concurrency) team_size = concurrency;
 
   Kokkos::TeamPolicy<ExecSpace, ScheduleType> policy(10, team_size, 16);
 
@@ -1551,15 +1525,18 @@ struct TestScratchAlignment {
     double x, y, z;
   };
   TestScratchAlignment() {
-    test(true);
-    test(false);
+    test_view(true);
+    test_view(false);
+    test_minimal();
+    test_raw();
   }
   using ScratchView =
       Kokkos::View<TestScalar *, typename ExecSpace::scratch_memory_space>;
   using ScratchViewInt =
       Kokkos::View<int *, typename ExecSpace::scratch_memory_space>;
-  void test(bool allocate_small) {
+  void test_view(bool allocate_small) {
     int shmem_size = ScratchView::shmem_size(11);
+    // FIXME_OPENMPTARGET temporary restriction for team size to be at least 32
 #ifdef KOKKOS_ENABLE_OPENMPTARGET
     int team_size =
         std::is_same<ExecSpace, Kokkos::Experimental::OpenMPTarget>::value ? 32
@@ -1580,12 +1557,106 @@ struct TestScratchAlignment {
         });
     Kokkos::fence();
   }
+
+  // test really small size of scratch space, produced error before
+  void test_minimal() {
+    using member_type = typename Kokkos::TeamPolicy<ExecSpace>::member_type;
+    // FIXME_OPENMPTARGET temporary restriction for team size to be at least 32
+#ifdef KOKKOS_ENABLE_OPENMPTARGET
+    int team_size =
+        std::is_same<ExecSpace, Kokkos::Experimental::OpenMPTarget>::value ? 32
+                                                                           : 1;
+#else
+    int team_size      = 1;
+#endif
+    Kokkos::TeamPolicy<ExecSpace> policy(1, team_size);
+    size_t scratch_size = sizeof(int);
+    Kokkos::View<int, ExecSpace> flag("Flag");
+
+    Kokkos::parallel_for(
+        policy.set_scratch_size(0, Kokkos::PerTeam(scratch_size)),
+        KOKKOS_LAMBDA(const member_type &team) {
+          int *scratch_ptr = (int *)team.team_shmem().get_shmem(scratch_size);
+          if (scratch_ptr == nullptr) flag() = 1;
+        });
+    Kokkos::fence();
+    int minimal_scratch_allocation_failed = 0;
+    Kokkos::deep_copy(minimal_scratch_allocation_failed, flag);
+    ASSERT_TRUE(minimal_scratch_allocation_failed == 0);
+  }
+
+  // test alignment of successive allocations
+  void test_raw() {
+    using member_type = typename Kokkos::TeamPolicy<ExecSpace>::member_type;
+#ifdef KOKKOS_ENABLE_OPENMPTARGET
+    int team_size =
+        std::is_same<ExecSpace, Kokkos::Experimental::OpenMPTarget>::value ? 32
+                                                                           : 1;
+#else
+    int team_size      = 1;
+#endif
+    Kokkos::TeamPolicy<ExecSpace> policy(1, team_size);
+    Kokkos::View<int, ExecSpace> flag("Flag");
+
+    Kokkos::parallel_for(
+        policy.set_scratch_size(0, Kokkos::PerTeam(1024)),
+        KOKKOS_LAMBDA(const member_type &team) {
+          // first get some unaligned allocations, should give back
+          // exactly the requested number of bytes
+          auto scratch_ptr1 =
+              reinterpret_cast<intptr_t>(team.team_shmem().get_shmem(24));
+          auto scratch_ptr2 =
+              reinterpret_cast<intptr_t>(team.team_shmem().get_shmem(32));
+          auto scratch_ptr3 =
+              reinterpret_cast<intptr_t>(team.team_shmem().get_shmem(12));
+
+          if (((scratch_ptr2 - scratch_ptr1) != 24) ||
+              ((scratch_ptr3 - scratch_ptr2) != 32))
+            flag() = 1;
+
+          // Now request aligned memory such that the allocation after
+          // for scratch_ptr2 would be unaligned if it doesn't pad
+          // correct.
+          // Depending on whether scratch_ptr3 is 4 or 8 byte aligned
+          // we need to request different amount of memory.
+          if ((scratch_ptr3 + 12) % 8 == 4)
+            scratch_ptr1 = reinterpret_cast<intptr_t>(
+                team.team_shmem().get_shmem_aligned(24, 4));
+          else {
+            scratch_ptr1 = reinterpret_cast<intptr_t>(
+                team.team_shmem().get_shmem_aligned(12, 4));
+          }
+          scratch_ptr2 = reinterpret_cast<intptr_t>(
+              team.team_shmem().get_shmem_aligned(32, 8));
+          scratch_ptr3 = reinterpret_cast<intptr_t>(
+              team.team_shmem().get_shmem_aligned(8, 4));
+
+          // note the difference between scratch_ptr2 and scratch_ptr1
+          // is 4 bytes larger than what we requested in either of the
+          // two cases.
+          if (((scratch_ptr2 - scratch_ptr1) != 28) &&
+              ((scratch_ptr2 - scratch_ptr1) != 16))
+            flag() = 1;
+          // check that there wasn't unnneccessary padding happening
+          // i.e. scratch_ptr2 was allocated with a 32 byte request
+          // and since scratch_ptr3 is then already aligned it difference
+          // should match that
+          if ((scratch_ptr3 - scratch_ptr2) != 32) flag() = 1;
+          // check actually alignment of ptrs is as requested
+          if (((scratch_ptr1 % 4) != 0) || ((scratch_ptr2 % 8) != 0) ||
+              ((scratch_ptr3 % 4) != 0))
+            flag() = 1;
+        });
+    Kokkos::fence();
+    int raw_get_shmem_alignment_failed = 0;
+    Kokkos::deep_copy(raw_get_shmem_alignment_failed, flag);
+    ASSERT_TRUE(raw_get_shmem_alignment_failed == 0);
+  }
 };
 
 }  // namespace
 
 namespace {
-
 template <class ExecSpace>
 struct TestTeamPolicyHandleByValue {
   using scalar     = double;
@@ -1626,7 +1697,7 @@ struct TestRepeatedTeamReduce {
       const {
     // non-divisible by power of two to make triggering problems easier
     constexpr int nlev = 129;
-    constexpr auto pi  = Kokkos::Experimental::pi_v<double>;
+    constexpr auto pi  = Kokkos::numbers::pi;
     double b           = 0.;
     for (int ri = 0; ri < 10; ++ri) {
       // The contributions here must be sufficiently complex, simply adding ones
diff --git a/packages/kokkos/core/unit_test/TestTeamBasic.hpp b/packages/kokkos/core/unit_test/TestTeamBasic.hpp
index be1848d70daa138bd38209dfe05c0b67a59a8d4e..5ee8629656fc06c17e95d3ab4936285bc15f4ba2 100644
--- a/packages/kokkos/core/unit_test/TestTeamBasic.hpp
+++ b/packages/kokkos/core/unit_test/TestTeamBasic.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_TEAM_BASIC_HPP
 #define KOKKOS_TEST_TEAM_BASIC_HPP
@@ -114,6 +86,84 @@ TEST(TEST_CATEGORY, team_reduce_large) {
   }
 }
 
+/*! \brief Test passing an aggregate to Kokkos::single in a parallel_for with
+           team policy
+*/
+template <typename ExecutionSpace>
+struct TestTeamForAggregate {
+  using range_policy_t = Kokkos::RangePolicy<ExecutionSpace>;
+  using team_policy_t  = Kokkos::TeamPolicy<ExecutionSpace>;
+  using member_t       = typename team_policy_t::member_type;
+  using memory_space   = typename ExecutionSpace::memory_space;
+  using results_type   = Kokkos::View<double*, memory_space>;
+
+  static constexpr double INIT_VALUE   = -1.0;
+  static constexpr double EXPECT_VALUE = 1.0;
+
+  struct Agg {
+    double d;
+  };
+  results_type results_;
+
+  TestTeamForAggregate(const size_t size) : results_("results", size) {}
+  TestTeamForAggregate() : TestTeamForAggregate(0) {}
+
+  KOKKOS_INLINE_FUNCTION
+  void operator()(const member_t& t) const {
+    Agg lagg;
+    lagg.d = INIT_VALUE;
+    Kokkos::single(
+        Kokkos::PerTeam(t), [&](Agg& myAgg) { myAgg.d = EXPECT_VALUE; }, lagg);
+    size_t i = t.league_rank() * t.team_size() + t.team_rank();
+    if (i < results_.size()) {
+      results_(i) = lagg.d;
+    }
+  }
+
+  KOKKOS_INLINE_FUNCTION
+  void operator()(const int i, int& lNumErrs) const {
+    if (EXPECT_VALUE != results_(i)) {
+      ++lNumErrs;
+    }
+  }
+
+  static void run() {
+    int minTeamSize = 1;
+    /* OpenMPTarget hard-codes 32 as the minimum size
+       FIXME OPENMPTARGET
+    */
+#ifdef KOKKOS_ENABLE_OPENMPTARGET
+    if constexpr (std::is_same<ExecutionSpace,
+                               Kokkos::Experimental::OpenMPTarget>::value) {
+      minTeamSize = 32;
+    }
+#endif
+
+    int maxTeamSize;
+    {
+      TestTeamForAggregate test;
+      maxTeamSize = team_policy_t(1, minTeamSize)
+                        .team_size_max(test, Kokkos::ParallelForTag());
+    }
+
+    for (int teamSize = minTeamSize; teamSize <= maxTeamSize; teamSize *= 2) {
+      for (int problemSize : {1, 100, 10'000, 1'000'000}) {
+        const int leagueSize = (problemSize + teamSize - 1) / teamSize;
+        TestTeamForAggregate test(problemSize);
+        Kokkos::parallel_for(team_policy_t(leagueSize, teamSize), test);
+        int numErrs = 0;
+        Kokkos::parallel_reduce(range_policy_t(0, problemSize), test, numErrs);
+        EXPECT_EQ(numErrs, 0)
+            << " teamSize=" << teamSize << " problemSize=" << problemSize;
+      }
+    }
+  }
+};
+
+TEST(TEST_CATEGORY, team_parallel_single) {
+  TestTeamForAggregate<TEST_EXECSPACE>::run();
+}
+
 template <typename ExecutionSpace>
 struct LargeTeamScratchFunctor {
   using team_member = typename Kokkos::TeamPolicy<ExecutionSpace>::member_type;
@@ -294,7 +344,7 @@ TEST(TEST_CATEGORY, team_broadcast_float) {
 #endif
     // FIXME_HIP
 #ifdef KOKKOS_ENABLE_HIP
-      if (!std::is_same<TEST_EXECSPACE, Kokkos::Experimental::HIP>::value)
+      if (!std::is_same<TEST_EXECSPACE, Kokkos::HIP>::value)
 #endif
       {
         TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>,
@@ -328,7 +378,7 @@ TEST(TEST_CATEGORY, team_broadcast_double) {
 #endif
     // FIXME_HIP
 #ifdef KOKKOS_ENABLE_HIP
-      if (!std::is_same<TEST_EXECSPACE, Kokkos::Experimental::HIP>::value)
+      if (!std::is_same<TEST_EXECSPACE, Kokkos::HIP>::value)
 #endif
       {
         TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>,
diff --git a/packages/kokkos/core/unit_test/TestTeamMDRange.hpp b/packages/kokkos/core/unit_test/TestTeamMDRange.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..8ac7e8338c749a62913ed87cd7682c35ebcccdc2
--- /dev/null
+++ b/packages/kokkos/core/unit_test/TestTeamMDRange.hpp
@@ -0,0 +1,1969 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#include <Kokkos_Core.hpp>
+
+namespace Test {
+
+namespace TeamMDRange {
+
+struct FillFlattenedIndex {
+  explicit FillFlattenedIndex(int n0, int n1, int n2, int n3 = 1, int n4 = 1,
+                              int n5 = 1, int n6 = 1, int n7 = 1)
+      : initValue{n0, n1, n2, n3, n4, n5, n6, n7} {}
+
+  KOKKOS_INLINE_FUNCTION
+  int operator()(int n0, int n1, int n2, int n3 = 0, int n4 = 0, int n5 = 0,
+                 int n6 = 0, int n7 = 0) const {
+    return ((((((n7 * initValue[7] + n6) * initValue[6] + n5) * initValue[5] +
+               n4) *
+                  initValue[4] +
+              n3) *
+                 initValue[3] +
+             n2) *
+                initValue[2] +
+            n1) *
+               initValue[1] +
+           n0;
+  }
+
+  int initValue[8];
+};
+
+struct TestTeamMDParallelFor {
+  using DataType = int64_t;
+  using DimsType = int[8];
+
+  template <typename HostViewType, typename FillFunctor>
+  static void check_result_3D(HostViewType h_view,
+                              FillFunctor const& fillFunctor) {
+    for (size_t i = 0; i < h_view.extent(0); ++i) {
+      for (size_t j = 0; j < h_view.extent(1); ++j) {
+        for (size_t k = 0; k < h_view.extent(2); ++k) {
+          EXPECT_EQ(h_view(i, j, k), fillFunctor(i, j, k));
+        }
+      }
+    }
+  }
+
+  template <typename HostViewType, typename FillFunctor>
+  static void check_result_4D(HostViewType h_view, FillFunctor& fillFunctor) {
+    for (size_t i = 0; i < h_view.extent(0); ++i) {
+      for (size_t j = 0; j < h_view.extent(1); ++j) {
+        for (size_t k = 0; k < h_view.extent(2); ++k) {
+          for (size_t l = 0; l < h_view.extent(3); ++l) {
+            EXPECT_EQ(h_view(i, j, k, l), fillFunctor(i, j, k, l));
+          }
+        }
+      }
+    }
+  }
+
+  template <typename HostViewType, typename FillFunctor>
+  static void check_result_5D(HostViewType h_view, FillFunctor& fillFunctor) {
+    for (size_t i = 0; i < h_view.extent(0); ++i) {
+      for (size_t j = 0; j < h_view.extent(1); ++j) {
+        for (size_t k = 0; k < h_view.extent(2); ++k) {
+          for (size_t l = 0; l < h_view.extent(3); ++l) {
+            for (size_t m = 0; m < h_view.extent(4); ++m) {
+              EXPECT_EQ(h_view(i, j, k, l, m), fillFunctor(i, j, k, l, m));
+            }
+          }
+        }
+      }
+    }
+  }
+
+  template <typename HostViewType, typename FillFunctor>
+  static void check_result_6D(HostViewType h_view, FillFunctor& fillFunctor) {
+    for (size_t i = 0; i < h_view.extent(0); ++i) {
+      for (size_t j = 0; j < h_view.extent(1); ++j) {
+        for (size_t k = 0; k < h_view.extent(2); ++k) {
+          for (size_t l = 0; l < h_view.extent(3); ++l) {
+            for (size_t m = 0; m < h_view.extent(4); ++m) {
+              for (size_t n = 0; n < h_view.extent(5); ++n) {
+                EXPECT_EQ(h_view(i, j, k, l, m, n),
+                          fillFunctor(i, j, k, l, m, n));
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+
+  template <typename HostViewType, typename FillFunctor>
+  static void check_result_7D(HostViewType h_view, FillFunctor& fillFunctor) {
+    for (size_t i = 0; i < h_view.extent(0); ++i) {
+      for (size_t j = 0; j < h_view.extent(1); ++j) {
+        for (size_t k = 0; k < h_view.extent(2); ++k) {
+          for (size_t l = 0; l < h_view.extent(3); ++l) {
+            for (size_t m = 0; m < h_view.extent(4); ++m) {
+              for (size_t n = 0; n < h_view.extent(5); ++n) {
+                for (size_t o = 0; o < h_view.extent(6); ++o) {
+                  EXPECT_EQ(h_view(i, j, k, l, m, n, o),
+                            fillFunctor(i, j, k, l, m, n, o));
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+
+  template <typename HostViewType, typename FillFunctor>
+  static void check_result_8D(HostViewType h_view, FillFunctor& fillFunctor) {
+    for (size_t i = 0; i < h_view.extent(0); ++i) {
+      for (size_t j = 0; j < h_view.extent(1); ++j) {
+        for (size_t k = 0; k < h_view.extent(2); ++k) {
+          for (size_t l = 0; l < h_view.extent(3); ++l) {
+            for (size_t m = 0; m < h_view.extent(4); ++m) {
+              for (size_t n = 0; n < h_view.extent(5); ++n) {
+                for (size_t o = 0; o < h_view.extent(6); ++o) {
+                  for (size_t p = 0; p < h_view.extent(7); ++p) {
+                    EXPECT_EQ(h_view(i, j, k, l, m, n, o, p),
+                              fillFunctor(i, j, k, l, m, n, o, p));
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+};
+
+// If KOKKOS_ENABLE_CUDA_LAMBDA is off, extended lambdas used in parallel_for
+// and parallel_reduce in these tests will not compile correctly
+#if !defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_CUDA_LAMBDA)
+
+template <typename ExecSpace>
+struct TestTeamThreadMDRangeParallelFor : public TestTeamMDParallelFor {
+  using TeamType = typename Kokkos::TeamPolicy<ExecSpace>::member_type;
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_for_3D_TeamThreadMDRange(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType***, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+
+    ViewType v("v", leagueSize, n0, n1);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          int leagueRank = team.league_rank();
+
+          auto teamRange =
+              Kokkos::TeamThreadMDRange<Kokkos::Rank<2, Direction>, TeamType>(
+                  team, n0, n1);
+
+          Kokkos::parallel_for(teamRange, [=](int i, int j) {
+            v(leagueRank, i, j) += fillFlattenedIndex(leagueRank, i, j);
+          });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_3D(h_view, fillFlattenedIndex);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_for_4D_TeamThreadMDRange(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType****, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+
+    ViewType v("v", leagueSize, n0, n1, n2);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          int leagueRank = team.league_rank();
+
+          auto teamRange =
+              Kokkos::TeamThreadMDRange<Kokkos::Rank<3, Direction>, TeamType>(
+                  team, n0, n1, n2);
+
+          Kokkos::parallel_for(teamRange, [=](int i, int j, int k) {
+            v(leagueRank, i, j, k) += fillFlattenedIndex(leagueRank, i, j, k);
+          });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_4D(h_view, fillFlattenedIndex);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_for_5D_TeamThreadMDRange(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType*****, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          int leagueRank = team.league_rank();
+
+          auto teamRange =
+              Kokkos::TeamThreadMDRange<Kokkos::Rank<4, Direction>, TeamType>(
+                  team, n0, n1, n2, n3);
+
+          Kokkos::parallel_for(teamRange, [=](int i, int j, int k, int l) {
+            v(leagueRank, i, j, k, l) +=
+                fillFlattenedIndex(leagueRank, i, j, k, l);
+          });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_5D(h_view, fillFlattenedIndex);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_for_6D_TeamThreadMDRange(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType******, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+    int n4         = dims[5];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3, n4);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          int leagueRank = team.league_rank();
+
+          auto teamRange =
+              Kokkos::TeamThreadMDRange<Kokkos::Rank<5, Direction>, TeamType>(
+                  team, n0, n1, n2, n3, n4);
+
+          Kokkos::parallel_for(
+              teamRange, [=](int i, int j, int k, int l, int m) {
+                v(leagueRank, i, j, k, l, m) +=
+                    fillFlattenedIndex(leagueRank, i, j, k, l, m);
+              });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_6D(h_view, fillFlattenedIndex);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_for_7D_TeamThreadMDRange(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType*******, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+    int n4         = dims[5];
+    int n5         = dims[6];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          int leagueRank = team.league_rank();
+
+          auto teamRange =
+              Kokkos::TeamThreadMDRange<Kokkos::Rank<6, Direction>, TeamType>(
+                  team, n0, n1, n2, n3, n4, n5);
+
+          Kokkos::parallel_for(
+              teamRange, [=](int i, int j, int k, int l, int m, int n) {
+                v(leagueRank, i, j, k, l, m, n) +=
+                    fillFlattenedIndex(leagueRank, i, j, k, l, m, n);
+              });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_7D(h_view, fillFlattenedIndex);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_for_8D_TeamThreadMDRange(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType********, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+    int n4         = dims[5];
+    int n5         = dims[6];
+    int n6         = dims[7];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5, n6);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5,
+                                          n6);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          int leagueRank = team.league_rank();
+
+          auto teamRange =
+              Kokkos::TeamThreadMDRange<Kokkos::Rank<7, Direction>, TeamType>(
+                  team, n0, n1, n2, n3, n4, n5, n6);
+
+          Kokkos::parallel_for(
+              teamRange, [=](int i, int j, int k, int l, int m, int n, int o) {
+                v(leagueRank, i, j, k, l, m, n, o) +=
+                    fillFlattenedIndex(leagueRank, i, j, k, l, m, n, o);
+              });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_8D(h_view, fillFlattenedIndex);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_single_direction_test(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType***, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int n0 = dims[0];
+    int n1 = dims[1];
+    int n2 = dims[2];
+
+    ViewType v("v", n0, n1, n2);
+    FillFlattenedIndex fillFlattenedIndex(n0, n1, n2);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(1, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          auto teamRange =
+              Kokkos::TeamThreadMDRange<Kokkos::Rank<3, Direction>, TeamType>(
+                  team, n0, n1, n2);
+
+          Kokkos::parallel_for(teamRange, [=](int i, int j, int k) {
+            v(i, j, k) += fillFlattenedIndex(i, j, k);
+          });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_3D(h_view, fillFlattenedIndex);
+  }
+};
+
+template <typename ExecSpace>
+struct TestThreadVectorMDRangeParallelFor : public TestTeamMDParallelFor {
+  using TeamType = typename Kokkos::TeamPolicy<ExecSpace>::member_type;
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_for_4D_ThreadVectorMDRange(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType****, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+
+    ViewType v("v", leagueSize, n0, n1, n2);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          int leagueRank = team.league_rank();
+
+          auto teamThreadRange = Kokkos::TeamThreadRange(team, n0);
+          auto teamRange =
+              Kokkos::ThreadVectorMDRange<Kokkos::Rank<2, Direction>, TeamType>(
+                  team, n1, n2);
+
+          Kokkos::parallel_for(teamThreadRange, [=](int i) {
+            Kokkos::parallel_for(teamRange, [=](int j, int k) {
+              v(leagueRank, i, j, k) += fillFlattenedIndex(leagueRank, i, j, k);
+            });
+          });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_4D(h_view, fillFlattenedIndex);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_for_5D_ThreadVectorMDRange(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType*****, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          int leagueRank = team.league_rank();
+
+          auto teamThreadRange = Kokkos::TeamThreadRange(team, n0);
+          auto teamRange =
+              Kokkos::ThreadVectorMDRange<Kokkos::Rank<3, Direction>, TeamType>(
+                  team, n1, n2, n3);
+
+          Kokkos::parallel_for(teamThreadRange, [=](int i) {
+            Kokkos::parallel_for(teamRange, [=](int j, int k, int l) {
+              v(leagueRank, i, j, k, l) +=
+                  fillFlattenedIndex(leagueRank, i, j, k, l);
+            });
+          });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_5D(h_view, fillFlattenedIndex);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_for_6D_ThreadVectorMDRange(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType******, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+    int n4         = dims[5];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3, n4);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          int leagueRank = team.league_rank();
+
+          auto teamThreadRange = Kokkos::TeamThreadRange(team, n0);
+          auto teamRange =
+              Kokkos::ThreadVectorMDRange<Kokkos::Rank<4, Direction>, TeamType>(
+                  team, n1, n2, n3, n4);
+
+          Kokkos::parallel_for(teamThreadRange, [=](int i) {
+            Kokkos::parallel_for(teamRange, [=](int j, int k, int l, int m) {
+              v(leagueRank, i, j, k, l, m) +=
+                  fillFlattenedIndex(leagueRank, i, j, k, l, m);
+            });
+          });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_6D(h_view, fillFlattenedIndex);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_for_7D_ThreadVectorMDRange(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType*******, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+    int n4         = dims[5];
+    int n5         = dims[6];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          int leagueRank = team.league_rank();
+
+          auto teamThreadRange = Kokkos::TeamThreadRange(team, n0);
+          auto teamRange =
+              Kokkos::ThreadVectorMDRange<Kokkos::Rank<5, Direction>, TeamType>(
+                  team, n1, n2, n3, n4, n5);
+
+          Kokkos::parallel_for(teamThreadRange, [=](int i) {
+            Kokkos::parallel_for(
+                teamRange, [=](int j, int k, int l, int m, int n) {
+                  v(leagueRank, i, j, k, l, m, n) +=
+                      fillFlattenedIndex(leagueRank, i, j, k, l, m, n);
+                });
+          });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_7D(h_view, fillFlattenedIndex);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_for_8D_ThreadVectorMDRange(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType********, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+    int n4         = dims[5];
+    int n5         = dims[6];
+    int n6         = dims[7];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5, n6);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5,
+                                          n6);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          int leagueRank = team.league_rank();
+
+          auto teamThreadRange = Kokkos::TeamThreadRange(team, n0);
+          auto teamRange =
+              Kokkos::ThreadVectorMDRange<Kokkos::Rank<6, Direction>, TeamType>(
+                  team, n1, n2, n3, n4, n5, n6);
+
+          Kokkos::parallel_for(teamThreadRange, [=](int i) {
+            Kokkos::parallel_for(
+                teamRange, [=](int j, int k, int l, int m, int n, int o) {
+                  v(leagueRank, i, j, k, l, m, n, o) +=
+                      fillFlattenedIndex(leagueRank, i, j, k, l, m, n, o);
+                });
+          });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_8D(h_view, fillFlattenedIndex);
+  }
+};
+
+template <typename ExecSpace>
+struct TestTeamVectorMDRangeParallelFor : public TestTeamMDParallelFor {
+  using TeamType = typename Kokkos::TeamPolicy<ExecSpace>::member_type;
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_for_3D_TeamVectorMDRange(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType***, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+
+    ViewType v("v", leagueSize, n0, n1);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          int leagueRank = team.league_rank();
+
+          auto teamRange =
+              Kokkos::TeamVectorMDRange<Kokkos::Rank<2, Direction>, TeamType>(
+                  team, n0, n1);
+
+          Kokkos::parallel_for(teamRange, [=](int i, int j) {
+            v(leagueRank, i, j) += fillFlattenedIndex(leagueRank, i, j);
+          });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_3D(h_view, fillFlattenedIndex);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_for_4D_TeamVectorMDRange(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType****, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+
+    ViewType v("v", leagueSize, n0, n1, n2);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          int leagueRank = team.league_rank();
+
+          auto teamRange =
+              Kokkos::TeamVectorMDRange<Kokkos::Rank<3, Direction>, TeamType>(
+                  team, n0, n1, n2);
+
+          Kokkos::parallel_for(teamRange, [=](int i, int j, int k) {
+            v(leagueRank, i, j, k) += fillFlattenedIndex(leagueRank, i, j, k);
+          });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_4D(h_view, fillFlattenedIndex);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_for_5D_TeamVectorMDRange(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType*****, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          int leagueRank = team.league_rank();
+
+          auto teamRange =
+              Kokkos::TeamVectorMDRange<Kokkos::Rank<4, Direction>, TeamType>(
+                  team, n0, n1, n2, n3);
+
+          Kokkos::parallel_for(teamRange, [=](int i, int j, int k, int l) {
+            v(leagueRank, i, j, k, l) +=
+                fillFlattenedIndex(leagueRank, i, j, k, l);
+          });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_5D(h_view, fillFlattenedIndex);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_for_6D_TeamVectorMDRange(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType******, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+    int n4         = dims[5];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3, n4);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          int leagueRank = team.league_rank();
+
+          auto teamRange =
+              Kokkos::TeamVectorMDRange<Kokkos::Rank<5, Direction>, TeamType>(
+                  team, n0, n1, n2, n3, n4);
+
+          Kokkos::parallel_for(
+              teamRange, [=](int i, int j, int k, int l, int m) {
+                v(leagueRank, i, j, k, l, m) +=
+                    fillFlattenedIndex(leagueRank, i, j, k, l, m);
+              });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_6D(h_view, fillFlattenedIndex);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_for_7D_TeamVectorMDRange(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType*******, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+    int n4         = dims[5];
+    int n5         = dims[6];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          int leagueRank = team.league_rank();
+
+          auto teamRange =
+              Kokkos::TeamVectorMDRange<Kokkos::Rank<6, Direction>, TeamType>(
+                  team, n0, n1, n2, n3, n4, n5);
+
+          Kokkos::parallel_for(
+              teamRange, [=](int i, int j, int k, int l, int m, int n) {
+                v(leagueRank, i, j, k, l, m, n) +=
+                    fillFlattenedIndex(leagueRank, i, j, k, l, m, n);
+              });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_7D(h_view, fillFlattenedIndex);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_for_8D_TeamVectorMDRange(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType********, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+    int n4         = dims[5];
+    int n5         = dims[6];
+    int n6         = dims[7];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5, n6);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5,
+                                          n6);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          int leagueRank = team.league_rank();
+
+          auto teamRange =
+              Kokkos::TeamVectorMDRange<Kokkos::Rank<7, Direction>, TeamType>(
+                  team, n0, n1, n2, n3, n4, n5, n6);
+
+          Kokkos::parallel_for(
+              teamRange, [=](int i, int j, int k, int l, int m, int n, int o) {
+                v(leagueRank, i, j, k, l, m, n, o) +=
+                    fillFlattenedIndex(leagueRank, i, j, k, l, m, n, o);
+              });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_8D(h_view, fillFlattenedIndex);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_double_direction_test(DimsType const& dims) {
+    using ViewType     = typename Kokkos::View<DataType****, ExecSpace>;
+    using HostViewType = typename ViewType::HostMirror;
+
+    int n0 = dims[0];
+    int n1 = dims[1];
+    int n2 = dims[2];
+    int n3 = dims[3];
+
+    ViewType v("v", n0, n1, n2, n3);
+    FillFlattenedIndex fillFlattenedIndex(n0, n1, n2, n3);
+
+    Kokkos::parallel_for(
+        Kokkos::TeamPolicy<ExecSpace>(1, Kokkos::AUTO),
+        KOKKOS_LAMBDA(const TeamType& team) {
+          auto teamRange =
+              Kokkos::TeamVectorMDRange<Kokkos::Rank<4, Direction>, TeamType>(
+                  team, n0, n1, n2, n3);
+
+          Kokkos::parallel_for(teamRange, [=](int i, int j, int k, int l) {
+            v(i, j, k, l) += fillFlattenedIndex(i, j, k, l);
+          });
+        });
+
+    HostViewType h_view = Kokkos::create_mirror_view_and_copy(
+        typename HostViewType::traits::memory_space(), v);
+
+    check_result_4D(h_view, fillFlattenedIndex);
+  }
+};
+
+struct TestTeamMDParallelReduce {
+  using DataType = int64_t;
+  using DimsType = int[8];
+
+  template <typename F>
+  constexpr static DataType get_expected_partial_sum(DimsType const& dims,
+                                                     size_t maxRank, F const& f,
+                                                     DimsType& indices,
+                                                     size_t rank) {
+    if (rank == maxRank) {
+      return f(indices[0], indices[1], indices[2], indices[3], indices[4],
+               indices[5], indices[6], indices[7]);
+    }
+
+    auto& index       = indices[rank];
+    DataType accValue = 0;
+    for (index = 0; index < dims[rank]; ++index) {
+      accValue += get_expected_partial_sum(dims, maxRank, f, indices, rank + 1);
+    }
+
+    return accValue;
+  }
+
+  template <typename F>
+  static DataType get_expected_sum(DimsType const& dims, size_t maxRank,
+                                   F const& f) {
+    DimsType indices = {};
+    return get_expected_partial_sum(dims, maxRank, f, indices, 0);
+  }
+};
+
+template <typename ExecSpace>
+struct TestTeamThreadMDRangeParallelReduce : public TestTeamMDParallelReduce {
+  using TeamType = typename Kokkos::TeamPolicy<ExecSpace>::member_type;
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_reduce_for_3D_TeamThreadMDRange(
+      DimsType const& dims) {
+    using ViewType = typename Kokkos::View<DataType***, ExecSpace>;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+
+    ViewType v("v", leagueSize, n0, n1);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1);
+
+    Kokkos::parallel_for(
+        Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<3>>({0, 0, 0},
+                                                          {leagueSize, n0, n1}),
+        KOKKOS_LAMBDA(const int i, const int j, const int k) {
+          v(i, j, k) = fillFlattenedIndex(i, j, k);
+        });
+
+    DataType finalSum = 0;
+
+    Kokkos::parallel_reduce(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) {
+          auto leagueRank  = team.league_rank();
+          DataType teamSum = 0;
+
+          Kokkos::parallel_reduce(
+              Kokkos::TeamThreadMDRange<Kokkos::Rank<2, Direction>, TeamType>(
+                  team, n0, n1),
+              [=](const int& i, const int& j, DataType& threadSum) {
+                threadSum += v(leagueRank, i, j);
+              },
+              teamSum);
+          leagueSum += teamSum;
+        },
+        finalSum);
+
+    DataType expectedSum = get_expected_sum(dims, 3, fillFlattenedIndex);
+
+    EXPECT_EQ(finalSum, expectedSum);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_reduce_for_4D_TeamThreadMDRange(
+      DimsType const& dims) {
+    using ViewType = typename Kokkos::View<DataType****, ExecSpace>;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+
+    ViewType v("v", leagueSize, n0, n1, n2);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2);
+
+    Kokkos::parallel_for(
+        Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<4>>(
+            {0, 0, 0, 0}, {leagueSize, n0, n1, n2}),
+        KOKKOS_LAMBDA(const int i, const int j, const int k, const int l) {
+          v(i, j, k, l) = fillFlattenedIndex(i, j, k, l);
+        });
+
+    DataType finalSum = 0;
+
+    Kokkos::parallel_reduce(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) {
+          auto leagueRank  = team.league_rank();
+          DataType teamSum = 0;
+
+          Kokkos::parallel_reduce(
+              Kokkos::TeamThreadMDRange<Kokkos::Rank<3, Direction>, TeamType>(
+                  team, n0, n1, n2),
+              [=](const int& i, const int& j, const int& k,
+                  DataType& threadSum) { threadSum += v(leagueRank, i, j, k); },
+              teamSum);
+          leagueSum += teamSum;
+        },
+        finalSum);
+
+    DataType expectedSum = get_expected_sum(dims, 4, fillFlattenedIndex);
+
+    EXPECT_EQ(finalSum, expectedSum);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_reduce_for_5D_TeamThreadMDRange(
+      DimsType const& dims) {
+    using ViewType = typename Kokkos::View<DataType*****, ExecSpace>;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3);
+
+    Kokkos::parallel_for(
+        Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<5>>(
+            {0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3}),
+        KOKKOS_LAMBDA(const int i, const int j, const int k, const int l,
+                      const int m) {
+          v(i, j, k, l, m) = fillFlattenedIndex(i, j, k, l, m);
+        });
+
+    DataType finalSum = 0;
+
+    Kokkos::parallel_reduce(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) {
+          auto leagueRank  = team.league_rank();
+          DataType teamSum = 0;
+
+          Kokkos::parallel_reduce(
+              Kokkos::TeamThreadMDRange<Kokkos::Rank<4, Direction>, TeamType>(
+                  team, n0, n1, n2, n3),
+              [=](const int& i, const int& j, const int& k, const int& l,
+                  DataType& threadSum) {
+                threadSum += v(leagueRank, i, j, k, l);
+              },
+              teamSum);
+          leagueSum += teamSum;
+        },
+        finalSum);
+
+    DataType expectedSum = get_expected_sum(dims, 5, fillFlattenedIndex);
+
+    EXPECT_EQ(finalSum, expectedSum);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_reduce_for_6D_TeamThreadMDRange(
+      DimsType const& dims) {
+    using ViewType = typename Kokkos::View<DataType******, ExecSpace>;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+    int n4         = dims[5];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3, n4);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4);
+
+    Kokkos::parallel_for(
+        Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>>(
+            {0, 0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3, n4}),
+        KOKKOS_LAMBDA(const int i, const int j, const int k, const int l,
+                      const int m, const int n) {
+          v(i, j, k, l, m, n) = fillFlattenedIndex(i, j, k, l, m, n);
+        });
+
+    DataType finalSum = 0;
+
+    Kokkos::parallel_reduce(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) {
+          auto leagueRank  = team.league_rank();
+          DataType teamSum = 0;
+
+          Kokkos::parallel_reduce(
+              Kokkos::TeamThreadMDRange<Kokkos::Rank<5, Direction>, TeamType>(
+                  team, n0, n1, n2, n3, n4),
+              [=](const int& i, const int& j, const int& k, const int& l,
+                  const int& m, DataType& threadSum) {
+                threadSum += v(leagueRank, i, j, k, l, m);
+              },
+              teamSum);
+          leagueSum += teamSum;
+        },
+        finalSum);
+
+    DataType expectedSum = get_expected_sum(dims, 6, fillFlattenedIndex);
+
+    EXPECT_EQ(finalSum, expectedSum);
+  }
+
+  // MDRangePolicy only allows up to rank of 6. Because of this, expectedSum
+  // array had to be constructed from a nested parallel_for loop.
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_reduce_for_7D_TeamThreadMDRange(
+      DimsType const& dims) {
+    using ViewType = typename Kokkos::View<DataType*******, ExecSpace>;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+    int n4         = dims[5];
+    int n5         = dims[6];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5);
+    auto mdRangePolicy = Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>>(
+        {0, 0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3, n4});
+
+    Kokkos::parallel_for(
+        mdRangePolicy,
+        KOKKOS_LAMBDA(const int leagueRank, const int i, const int j,
+                      const int k, const int l, const int m) {
+          for (int n = 0; n < n5; ++n) {
+            v(leagueRank, i, j, k, l, m, n) =
+                fillFlattenedIndex(leagueRank, i, j, k, l, m, n);
+          }
+        });
+
+    DataType finalSum = 0;
+
+    Kokkos::parallel_reduce(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) {
+          auto leagueRank  = team.league_rank();
+          DataType teamSum = 0;
+
+          Kokkos::parallel_reduce(
+              Kokkos::TeamThreadMDRange<Kokkos::Rank<6, Direction>, TeamType>(
+                  team, n0, n1, n2, n3, n4, n5),
+              [=](const int& i, const int& j, const int& k, const int& l,
+                  const int& m, const int& n, DataType& threadSum) {
+                threadSum += v(leagueRank, i, j, k, l, m, n);
+              },
+              teamSum);
+          leagueSum += teamSum;
+        },
+        finalSum);
+
+    DataType expectedSum = get_expected_sum(dims, 7, fillFlattenedIndex);
+
+    EXPECT_EQ(finalSum, expectedSum);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_reduce_for_8D_TeamThreadMDRange(
+      DimsType const& dims) {
+    using ViewType = typename Kokkos::View<DataType********, ExecSpace>;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+    int n4         = dims[5];
+    int n5         = dims[6];
+    int n6         = dims[7];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5, n6);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5,
+                                          n6);
+    auto mdRangePolicy = Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>>(
+        {0, 0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3, n4});
+
+    Kokkos::parallel_for(
+        mdRangePolicy,
+        KOKKOS_LAMBDA(const int leagueRank, const int i, const int j,
+                      const int k, const int l, const int m) {
+          for (int n = 0; n < n5; ++n) {
+            for (int o = 0; o < n6; ++o) {
+              v(leagueRank, i, j, k, l, m, n, o) =
+                  fillFlattenedIndex(leagueRank, i, j, k, l, m, n, o);
+            }
+          }
+        });
+
+    DataType finalSum = 0;
+
+    Kokkos::parallel_reduce(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) {
+          auto leagueRank  = team.league_rank();
+          DataType teamSum = 0;
+
+          Kokkos::parallel_reduce(
+              Kokkos::TeamThreadMDRange<Kokkos::Rank<7, Direction>, TeamType>(
+                  team, n0, n1, n2, n3, n4, n5, n6),
+              [=](const int& i, const int& j, const int& k, const int& l,
+                  const int& m, const int& n, const int& o,
+                  DataType& threadSum) {
+                threadSum += v(leagueRank, i, j, k, l, m, n, o);
+              },
+              teamSum);
+          leagueSum += teamSum;
+        },
+        finalSum);
+
+    DataType expectedSum = get_expected_sum(dims, 8, fillFlattenedIndex);
+
+    EXPECT_EQ(finalSum, expectedSum);
+  }
+};
+
+template <typename ExecSpace>
+struct TestThreadVectorMDRangeParallelReduce : public TestTeamMDParallelReduce {
+  using TeamType = typename Kokkos::TeamPolicy<ExecSpace>::member_type;
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_reduce_for_4D_ThreadVectorMDRange(
+      DimsType const& dims) {
+    using ViewType = typename Kokkos::View<DataType****, ExecSpace>;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+
+    ViewType v("v", leagueSize, n0, n1, n2);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2);
+
+    Kokkos::parallel_for(
+        Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<4>>(
+            {0, 0, 0, 0}, {leagueSize, n0, n1, n2}),
+        KOKKOS_LAMBDA(const int i, const int j, const int k, const int l) {
+          v(i, j, k, l) = fillFlattenedIndex(i, j, k, l);
+        });
+
+    DataType finalSum = 0;
+
+    Kokkos::parallel_reduce(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) {
+          auto leagueRank  = team.league_rank();
+          DataType teamSum = 0;
+
+          auto teamThreadRange = Kokkos::TeamThreadRange(team, n0);
+          auto threadVectorRange =
+              Kokkos::ThreadVectorMDRange<Kokkos::Rank<2, Direction>, TeamType>(
+                  team, n1, n2);
+
+          Kokkos::parallel_for(teamThreadRange, [=, &teamSum](const int& i) {
+            DataType threadSum = 0;
+            Kokkos::parallel_reduce(
+                threadVectorRange,
+                [=](const int& j, const int& k, DataType& vectorSum) {
+                  vectorSum += v(leagueRank, i, j, k);
+                },
+                threadSum);
+
+            teamSum += threadSum;
+          });
+
+          leagueSum += teamSum;
+        },
+        finalSum);
+
+    DataType expectedSum = get_expected_sum(dims, 4, fillFlattenedIndex);
+
+    EXPECT_EQ(finalSum, expectedSum);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_reduce_for_5D_ThreadVectorMDRange(
+      DimsType const& dims) {
+    using ViewType = typename Kokkos::View<DataType*****, ExecSpace>;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3);
+
+    Kokkos::parallel_for(
+        Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<5>>(
+            {0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3}),
+        KOKKOS_LAMBDA(const int i, const int j, const int k, const int l,
+                      const int m) {
+          v(i, j, k, l, m) = fillFlattenedIndex(i, j, k, l, m);
+        });
+
+    DataType finalSum = 0;
+
+    Kokkos::parallel_reduce(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) {
+          auto leagueRank  = team.league_rank();
+          DataType teamSum = 0;
+
+          auto teamThreadRange = Kokkos::TeamThreadRange(team, n0);
+          auto threadVectorRange =
+              Kokkos::ThreadVectorMDRange<Kokkos::Rank<3, Direction>, TeamType>(
+                  team, n1, n2, n3);
+
+          Kokkos::parallel_for(teamThreadRange, [=, &teamSum](const int& i) {
+            DataType threadSum = 0;
+            Kokkos::parallel_reduce(
+                threadVectorRange,
+                [=](const int& j, const int& k, const int& l,
+                    DataType& vectorSum) {
+                  vectorSum += v(leagueRank, i, j, k, l);
+                },
+                threadSum);
+
+            teamSum += threadSum;
+          });
+
+          leagueSum += teamSum;
+        },
+        finalSum);
+
+    DataType expectedSum = get_expected_sum(dims, 5, fillFlattenedIndex);
+
+    EXPECT_EQ(finalSum, expectedSum);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_reduce_for_6D_ThreadVectorMDRange(
+      DimsType const& dims) {
+    using ViewType = typename Kokkos::View<DataType******, ExecSpace>;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+    int n4         = dims[5];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3, n4);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4);
+
+    Kokkos::parallel_for(
+        Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>>(
+            {0, 0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3, n4}),
+        KOKKOS_LAMBDA(const int i, const int j, const int k, const int l,
+                      const int m, const int n) {
+          v(i, j, k, l, m, n) = fillFlattenedIndex(i, j, k, l, m, n);
+        });
+
+    DataType finalSum = 0;
+
+    Kokkos::parallel_reduce(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) {
+          auto leagueRank  = team.league_rank();
+          DataType teamSum = 0;
+
+          auto teamThreadRange = Kokkos::TeamThreadRange(team, n0);
+          auto threadVectorRange =
+              Kokkos::ThreadVectorMDRange<Kokkos::Rank<4, Direction>, TeamType>(
+                  team, n1, n2, n3, n4);
+
+          Kokkos::parallel_for(teamThreadRange, [=, &teamSum](const int& i) {
+            DataType threadSum = 0;
+            Kokkos::parallel_reduce(
+                threadVectorRange,
+                [=](const int& j, const int& k, const int& l, const int& m,
+                    DataType& vectorSum) {
+                  vectorSum += v(leagueRank, i, j, k, l, m);
+                },
+                threadSum);
+
+            teamSum += threadSum;
+          });
+
+          leagueSum += teamSum;
+        },
+        finalSum);
+
+    DataType expectedSum = get_expected_sum(dims, 6, fillFlattenedIndex);
+
+    EXPECT_EQ(finalSum, expectedSum);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_reduce_for_7D_ThreadVectorMDRange(
+      DimsType const& dims) {
+    using ViewType = typename Kokkos::View<DataType*******, ExecSpace>;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+    int n4         = dims[5];
+    int n5         = dims[6];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5);
+    auto mdRangePolicy = Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>>(
+        {0, 0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3, n4});
+
+    Kokkos::parallel_for(
+        mdRangePolicy,
+        KOKKOS_LAMBDA(const int leagueRank, const int i, const int j,
+                      const int k, const int l, const int m) {
+          for (int n = 0; n < n5; ++n) {
+            v(leagueRank, i, j, k, l, m, n) =
+                fillFlattenedIndex(leagueRank, i, j, k, l, m, n);
+          }
+        });
+
+    DataType finalSum = 0;
+
+    Kokkos::parallel_reduce(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) {
+          auto leagueRank  = team.league_rank();
+          DataType teamSum = 0;
+
+          auto teamThreadRange = Kokkos::TeamThreadRange(team, n0);
+          auto threadVectorRange =
+              Kokkos::ThreadVectorMDRange<Kokkos::Rank<5, Direction>, TeamType>(
+                  team, n1, n2, n3, n4, n5);
+
+          Kokkos::parallel_for(teamThreadRange, [=, &teamSum](const int& i) {
+            DataType threadSum = 0;
+            Kokkos::parallel_reduce(
+                threadVectorRange,
+                [=](const int& j, const int& k, const int& l, const int& m,
+                    const int& n, DataType& vectorSum) {
+                  vectorSum += v(leagueRank, i, j, k, l, m, n);
+                },
+                threadSum);
+
+            teamSum += threadSum;
+          });
+
+          leagueSum += teamSum;
+        },
+        finalSum);
+
+    DataType expectedSum = get_expected_sum(dims, 7, fillFlattenedIndex);
+
+    EXPECT_EQ(finalSum, expectedSum);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_reduce_for_8D_ThreadVectorMDRange(
+      DimsType const& dims) {
+    using ViewType = typename Kokkos::View<DataType********, ExecSpace>;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+    int n4         = dims[5];
+    int n5         = dims[6];
+    int n6         = dims[7];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5, n6);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5,
+                                          n6);
+    auto mdRangePolicy = Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>>(
+        {0, 0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3, n4});
+
+    Kokkos::parallel_for(
+        mdRangePolicy,
+        KOKKOS_LAMBDA(const int leagueRank, const int i, const int j,
+                      const int k, const int l, const int m) {
+          for (int n = 0; n < n5; ++n) {
+            for (int o = 0; o < n6; ++o) {
+              v(leagueRank, i, j, k, l, m, n, o) =
+                  fillFlattenedIndex(leagueRank, i, j, k, l, m, n, o);
+            }
+          }
+        });
+
+    DataType finalSum = 0;
+
+    Kokkos::parallel_reduce(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) {
+          auto leagueRank  = team.league_rank();
+          DataType teamSum = 0;
+
+          auto teamThreadRange = Kokkos::TeamThreadRange(team, n0);
+          auto threadVectorRange =
+              Kokkos::ThreadVectorMDRange<Kokkos::Rank<6, Direction>, TeamType>(
+                  team, n1, n2, n3, n4, n5, n6);
+
+          Kokkos::parallel_for(teamThreadRange, [=, &teamSum](const int& i) {
+            DataType threadSum = 0;
+            Kokkos::parallel_reduce(
+                threadVectorRange,
+                [=](const int& j, const int& k, const int& l, const int& m,
+                    const int& n, const int& o, DataType& vectorSum) {
+                  vectorSum += v(leagueRank, i, j, k, l, m, n, o);
+                },
+                threadSum);
+
+            teamSum += threadSum;
+          });
+
+          leagueSum += teamSum;
+        },
+        finalSum);
+
+    DataType expectedSum = get_expected_sum(dims, 8, fillFlattenedIndex);
+
+    EXPECT_EQ(finalSum, expectedSum);
+  }
+};
+
+template <typename ExecSpace>
+struct TestTeamVectorMDRangeParallelReduce : public TestTeamMDParallelReduce {
+  using TeamType = typename Kokkos::TeamPolicy<ExecSpace>::member_type;
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_reduce_for_4D_TeamVectorMDRange(
+      DimsType const& dims) {
+    using ViewType = typename Kokkos::View<DataType****, ExecSpace>;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+
+    ViewType v("v", leagueSize, n0, n1, n2);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2);
+
+    Kokkos::parallel_for(
+        Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<4>>(
+            {0, 0, 0, 0}, {leagueSize, n0, n1, n2}),
+        KOKKOS_LAMBDA(const int i, const int j, const int k, const int l) {
+          v(i, j, k, l) = fillFlattenedIndex(i, j, k, l);
+        });
+
+    DataType finalSum = 0;
+
+    Kokkos::parallel_reduce(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) {
+          auto leagueRank  = team.league_rank();
+          DataType teamSum = 0;
+
+          auto teamVectorRange =
+              Kokkos::TeamVectorMDRange<Kokkos::Rank<3, Direction>, TeamType>(
+                  team, n0, n1, n2);
+
+          Kokkos::parallel_reduce(
+              teamVectorRange,
+              [=](const int& i, const int& j, const int& k,
+                  DataType& vectorSum) { vectorSum += v(leagueRank, i, j, k); },
+              teamSum);
+          leagueSum += teamSum;
+        },
+        finalSum);
+
+    DataType expectedSum = get_expected_sum(dims, 4, fillFlattenedIndex);
+
+    EXPECT_EQ(finalSum, expectedSum);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_reduce_for_5D_TeamVectorMDRange(
+      DimsType const& dims) {
+    using ViewType = typename Kokkos::View<DataType*****, ExecSpace>;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3);
+
+    Kokkos::parallel_for(
+        Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<5>>(
+            {0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3}),
+        KOKKOS_LAMBDA(const int i, const int j, const int k, const int l,
+                      const int m) {
+          v(i, j, k, l, m) = fillFlattenedIndex(i, j, k, l, m);
+        });
+
+    DataType finalSum = 0;
+
+    Kokkos::parallel_reduce(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) {
+          auto leagueRank  = team.league_rank();
+          DataType teamSum = 0;
+
+          auto teamVectorRange =
+              Kokkos::TeamVectorMDRange<Kokkos::Rank<4, Direction>, TeamType>(
+                  team, n0, n1, n2, n3);
+
+          Kokkos::parallel_reduce(
+              teamVectorRange,
+              [=](const int& i, const int& j, const int& k, const int& l,
+                  DataType& vectorSum) {
+                vectorSum += v(leagueRank, i, j, k, l);
+              },
+              teamSum);
+          leagueSum += teamSum;
+        },
+        finalSum);
+
+    DataType expectedSum = get_expected_sum(dims, 5, fillFlattenedIndex);
+
+    EXPECT_EQ(finalSum, expectedSum);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_reduce_for_6D_TeamVectorMDRange(
+      DimsType const& dims) {
+    using ViewType = typename Kokkos::View<DataType******, ExecSpace>;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+    int n4         = dims[5];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3, n4);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4);
+
+    Kokkos::parallel_for(
+        Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>>(
+            {0, 0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3, n4}),
+        KOKKOS_LAMBDA(const int i, const int j, const int k, const int l,
+                      const int m, const int n) {
+          v(i, j, k, l, m, n) = fillFlattenedIndex(i, j, k, l, m, n);
+        });
+
+    DataType finalSum = 0;
+
+    Kokkos::parallel_reduce(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) {
+          auto leagueRank  = team.league_rank();
+          DataType teamSum = 0;
+
+          auto teamVectorRange =
+              Kokkos::TeamVectorMDRange<Kokkos::Rank<5, Direction>, TeamType>(
+                  team, n0, n1, n2, n3, n4);
+
+          Kokkos::parallel_reduce(
+              teamVectorRange,
+              [=](const int& i, const int& j, const int& k, const int& l,
+                  const int& m, DataType& vectorSum) {
+                vectorSum += v(leagueRank, i, j, k, l, m);
+              },
+              teamSum);
+          leagueSum += teamSum;
+        },
+        finalSum);
+
+    DataType expectedSum = get_expected_sum(dims, 6, fillFlattenedIndex);
+
+    EXPECT_EQ(finalSum, expectedSum);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_reduce_for_7D_TeamVectorMDRange(
+      DimsType const& dims) {
+    using ViewType = typename Kokkos::View<DataType*******, ExecSpace>;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+    int n4         = dims[5];
+    int n5         = dims[6];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5);
+    auto mdRangePolicy = Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>>(
+        {0, 0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3, n4});
+
+    Kokkos::parallel_for(
+        mdRangePolicy,
+        KOKKOS_LAMBDA(const int leagueRank, const int i, const int j,
+                      const int k, const int l, const int m) {
+          for (int n = 0; n < n5; ++n) {
+            v(leagueRank, i, j, k, l, m, n) =
+                fillFlattenedIndex(leagueRank, i, j, k, l, m, n);
+          }
+        });
+
+    DataType finalSum = 0;
+
+    Kokkos::parallel_reduce(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) {
+          auto leagueRank  = team.league_rank();
+          DataType teamSum = 0;
+
+          auto teamVectorRange =
+              Kokkos::TeamVectorMDRange<Kokkos::Rank<6, Direction>, TeamType>(
+                  team, n0, n1, n2, n3, n4, n5);
+
+          Kokkos::parallel_reduce(
+              teamVectorRange,
+              [=](const int& i, const int& j, const int& k, const int& l,
+                  const int& m, const int& n, DataType& vectorSum) {
+                vectorSum += v(leagueRank, i, j, k, l, m, n);
+              },
+              teamSum);
+          leagueSum += teamSum;
+        },
+        finalSum);
+
+    DataType expectedSum = get_expected_sum(dims, 7, fillFlattenedIndex);
+
+    EXPECT_EQ(finalSum, expectedSum);
+  }
+
+  template <Kokkos::Iterate Direction = Kokkos::Iterate::Default>
+  static void test_parallel_reduce_for_8D_TeamVectorMDRange(
+      DimsType const& dims) {
+    using ViewType = typename Kokkos::View<DataType********, ExecSpace>;
+
+    int leagueSize = dims[0];
+    int n0         = dims[1];
+    int n1         = dims[2];
+    int n2         = dims[3];
+    int n3         = dims[4];
+    int n4         = dims[5];
+    int n5         = dims[6];
+    int n6         = dims[7];
+
+    ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5, n6);
+    FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5,
+                                          n6);
+    auto mdRangePolicy = Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>>(
+        {0, 0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3, n4});
+
+    Kokkos::parallel_for(
+        mdRangePolicy,
+        KOKKOS_LAMBDA(const int leagueRank, const int i, const int j,
+                      const int k, const int l, const int m) {
+          for (int n = 0; n < n5; ++n) {
+            for (int o = 0; o < n6; ++o) {
+              v(leagueRank, i, j, k, l, m, n, o) =
+                  fillFlattenedIndex(leagueRank, i, j, k, l, m, n, o);
+            }
+          }
+        });
+
+    DataType finalSum = 0;
+
+    Kokkos::parallel_reduce(
+        Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO),
+        KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) {
+          auto leagueRank  = team.league_rank();
+          DataType teamSum = 0;
+
+          auto teamVectorRange =
+              Kokkos::TeamVectorMDRange<Kokkos::Rank<7, Direction>, TeamType>(
+                  team, n0, n1, n2, n3, n4, n5, n6);
+
+          Kokkos::parallel_reduce(
+              teamVectorRange,
+              [=](const int& i, const int& j, const int& k, const int& l,
+                  const int& m, const int& n, const int& o,
+                  DataType& vectorSum) {
+                vectorSum += v(leagueRank, i, j, k, l, m, n, o);
+              },
+              teamSum);
+          leagueSum += teamSum;
+        },
+        finalSum);
+
+    DataType expectedSum = get_expected_sum(dims, 8, fillFlattenedIndex);
+
+    EXPECT_EQ(finalSum, expectedSum);
+  }
+};
+/*--------------------------------------------------------------------------*/
+
+constexpr auto Left  = Kokkos::Iterate::Left;
+constexpr auto Right = Kokkos::Iterate::Right;
+
+// Using prime numbers makes debugging easier
+// small dimensions were needed for larger dimensions to reduce test run time
+int dims[]      = {3, 5, 7, 11, 13, 17, 19, 23};
+int smallDims[] = {2, 3, 2, 3, 5, 2, 3, 5};
+
+TEST(TEST_CATEGORY, TeamThreadMDRangeParallelFor) {
+  TestTeamThreadMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_3D_TeamThreadMDRange<Left>(dims);
+  TestTeamThreadMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_3D_TeamThreadMDRange<Right>(dims);
+
+  TestTeamThreadMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_4D_TeamThreadMDRange<Left>(dims);
+  TestTeamThreadMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_4D_TeamThreadMDRange<Right>(dims);
+
+  TestTeamThreadMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_5D_TeamThreadMDRange<Left>(dims);
+  TestTeamThreadMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_5D_TeamThreadMDRange<Right>(dims);
+
+  TestTeamThreadMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_6D_TeamThreadMDRange<Left>(dims);
+  TestTeamThreadMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_6D_TeamThreadMDRange<Right>(dims);
+
+  TestTeamThreadMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_7D_TeamThreadMDRange<Left>(smallDims);
+  TestTeamThreadMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_7D_TeamThreadMDRange<Right>(smallDims);
+
+  TestTeamThreadMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_8D_TeamThreadMDRange<Left>(smallDims);
+  TestTeamThreadMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_8D_TeamThreadMDRange<Right>(smallDims);
+
+  TestTeamThreadMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_single_direction_test<Left>(dims);
+  TestTeamThreadMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_single_direction_test<Right>(dims);
+}
+
+TEST(TEST_CATEGORY, ThreadVectorMDRangeParallelFor) {
+  TestThreadVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_4D_ThreadVectorMDRange<Left>(dims);
+  TestThreadVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_4D_ThreadVectorMDRange<Right>(dims);
+
+  TestThreadVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_5D_ThreadVectorMDRange<Left>(dims);
+  TestThreadVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_5D_ThreadVectorMDRange<Right>(dims);
+
+  TestThreadVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_6D_ThreadVectorMDRange<Left>(dims);
+  TestThreadVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_6D_ThreadVectorMDRange<Right>(dims);
+
+  TestThreadVectorMDRangeParallelFor<TEST_EXECSPACE>::
+      test_parallel_for_7D_ThreadVectorMDRange<Left>(smallDims);
+  TestThreadVectorMDRangeParallelFor<TEST_EXECSPACE>::
+      test_parallel_for_7D_ThreadVectorMDRange<Right>(smallDims);
+
+  TestThreadVectorMDRangeParallelFor<TEST_EXECSPACE>::
+      test_parallel_for_8D_ThreadVectorMDRange<Left>(smallDims);
+  TestThreadVectorMDRangeParallelFor<TEST_EXECSPACE>::
+      test_parallel_for_8D_ThreadVectorMDRange<Right>(smallDims);
+}
+
+TEST(TEST_CATEGORY, TeamVectorMDRangeParallelFor) {
+  TestTeamVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_3D_TeamVectorMDRange<Left>(dims);
+  TestTeamVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_3D_TeamVectorMDRange<Right>(dims);
+
+  TestTeamVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_4D_TeamVectorMDRange<Left>(dims);
+  TestTeamVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_4D_TeamVectorMDRange<Right>(dims);
+
+  TestTeamVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_5D_TeamVectorMDRange<Left>(dims);
+  TestTeamVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_5D_TeamVectorMDRange<Right>(dims);
+
+  TestTeamVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_6D_TeamVectorMDRange<Left>(dims);
+  TestTeamVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_6D_TeamVectorMDRange<Right>(dims);
+
+  TestTeamVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_7D_TeamVectorMDRange<Left>(smallDims);
+  TestTeamVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_7D_TeamVectorMDRange<Right>(smallDims);
+
+  TestTeamVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_8D_TeamVectorMDRange<Left>(smallDims);
+  TestTeamVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_for_8D_TeamVectorMDRange<Right>(smallDims);
+
+  TestTeamVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_double_direction_test<Left>(dims);
+  TestTeamVectorMDRangeParallelFor<
+      TEST_EXECSPACE>::test_parallel_double_direction_test<Right>(dims);
+}
+
+TEST(TEST_CATEGORY, TeamThreadMDRangeParallelReduce) {
+  TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_3D_TeamThreadMDRange<Left>(dims);
+  TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_3D_TeamThreadMDRange<Right>(dims);
+
+  TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_4D_TeamThreadMDRange<Left>(dims);
+  TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_4D_TeamThreadMDRange<Right>(dims);
+
+  TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_5D_TeamThreadMDRange<Left>(dims);
+  TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_5D_TeamThreadMDRange<Right>(dims);
+
+  TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_6D_TeamThreadMDRange<Left>(dims);
+  TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_6D_TeamThreadMDRange<Right>(dims);
+
+  TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_7D_TeamThreadMDRange<Left>(smallDims);
+  TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_7D_TeamThreadMDRange<Right>(smallDims);
+
+  TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_8D_TeamThreadMDRange<Left>(smallDims);
+  TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_8D_TeamThreadMDRange<Right>(smallDims);
+}
+
+TEST(TEST_CATEGORY, ThreadVectorMDRangeParallelReduce) {
+// FIXME_SYCL sycl::group_barrier doesn't work correctly for non-Intel GPUs
+#if defined(KOKKOS_ENABLE_SYCL) && !defined(KOKKOS_ARCH_INTEL_GPU)
+  if (std::is_same_v<TEST_EXECSPACE, Kokkos::Experimental::SYCL>)
+    GTEST_SKIP() << "skipping because of bug in group_barrier implementation";
+#endif
+
+  TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_4D_ThreadVectorMDRange<Left>(dims);
+  TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_4D_ThreadVectorMDRange<Right>(dims);
+
+  TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_5D_ThreadVectorMDRange<Left>(dims);
+  TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_5D_ThreadVectorMDRange<Right>(dims);
+
+  TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_6D_ThreadVectorMDRange<Left>(dims);
+  TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_6D_ThreadVectorMDRange<Right>(dims);
+
+  TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_7D_ThreadVectorMDRange<Left>(smallDims);
+  TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_7D_ThreadVectorMDRange<Right>(smallDims);
+
+  TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_8D_ThreadVectorMDRange<Left>(smallDims);
+  TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_8D_ThreadVectorMDRange<Right>(smallDims);
+}
+
+TEST(TEST_CATEGORY, TeamVectorMDRangeParallelReduce) {
+// FIXME_SYCL sycl::group_barrier doesn't work correctly for non-Intel GPUs
+#if defined(KOKKOS_ENABLE_SYCL) && !defined(KOKKOS_ARCH_INTEL_GPU)
+  if (std::is_same_v<TEST_EXECSPACE, Kokkos::Experimental::SYCL>)
+    GTEST_SKIP() << "skipping because of bug in group_barrier implementation";
+#endif
+
+  TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_4D_TeamVectorMDRange<Left>(dims);
+  TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_4D_TeamVectorMDRange<Right>(dims);
+
+  TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_5D_TeamVectorMDRange<Left>(dims);
+  TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_5D_TeamVectorMDRange<Right>(dims);
+
+  TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_6D_TeamVectorMDRange<Left>(dims);
+  TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_6D_TeamVectorMDRange<Right>(dims);
+
+  TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_7D_TeamVectorMDRange<Left>(smallDims);
+  TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_7D_TeamVectorMDRange<Right>(smallDims);
+
+  TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_8D_TeamVectorMDRange<Left>(smallDims);
+  TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>::
+      test_parallel_reduce_for_8D_TeamVectorMDRange<Right>(smallDims);
+}
+
+#endif
+
+}  // namespace TeamMDRange
+}  // namespace Test
diff --git a/packages/kokkos/core/unit_test/TestTeamPolicyConstructors.hpp b/packages/kokkos/core/unit_test/TestTeamPolicyConstructors.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..5b0bfdb1755c3cbae1062ed84b902d4d3743452f
--- /dev/null
+++ b/packages/kokkos/core/unit_test/TestTeamPolicyConstructors.hpp
@@ -0,0 +1,141 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#include <gtest/gtest.h>
+
+#include <Kokkos_Core.hpp>
+
+namespace {
+
+template <typename Policy>
+void test_run_time_parameters() {
+  int league_size = 131;
+
+  using ExecutionSpace = typename Policy::execution_space;
+  int team_size =
+      4 < ExecutionSpace().concurrency() ? 4 : ExecutionSpace().concurrency();
+#ifdef KOKKOS_ENABLE_HPX
+  team_size = 1;
+#endif
+#ifdef KOKKOS_ENABLE_OPENMPTARGET
+  if (std::is_same<ExecutionSpace, Kokkos::Experimental::OpenMPTarget>::value)
+    team_size = 32;
+#endif
+  int chunk_size         = 4;
+  int per_team_scratch   = 1024;
+  int per_thread_scratch = 16;
+  int scratch_size       = per_team_scratch + per_thread_scratch * team_size;
+
+  Policy p1(league_size, team_size);
+  ASSERT_EQ(p1.league_size(), league_size);
+  ASSERT_EQ(p1.team_size(), team_size);
+  ASSERT_GT(p1.chunk_size(), 0);
+  ASSERT_EQ(p1.scratch_size(0), 0u);
+
+  Policy p2 = p1.set_chunk_size(chunk_size);
+  ASSERT_EQ(p1.league_size(), league_size);
+  ASSERT_EQ(p1.team_size(), team_size);
+  ASSERT_EQ(p1.chunk_size(), chunk_size);
+  ASSERT_EQ(p1.scratch_size(0), 0u);
+
+  ASSERT_EQ(p2.league_size(), league_size);
+  ASSERT_EQ(p2.team_size(), team_size);
+  ASSERT_EQ(p2.chunk_size(), chunk_size);
+  ASSERT_EQ(p2.scratch_size(0), 0u);
+
+  Policy p3 = p2.set_scratch_size(0, Kokkos::PerTeam(per_team_scratch));
+  ASSERT_EQ(p2.league_size(), league_size);
+  ASSERT_EQ(p2.team_size(), team_size);
+  ASSERT_EQ(p2.chunk_size(), chunk_size);
+  ASSERT_EQ(p2.scratch_size(0), size_t(per_team_scratch));
+  ASSERT_EQ(p3.league_size(), league_size);
+  ASSERT_EQ(p3.team_size(), team_size);
+  ASSERT_EQ(p3.chunk_size(), chunk_size);
+  ASSERT_EQ(p3.scratch_size(0), size_t(per_team_scratch));
+
+  Policy p4 = p2.set_scratch_size(0, Kokkos::PerThread(per_thread_scratch));
+  ASSERT_EQ(p2.league_size(), league_size);
+  ASSERT_EQ(p2.team_size(), team_size);
+  ASSERT_EQ(p2.chunk_size(), chunk_size);
+  ASSERT_EQ(p2.scratch_size(0), size_t(scratch_size));
+  ASSERT_EQ(p4.league_size(), league_size);
+  ASSERT_EQ(p4.team_size(), team_size);
+  ASSERT_EQ(p4.chunk_size(), chunk_size);
+  ASSERT_EQ(p4.scratch_size(0), size_t(scratch_size));
+
+  Policy p5 = p2.set_scratch_size(0, Kokkos::PerThread(per_thread_scratch),
+                                  Kokkos::PerTeam(per_team_scratch));
+  ASSERT_EQ(p2.league_size(), league_size);
+  ASSERT_EQ(p2.team_size(), team_size);
+  ASSERT_EQ(p2.chunk_size(), chunk_size);
+  ASSERT_EQ(p2.scratch_size(0), size_t(scratch_size));
+  ASSERT_EQ(p5.league_size(), league_size);
+  ASSERT_EQ(p5.team_size(), team_size);
+  ASSERT_EQ(p5.chunk_size(), chunk_size);
+  ASSERT_EQ(p5.scratch_size(0), size_t(scratch_size));
+
+  Policy p6 = p2.set_scratch_size(0, Kokkos::PerTeam(per_team_scratch),
+                                  Kokkos::PerThread(per_thread_scratch));
+  ASSERT_EQ(p2.league_size(), league_size);
+  ASSERT_EQ(p2.team_size(), team_size);
+  ASSERT_EQ(p2.chunk_size(), chunk_size);
+  ASSERT_EQ(p2.scratch_size(0), size_t(scratch_size));
+  ASSERT_EQ(p6.league_size(), league_size);
+  ASSERT_EQ(p6.team_size(), team_size);
+  ASSERT_EQ(p6.chunk_size(), chunk_size);
+  ASSERT_EQ(p6.scratch_size(0), size_t(scratch_size));
+
+  Policy p7 = p3.set_scratch_size(0, Kokkos::PerTeam(per_team_scratch),
+                                  Kokkos::PerThread(per_thread_scratch));
+  ASSERT_EQ(p3.league_size(), league_size);
+  ASSERT_EQ(p3.team_size(), team_size);
+  ASSERT_EQ(p3.chunk_size(), chunk_size);
+  ASSERT_EQ(p3.scratch_size(0), size_t(scratch_size));
+  ASSERT_EQ(p7.league_size(), league_size);
+  ASSERT_EQ(p7.team_size(), team_size);
+  ASSERT_EQ(p7.chunk_size(), chunk_size);
+  ASSERT_EQ(p7.scratch_size(0), size_t(scratch_size));
+
+  Policy p8;  // default constructed
+  ASSERT_EQ(p8.league_size(), 0);
+  ASSERT_EQ(p8.scratch_size(0), 0u);
+  p8 = p3;  // call assignment operator
+  ASSERT_EQ(p3.league_size(), league_size);
+  ASSERT_EQ(p3.team_size(), team_size);
+  ASSERT_EQ(p3.chunk_size(), chunk_size);
+  ASSERT_EQ(p3.scratch_size(0), size_t(scratch_size));
+  ASSERT_EQ(p8.league_size(), league_size);
+  ASSERT_EQ(p8.team_size(), team_size);
+  ASSERT_EQ(p8.chunk_size(), chunk_size);
+  ASSERT_EQ(p8.scratch_size(0), size_t(scratch_size));
+}
+
+TEST(TEST_CATEGORY, team_policy_runtime_parameters) {
+  struct SomeTag {};
+
+  using TestExecSpace   = TEST_EXECSPACE;
+  using DynamicSchedule = Kokkos::Schedule<Kokkos::Dynamic>;
+  using LongIndex       = Kokkos::IndexType<long>;
+
+  // clang-format off
+  test_run_time_parameters<Kokkos::TeamPolicy<TestExecSpace                                             >>();
+  test_run_time_parameters<Kokkos::TeamPolicy<TestExecSpace,   DynamicSchedule, LongIndex               >>();
+  test_run_time_parameters<Kokkos::TeamPolicy<LongIndex,       TestExecSpace,   DynamicSchedule         >>();
+  test_run_time_parameters<Kokkos::TeamPolicy<DynamicSchedule, LongIndex,       TestExecSpace,   SomeTag>>();
+  // clang-format on
+}
+
+}  // namespace
diff --git a/packages/kokkos/core/unit_test/TestTeamReductionScan.hpp b/packages/kokkos/core/unit_test/TestTeamReductionScan.hpp
index 4d4f3b1f4d34eeae219b9436922162f7279ac8ca..f8f56ad0d85128941dd96fbaa6ef16e6b39f2924 100644
--- a/packages/kokkos/core/unit_test/TestTeamReductionScan.hpp
+++ b/packages/kokkos/core/unit_test/TestTeamReductionScan.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_TEAM_REDUCTION_SCAN_HPP
 #define KOKKOS_TEST_TEAM_REDUCTION_SCAN_HPP
diff --git a/packages/kokkos/core/unit_test/TestTeamScan.hpp b/packages/kokkos/core/unit_test/TestTeamScan.hpp
index b93285b21e2b09dcc22dd718b35626a20fb5b8ec..cec36236d848be12644d4c1ccd60d415986c74e1 100644
--- a/packages/kokkos/core/unit_test/TestTeamScan.hpp
+++ b/packages/kokkos/core/unit_test/TestTeamScan.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <impl/Kokkos_Stacktrace.hpp>
diff --git a/packages/kokkos/core/unit_test/TestTeamScratch.hpp b/packages/kokkos/core/unit_test/TestTeamScratch.hpp
index bab937273ddee06bb55b17b4fefc567c98bac30b..3fdf81e04408d4a551f6222d229e7753e8965ae8 100644
--- a/packages/kokkos/core/unit_test/TestTeamScratch.hpp
+++ b/packages/kokkos/core/unit_test/TestTeamScratch.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_TEAM_SCRATCH_HPP
 #define KOKKOS_TEST_TEAM_SCRATCH_HPP
diff --git a/packages/kokkos/core/unit_test/TestTeamTeamSize.hpp b/packages/kokkos/core/unit_test/TestTeamTeamSize.hpp
index 5e637616c9a0240fc7350d903e6add0783a4a033..7a6a4dd581929be1a44e655d1084794ac324c83e 100644
--- a/packages/kokkos/core/unit_test/TestTeamTeamSize.hpp
+++ b/packages/kokkos/core/unit_test/TestTeamTeamSize.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <cstdio>
 #include <sstream>
diff --git a/packages/kokkos/core/unit_test/TestTeamVector.hpp b/packages/kokkos/core/unit_test/TestTeamVector.hpp
index 8c302f9307c7b4f6eaa5b10e8cf935c89da36293..15410bb63fa115e3e008a9e8641e481996c482d0 100644
--- a/packages/kokkos/core/unit_test/TestTeamVector.hpp
+++ b/packages/kokkos/core/unit_test/TestTeamVector.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 
@@ -729,8 +701,8 @@ bool Test(int test) {
 #else
   int team_size = 33;
 #endif
-  if (team_size > int(ExecutionSpace::concurrency()))
-    team_size = int(ExecutionSpace::concurrency());
+  int const concurrency = ExecutionSpace().concurrency();
+  if (team_size > concurrency) team_size = concurrency;
   passed = passed && test_scalar<int, ExecutionSpace>(317, team_size, test);
   passed = passed &&
            test_scalar<long long int, ExecutionSpace>(317, team_size, test);
@@ -770,8 +742,9 @@ class TestTripleNestedReduce {
 
   void run_test(const size_type &nrows, const size_type &ncols,
                 size_type team_size, const size_type &vector_length) {
-    if (team_size > size_type(DeviceType::execution_space::concurrency()))
-      team_size = size_type(DeviceType::execution_space::concurrency());
+    auto const concurrency =
+        static_cast<size_type>(execution_space().concurrency());
+    if (team_size > concurrency) team_size = concurrency;
 
 #ifdef KOKKOS_ENABLE_HPX
     team_size = 1;
@@ -978,7 +951,7 @@ struct checkScan {
       }
     }
     for (int i = 0; i < host_outputs.extent_int(0); ++i)
-      ASSERT_EQ(host_outputs(i), expected(i));
+      ASSERT_EQ(host_outputs(i), expected(i)) << "differ at index " << i;
   }
 };
 }  // namespace VectorScanReducer
@@ -987,7 +960,10 @@ struct checkScan {
 TEST(TEST_CATEGORY, team_vector) {
   ASSERT_TRUE((TestTeamVector::Test<TEST_EXECSPACE>(0)));
   ASSERT_TRUE((TestTeamVector::Test<TEST_EXECSPACE>(1)));
+#if !(defined(KOKKOS_ENABLE_CUDA) && \
+      defined(KOKKOS_COMPILER_NVHPC))  // FIXME_NVHPC
   ASSERT_TRUE((TestTeamVector::Test<TEST_EXECSPACE>(2)));
+#endif
   ASSERT_TRUE((TestTeamVector::Test<TEST_EXECSPACE>(3)));
   ASSERT_TRUE((TestTeamVector::Test<TEST_EXECSPACE>(4)));
   ASSERT_TRUE((TestTeamVector::Test<TEST_EXECSPACE>(5)));
@@ -1034,6 +1010,13 @@ TEST(TEST_CATEGORY, parallel_scan_with_reducers) {
   constexpr int n              = 1000000;
   constexpr int n_vector_range = 100;
 
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<TEST_EXECSPACE, Kokkos::Cuda>) {
+    GTEST_SKIP() << "All but max inclusive scan differ at index 101";
+  }
+#endif
+
   checkScan<TEST_EXECSPACE, ScanType::Exclusive, n, n_vector_range,
             Kokkos::Prod<T, TEST_EXECSPACE>>()
       .run();
diff --git a/packages/kokkos/core/unit_test/TestTeamVectorRange.hpp b/packages/kokkos/core/unit_test/TestTeamVectorRange.hpp
index 44ffc7f3be4700948e66d385d9099215a1381953..bc7eb76932caed3938f578eadca62e52668ca2a0 100644
--- a/packages/kokkos/core/unit_test/TestTeamVectorRange.hpp
+++ b/packages/kokkos/core/unit_test/TestTeamVectorRange.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 
@@ -443,8 +415,8 @@ bool Test(int test) {
 #else
   int team_size = 33;
 #endif
-  if (team_size > int(ExecutionSpace::concurrency()))
-    team_size = int(ExecutionSpace::concurrency());
+  int const concurrency = ExecutionSpace().concurrency();
+  if (team_size > concurrency) team_size = concurrency;
   passed = passed && test_scalar<int, ExecutionSpace>(317, team_size, test);
   passed = passed &&
            test_scalar<long long int, ExecutionSpace>(317, team_size, test);
@@ -466,6 +438,12 @@ namespace Test {
 
 TEST(TEST_CATEGORY, team_teamvector_range) {
   ASSERT_TRUE((TestTeamVectorRange::Test<TEST_EXECSPACE>(0)));
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  if constexpr (std::is_same_v<TEST_EXECSPACE, Kokkos::Cuda>) {
+    GTEST_SKIP() << "Disabling 2/3rd of the test for now";
+  }
+#endif
   ASSERT_TRUE((TestTeamVectorRange::Test<TEST_EXECSPACE>(1)));
   // FIXME_OPENMPTARGET - Use of kokkos reducers currently results in runtime
   // memory errors.
diff --git a/packages/kokkos/core/unit_test/TestTypeList.cpp b/packages/kokkos/core/unit_test/TestTypeList.cpp
index e450d11562819c756334daeea91f3f448df624db..7057b8c3f70f1a01cb2ae4e0c0d1d804ee9864a2 100644
--- a/packages/kokkos/core/unit_test/TestTypeList.cpp
+++ b/packages/kokkos/core/unit_test/TestTypeList.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <impl/Kokkos_Utilities.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestUniqueToken.hpp b/packages/kokkos/core/unit_test/TestUniqueToken.hpp
index 224a97fef00330a8812590231295574501d1887a..55ea6eba61e4936b25b13b94c406bd30bcc5fdb7 100644
--- a/packages/kokkos/core/unit_test/TestUniqueToken.hpp
+++ b/packages/kokkos/core/unit_test/TestUniqueToken.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
@@ -221,7 +193,7 @@ class TestAcquireTeamUniqueToken {
   }
 
   TestAcquireTeamUniqueToken(int team_size)
-      : tokens(execution_space::concurrency() / team_size, execution_space()),
+      : tokens(execution_space().concurrency() / team_size, execution_space()),
         verify("TestAcquireTeamUniqueTokenVerify", tokens.size()),
         counts("TestAcquireTeamUniqueTokenCounts", tokens.size()),
         errors("TestAcquireTeamUniqueTokenErrors", 1) {}
diff --git a/packages/kokkos/core/unit_test/TestUtilities.hpp b/packages/kokkos/core/unit_test/TestUtilities.hpp
index cbe9b77af1bd8c2ca06a8b622221d5f4a0052956..8de5f5e0d16bee1532b557fffe042b3d33f00e87 100644
--- a/packages/kokkos/core/unit_test/TestUtilities.hpp
+++ b/packages/kokkos/core/unit_test/TestUtilities.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
@@ -69,22 +41,4 @@ void test_is_specialization_of() {
                 "");
 }
 
-template <std::size_t... Idxs, class... Args>
-std::size_t do_comma_emulation_test(std::integer_sequence<std::size_t, Idxs...>,
-                                    Args... args) {
-  // Count the bugs, since ASSERT_EQ is a statement and not an expression
-  std::size_t bugs = 0;
-  // Ensure in-order evaluation
-  std::size_t i = 0;
-  KOKKOS_IMPL_FOLD_COMMA_OPERATOR(bugs += std::size_t(Idxs != i++) /*, ...*/);
-  // Ensure expansion of multiple packs works
-  KOKKOS_IMPL_FOLD_COMMA_OPERATOR(bugs += std::size_t(Idxs != args) /*, ...*/);
-  return bugs;
-}
-
-TEST(utilities, comma_operator_emulation) {
-  ASSERT_EQ(0u, do_comma_emulation_test(std::make_index_sequence<5>{}, 0, 1, 2,
-                                        3, 4));
-}
-
 }  // namespace Test
diff --git a/packages/kokkos/core/unit_test/TestViewAPI.hpp b/packages/kokkos/core/unit_test/TestViewAPI.hpp
index 320eb6f2ea9bed603fa22547e511f8cf5655cc08..767f6e5e49c2355d097d2f997c2856fdd3fc1319 100644
--- a/packages/kokkos/core/unit_test/TestViewAPI.hpp
+++ b/packages/kokkos/core/unit_test/TestViewAPI.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/TestViewAPI_a.hpp b/packages/kokkos/core/unit_test/TestViewAPI_a.hpp
index 048ba51c17001a0a65027922c7132eb239d5b8ea..994ab9c1cf609645e18b3c81053e4c17b3945495 100644
--- a/packages/kokkos/core/unit_test/TestViewAPI_a.hpp
+++ b/packages/kokkos/core/unit_test/TestViewAPI_a.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestViewAPI.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestViewAPI_b.hpp b/packages/kokkos/core/unit_test/TestViewAPI_b.hpp
index 5cd9446a1cd52ed0a57d3d9c27389d82f21c0e19..e66ed70ef49b63e659e038759ba7e4a2c77e86d5 100644
--- a/packages/kokkos/core/unit_test/TestViewAPI_b.hpp
+++ b/packages/kokkos/core/unit_test/TestViewAPI_b.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestViewAPI.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestViewAPI_c.hpp b/packages/kokkos/core/unit_test/TestViewAPI_c.hpp
index a70792dc623b63bb8aa1a84fec93ca413ffa94a1..5efbd95bc94e4d287452ec4fb6651ea077d94fd8 100644
--- a/packages/kokkos/core/unit_test/TestViewAPI_c.hpp
+++ b/packages/kokkos/core/unit_test/TestViewAPI_c.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestViewAPI.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestViewAPI_d.hpp b/packages/kokkos/core/unit_test/TestViewAPI_d.hpp
index ecb65804b7900d773e0018f4763a0a3d60aa566b..08d21f54499fcd77b4ba02b6c4a098e855b4d8f7 100644
--- a/packages/kokkos/core/unit_test/TestViewAPI_d.hpp
+++ b/packages/kokkos/core/unit_test/TestViewAPI_d.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestViewAPI.hpp>
 
@@ -55,6 +27,9 @@ TEST(TEST_CATEGORY, view_api_d) {
 }
 
 TEST(TEST_CATEGORY, view_allocation_error) {
+#if ((HIP_VERSION_MAJOR == 5) && (HIP_VERSION_MINOR == 3))
+  GTEST_SKIP() << "ROCm 5.3 segfaults when trying to allocate too much memory";
+#endif
   TestViewAPI<double, TEST_EXECSPACE>::run_test_error();
 }
 
diff --git a/packages/kokkos/core/unit_test/TestViewAPI_e.hpp b/packages/kokkos/core/unit_test/TestViewAPI_e.hpp
index 2dfde085733a8077616cb56a024c5e7084f4d928..df66396ab845f212edd507ec926afc2195b193b4 100644
--- a/packages/kokkos/core/unit_test/TestViewAPI_e.hpp
+++ b/packages/kokkos/core/unit_test/TestViewAPI_e.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
@@ -58,10 +30,9 @@ TEST(TEST_CATEGORY, view_remap) {
   std::conditional<std::is_same<TEST_EXECSPACE, Kokkos::Cuda>::value, \
                    Kokkos::CudaHostPinnedSpace, TEST_EXECSPACE>::type
 #elif defined(KOKKOS_ENABLE_HIP)
-#define EXECSPACE                                                     \
-  std::conditional<                                                   \
-      std::is_same<TEST_EXECSPACE, Kokkos::Experimental::HIP>::value, \
-      Kokkos::Experimental::HIPHostPinnedSpace, TEST_EXECSPACE>::type
+#define EXECSPACE                                                    \
+  std::conditional<std::is_same<TEST_EXECSPACE, Kokkos::HIP>::value, \
+                   Kokkos::HIPHostPinnedSpace, TEST_EXECSPACE>::type
 #elif defined(KOKKOS_ENABLE_SYCL)
 #define EXECSPACE                                                      \
   std::conditional<                                                    \
diff --git a/packages/kokkos/core/unit_test/TestViewCopy_a.hpp b/packages/kokkos/core/unit_test/TestViewCopy_a.hpp
index ced0aa3828cffabfc196fd9dac146718c0f005d3..3bfc93aadacf721e5c6c77ffd54208eb3113acaf 100644
--- a/packages/kokkos/core/unit_test/TestViewCopy_a.hpp
+++ b/packages/kokkos/core/unit_test/TestViewCopy_a.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <cstdio>
 
@@ -223,6 +195,7 @@ TEST(TEST_CATEGORY, view_copy_tests) {
     Kokkos::deep_copy(dev, b, h_b);
     ASSERT_TRUE(run_check(b, 4));
   }
+
   // Non contiguous copies
   {
     Kokkos::deep_copy(dev, s_a, 5);
diff --git a/packages/kokkos/core/unit_test/TestViewCopy_b.hpp b/packages/kokkos/core/unit_test/TestViewCopy_b.hpp
index 79647caa90a11ed93f13e32aa49226b12ebd8707..4b155c4c7fc4dcb9b83dc90fcfe1ef4b28dd14b1 100644
--- a/packages/kokkos/core/unit_test/TestViewCopy_b.hpp
+++ b/packages/kokkos/core/unit_test/TestViewCopy_b.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <cstdio>
 
diff --git a/packages/kokkos/core/unit_test/TestViewCtorDimMatch.hpp b/packages/kokkos/core/unit_test/TestViewCtorDimMatch.hpp
index e1eb88dba11fee8d03476c0272fac585b7d79135..ff62eaecccf13ef456e588982cb3ce9a7359a738 100644
--- a/packages/kokkos/core/unit_test/TestViewCtorDimMatch.hpp
+++ b/packages/kokkos/core/unit_test/TestViewCtorDimMatch.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-// Kokkos v. 3.0
-// Copyright (2020) National Technology & Engineering
-// Solutions of Sandia, LLC (NTESS).
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 #include <Kokkos_Core.hpp>
diff --git a/packages/kokkos/core/unit_test/TestViewCtorPropEmbeddedDim.hpp b/packages/kokkos/core/unit_test/TestViewCtorPropEmbeddedDim.hpp
index d6b3c33ebe1872c6c740d13e46c46ac7256ad59c..1ab28208f310a2034ad395a5f7b16be0fee67c6c 100644
--- a/packages/kokkos/core/unit_test/TestViewCtorPropEmbeddedDim.hpp
+++ b/packages/kokkos/core/unit_test/TestViewCtorPropEmbeddedDim.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <cstdio>
 
diff --git a/packages/kokkos/core/unit_test/TestViewHooks.hpp b/packages/kokkos/core/unit_test/TestViewHooks.hpp
index ac679bedbdf6f06f1d2431242c9c3a6e4e3bf5dc..da9ea42e5fb224b2793b2bddc0c9aaca2decc360 100644
--- a/packages/kokkos/core/unit_test/TestViewHooks.hpp
+++ b/packages/kokkos/core/unit_test/TestViewHooks.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 #ifndef TESTVIEWHOOKS_HPP_
 #define TESTVIEWHOOKS_HPP_
 
diff --git a/packages/kokkos/core/unit_test/TestViewIsAssignable.hpp b/packages/kokkos/core/unit_test/TestViewIsAssignable.hpp
index 3ac392d3e98860fe536a07fbff43cc7d5fc1aecd..0221569b226938434533eb5dd21e54dfa81bbd56 100644
--- a/packages/kokkos/core/unit_test/TestViewIsAssignable.hpp
+++ b/packages/kokkos/core/unit_test/TestViewIsAssignable.hpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #include <Kokkos_Core.hpp>
 
 namespace Test {
@@ -128,7 +144,6 @@ TEST(TEST_CATEGORY, view_is_assignable) {
 
   // reference type and const-qualified types
   using SomeViewType = View<int*, left, d_exec>;
-#if defined(KOKKOS_ENABLE_CXX17)
   static_assert(is_always_assignable_v<SomeViewType, SomeViewType>);
   static_assert(is_always_assignable_v<SomeViewType, SomeViewType&>);
   static_assert(is_always_assignable_v<SomeViewType, SomeViewType const>);
@@ -137,19 +152,5 @@ TEST(TEST_CATEGORY, view_is_assignable) {
   static_assert(is_always_assignable_v<SomeViewType&, SomeViewType&>);
   static_assert(is_always_assignable_v<SomeViewType&, SomeViewType const>);
   static_assert(is_always_assignable_v<SomeViewType&, SomeViewType const&>);
-#else
-  static_assert(is_always_assignable<SomeViewType, SomeViewType>::value, "");
-  static_assert(is_always_assignable<SomeViewType, SomeViewType&>::value, "");
-  static_assert(is_always_assignable<SomeViewType, SomeViewType const>::value,
-                "");
-  static_assert(is_always_assignable<SomeViewType, SomeViewType const&>::value,
-                "");
-  static_assert(is_always_assignable<SomeViewType&, SomeViewType>::value, "");
-  static_assert(is_always_assignable<SomeViewType&, SomeViewType&>::value, "");
-  static_assert(is_always_assignable<SomeViewType&, SomeViewType const>::value,
-                "");
-  static_assert(is_always_assignable<SomeViewType&, SomeViewType const&>::value,
-                "");
-#endif
 }
 }  // namespace Test
diff --git a/packages/kokkos/core/unit_test/TestViewLayoutStrideAssignment.hpp b/packages/kokkos/core/unit_test/TestViewLayoutStrideAssignment.hpp
index a8d28933af44b5c784bbf21d45648467354dce54..865f87efae36dca5949d47801462f31ee3a144dc 100644
--- a/packages/kokkos/core/unit_test/TestViewLayoutStrideAssignment.hpp
+++ b/packages/kokkos/core/unit_test/TestViewLayoutStrideAssignment.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/TestViewLayoutTiled.hpp b/packages/kokkos/core/unit_test/TestViewLayoutTiled.hpp
index b0fabddbfc7424a7852e452a73ccaee428ab8646..67308212ee0feb391a1d1bfb0244bc6c6f9d301f 100644
--- a/packages/kokkos/core/unit_test/TestViewLayoutTiled.hpp
+++ b/packages/kokkos/core/unit_test/TestViewLayoutTiled.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
 #define KOKKOS_IMPL_PUBLIC_INCLUDE
diff --git a/packages/kokkos/core/unit_test/TestViewMapping_a.hpp b/packages/kokkos/core/unit_test/TestViewMapping_a.hpp
index 5a54a93619a819bf2a460a4f377f23867df371bf..9df044ec7a4b7fd70097fcdf6e6029b1fc371dd5 100644
--- a/packages/kokkos/core/unit_test/TestViewMapping_a.hpp
+++ b/packages/kokkos/core/unit_test/TestViewMapping_a.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/TestViewMapping_b.hpp b/packages/kokkos/core/unit_test/TestViewMapping_b.hpp
index b6f83e2f26649123fd68320346030b056a5e6bf5..9ac4e7da8453eea1363a3ea5bfd94c7b79d80717 100644
--- a/packages/kokkos/core/unit_test/TestViewMapping_b.hpp
+++ b/packages/kokkos/core/unit_test/TestViewMapping_b.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/TestViewMapping_subview.hpp b/packages/kokkos/core/unit_test/TestViewMapping_subview.hpp
index 0dd6a8d52134bb05b1cb392eee07f1bdf506ba6d..069ad09da98f8088a35bd2a5f1103c8ad9778da9 100644
--- a/packages/kokkos/core/unit_test/TestViewMapping_subview.hpp
+++ b/packages/kokkos/core/unit_test/TestViewMapping_subview.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/TestViewMemoryAccessViolation.hpp b/packages/kokkos/core/unit_test/TestViewMemoryAccessViolation.hpp
index aeab9dbcb9f61739755c38c50de136de3f66a119..cdd90426eb4ce2c9ae9ddc83be3e9776902e47e2 100644
--- a/packages/kokkos/core/unit_test/TestViewMemoryAccessViolation.hpp
+++ b/packages/kokkos/core/unit_test/TestViewMemoryAccessViolation.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 
@@ -198,11 +170,6 @@ TEST(TEST_CATEGORY_DEATH, view_memory_access_violations_from_device) {
     GTEST_SKIP() << "skipping since no memory access violation would occur";
   }
 
-#if defined(KOKKOS_IMPL_HIP_ABORT_DOES_NOT_PRINT_MESSAGE)
-  if (std::is_same<ExecutionSpace, Kokkos::Experimental::HIP>::value) {
-    GTEST_SKIP() << "skipping because not yet supported with HIP toolchain";
-  }
-#endif
 #if defined(KOKKOS_ENABLE_SYCL) && defined(NDEBUG)  // FIXME_SYCL
   if (std::is_same<ExecutionSpace, Kokkos::Experimental::SYCL>::value) {
     GTEST_SKIP() << "skipping SYCL device-side abort does not work when NDEBUG "
diff --git a/packages/kokkos/core/unit_test/TestViewOfClass.hpp b/packages/kokkos/core/unit_test/TestViewOfClass.hpp
index e9128debf7d3ba9c8edf841e3565ce528691ba54..e1edd3d7dc094a060bc8c68816d0c501c8cddce3 100644
--- a/packages/kokkos/core/unit_test/TestViewOfClass.hpp
+++ b/packages/kokkos/core/unit_test/TestViewOfClass.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/TestViewResize.hpp b/packages/kokkos/core/unit_test/TestViewResize.hpp
index 36214c2c6580f2aacab2f694c03b8acf07316f50..d056c960ecdc30851b79e84e03ed3314674130d6 100644
--- a/packages/kokkos/core/unit_test/TestViewResize.hpp
+++ b/packages/kokkos/core/unit_test/TestViewResize.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 #ifndef TESTVIEWRESIZE_HPP_
 #define TESTVIEWRESIZE_HPP_
 
diff --git a/packages/kokkos/core/unit_test/TestViewSpaceAssign.hpp b/packages/kokkos/core/unit_test/TestViewSpaceAssign.hpp
index b7c50d63621e09e97880d7f1ab8fc67288c60eaa..f49edf9260b65efbed7719baaaa1a2161b685c20 100644
--- a/packages/kokkos/core/unit_test/TestViewSpaceAssign.hpp
+++ b/packages/kokkos/core/unit_test/TestViewSpaceAssign.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/TestViewSubview.hpp b/packages/kokkos/core/unit_test/TestViewSubview.hpp
index 3114d41be3c586bf96f8fffa8f94454bddc66391..eb0050a6827900385723b6f6b220f275b5510653 100644
--- a/packages/kokkos/core/unit_test/TestViewSubview.hpp
+++ b/packages/kokkos/core/unit_test/TestViewSubview.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 #ifndef TESTVIEWSUBVIEW_HPP_
 #define TESTVIEWSUBVIEW_HPP_
 #include <gtest/gtest.h>
@@ -164,8 +136,9 @@ struct fill_2D {
 
 template <class Layout, class Space>
 void test_auto_1d() {
-  using mv_type   = Kokkos::View<double**, Layout, Space>;
-  using size_type = typename mv_type::size_type;
+  using mv_type         = Kokkos::View<double**, Layout, Space>;
+  using execution_space = typename Space::execution_space;
+  using size_type       = typename mv_type::size_type;
 
   const double ZERO = 0.0;
   const double ONE  = 1.0;
@@ -178,7 +151,14 @@ void test_auto_1d() {
   typename mv_type::HostMirror X_h = Kokkos::create_mirror_view(X);
 
   fill_2D<mv_type, Space> f1(X, ONE);
-  Kokkos::parallel_for(X.extent(0), f1);
+#if (HIP_VERSION_MAJOR == 5) && (HIP_VERSION_MINOR == 3)
+  using Property =
+      Kokkos::Experimental::WorkItemProperty::ImplForceGlobalLaunch_t;
+#else
+  using Property = Kokkos::Experimental::WorkItemProperty::None_t;
+#endif
+  Kokkos::parallel_for(
+      Kokkos::RangePolicy<execution_space, Property>(0, X.extent(0)), f1);
   Kokkos::fence();
   Kokkos::deep_copy(X_h, X);
   for (size_type j = 0; j < numCols; ++j) {
@@ -188,7 +168,8 @@ void test_auto_1d() {
   }
 
   fill_2D<mv_type, Space> f2(X, 0.0);
-  Kokkos::parallel_for(X.extent(0), f2);
+  Kokkos::parallel_for(
+      Kokkos::RangePolicy<execution_space, Property>(0, X.extent(0)), f2);
   Kokkos::fence();
   Kokkos::deep_copy(X_h, X);
   for (size_type j = 0; j < numCols; ++j) {
@@ -198,7 +179,8 @@ void test_auto_1d() {
   }
 
   fill_2D<mv_type, Space> f3(X, TWO);
-  Kokkos::parallel_for(X.extent(0), f3);
+  Kokkos::parallel_for(
+      Kokkos::RangePolicy<execution_space, Property>(0, X.extent(0)), f3);
   Kokkos::fence();
   Kokkos::deep_copy(X_h, X);
   for (size_type j = 0; j < numCols; ++j) {
@@ -211,7 +193,8 @@ void test_auto_1d() {
     auto X_j = Kokkos::subview(X, Kokkos::ALL, j);
 
     fill_1D<decltype(X_j), Space> f4(X_j, ZERO);
-    Kokkos::parallel_for(X_j.extent(0), f4);
+    Kokkos::parallel_for(
+        Kokkos::RangePolicy<execution_space, Property>(0, X_j.extent(0)), f4);
     Kokkos::fence();
     Kokkos::deep_copy(X_h, X);
     for (size_type i = 0; i < numRows; ++i) {
@@ -221,7 +204,9 @@ void test_auto_1d() {
     for (size_type jj = 0; jj < numCols; ++jj) {
       auto X_jj = Kokkos::subview(X, Kokkos::ALL, jj);
       fill_1D<decltype(X_jj), Space> f5(X_jj, ONE);
-      Kokkos::parallel_for(X_jj.extent(0), f5);
+      Kokkos::parallel_for(
+          Kokkos::RangePolicy<execution_space, Property>(0, X_jj.extent(0)),
+          f5);
       Kokkos::fence();
       Kokkos::deep_copy(X_h, X);
       for (size_type i = 0; i < numRows; ++i) {
diff --git a/packages/kokkos/core/unit_test/TestViewTypeTraits.cpp b/packages/kokkos/core/unit_test/TestViewTypeTraits.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..8f4e0e579eea1ca9ccf561ae23e5112d5a2c1c6a
--- /dev/null
+++ b/packages/kokkos/core/unit_test/TestViewTypeTraits.cpp
@@ -0,0 +1,50 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#include <Kokkos_Core.hpp>
+
+#include <type_traits>
+
+namespace {
+
+constexpr bool test_view_rank() {
+  // clang-format off
+  static_assert(Kokkos::View<int         >::rank == 0);
+  static_assert(Kokkos::View<int[1]      >::rank == 1);
+  static_assert(Kokkos::View<int *       >::rank == 1);
+  static_assert(Kokkos::View<int[1][2]   >::rank == 2);
+  static_assert(Kokkos::View<int * [1]   >::rank == 2);
+  static_assert(Kokkos::View<int *  *    >::rank == 2);
+  static_assert(Kokkos::View<int[1][2][3]>::rank == 3);
+  static_assert(Kokkos::View<int * [1][2]>::rank == 3);
+  static_assert(Kokkos::View<int *  * [1]>::rank == 3);
+  static_assert(Kokkos::View<int *  *  * >::rank == 3);
+  // clang-format on
+  return true;
+}
+static_assert(test_view_rank());
+
+constexpr bool test_is_view_type_trait() {
+  struct NotView {};
+  static_assert(Kokkos::is_view<Kokkos::View<int>>::value);
+  static_assert(Kokkos::is_view_v<Kokkos::View<int>>);
+  static_assert(!Kokkos::is_view_v<NotView>);
+  static_assert(!Kokkos::is_view<NotView>::value);
+  return true;
+}
+static_assert(test_is_view_type_trait());
+
+}  // namespace
diff --git a/packages/kokkos/core/unit_test/TestView_64bit.hpp b/packages/kokkos/core/unit_test/TestView_64bit.hpp
index 174a07ac1d5b6ca6e9ddc145617ea86bf51de314..f30fe2d13275fd03497ae1a055285b35a60452f0 100644
--- a/packages/kokkos/core/unit_test/TestView_64bit.hpp
+++ b/packages/kokkos/core/unit_test/TestView_64bit.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 
diff --git a/packages/kokkos/core/unit_test/TestWindowsInclude.cpp b/packages/kokkos/core/unit_test/TestWindowsInclude.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1db8068a3e992b29b6f421513b86d5edde295f13
--- /dev/null
+++ b/packages/kokkos/core/unit_test/TestWindowsInclude.cpp
@@ -0,0 +1,21 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+// as we use min and max as names in our headers and these are defined as macros
+// in windows.h, we added a pragma push to disable them at the beginning of
+// Kokkos_Core and pop them back into existence at the end.
+#include <windows.h>
+#include <Kokkos_Core.hpp>
diff --git a/packages/kokkos/core/unit_test/TestWithoutInitializing.hpp b/packages/kokkos/core/unit_test/TestWithoutInitializing.hpp
index 2bf93ab3f67d75911bb0aa7218cf1ed9f1cdeed9..0509cc62b9641f56bd83a7691503a56f092f4eb1 100644
--- a/packages/kokkos/core/unit_test/TestWithoutInitializing.hpp
+++ b/packages/kokkos/core/unit_test/TestWithoutInitializing.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 
@@ -242,6 +214,12 @@ TEST(TEST_CATEGORY, deep_copy_zero_memset) {
     GTEST_SKIP() << "skipping since the OpenMPTarget backend doesn't implement "
                     "ZeroMemset";
 #endif
+// FIXME_OPENACC: The OpenACC backend doesn't implement ZeroMemset
+#ifdef KOKKOS_ENABLE_OPENACC
+  if (std::is_same<TEST_EXECSPACE, Kokkos::Experimental::OpenACC>::value)
+    GTEST_SKIP() << "skipping since the OpenACC backend doesn't implement "
+                    "ZeroMemset";
+#endif
 
   using namespace Kokkos::Test::Tools;
   listen_tool_events(Config::DisableAll(), Config::EnableKernels());
@@ -361,3 +339,13 @@ TEST(TEST_CATEGORY, view_allocation_exec_space_int) {
   ASSERT_TRUE(success);
   listen_tool_events(Config::DisableAll());
 }
+
+struct NotDefaultConstructible {
+  NotDefaultConstructible() = delete;
+};
+
+TEST(TEST_CATEGORY, view_not_default_constructible) {
+  using Space = TEST_EXECSPACE;
+  Kokkos::View<NotDefaultConstructible, Space> my_view(Kokkos::view_alloc(
+      "not_default_constructible", Kokkos::WithoutInitializing));
+}
diff --git a/packages/kokkos/core/unit_test/TestWorkGraph.hpp b/packages/kokkos/core/unit_test/TestWorkGraph.hpp
index 472af3a0444a3d78a9361640399967535d15d704..9e0b8b7f25ca698f0a16bf82807bfaab434f6b46 100644
--- a/packages/kokkos/core/unit_test/TestWorkGraph.hpp
+++ b/packages/kokkos/core/unit_test/TestWorkGraph.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <vector>
 #include <iostream>
@@ -159,12 +131,7 @@ struct TestWorkGraph {
 }  // anonymous namespace
 
 TEST(TEST_CATEGORY, workgraph_fib) {
-  // FIXME_HIP The test is very slow with HIP and it causes the CI to timeout
-#ifdef KOKKOS_ENABLE_HIP
-  int limit = 7;
-#else
   int limit = 27;
-#endif
   for (int i = 0; i < limit; ++i) {
     TestWorkGraph<TEST_EXECSPACE> f(i);
     f.test_for();
diff --git a/packages/kokkos/core/unit_test/Test_InterOp_Streams.hpp b/packages/kokkos/core/unit_test/Test_InterOp_Streams.hpp
index 6af731b9fa3e037598123add65071c1efa341187..4d3d63954f6b0bf73ea9a6d7abd1c7ae9479b2c4 100644
--- a/packages/kokkos/core/unit_test/Test_InterOp_Streams.hpp
+++ b/packages/kokkos/core/unit_test/Test_InterOp_Streams.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 
diff --git a/packages/kokkos/core/unit_test/UnitTestMain.cpp b/packages/kokkos/core/unit_test/UnitTestMain.cpp
index a70409105f0b43a9fe07c102b626dce7cf803410..da37ff823b16e7b443db34676dcd256f3eddb0e6 100644
--- a/packages/kokkos/core/unit_test/UnitTestMain.cpp
+++ b/packages/kokkos/core/unit_test/UnitTestMain.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 #include <cstdlib>
diff --git a/packages/kokkos/core/unit_test/UnitTestMainInit.cpp b/packages/kokkos/core/unit_test/UnitTestMainInit.cpp
index 140ba418fdac4eda95ed362a9b5bf64e50676cc2..0bf647012ac64a64fde6218e4f49aad0b47e2f89 100644
--- a/packages/kokkos/core/unit_test/UnitTestMainInit.cpp
+++ b/packages/kokkos/core/unit_test/UnitTestMainInit.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 #include <cstdlib>
diff --git a/packages/kokkos/core/unit_test/UnitTest_CMakePassCmdLineArgs.cpp b/packages/kokkos/core/unit_test/UnitTest_CMakePassCmdLineArgs.cpp
index 7525f8d2b4b939702b9b361b107b12e57826cb65..3a552bc31e32fef3f5eeb15cc7559d3df744ebb2 100644
--- a/packages/kokkos/core/unit_test/UnitTest_CMakePassCmdLineArgs.cpp
+++ b/packages/kokkos/core/unit_test/UnitTest_CMakePassCmdLineArgs.cpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #include <string>
 
 struct Up {};
diff --git a/packages/kokkos/core/unit_test/UnitTest_DeviceAndThreads.cpp b/packages/kokkos/core/unit_test/UnitTest_DeviceAndThreads.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2b3c90ef2aed7825dd3200f7a6635861616ec06f
--- /dev/null
+++ b/packages/kokkos/core/unit_test/UnitTest_DeviceAndThreads.cpp
@@ -0,0 +1,110 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#include <Kokkos_Core.hpp>
+#include <iostream>
+#include <string>
+#include <thread>
+
+int get_device_count() {
+#if defined(KOKKOS_ENABLE_CUDA)
+  int count;
+  KOKKOS_IMPL_CUDA_SAFE_CALL(cudaGetDeviceCount(&count));
+  return count;
+#elif defined(KOKKOS_ENABLE_HIP)
+  int count;
+  KOKKOS_IMPL_HIP_SAFE_CALL(hipGetDevice(&count));
+  return count;
+#elif defined(KOKKOS_ENABLE_OPENMPTARGET)
+  return omp_get_num_devices();
+#elif defined(KOKKOS_ENABLE_OPENACC)
+  return acc_get_num_devices(acc_get_device_type());
+#else
+  return 0;
+#endif
+}
+
+int get_device_id() {
+#if defined(KOKKOS_ENABLE_CUDA)
+  int device;
+  KOKKOS_IMPL_CUDA_SAFE_CALL(cudaGetDevice(&device));
+  return device;
+#elif defined(KOKKOS_ENABLE_HIP)
+  int device_id;
+  KOKKOS_IMPL_HIP_SAFE_CALL(hipGetDevice(&device_id));
+  return device_id;
+#elif defined(KOKKOS_ENABLE_OPENMPTARGET)
+  return omp_get_device_num();
+#elif defined(KOKKOS_ENABLE_OPENACC)
+  return acc_get_device_num(acc_get_device_type());
+#else
+  return -1;
+#endif
+}
+
+int get_max_threads() {
+#if defined(KOKKOS_ENABLE_OPENMP)
+  return omp_get_max_threads();
+#elif defined(KOKKOS_ENABLE_THREADS)
+  return std::thread::hardware_concurrency();
+#else
+  return 1;
+#endif
+}
+
+int get_num_threads() {
+  return Kokkos::DefaultHostExecutionSpace().concurrency();
+}
+
+int get_disable_warnings() { return !Kokkos::show_warnings(); }
+
+int get_tune_internals() { return Kokkos::tune_internals(); }
+
+int print_flag(std::string const& flag) {
+  std::vector<std::string> valid_flags;
+#define KOKKOS_TEST_PRINT_FLAG(NAME)   \
+  if (flag == #NAME) {                 \
+    std::cout << get_##NAME() << '\n'; \
+    return EXIT_SUCCESS;               \
+  }                                    \
+  valid_flags.push_back(#NAME)
+
+  KOKKOS_TEST_PRINT_FLAG(num_threads);
+  KOKKOS_TEST_PRINT_FLAG(max_threads);
+  KOKKOS_TEST_PRINT_FLAG(device_id);
+  KOKKOS_TEST_PRINT_FLAG(device_count);
+  KOKKOS_TEST_PRINT_FLAG(disable_warnings);
+  KOKKOS_TEST_PRINT_FLAG(tune_internals);
+
+#undef KOKKOS_TEST_PRINT_FLAG
+
+  std::cerr << "Invalid flag name " << flag << ".  Valid names are ";
+  for (int i = 0; i < (int)valid_flags.size() - 1; ++i) {
+    std::cerr << valid_flags[i] << ", ";
+  }
+  std::cerr << "and " << valid_flags.back() << ".\n";
+  return EXIT_FAILURE;
+}
+
+int main(int argc, char* argv[]) {
+  Kokkos::ScopeGuard guard(argc, argv);
+  if (argc != 2) {
+    std::cerr << "Usage: <executable> NAME_OF_FLAG\n";
+    return EXIT_FAILURE;
+  }
+  int exit_code = print_flag(argv[1]);
+  return exit_code;
+}
diff --git a/packages/kokkos/core/unit_test/UnitTest_PushFinalizeHook.cpp b/packages/kokkos/core/unit_test/UnitTest_PushFinalizeHook.cpp
index 1b99691e6d13dc23c0cc94f653cd6b91c069c82d..3a30de4d7a42b23336f9c8ff0cd6dc6efe56a4f2 100644
--- a/packages/kokkos/core/unit_test/UnitTest_PushFinalizeHook.cpp
+++ b/packages/kokkos/core/unit_test/UnitTest_PushFinalizeHook.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <cstdlib>
 #include <exception>
diff --git a/packages/kokkos/core/unit_test/UnitTest_PushFinalizeHook_terminate.cpp b/packages/kokkos/core/unit_test/UnitTest_PushFinalizeHook_terminate.cpp
index 442310542be36bf40c495336d287d37812c9b83c..e58f17beef80f604621bcf57755488aa922f58c3 100644
--- a/packages/kokkos/core/unit_test/UnitTest_PushFinalizeHook_terminate.cpp
+++ b/packages/kokkos/core/unit_test/UnitTest_PushFinalizeHook_terminate.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <cstdlib>
 #include <iostream>
diff --git a/packages/kokkos/core/unit_test/category_files/TestCudaHostPinned_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestCudaHostPinned_Category.hpp
index 3f8ec6bacf209f9fe3fc0739170b359dfb986f36..28704de29ea619f333c9def78443a9ab45bd28dc 100644
--- a/packages/kokkos/core/unit_test/category_files/TestCudaHostPinned_Category.hpp
+++ b/packages/kokkos/core/unit_test/category_files/TestCudaHostPinned_Category.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_CUDAHOSTPINNED_HPP
 #define KOKKOS_TEST_CUDAHOSTPINNED_HPP
diff --git a/packages/kokkos/core/unit_test/category_files/TestCudaUVM_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestCudaUVM_Category.hpp
index ff53e5a719a7274e8d38b93259286e14bc44d27a..7197065b6542f255054ce119ec6d70c6244544db 100644
--- a/packages/kokkos/core/unit_test/category_files/TestCudaUVM_Category.hpp
+++ b/packages/kokkos/core/unit_test/category_files/TestCudaUVM_Category.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_CUDAUVM_HPP
 #define KOKKOS_TEST_CUDAUVM_HPP
diff --git a/packages/kokkos/core/unit_test/category_files/TestCuda_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestCuda_Category.hpp
index 22666dc82fab611ee08aa7555e9b56ae0b2f148a..191d0a11afa9b187b1b64680e8ac29f9b83578a5 100644
--- a/packages/kokkos/core/unit_test/category_files/TestCuda_Category.hpp
+++ b/packages/kokkos/core/unit_test/category_files/TestCuda_Category.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_CUDA_HPP
 #define KOKKOS_TEST_CUDA_HPP
diff --git a/packages/kokkos/core/unit_test/category_files/TestDefaultDeviceType_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestDefaultDeviceType_Category.hpp
index 57a0e0ee006460a59c71d5fbccfbd87c2c754653..5d8fb496f0e8995606751409e7917593d6da3264 100644
--- a/packages/kokkos/core/unit_test/category_files/TestDefaultDeviceType_Category.hpp
+++ b/packages/kokkos/core/unit_test/category_files/TestDefaultDeviceType_Category.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_DEFAULTDEVICETYPE_HPP
 #define KOKKOS_TEST_DEFAULTDEVICETYPE_HPP
diff --git a/packages/kokkos/core/unit_test/category_files/TestHIPHostPinned_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestHIPHostPinned_Category.hpp
index dace3924a32e43427b23ffccabd80d16df731685..c00a717ee1ec26ae398b0301ac29cfb9a2a4d5f7 100644
--- a/packages/kokkos/core/unit_test/category_files/TestHIPHostPinned_Category.hpp
+++ b/packages/kokkos/core/unit_test/category_files/TestHIPHostPinned_Category.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_HIPHOSTPINNED_HPP
 #define KOKKOS_TEST_HIPHOSTPINNED_HPP
@@ -49,6 +21,6 @@
 
 #define TEST_CATEGORY hip_hostpinned
 #define TEST_CATEGORY_DEATH hip_hostpinned_DeathTest
-#define TEST_EXECSPACE Kokkos::Experimental::HIPHostPinnedSpace
+#define TEST_EXECSPACE Kokkos::HIPHostPinnedSpace
 
 #endif
diff --git a/packages/kokkos/core/unit_test/category_files/TestHIPManaged_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestHIPManaged_Category.hpp
index 1ff88a4841b2ef032c38775a23a33f3c64c918f2..9cf14ef0ef6054084056b35664551a92816929df 100644
--- a/packages/kokkos/core/unit_test/category_files/TestHIPManaged_Category.hpp
+++ b/packages/kokkos/core/unit_test/category_files/TestHIPManaged_Category.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_HIPUNIFIED_HPP
 #define KOKKOS_TEST_HIPUNIFIED_HPP
@@ -49,6 +21,6 @@
 
 #define TEST_CATEGORY hip_managed
 #define TEST_CATEGORY_DEATH hip_managed_DeathTest
-#define TEST_EXECSPACE Kokkos::Experimental::HIPManagedSpace
+#define TEST_EXECSPACE Kokkos::HIPManagedSpace
 
 #endif
diff --git a/packages/kokkos/core/unit_test/category_files/TestHIP_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestHIP_Category.hpp
index a0a34f5c954d58e24e2a85867a94d04e4eee7ca6..adaed3281ab4a7d64ce73d349e682e2d3a15b75b 100644
--- a/packages/kokkos/core/unit_test/category_files/TestHIP_Category.hpp
+++ b/packages/kokkos/core/unit_test/category_files/TestHIP_Category.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_HIP_HPP
 #define KOKKOS_TEST_HIP_HPP
@@ -50,6 +22,6 @@
 #define TEST_CATEGORY hip
 #define TEST_CATEGORY_NUMBER 6
 #define TEST_CATEGORY_DEATH hip_DeathTest
-#define TEST_EXECSPACE Kokkos::Experimental::HIP
+#define TEST_EXECSPACE Kokkos::HIP
 
 #endif
diff --git a/packages/kokkos/core/unit_test/category_files/TestHPX_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestHPX_Category.hpp
index 401794c43177a4304817318bb6ed88ce1ff1dd88..d3a7cdbea530ff655770a6fd96b7f0bffae0ed0b 100644
--- a/packages/kokkos/core/unit_test/category_files/TestHPX_Category.hpp
+++ b/packages/kokkos/core/unit_test/category_files/TestHPX_Category.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_HPX_HPP
 #define KOKKOS_TEST_HPX_HPP
diff --git a/packages/kokkos/core/unit_test/category_files/TestOpenACC_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestOpenACC_Category.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..0c4e4b7e11953be5be1eefce5d453e08c605ce55
--- /dev/null
+++ b/packages/kokkos/core/unit_test/category_files/TestOpenACC_Category.hpp
@@ -0,0 +1,27 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_TEST_OACC_HPP
+#define KOKKOS_TEST_OACC_HPP
+
+#include <gtest/gtest.h>
+
+#define TEST_CATEGORY openacc
+#define TEST_CATEGORY_NUMBER 8
+#define TEST_CATEGORY_DEATH openacc_DeathTest
+#define TEST_EXECSPACE Kokkos::Experimental::OpenACC
+
+#endif
diff --git a/packages/kokkos/core/unit_test/category_files/TestOpenMPTarget_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestOpenMPTarget_Category.hpp
index 4d3d14e245099e11986d7fdcb83e5cb4289c5d23..235b34ffab78d214301d35cbf2452dff9da0e377 100644
--- a/packages/kokkos/core/unit_test/category_files/TestOpenMPTarget_Category.hpp
+++ b/packages/kokkos/core/unit_test/category_files/TestOpenMPTarget_Category.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_OMPTARGET_HPP
 #define KOKKOS_TEST_OMPTARGET_HPP
diff --git a/packages/kokkos/core/unit_test/category_files/TestOpenMP_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestOpenMP_Category.hpp
index 98b8b9f515d128ca3fb9fd239f7d3b5ab5131e0b..22924ad1974948b24f8e6349c7ef650d076279f2 100644
--- a/packages/kokkos/core/unit_test/category_files/TestOpenMP_Category.hpp
+++ b/packages/kokkos/core/unit_test/category_files/TestOpenMP_Category.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_OMP_HPP
 #define KOKKOS_TEST_OMP_HPP
diff --git a/packages/kokkos/core/unit_test/category_files/TestSYCLHostUSM_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestSYCLHostUSM_Category.hpp
index 4c1996bfaa73eea936d8f3a6e15340ebd5408fb8..465b066c32c98c242c52bbd0a4d18c4c40430184 100644
--- a/packages/kokkos/core/unit_test/category_files/TestSYCLHostUSM_Category.hpp
+++ b/packages/kokkos/core/unit_test/category_files/TestSYCLHostUSM_Category.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SYCL_HOST_USM_SPACE_HPP
 #define KOKKOS_TEST_SYCL_HOST_USM_SPACE_HPP
diff --git a/packages/kokkos/core/unit_test/category_files/TestSYCLSharedUSM_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestSYCLSharedUSM_Category.hpp
index 4421559180c4e83348419bea0172e25a79660766..e377f73eec28ca35ff873930bd3c9555f1a539f4 100644
--- a/packages/kokkos/core/unit_test/category_files/TestSYCLSharedUSM_Category.hpp
+++ b/packages/kokkos/core/unit_test/category_files/TestSYCLSharedUSM_Category.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SYCL_SHARED_USM_SPACE_HPP
 #define KOKKOS_TEST_SYCL_SHARED_USM_SPACE_HPP
diff --git a/packages/kokkos/core/unit_test/category_files/TestSYCL_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestSYCL_Category.hpp
index efa84ad39f0ad5f12e96c2eb5a908fb505ba5bd5..8e1b18c9acd9b69509f1793f9563699ddcd43052 100644
--- a/packages/kokkos/core/unit_test/category_files/TestSYCL_Category.hpp
+++ b/packages/kokkos/core/unit_test/category_files/TestSYCL_Category.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SYCL_HPP
 #define KOKKOS_TEST_SYCL_HPP
diff --git a/packages/kokkos/core/unit_test/category_files/TestSerial_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestSerial_Category.hpp
index b2e0f96f446bd9c67c57f4dd0c7429f133f67bf8..0baf2b9265f5705cfa83c1ada65eeb131a90c0c3 100644
--- a/packages/kokkos/core/unit_test/category_files/TestSerial_Category.hpp
+++ b/packages/kokkos/core/unit_test/category_files/TestSerial_Category.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_SERIAL_HPP
 #define KOKKOS_TEST_SERIAL_HPP
diff --git a/packages/kokkos/core/unit_test/category_files/TestThreads_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestThreads_Category.hpp
index b7ca7c826b090649e9e49cc26b3a1bf8b9b45894..13b0b653f21ec3061ffe0084fe9f52b10f6c98f6 100644
--- a/packages/kokkos/core/unit_test/category_files/TestThreads_Category.hpp
+++ b/packages/kokkos/core/unit_test/category_files/TestThreads_Category.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_THREADS_HPP
 #define KOKKOS_TEST_THREADS_HPP
diff --git a/packages/kokkos/core/unit_test/configuration/test-code/CMakeLists.txt b/packages/kokkos/core/unit_test/configuration/test-code/CMakeLists.txt
index 759d59a07dd9e9268fb7d818b4dc50f564845805..551588f642da0c9c271ff0eff99e6e6c10bb159d 100644
--- a/packages/kokkos/core/unit_test/configuration/test-code/CMakeLists.txt
+++ b/packages/kokkos/core/unit_test/configuration/test-code/CMakeLists.txt
@@ -19,8 +19,8 @@
 # The CMake variables CMAKE_CXX_STANDARD and CMAKE_CXX_EXTENSIONS are
 # respected.  We recommend that you set CMAKE_CXX_EXTENSIONS to OFF.
 # Otherwise, CMake defaults to using extensions for the C++ standard, and the
-# GNU extensions (-std=gnu++14) will be used for compilers that support it
-# instead of standard C++14 (-std=c++14).
+# GNU extensions (-std=gnu++17) will be used for compilers that support it
+# instead of standard C++17 (-std=c++17).
 #
 # A bunch of build options are added as variables (all starting with KOKKOS_)
 # to the build.  Check them out using ccmake or the CMake GUI.
diff --git a/packages/kokkos/core/unit_test/configuration/test-code/main.cpp b/packages/kokkos/core/unit_test/configuration/test-code/main.cpp
index 0d2f6de3a9f6cc70bf9d6ebb83d46780405a2b89..69af1d7ae9d3142bc3af477004183fd623560bac 100644
--- a/packages/kokkos/core/unit_test/configuration/test-code/main.cpp
+++ b/packages/kokkos/core/unit_test/configuration/test-code/main.cpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #include <Kokkos_Core.hpp>
 
 int main(int argc, char* argv[]) {
diff --git a/packages/kokkos/core/unit_test/cuda/TestCuda_DebugPinUVMSpace.cpp b/packages/kokkos/core/unit_test/cuda/TestCuda_DebugPinUVMSpace.cpp
index 5b6fccdbd0a500cbb0d45574879a797c866d1b55..5814b36509f8eac2dcbe009caf4284de63b568f3 100644
--- a/packages/kokkos/core/unit_test/cuda/TestCuda_DebugPinUVMSpace.cpp
+++ b/packages/kokkos/core/unit_test/cuda/TestCuda_DebugPinUVMSpace.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestCuda_Category.hpp>
diff --git a/packages/kokkos/core/unit_test/cuda/TestCuda_DebugSerialExecution.cpp b/packages/kokkos/core/unit_test/cuda/TestCuda_DebugSerialExecution.cpp
index f1d3dfc5245d971b6b90ca3ef11731e34b538f67..15d197bb86198343663b9113cfa267fef28e4061 100644
--- a/packages/kokkos/core/unit_test/cuda/TestCuda_DebugSerialExecution.cpp
+++ b/packages/kokkos/core/unit_test/cuda/TestCuda_DebugSerialExecution.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestCuda_Category.hpp>
diff --git a/packages/kokkos/core/unit_test/cuda/TestCuda_Graph.cpp b/packages/kokkos/core/unit_test/cuda/TestCuda_Graph.cpp
index 77b1e58a1586482b029f89298c7273cfccc95a7d..272036396905722ab04982c7526d229da40a79a0 100644
--- a/packages/kokkos/core/unit_test/cuda/TestCuda_Graph.cpp
+++ b/packages/kokkos/core/unit_test/cuda/TestCuda_Graph.cpp
@@ -1,47 +1,18 @@
-
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestCuda_Category.hpp>
 #include <TestGraph.hpp>
diff --git a/packages/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp b/packages/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp
index 31fd63f08437520614c54714fd611d1bd87db9e3..0ed0e19b5e51961b5e6b8e21f46739c3b017d857 100644
--- a/packages/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp
+++ b/packages/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestCuda_Category.hpp>
@@ -59,9 +31,11 @@ __global__ void offset(int* p) {
 // Test whether allocations survive Kokkos initialize/finalize if done via Raw
 // Cuda.
 TEST(cuda, raw_cuda_interop) {
+  // Make sure that we use the same device for all allocations
+  Kokkos::initialize();
+
   int* p;
   KOKKOS_IMPL_CUDA_SAFE_CALL(cudaMalloc(&p, sizeof(int) * 100));
-  Kokkos::initialize();
 
   Kokkos::View<int*, Kokkos::MemoryTraits<Kokkos::Unmanaged>> v(p, 100);
   Kokkos::deep_copy(v, 5);
diff --git a/packages/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp b/packages/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp
index f11f657e004d7955dc1cdcff8518ad4b58e443d6..b48a08a9a34617763236f4ab5f05bf8b07022120 100644
--- a/packages/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp
+++ b/packages/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestCuda_Category.hpp>
 #include <Test_InterOp_Streams.hpp>
@@ -48,9 +20,11 @@
 namespace Test {
 // Test Interoperability with Cuda Streams
 TEST(cuda, raw_cuda_streams) {
+  // Make sure that we use the same device for all allocations
+  Kokkos::initialize();
+
   cudaStream_t stream;
   cudaStreamCreate(&stream);
-  Kokkos::initialize();
   int* p;
   cudaMalloc(&p, sizeof(int) * 100);
   using MemorySpace = typename TEST_EXECSPACE::memory_space;
diff --git a/packages/kokkos/core/unit_test/cuda/TestCuda_ReducerViewSizeLimit.cpp b/packages/kokkos/core/unit_test/cuda/TestCuda_ReducerViewSizeLimit.cpp
index b8ae97f5861b9d0552d1014b58a5041bd9e20c4c..fea91a39b8486b4f76875eda3564f0226177ab7e 100644
--- a/packages/kokkos/core/unit_test/cuda/TestCuda_ReducerViewSizeLimit.cpp
+++ b/packages/kokkos/core/unit_test/cuda/TestCuda_ReducerViewSizeLimit.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestCuda_Category.hpp>
 #include <Kokkos_Core.hpp>
diff --git a/packages/kokkos/core/unit_test/cuda/TestCuda_Spaces.cpp b/packages/kokkos/core/unit_test/cuda/TestCuda_Spaces.cpp
index 2fa61d43120d338bac3c475fc7cf35e9aeb06776..407aa60a0a645172120ac644fbd47caacbe7d8ca 100644
--- a/packages/kokkos/core/unit_test/cuda/TestCuda_Spaces.cpp
+++ b/packages/kokkos/core/unit_test/cuda/TestCuda_Spaces.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestCuda_Category.hpp>
@@ -260,20 +232,18 @@ TEST(cuda, space_access) {
 }
 
 TEST(cuda, uvm) {
-  if (Kokkos::CudaUVMSpace::available()) {
-    int *uvm_ptr = static_cast<int *>(
-        Kokkos::kokkos_malloc<Kokkos::CudaUVMSpace>("uvm_ptr", sizeof(int)));
+  int *uvm_ptr = static_cast<int *>(
+      Kokkos::kokkos_malloc<Kokkos::CudaUVMSpace>("uvm_ptr", sizeof(int)));
 
-    *uvm_ptr = 42;
+  *uvm_ptr = 42;
 
-    Kokkos::Cuda().fence();
-    test_cuda_spaces_int_value<<<1, 1>>>(uvm_ptr);
-    Kokkos::Cuda().fence();
+  Kokkos::fence();
+  test_cuda_spaces_int_value<<<1, 1>>>(uvm_ptr);
+  Kokkos::fence();
 
-    EXPECT_EQ(*uvm_ptr, int(2 * 42));
+  EXPECT_EQ(*uvm_ptr, int(2 * 42));
 
-    Kokkos::kokkos_free<Kokkos::CudaUVMSpace>(uvm_ptr);
-  }
+  Kokkos::kokkos_free<Kokkos::CudaUVMSpace>(uvm_ptr);
 }
 
 template <class MemSpace, class ExecSpace>
@@ -368,8 +338,83 @@ struct TestViewCudaTexture {
 };
 
 TEST(cuda, impl_view_texture) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC
+  GTEST_SKIP()
+      << "Getting error_count of 1000 meaning all assertions are failing";
+#endif
   TestViewCudaTexture<Kokkos::CudaSpace>::run();
   TestViewCudaTexture<Kokkos::CudaUVMSpace>::run();
 }
 
+// couldn't create a random-access subview of a view of const T in Kokkos::Cuda
+namespace issue_5594 {
+
+template <typename View>
+struct InitFunctor {
+  InitFunctor(const View &view) : view_(view) {}
+  KOKKOS_INLINE_FUNCTION
+  void operator()(int i) const { view_(i) = i; }
+  View view_;
+};
+
+template <typename V1, typename V2>
+struct Issue5594Functor {
+  Issue5594Functor(const V1 &v1) : v1_(v1) {}
+  KOKKOS_INLINE_FUNCTION
+  void operator()(int i, int &lerr) const {
+    V2 v2(&v1_(0),
+          v1_.size());  // failure here -- create subview in execution space
+    lerr += v1_(i) != v2(i);  // check that subview is correct
+  }
+  V1 v1_;
+};
+
+template <typename View>
+View create_view() {
+  using execution_space = typename View::execution_space;
+  View view("", 10);
+  InitFunctor iota(view);
+  Kokkos::parallel_for("test_view_subview_const_randomaccess",
+                       Kokkos::RangePolicy<execution_space>(0, view.extent(0)),
+                       iota);
+  return view;
+}
+
+// creating a RandomAccess subview of a view of const T in Kokkos::Cuda
+template <typename Exec, typename Mem>
+void test_view_subview_const_randomaccess() {
+  using view_t         = Kokkos::View<int *, Mem>;
+  using view_const_t   = Kokkos::View<const int *, Mem>;
+  using u_view_const_t = Kokkos::View<
+      const int *, Mem,
+      Kokkos::MemoryTraits<Kokkos::Unmanaged | Kokkos::RandomAccess>>;
+
+  // create non-const view with known values
+  view_t nonConst = create_view<view_t>();
+  // get a const version of the values
+  view_const_t view(nonConst);
+
+  // create a subview in the execution space and check that it worked
+  Issue5594Functor<view_const_t, u_view_const_t> checker(view);
+  int errCount;
+  Kokkos::parallel_reduce("test_view_subview_const_randomaccess",
+                          Kokkos::RangePolicy<Exec>(0, view.extent(0)), checker,
+                          errCount);
+  EXPECT_TRUE(0 == errCount);
+}
+}  // namespace issue_5594
+
+TEST(cuda, view_subview_const_randomaccess) {
+#if defined(KOKKOS_ENABLE_CUDA) && \
+    defined(KOKKOS_COMPILER_NVHPC)  // FIXME_NVHPC (similar failure to
+                                    // TestViewCudaTexture?)
+  GTEST_SKIP() << "RandomAccess view not working on NVHPC?";
+#endif
+  issue_5594::test_view_subview_const_randomaccess<Kokkos::Cuda,
+                                                   Kokkos::CudaSpace>();
+  issue_5594::test_view_subview_const_randomaccess<Kokkos::Cuda,
+                                                   Kokkos::CudaUVMSpace>();
+}
+
 }  // namespace Test
diff --git a/packages/kokkos/core/unit_test/cuda/TestCuda_Task.cpp b/packages/kokkos/core/unit_test/cuda/TestCuda_Task.cpp
index 42fa615bc6f65f0661ceaad12c3613781a133a52..ac38923cb5b40fee3b0fc9752c0a8ea9468909d1 100644
--- a/packages/kokkos/core/unit_test/cuda/TestCuda_Task.cpp
+++ b/packages/kokkos/core/unit_test/cuda/TestCuda_Task.cpp
@@ -1,47 +1,18 @@
-
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestCuda_Category.hpp>
 #include <TestTaskScheduler.hpp>
diff --git a/packages/kokkos/core/unit_test/cuda/TestCuda_TeamScratchStreams.cpp b/packages/kokkos/core/unit_test/cuda/TestCuda_TeamScratchStreams.cpp
index eb9077aaf423b2bf9bdfa919d4d45cd18805d069..9ad338fc998013e0a9ea7da1e62720f7f9dd176a 100644
--- a/packages/kokkos/core/unit_test/cuda/TestCuda_TeamScratchStreams.cpp
+++ b/packages/kokkos/core/unit_test/cuda/TestCuda_TeamScratchStreams.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestCuda_Category.hpp>
 #include <Kokkos_Core.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceDevelop.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceDevelop.cpp
index b312f42b24369a725a44bdd1de1a2771e794959f..d85973ec155d59e43a29e101edfb4ef6cd8c46e2 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceDevelop.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceDevelop.cpp
@@ -1,47 +1,18 @@
-
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType.cpp
index 6d6ff0a67bc151421556fca487f30677a5119c33..4a70d9e79beb8b96fedb97471e66d9512027323f 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_1.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_1.cpp
index 0f53cf8de7908d3e4dc046cc5c9624fe90e3cb76..348b9feeab04b1bf12637c0fa8e0995550c1efca 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_1.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_1.cpp
@@ -1,2 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_01
 #include <TestDefaultDeviceTypeInit.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_10.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_10.cpp
index c4691edd9b70428844462dd27627bc29618556c8..a77a55ea65303e8a34f8bb17d4e8923e749382fb 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_10.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_10.cpp
@@ -1,2 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_10
 #include <TestDefaultDeviceTypeInit.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_11.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_11.cpp
index 6d999e6cca50f8765f2216c72625b00942d24cab..1b6a140920c85865cf458f408a2c42ee2496dbff 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_11.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_11.cpp
@@ -1,2 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_11
 #include <TestDefaultDeviceTypeInit.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_12.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_12.cpp
index 8b60a704af57c32af9cbf479e8b8475ffc69d543..316bc85526f4cd947d55b1dd594b95ee8756d036 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_12.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_12.cpp
@@ -1,2 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_12
 #include <TestDefaultDeviceTypeInit.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_13.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_13.cpp
index 22af90b95225798b8fe4c5456df8fe5d43aa67d8..6344960a1cfe9229557f694c24c2a1f7fe5d531d 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_13.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_13.cpp
@@ -1,2 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_13
 #include <TestDefaultDeviceTypeInit.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_14.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_14.cpp
index cbe7aa34c7b48d892528b1e2139b03cd3e979470..4515174b82b136b65cca1bfce7f7b0bb90a9a6ef 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_14.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_14.cpp
@@ -1,2 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_14
 #include <TestDefaultDeviceTypeInit.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_15.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_15.cpp
index 8aefe0b77a277edcf8ef1ca52e7b0e520ebdf638..7ead50f0944e0e5a78fc1172ed4dd746974c34d2 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_15.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_15.cpp
@@ -1,2 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_15
 #include <TestDefaultDeviceTypeInit.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_16.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_16.cpp
index 0023c903be9762a71077fa56c9ebf7852679051a..e12b9b3894aeb29da67ff78535c4207a93b83b98 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_16.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_16.cpp
@@ -1,2 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_16
 #include <TestDefaultDeviceTypeInit.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_17.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_17.cpp
index e2c6eed8309cd664e51c1776c3421bb1d40124df..959d0ab7503e15465fd06e0cf0beab510eecb58e 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_17.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_17.cpp
@@ -1,2 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_17
 #include <TestDefaultDeviceTypeInit.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_18.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_18.cpp
index 282634bc184786aa68537de9817a1bdc5f46b04a..07d841519dcf33e9d84e0d8bbcabfcb495056db4 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_18.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_18.cpp
@@ -1,2 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_18
 #include <TestDefaultDeviceTypeInit.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_2.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_2.cpp
index da3c5d381c0d97481874661f245fd3202039dea8..042a515b16acbc5c6656be06a8b92f6b669720e4 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_2.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_2.cpp
@@ -1,2 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_02
 #include <TestDefaultDeviceTypeInit.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_3.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_3.cpp
index ab55bf93aa91360fdce82248d8c282fc6aa6d32e..dba401e5bcf9fc2be70195f1bd19c40cfb4c04b4 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_3.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_3.cpp
@@ -1,2 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_03
 #include <TestDefaultDeviceTypeInit.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_4.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_4.cpp
index 02b637d6cdc16953e84dce595675738b9b0e2ab4..a44c58bdb55adb261e39af050df443493bc0fb23 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_4.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_4.cpp
@@ -1,2 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_04
 #include <TestDefaultDeviceTypeInit.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_5.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_5.cpp
index 0d6dbc52233d0b15618cd5c805cbab60ade6c034..cac0841dd8324de21722df8f3861acd1cb2a6303 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_5.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_5.cpp
@@ -1,2 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_05
 #include <TestDefaultDeviceTypeInit.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_6.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_6.cpp
index 148153944da29f710c8bd5829a50b1b3723bb44b..bafe3b3fd2af39bd626ec29fbdfdde40cc776bc3 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_6.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_6.cpp
@@ -1,2 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_06
 #include <TestDefaultDeviceTypeInit.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_7.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_7.cpp
index d7366577e9e64e078d08cac819c28da3cd26115b..3a4dd9d2533daa2019795085c0cc886927840051 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_7.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_7.cpp
@@ -1,2 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_07
 #include <TestDefaultDeviceTypeInit.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_8.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_8.cpp
index 72404d4328335b901cd5e65b1ecfc6c375dcf714..4e92aae565a3be70762c68c7e41c6b0dc9251fda 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_8.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_8.cpp
@@ -1,2 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_08
 #include <TestDefaultDeviceTypeInit.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_9.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_9.cpp
index 7e327677199a906ed0f48636e384d7a61af0c2e2..44b8f3428d920fb99f08b56d556040615e34c2a7 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_9.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_9.cpp
@@ -1,2 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_09
 #include <TestDefaultDeviceTypeInit.hpp>
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeResize.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeResize.cpp
index 7f53034557dca1c06bcbc6588ff7fdce6ddbb4c4..354520137638910dd11b5ca4271a812cbc9384a0 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeResize.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeResize.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 #include "TestResize.hpp"
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeViewAPI.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeViewAPI.cpp
index c0d6a8afe878c44791d3133352fdde343cb02810..96fffa0dc7ee22350bed9fa7250a32134f26decb 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeViewAPI.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeViewAPI.cpp
@@ -1,47 +1,18 @@
-
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a1.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a1.cpp
index 9b57de712183a7ff1fd72533f578c25947901f39..08268178686d3cfcbd55c415bfdc450ff03b71e4 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a1.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a1.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a2.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a2.cpp
index 314891433693df21689fedb2827dc8d614896383..9826bc777034ace50499d2c414051ada62f9a50d 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a2.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a2.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a3.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a3.cpp
index f9e36e298a227281683ceae0bf5bfe9179a6b8d5..ffca3961fc66fe30b255c932fab0582a140c35e2 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a3.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a3.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b1.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b1.cpp
index 1a34bef874f75ecf4a75a99166f7abc66ec1804c..944fe95083743118d19ddf738862ffb3b9c86fed 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b1.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b1.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b2.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b2.cpp
index 8bd7628243ab0e3c073d797cc2817ec2a4ba1185..979d0e56f604eb740595f5822364b56301149e65 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b2.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b2.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b3.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b3.cpp
index bc1d763437d1f4d23ae688fe94c16fcd7f9367f9..3a43735982b1f37a84ea8be45ddc8e7d3e6b8645 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b3.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b3.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c1.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c1.cpp
index ba4cca46fbb9d0883691a40ee53b8a11c739b4c5..8e9fefb347d3c71deb3790df36daca6681f91bff 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c1.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c1.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c2.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c2.cpp
index 0459f98dddb20e7cae811502e4ebf5518b011c6b..3004376804b330d315c9d4e9f28361d86d999971 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c2.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c2.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c3.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c3.cpp
index 801dee83bbe16b6b25398b27068e5d8a3b3d29e2..044e76173735dfbc237c55bd8f40f514f77cd5de 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c3.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c3.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_d.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_d.cpp
index c74090fff93c8b9a529fad2e5d156d4cad55b954..2bb378d294c4e3285692e1211a8d1328a438a93e 100644
--- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_d.cpp
+++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_d.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
diff --git a/packages/kokkos/core/unit_test/headers_self_contained/tstHeader.cpp b/packages/kokkos/core/unit_test/headers_self_contained/tstHeader.cpp
index 9f249045be9d85001f92abb5906383d570097460..5a558854c61714bc990058f821ca52101b9e3e62 100644
--- a/packages/kokkos/core/unit_test/headers_self_contained/tstHeader.cpp
+++ b/packages/kokkos/core/unit_test/headers_self_contained/tstHeader.cpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #define KOKKOS_HEADER_TEST_STRINGIZE_IMPL(x) #x
 #define KOKKOS_HEADER_TEST_STRINGIZE(x) KOKKOS_HEADER_TEST_STRINGIZE_IMPL(x)
 
diff --git a/packages/kokkos/core/unit_test/hip/TestHIP_AsyncLauncher.cpp b/packages/kokkos/core/unit_test/hip/TestHIP_AsyncLauncher.cpp
index 854f916ba3dad7777f453694ea708a0754872d3d..8142893748398dad07e943e7819055579c97ea56 100644
--- a/packages/kokkos/core/unit_test/hip/TestHIP_AsyncLauncher.cpp
+++ b/packages/kokkos/core/unit_test/hip/TestHIP_AsyncLauncher.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestHIP_Category.hpp>
@@ -69,10 +41,9 @@ TEST(hip, async_launcher) {
   KOKKOS_IMPL_HIP_SAFE_CALL(hipMalloc(&flag, sizeof(size_t)));
   KOKKOS_IMPL_HIP_SAFE_CALL(hipMemset(flag, 0, sizeof(size_t)));
   // launch # of cycles * 1000 kernels w/ distinct values
-  auto space        = Kokkos::Experimental::HIP();
-  auto instance     = space.impl_internal_space_instance();
-  size_t max_cycles = instance->m_maxDriverCycles;
-  size_t nkernels   = max_cycles * 1000;
+  auto space      = Kokkos::HIP();
+  auto instance   = space.impl_internal_space_instance();
+  size_t nkernels = 1000;
   for (size_t i = 0; i < nkernels; ++i) {
     TestAsyncLauncher(flag, i).run();
   }
diff --git a/packages/kokkos/core/unit_test/hip/TestHIP_BlocksizeDeduction.cpp b/packages/kokkos/core/unit_test/hip/TestHIP_BlocksizeDeduction.cpp
index f382e5b568b85cdac1f4943c72aa02be73472d7a..07df31a5e890d96a7d3312c254b9936fcf3a07e4 100644
--- a/packages/kokkos/core/unit_test/hip/TestHIP_BlocksizeDeduction.cpp
+++ b/packages/kokkos/core/unit_test/hip/TestHIP_BlocksizeDeduction.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestHIP_Category.hpp>
@@ -85,14 +57,14 @@ TEST(hip, preferred_blocksize_deduction) {
 
   {
     using DriverType = Kokkos::Impl::ParallelFor<TestNone, policy>;
-    ASSERT_TRUE(Kokkos::Experimental::Impl::HIPParallelLaunch<
-                    DriverType>::get_scratch_size() == 0);
+    ASSERT_TRUE(
+        Kokkos::Impl::HIPParallelLaunch<DriverType>::get_scratch_size() == 0);
   }
 
   {
     using DriverType = Kokkos::Impl::ParallelFor<TestSpiller, policy>;
-    ASSERT_TRUE(Kokkos::Experimental::Impl::HIPParallelLaunch<
-                    DriverType>::get_scratch_size() > 0);
+    ASSERT_TRUE(
+        Kokkos::Impl::HIPParallelLaunch<DriverType>::get_scratch_size() > 0);
   }
 }
 
diff --git a/packages/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp b/packages/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp
index af20e753d4c99ea9941d4bbd19aa61b7894d1f3a..6fab53e021a933517718fe7d39467c6cb9b073d5 100644
--- a/packages/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp
+++ b/packages/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestHIP_Category.hpp>
@@ -59,9 +31,11 @@ __global__ void offset(int* p) {
 // Test whether allocations survive Kokkos initialize/finalize if done via Raw
 // HIP.
 TEST(hip, raw_hip_interop) {
+  // Make sure that we use the same device for all allocations
+  Kokkos::initialize();
+
   int* p;
   KOKKOS_IMPL_HIP_SAFE_CALL(hipMalloc(&p, sizeof(int) * 100));
-  Kokkos::initialize();
 
   Kokkos::View<int*, Kokkos::MemoryTraits<Kokkos::Unmanaged>> v(p, 100);
   Kokkos::deep_copy(v, 5);
diff --git a/packages/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp b/packages/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp
index 95d102d4d1c2628ca4964d7598235bb531683912..29108059619978cfc6818b139c66e8c18f5be0be 100644
--- a/packages/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp
+++ b/packages/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestHIP_Category.hpp>
 #include <Test_InterOp_Streams.hpp>
@@ -50,9 +22,11 @@ namespace Test {
 // The difference with the CUDA tests are: raw HIP vs raw CUDA and no launch
 // bound in HIP due to an error when computing the block size.
 TEST(hip, raw_hip_streams) {
+  // Make sure that we use the same device for all allocations
+  Kokkos::initialize();
+
   hipStream_t stream;
   KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamCreate(&stream));
-  Kokkos::initialize();
   int* p;
   KOKKOS_IMPL_HIP_SAFE_CALL(hipMalloc(&p, sizeof(int) * 100));
   using MemorySpace = typename TEST_EXECSPACE::memory_space;
diff --git a/packages/kokkos/core/unit_test/hip/TestHIP_Memory_Requirements.cpp b/packages/kokkos/core/unit_test/hip/TestHIP_Memory_Requirements.cpp
index 24f48c6599876e9ee68949d65325e75d79590dcd..8c72e9f297241ceab6bc3b1e168235a714319f85 100644
--- a/packages/kokkos/core/unit_test/hip/TestHIP_Memory_Requirements.cpp
+++ b/packages/kokkos/core/unit_test/hip/TestHIP_Memory_Requirements.cpp
@@ -1,47 +1,18 @@
-
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestHIP_Category.hpp>
@@ -77,10 +48,8 @@ TEST(hip, memory_requirements) {
   // we want all user-facing memory in hip to be coarse grained. As of
   // today(07.01.22) the documentation is not reliable/correct, we test the
   // memory on the device and host
-  KOKKOS_TEST_MEMORY_COARSEGRAINEDNESS(Kokkos::Experimental::HIPSpace, int, 10);
-  KOKKOS_TEST_MEMORY_COARSEGRAINEDNESS(Kokkos::Experimental::HIPHostPinnedSpace,
-                                       int, 10);
-  KOKKOS_TEST_MEMORY_COARSEGRAINEDNESS(Kokkos::Experimental::HIPManagedSpace,
-                                       int, 10);
+  KOKKOS_TEST_MEMORY_COARSEGRAINEDNESS(Kokkos::HIPSpace, int, 10);
+  KOKKOS_TEST_MEMORY_COARSEGRAINEDNESS(Kokkos::HIPHostPinnedSpace, int, 10);
+  KOKKOS_TEST_MEMORY_COARSEGRAINEDNESS(Kokkos::HIPManagedSpace, int, 10);
 }
 }  // namespace
diff --git a/packages/kokkos/core/unit_test/hip/TestHIP_ScanUnit.cpp b/packages/kokkos/core/unit_test/hip/TestHIP_ScanUnit.cpp
index b44bc46fb7abc3cee5be16ec2a3fd3ce910aafa1..0b46d9742ac720dfddd5c2490da00e1886e66b06 100644
--- a/packages/kokkos/core/unit_test/hip/TestHIP_ScanUnit.cpp
+++ b/packages/kokkos/core/unit_test/hip/TestHIP_ScanUnit.cpp
@@ -1,47 +1,18 @@
-
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestHIP_Category.hpp>
@@ -62,8 +33,7 @@ __global__ void start_intra_block_scan()
   DummyFunctor f;
   typename Kokkos::Impl::FunctorAnalysis<
       Kokkos::Impl::FunctorPatternInterface::SCAN,
-      Kokkos::RangePolicy<Kokkos::Experimental::HIP>, DummyFunctor>::Reducer
-      reducer(&f);
+      Kokkos::RangePolicy<Kokkos::HIP>, DummyFunctor>::Reducer reducer(&f);
   Kokkos::Impl::hip_intra_block_reduce_scan<true>(reducer, values);
 
   __syncthreads();
@@ -82,9 +52,8 @@ void test_intra_block_scan() {
 }
 
 TEST(TEST_CATEGORY, scan_unit) {
-  if (std::is_same<
-          TEST_EXECSPACE,
-          typename Kokkos::Experimental::HIPSpace::execution_space>::value) {
+  if (std::is_same<TEST_EXECSPACE,
+                   typename Kokkos::HIPSpace::execution_space>::value) {
     test_intra_block_scan<1>();
     test_intra_block_scan<2>();
     test_intra_block_scan<4>();
diff --git a/packages/kokkos/core/unit_test/hip/TestHIP_Spaces.cpp b/packages/kokkos/core/unit_test/hip/TestHIP_Spaces.cpp
index c9b370ea7b4466e02b5b6e13da8515ac56fe45c4..14fd4e28837cd6ed690bf006ada187ebe74447cb 100644
--- a/packages/kokkos/core/unit_test/hip/TestHIP_Spaces.cpp
+++ b/packages/kokkos/core/unit_test/hip/TestHIP_Spaces.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestHIP_Category.hpp>
@@ -60,216 +32,193 @@ TEST(hip, space_access) {
                                                 Kokkos::HostSpace>::assignable,
                 "");
 
-  static_assert(Kokkos::Impl::MemorySpaceAccess<
-                    Kokkos::HostSpace,
-                    Kokkos::Experimental::HIPHostPinnedSpace>::assignable,
-                "");
-
   static_assert(
-      !Kokkos::Impl::MemorySpaceAccess<
-          Kokkos::HostSpace, Kokkos::Experimental::HIPSpace>::assignable,
+      Kokkos::Impl::MemorySpaceAccess<Kokkos::HostSpace,
+                                      Kokkos::HIPHostPinnedSpace>::assignable,
       "");
 
-  static_assert(
-      !Kokkos::Impl::MemorySpaceAccess<
-          Kokkos::HostSpace, Kokkos::Experimental::HIPSpace>::accessible,
-      "");
+  static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HostSpace,
+                                                 Kokkos::HIPSpace>::assignable,
+                "");
+
+  static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HostSpace,
+                                                 Kokkos::HIPSpace>::accessible,
+                "");
 
   static_assert(
-      !Kokkos::Impl::MemorySpaceAccess<
-          Kokkos::HostSpace, Kokkos::Experimental::HIPManagedSpace>::assignable,
+      !Kokkos::Impl::MemorySpaceAccess<Kokkos::HostSpace,
+                                       Kokkos::HIPManagedSpace>::assignable,
       "");
 
   static_assert(
-      Kokkos::Impl::MemorySpaceAccess<
-          Kokkos::HostSpace, Kokkos::Experimental::HIPManagedSpace>::accessible,
+      Kokkos::Impl::MemorySpaceAccess<Kokkos::HostSpace,
+                                      Kokkos::HIPManagedSpace>::accessible,
       "");
 
   //--------------------------------------
 
-  static_assert(Kokkos::Impl::MemorySpaceAccess<
-                    Kokkos::Experimental::HIPSpace,
-                    Kokkos::Experimental::HIPSpace>::assignable,
+  static_assert(Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPSpace,
+                                                Kokkos::HIPSpace>::assignable,
                 "");
 
-  static_assert(!Kokkos::Impl::MemorySpaceAccess<
-                    Kokkos::Experimental::HIPSpace,
-                    Kokkos::Experimental::HIPHostPinnedSpace>::assignable,
-                "");
+  static_assert(
+      !Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPSpace,
+                                       Kokkos::HIPHostPinnedSpace>::assignable,
+      "");
 
-  static_assert(Kokkos::Impl::MemorySpaceAccess<
-                    Kokkos::Experimental::HIPSpace,
-                    Kokkos::Experimental::HIPHostPinnedSpace>::accessible,
-                "");
+  static_assert(
+      Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPSpace,
+                                      Kokkos::HIPHostPinnedSpace>::accessible,
+      "");
 
-  static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::HIPSpace,
+  static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPSpace,
                                                  Kokkos::HostSpace>::assignable,
                 "");
 
-  static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::HIPSpace,
+  static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPSpace,
                                                  Kokkos::HostSpace>::accessible,
                 "");
 
-  static_assert(Kokkos::Impl::MemorySpaceAccess<
-                    Kokkos::Experimental::HIPSpace,
-                    Kokkos::Experimental::HIPManagedSpace>::assignable,
-                "");
-
-  static_assert(Kokkos::Impl::MemorySpaceAccess<
-                    Kokkos::Experimental::HIPSpace,
-                    Kokkos::Experimental::HIPManagedSpace>::accessible,
-                "");
-
-  //--------------------------------------
-
-  static_assert(Kokkos::Impl::MemorySpaceAccess<
-                    Kokkos::Experimental::HIPHostPinnedSpace,
-                    Kokkos::Experimental::HIPHostPinnedSpace>::assignable,
-                "");
+  static_assert(
+      Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPSpace,
+                                      Kokkos::HIPManagedSpace>::assignable,
+      "");
 
   static_assert(
-      !Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::HIPHostPinnedSpace,
-                                       Kokkos::HostSpace>::assignable,
+      Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPSpace,
+                                      Kokkos::HIPManagedSpace>::accessible,
       "");
 
+  //--------------------------------------
+
   static_assert(
-      Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::HIPHostPinnedSpace,
-                                      Kokkos::HostSpace>::accessible,
+      Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPHostPinnedSpace,
+                                      Kokkos::HIPHostPinnedSpace>::assignable,
       "");
 
-  static_assert(!Kokkos::Impl::MemorySpaceAccess<
-                    Kokkos::Experimental::HIPHostPinnedSpace,
-                    Kokkos::Experimental::HIPSpace>::assignable,
+  static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPHostPinnedSpace,
+                                                 Kokkos::HostSpace>::assignable,
                 "");
 
-  static_assert(!Kokkos::Impl::MemorySpaceAccess<
-                    Kokkos::Experimental::HIPHostPinnedSpace,
-                    Kokkos::Experimental::HIPSpace>::accessible,
+  static_assert(Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPHostPinnedSpace,
+                                                Kokkos::HostSpace>::accessible,
                 "");
 
-  static_assert(!Kokkos::Impl::MemorySpaceAccess<
-                    Kokkos::Experimental::HIPHostPinnedSpace,
-                    Kokkos::Experimental::HIPManagedSpace>::assignable,
+  static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPHostPinnedSpace,
+                                                 Kokkos::HIPSpace>::assignable,
                 "");
 
-  static_assert(Kokkos::Impl::MemorySpaceAccess<
-                    Kokkos::Experimental::HIPHostPinnedSpace,
-                    Kokkos::Experimental::HIPManagedSpace>::accessible,
+  static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPHostPinnedSpace,
+                                                 Kokkos::HIPSpace>::accessible,
                 "");
 
-  //--------------------------------------
-
-  static_assert(Kokkos::Impl::MemorySpaceAccess<
-                    Kokkos::Experimental::HIPManagedSpace,
-                    Kokkos::Experimental::HIPManagedSpace>::assignable,
-                "");
+  static_assert(
+      !Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPHostPinnedSpace,
+                                       Kokkos::HIPManagedSpace>::assignable,
+      "");
 
   static_assert(
-      !Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::HIPManagedSpace,
-                                       Kokkos::HostSpace>::assignable,
+      Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPHostPinnedSpace,
+                                      Kokkos::HIPManagedSpace>::accessible,
       "");
 
+  //--------------------------------------
+
   static_assert(
-      !Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::HIPManagedSpace,
-                                       Kokkos::HostSpace>::accessible,
+      Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPManagedSpace,
+                                      Kokkos::HIPManagedSpace>::assignable,
       "");
 
-  static_assert(!Kokkos::Impl::MemorySpaceAccess<
-                    Kokkos::Experimental::HIPManagedSpace,
-                    Kokkos::Experimental::HIPSpace>::assignable,
+  static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPManagedSpace,
+                                                 Kokkos::HostSpace>::assignable,
                 "");
 
-  static_assert(Kokkos::Impl::MemorySpaceAccess<
-                    Kokkos::Experimental::HIPManagedSpace,
-                    Kokkos::Experimental::HIPSpace>::accessible,
+  static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPManagedSpace,
+                                                 Kokkos::HostSpace>::accessible,
                 "");
 
-  static_assert(!Kokkos::Impl::MemorySpaceAccess<
-                    Kokkos::Experimental::HIPManagedSpace,
-                    Kokkos::Experimental::HIPHostPinnedSpace>::assignable,
+  static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPManagedSpace,
+                                                 Kokkos::HIPSpace>::assignable,
                 "");
 
-  static_assert(Kokkos::Impl::MemorySpaceAccess<
-                    Kokkos::Experimental::HIPManagedSpace,
-                    Kokkos::Experimental::HIPHostPinnedSpace>::accessible,
+  static_assert(Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPManagedSpace,
+                                                Kokkos::HIPSpace>::accessible,
                 "");
 
+  static_assert(
+      !Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPManagedSpace,
+                                       Kokkos::HIPHostPinnedSpace>::assignable,
+      "");
+
+  static_assert(
+      Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPManagedSpace,
+                                      Kokkos::HIPHostPinnedSpace>::accessible,
+      "");
+
   //--------------------------------------
 
-  static_assert(!Kokkos::SpaceAccessibility<Kokkos::Experimental::HIP,
-                                            Kokkos::HostSpace>::accessible,
-                "");
+  static_assert(
+      !Kokkos::SpaceAccessibility<Kokkos::HIP, Kokkos::HostSpace>::accessible,
+      "");
 
   static_assert(
-      Kokkos::SpaceAccessibility<Kokkos::Experimental::HIP,
-                                 Kokkos::Experimental::HIPSpace>::accessible,
+      Kokkos::SpaceAccessibility<Kokkos::HIP, Kokkos::HIPSpace>::accessible,
       "");
 
-  static_assert(Kokkos::SpaceAccessibility<
-                    Kokkos::Experimental::HIP,
-                    Kokkos::Experimental::HIPHostPinnedSpace>::accessible,
+  static_assert(
+      Kokkos::SpaceAccessibility<Kokkos::HIP,
+                                 Kokkos::HIPHostPinnedSpace>::accessible,
+      "");
+
+  static_assert(Kokkos::SpaceAccessibility<Kokkos::HIP,
+                                           Kokkos::HIPManagedSpace>::accessible,
                 "");
 
-  static_assert(Kokkos::SpaceAccessibility<
-                    Kokkos::Experimental::HIP,
-                    Kokkos::Experimental::HIPManagedSpace>::accessible,
+  static_assert(!Kokkos::SpaceAccessibility<Kokkos::HostSpace,
+                                            Kokkos::HIPSpace>::accessible,
                 "");
 
   static_assert(
-      !Kokkos::SpaceAccessibility<Kokkos::HostSpace,
-                                  Kokkos::Experimental::HIPSpace>::accessible,
+      Kokkos::SpaceAccessibility<Kokkos::HostSpace,
+                                 Kokkos::HIPHostPinnedSpace>::accessible,
       "");
 
-  static_assert(Kokkos::SpaceAccessibility<
-                    Kokkos::HostSpace,
-                    Kokkos::Experimental::HIPHostPinnedSpace>::accessible,
+  static_assert(Kokkos::SpaceAccessibility<Kokkos::HostSpace,
+                                           Kokkos::HIPManagedSpace>::accessible,
                 "");
 
-  static_assert(
-      Kokkos::SpaceAccessibility<
-          Kokkos::HostSpace, Kokkos::Experimental::HIPManagedSpace>::accessible,
-      "");
+  static_assert(std::is_same<Kokkos::Impl::HostMirror<Kokkos::HIPSpace>::Space,
+                             Kokkos::HostSpace>::value,
+                "");
 
   static_assert(
-      std::is_same<
-          Kokkos::Impl::HostMirror<Kokkos::Experimental::HIPSpace>::Space,
-          Kokkos::HostSpace>::value,
+      std::is_same<Kokkos::Impl::HostMirror<Kokkos::HIPHostPinnedSpace>::Space,
+                   Kokkos::HIPHostPinnedSpace>::value,
       "");
 
   static_assert(
-      std::is_same<Kokkos::Impl::HostMirror<
-                       Kokkos::Experimental::HIPHostPinnedSpace>::Space,
-                   Kokkos::Experimental::HIPHostPinnedSpace>::value,
+      std::is_same<Kokkos::Impl::HostMirror<Kokkos::HIPManagedSpace>::Space,
+                   Kokkos::Device<Kokkos::HostSpace::execution_space,
+                                  Kokkos::HIPManagedSpace>>::value,
       "");
 
   static_assert(
-      std::is_same<
-          Kokkos::Impl::HostMirror<
-              Kokkos::Experimental::HIPManagedSpace>::Space,
-          Kokkos::Device<Kokkos::HostSpace::execution_space,
-                         Kokkos::Experimental::HIPManagedSpace>>::value,
+      Kokkos::SpaceAccessibility<Kokkos::Impl::HostMirror<Kokkos::HIP>::Space,
+                                 Kokkos::HostSpace>::accessible,
       "");
 
   static_assert(Kokkos::SpaceAccessibility<
-                    Kokkos::Impl::HostMirror<Kokkos::Experimental::HIP>::Space,
+                    Kokkos::Impl::HostMirror<Kokkos::HIPSpace>::Space,
                     Kokkos::HostSpace>::accessible,
                 "");
 
-  static_assert(
-      Kokkos::SpaceAccessibility<
-          Kokkos::Impl::HostMirror<Kokkos::Experimental::HIPSpace>::Space,
-          Kokkos::HostSpace>::accessible,
-      "");
-
   static_assert(Kokkos::SpaceAccessibility<
-                    Kokkos::Impl::HostMirror<
-                        Kokkos::Experimental::HIPHostPinnedSpace>::Space,
+                    Kokkos::Impl::HostMirror<Kokkos::HIPHostPinnedSpace>::Space,
                     Kokkos::HostSpace>::accessible,
                 "");
 
   static_assert(Kokkos::SpaceAccessibility<
-                    Kokkos::Impl::HostMirror<
-                        Kokkos::Experimental::HIPManagedSpace>::Space,
+                    Kokkos::Impl::HostMirror<Kokkos::HIPManagedSpace>::Space,
                     Kokkos::HostSpace>::accessible,
                 "");
 }
@@ -311,18 +260,15 @@ struct TestViewHIPAccessible {
 };
 
 TEST(hip, impl_view_accessible) {
-  TestViewHIPAccessible<Kokkos::Experimental::HIPSpace,
-                        Kokkos::Experimental::HIP>::run();
+  TestViewHIPAccessible<Kokkos::HIPSpace, Kokkos::HIP>::run();
 
-  TestViewHIPAccessible<Kokkos::Experimental::HIPHostPinnedSpace,
-                        Kokkos::Experimental::HIP>::run();
-  TestViewHIPAccessible<Kokkos::Experimental::HIPHostPinnedSpace,
+  TestViewHIPAccessible<Kokkos::HIPHostPinnedSpace, Kokkos::HIP>::run();
+  TestViewHIPAccessible<Kokkos::HIPHostPinnedSpace,
                         Kokkos::HostSpace::execution_space>::run();
 
-  TestViewHIPAccessible<Kokkos::Experimental::HIPManagedSpace,
+  TestViewHIPAccessible<Kokkos::HIPManagedSpace,
                         Kokkos::HostSpace::execution_space>::run();
-  TestViewHIPAccessible<Kokkos::Experimental::HIPManagedSpace,
-                        Kokkos::Experimental::HIP>::run();
+  TestViewHIPAccessible<Kokkos::HIPManagedSpace, Kokkos::HIP>::run();
 }
 
 }  // namespace Test
diff --git a/packages/kokkos/core/unit_test/hip/TestHIP_TeamScratchStreams.cpp b/packages/kokkos/core/unit_test/hip/TestHIP_TeamScratchStreams.cpp
index 86b2fab3c7e3fc0b53b309646add9f4817b804f2..c1c5fba427496efb213d4fa5dc2e4cf3f361c268 100644
--- a/packages/kokkos/core/unit_test/hip/TestHIP_TeamScratchStreams.cpp
+++ b/packages/kokkos/core/unit_test/hip/TestHIP_TeamScratchStreams.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestHIP_Category.hpp>
 #include <Kokkos_Core.hpp>
@@ -50,17 +22,14 @@ namespace Test {
 namespace Impl {
 
 struct HIPStreamScratchTestFunctor {
-  using team_t = Kokkos::TeamPolicy<Kokkos::Experimental::HIP>::member_type;
-  using scratch_t =
-      Kokkos::View<int64_t*, Kokkos::Experimental::HIP::scratch_memory_space>;
+  using team_t    = Kokkos::TeamPolicy<Kokkos::HIP>::member_type;
+  using scratch_t = Kokkos::View<int64_t*, Kokkos::HIP::scratch_memory_space>;
 
-  Kokkos::View<int64_t, Kokkos::Experimental::HIPSpace,
-               Kokkos::MemoryTraits<Kokkos::Atomic>>
+  Kokkos::View<int64_t, Kokkos::HIPSpace, Kokkos::MemoryTraits<Kokkos::Atomic>>
       counter;
   int N, M;
-  HIPStreamScratchTestFunctor(
-      Kokkos::View<int64_t, Kokkos::Experimental::HIPSpace> counter_, int N_,
-      int M_)
+  HIPStreamScratchTestFunctor(Kokkos::View<int64_t, Kokkos::HIPSpace> counter_,
+                              int N_, int M_)
       : counter(counter_), N(N_), M(M_) {}
 
   KOKKOS_FUNCTION
@@ -81,13 +50,11 @@ struct HIPStreamScratchTestFunctor {
 };
 
 void hip_stream_scratch_test_one(
-    int N, int T, int M_base,
-    Kokkos::View<int64_t, Kokkos::Experimental::HIPSpace> counter,
-    Kokkos::Experimental::HIP hip, int tid) {
+    int N, int T, int M_base, Kokkos::View<int64_t, Kokkos::HIPSpace> counter,
+    Kokkos::HIP hip, int tid) {
   int M = M_base + tid * 5;
-  Kokkos::TeamPolicy<Kokkos::Experimental::HIP> p(hip, T, 64);
-  using scratch_t =
-      Kokkos::View<int64_t*, Kokkos::Experimental::HIP::scratch_memory_space>;
+  Kokkos::TeamPolicy<Kokkos::HIP> p(hip, T, 64);
+  using scratch_t = Kokkos::View<int64_t*, Kokkos::HIP::scratch_memory_space>;
 
   int bytes = scratch_t::shmem_size(M);
 
@@ -97,15 +64,14 @@ void hip_stream_scratch_test_one(
   }
 }
 
-void hip_stream_scratch_test(
-    int N, int T, int M_base,
-    Kokkos::View<int64_t, Kokkos::Experimental::HIPSpace> counter) {
+void hip_stream_scratch_test(int N, int T, int M_base,
+                             Kokkos::View<int64_t, Kokkos::HIPSpace> counter) {
   int K = 4;
   hipStream_t stream[4];
-  Kokkos::Experimental::HIP hip[4];
+  Kokkos::HIP hip[4];
   for (int i = 0; i < K; i++) {
     KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamCreate(&stream[i]));
-    hip[i] = Kokkos::Experimental::HIP(stream[i]);
+    hip[i] = Kokkos::HIP(stream[i]);
   }
 // Test that growing scratch size in subsequent calls doesn't crash things
 #if defined(KOKKOS_ENABLE_OPENMP)
@@ -130,7 +96,7 @@ void hip_stream_scratch_test(
 
   Kokkos::fence();
   for (int i = 0; i < K; i++) {
-    hip[i] = Kokkos::Experimental::HIP();
+    hip[i] = Kokkos::HIP();
     KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamDestroy(stream[i]));
   }
 }
@@ -141,7 +107,7 @@ TEST(hip, team_scratch_1_streams) {
   int T      = 10;
   int M_base = 150;
 
-  Kokkos::View<int64_t, Kokkos::Experimental::HIPSpace> counter("C");
+  Kokkos::View<int64_t, Kokkos::HIPSpace> counter("C");
 
   Impl::hip_stream_scratch_test(N, T, M_base, counter);
 
diff --git a/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstances.cpp b/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstances.cpp
index 421e3c50bf675354e2081ee889c4e05ecfef524b..8f349cf8045bb38b8fce7562e693b63ecbca077b 100644
--- a/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstances.cpp
+++ b/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstances.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestHPX_Category.hpp>
diff --git a/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesDelayedExecution.cpp b/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesDelayedExecution.cpp
index 872bf2fd5031d51930a066268c6dff3483b7f986..177d87c1c86e468360589b23da85d32c648576fd 100644
--- a/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesDelayedExecution.cpp
+++ b/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesDelayedExecution.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestHPX_Category.hpp>
diff --git a/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesInstanceIds.cpp b/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesInstanceIds.cpp
index 899cd09d4f4d766101105e19765fc264245ea153..6441666e64f35df133a9dccfa4aec1638c285d42 100644
--- a/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesInstanceIds.cpp
+++ b/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesInstanceIds.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestHPX_Category.hpp>
diff --git a/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesRefCounting.cpp b/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesRefCounting.cpp
index a69bea572f7bccc5108087f11fa6dbfca5afd4c9..2e9ca081bc03b8c581ea71a4ea3e439e0ce3293a 100644
--- a/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesRefCounting.cpp
+++ b/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesRefCounting.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestHPX_Category.hpp>
diff --git a/packages/kokkos/core/unit_test/hpx/TestHPX_InterOp.cpp b/packages/kokkos/core/unit_test/hpx/TestHPX_InterOp.cpp
index e89f7acacc3a5b0c4dff58137dff4c067eeae02e..c52a1328dd8f4ed39b9e653f16edceeea608b635 100644
--- a/packages/kokkos/core/unit_test/hpx/TestHPX_InterOp.cpp
+++ b/packages/kokkos/core/unit_test/hpx/TestHPX_InterOp.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestHPX_Category.hpp>
diff --git a/packages/kokkos/core/unit_test/hpx/TestHPX_Task.cpp b/packages/kokkos/core/unit_test/hpx/TestHPX_Task.cpp
index 57d0ac803bcd86b5499dd6c29348d88138088c15..e8e5b935c492cf99beea48693bfe819ad34493ed 100644
--- a/packages/kokkos/core/unit_test/hpx/TestHPX_Task.cpp
+++ b/packages/kokkos/core/unit_test/hpx/TestHPX_Task.cpp
@@ -1,47 +1,18 @@
-
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestHPX_Category.hpp>
 #include <TestTaskScheduler.hpp>
diff --git a/packages/kokkos/core/unit_test/incremental/README.md b/packages/kokkos/core/unit_test/incremental/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..a67247c7d87510891cff579fd92c57a694221037
--- /dev/null
+++ b/packages/kokkos/core/unit_test/incremental/README.md
@@ -0,0 +1,3 @@
+# Incremental testing for test-driven development
+
+This sequence of tests aims to provide a clear implementation path for developing new backends. The idea being, if one can get these tests to pass in sequence, failures in the broader test suite of the parent directory should become more informative about more obscure errors.
\ No newline at end of file
diff --git a/packages/kokkos/core/unit_test/incremental/Test01_execspace.hpp b/packages/kokkos/core/unit_test/incremental/Test01_execspace.hpp
index c14a90d749709d05ab7c87b6de032cc30f55cf5f..25c7138ed3c14ae594e56ec40952f8aee5be018c 100644
--- a/packages/kokkos/core/unit_test/incremental/Test01_execspace.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test01_execspace.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /// @Kokkos_Feature_Level_Required:1
 
diff --git a/packages/kokkos/core/unit_test/incremental/Test02_atomic_host.hpp b/packages/kokkos/core/unit_test/incremental/Test02_atomic_host.hpp
index d40cb4dbe7f77627429f9880ce4981b38f414c9d..3ea674d48365724c1feca7c335094dd5fc609b02 100644
--- a/packages/kokkos/core/unit_test/incremental/Test02_atomic_host.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test02_atomic_host.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /// @Kokkos_Feature_Level_Required:2
 // Unit test for atomic exchange, atomic add and atomic sub.
diff --git a/packages/kokkos/core/unit_test/incremental/Test03a_MemorySpace_malloc.hpp b/packages/kokkos/core/unit_test/incremental/Test03a_MemorySpace_malloc.hpp
index da808be21918892b423854db0e162706d9b0672b..9ee671214cbb691c9ecf675a775cc6754efc01a9 100644
--- a/packages/kokkos/core/unit_test/incremental/Test03a_MemorySpace_malloc.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test03a_MemorySpace_malloc.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <gtest/gtest.h>
diff --git a/packages/kokkos/core/unit_test/incremental/Test03b_MemorySpace_free.hpp b/packages/kokkos/core/unit_test/incremental/Test03b_MemorySpace_free.hpp
index f7ee76ec9de45e23b6d7fbd2849ef51ac21443da..f552892b00d37c524eefbfcfc2dac73ab762cf4a 100644
--- a/packages/kokkos/core/unit_test/incremental/Test03b_MemorySpace_free.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test03b_MemorySpace_free.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /// @Kokkos_Feature_Level_Required:3
 // Unit test for Kokkos free.
diff --git a/packages/kokkos/core/unit_test/incremental/Test04_ParallelFor_RangePolicy.hpp b/packages/kokkos/core/unit_test/incremental/Test04_ParallelFor_RangePolicy.hpp
index ee9cdc3174d6b2f804d937b41f4956d8421b7975..75cf601e782b031481ee42a51a631065fdf2b33f 100644
--- a/packages/kokkos/core/unit_test/incremental/Test04_ParallelFor_RangePolicy.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test04_ParallelFor_RangePolicy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <gtest/gtest.h>
diff --git a/packages/kokkos/core/unit_test/incremental/Test05_ParallelReduce_RangePolicy.hpp b/packages/kokkos/core/unit_test/incremental/Test05_ParallelReduce_RangePolicy.hpp
index 0cc9d6c5d8961730d59365508eb9716bb8a16ba8..4235c73c8e69bd1f7b454a6fd75925b920a2c54f 100644
--- a/packages/kokkos/core/unit_test/incremental/Test05_ParallelReduce_RangePolicy.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test05_ParallelReduce_RangePolicy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <gtest/gtest.h>
diff --git a/packages/kokkos/core/unit_test/incremental/Test06_ParallelFor_MDRangePolicy.hpp b/packages/kokkos/core/unit_test/incremental/Test06_ParallelFor_MDRangePolicy.hpp
index 2fed01dd66a2d42f1ade6f86b0e98dc34d43f682..4616086648707b21b49b91df5bcc61226d65ae83 100644
--- a/packages/kokkos/core/unit_test/incremental/Test06_ParallelFor_MDRangePolicy.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test06_ParallelFor_MDRangePolicy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <gtest/gtest.h>
diff --git a/packages/kokkos/core/unit_test/incremental/Test08_deep_copy.hpp b/packages/kokkos/core/unit_test/incremental/Test08_deep_copy.hpp
index 6e8fc07b8de50e61e1139ad0b7ba6e2752e81229..cea182aadfa38545b99ae7f6b06c100867702fe5 100644
--- a/packages/kokkos/core/unit_test/incremental/Test08_deep_copy.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test08_deep_copy.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <gtest/gtest.h>
diff --git a/packages/kokkos/core/unit_test/incremental/Test10_HierarchicalBasics.hpp b/packages/kokkos/core/unit_test/incremental/Test10_HierarchicalBasics.hpp
index 720197c3545001e3fe2bc56c9b51692f86cac6e4..1f3370b6ebd422609ae35841e404e13a693562e5 100644
--- a/packages/kokkos/core/unit_test/incremental/Test10_HierarchicalBasics.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test10_HierarchicalBasics.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // @Kokkos_Feature_Level_Required:10
 // Unit test for hierarchical parallelism
@@ -58,7 +30,8 @@ struct HierarchicalBasics {
   using team_t   = typename policy_t::member_type;
 
   void run(const int nP, int nT) {
-    if (nT > ExecSpace::concurrency()) nT = ExecSpace::concurrency();
+    int const concurrency = ExecSpace().concurrency();
+    if (nT > concurrency) nT = concurrency;
 
     policy_t pol(nP, nT);
 
diff --git a/packages/kokkos/core/unit_test/incremental/Test11a_ParallelFor_TeamThreadRange.hpp b/packages/kokkos/core/unit_test/incremental/Test11a_ParallelFor_TeamThreadRange.hpp
index fef4d9c6906454568d963f7f9053fc12c39160e8..ec15e245e7ad596db7433e87e06517a68eb770a3 100644
--- a/packages/kokkos/core/unit_test/incremental/Test11a_ParallelFor_TeamThreadRange.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test11a_ParallelFor_TeamThreadRange.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // @Kokkos_Feature_Level_Required:11
 // Unit test for hierarchical parallelism
diff --git a/packages/kokkos/core/unit_test/incremental/Test11b_ParallelFor_TeamVectorRange.hpp b/packages/kokkos/core/unit_test/incremental/Test11b_ParallelFor_TeamVectorRange.hpp
index a81b474a64f9db4a2dee93ab0a83dc7c067de766..07b3dd2da1b32ebd4b0e3090afc6b87d209d8cd0 100644
--- a/packages/kokkos/core/unit_test/incremental/Test11b_ParallelFor_TeamVectorRange.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test11b_ParallelFor_TeamVectorRange.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // @Kokkos_Feature_Level_Required:11
 // Unit test for hierarchical parallelism
diff --git a/packages/kokkos/core/unit_test/incremental/Test11c_ParallelFor_ThreadVectorRange.hpp b/packages/kokkos/core/unit_test/incremental/Test11c_ParallelFor_ThreadVectorRange.hpp
index 814ab5fda660fd53c3bbe4e71d252c7e63ec9c73..caa7087df41b51c3f6c18c218965f2862425caca 100644
--- a/packages/kokkos/core/unit_test/incremental/Test11c_ParallelFor_ThreadVectorRange.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test11c_ParallelFor_ThreadVectorRange.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // @Kokkos_Feature_Level_Required:11
 // Unit test for hierarchical parallelism
diff --git a/packages/kokkos/core/unit_test/incremental/Test12a_ThreadScratch.hpp b/packages/kokkos/core/unit_test/incremental/Test12a_ThreadScratch.hpp
index ab1cd90d4bfa2e5f5800b8dd13f23a999d2a8fa0..a4cd4fc56f509c3a08e7042f2142613dd0ea251e 100644
--- a/packages/kokkos/core/unit_test/incremental/Test12a_ThreadScratch.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test12a_ThreadScratch.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-// Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // @Kokkos_Feature_Level_Required:12
 // Unit test for hierarchical parallelism
diff --git a/packages/kokkos/core/unit_test/incremental/Test12b_TeamScratch.hpp b/packages/kokkos/core/unit_test/incremental/Test12b_TeamScratch.hpp
index d81822d0da9cfd67b25c8394886509407ecbfeb0..9b27e35dfe9b51dfe5e025d50c88299788de20d6 100644
--- a/packages/kokkos/core/unit_test/incremental/Test12b_TeamScratch.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test12b_TeamScratch.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-// Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // @Kokkos_Feature_Level_Required:12
 // Unit test for hierarchical parallelism
diff --git a/packages/kokkos/core/unit_test/incremental/Test13a_ParallelRed_TeamThreadRange.hpp b/packages/kokkos/core/unit_test/incremental/Test13a_ParallelRed_TeamThreadRange.hpp
index e32b0ed0fc92684072cf004b64240093e1b981fd..876393bfb341d1d7f127d8230e51e77180fafb42 100644
--- a/packages/kokkos/core/unit_test/incremental/Test13a_ParallelRed_TeamThreadRange.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test13a_ParallelRed_TeamThreadRange.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // @Kokkos_Feature_Level_Required:13
 // Unit test for hierarchical parallelism
diff --git a/packages/kokkos/core/unit_test/incremental/Test13b_ParallelRed_TeamVectorRange.hpp b/packages/kokkos/core/unit_test/incremental/Test13b_ParallelRed_TeamVectorRange.hpp
index 0d37703e2b73d5ca22e73f2bfbd2f553e1fe0225..748e01a38cce32babef8bd814717ff1ef84915e5 100644
--- a/packages/kokkos/core/unit_test/incremental/Test13b_ParallelRed_TeamVectorRange.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test13b_ParallelRed_TeamVectorRange.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // @Kokkos_Feature_Level_Required:13
 // Unit test for hierarchical parallelism
diff --git a/packages/kokkos/core/unit_test/incremental/Test13c_ParallelRed_ThreadVectorRange.hpp b/packages/kokkos/core/unit_test/incremental/Test13c_ParallelRed_ThreadVectorRange.hpp
index 26f9d000914393a8af86d9ba1bc4bb5658a7244e..32a37013cf62805ade0ee88afdc244bf47d84d15 100644
--- a/packages/kokkos/core/unit_test/incremental/Test13c_ParallelRed_ThreadVectorRange.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test13c_ParallelRed_ThreadVectorRange.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // @Kokkos_Feature_Level_Required:13
 // Unit test for hierarchical parallelism
diff --git a/packages/kokkos/core/unit_test/incremental/Test14_MDRangeReduce.hpp b/packages/kokkos/core/unit_test/incremental/Test14_MDRangeReduce.hpp
index 649cf6c3830143ad0e7c530e84d57c3484a5e9f9..a1f307c0c82de68b5debf7bd0c2ae4a51c342fd2 100644
--- a/packages/kokkos/core/unit_test/incremental/Test14_MDRangeReduce.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test14_MDRangeReduce.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 /// @Kokkos_Feature_Level_Required:14
 // Incremental test for MDRange reduction .
diff --git a/packages/kokkos/core/unit_test/incremental/Test16_ParallelScan.hpp b/packages/kokkos/core/unit_test/incremental/Test16_ParallelScan.hpp
index e1f5e3767cbc2d45f52ab41dd7220ba68eb4090b..78f791914a93c10bcb62e3c911385224b969fba8 100644
--- a/packages/kokkos/core/unit_test/incremental/Test16_ParallelScan.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test16_ParallelScan.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <gtest/gtest.h>
diff --git a/packages/kokkos/core/unit_test/incremental/Test17_CompleteAtomic.hpp b/packages/kokkos/core/unit_test/incremental/Test17_CompleteAtomic.hpp
index 6ba5adc618717647b655c6f9654e291cbbf9cb56..e2953aa91931402a5e70782aa4c6e8634a883349 100644
--- a/packages/kokkos/core/unit_test/incremental/Test17_CompleteAtomic.hpp
+++ b/packages/kokkos/core/unit_test/incremental/Test17_CompleteAtomic.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <array>
diff --git a/packages/kokkos/core/unit_test/openmp/TestOpenMP.hpp b/packages/kokkos/core/unit_test/openmp/TestOpenMP.hpp
index 1039f13fec00e5c39149511ebfcd8c28edc24aa0..3a974d517cea0fed3e2e28d6fe80fe9842c6a999 100644
--- a/packages/kokkos/core/unit_test/openmp/TestOpenMP.hpp
+++ b/packages/kokkos/core/unit_test/openmp/TestOpenMP.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_OPENMP_HPP
 #define KOKKOS_TEST_OPENMP_HPP
diff --git a/packages/kokkos/core/unit_test/openmp/TestOpenMP_Graph.cpp b/packages/kokkos/core/unit_test/openmp/TestOpenMP_Graph.cpp
index e5ba9e8738275b4163a787518678c6615f91f0f7..22c8ab1bf8fdc8ea888d95ac174776da39a70017 100644
--- a/packages/kokkos/core/unit_test/openmp/TestOpenMP_Graph.cpp
+++ b/packages/kokkos/core/unit_test/openmp/TestOpenMP_Graph.cpp
@@ -1,47 +1,18 @@
-
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestOpenMP_Category.hpp>
 #include <TestGraph.hpp>
diff --git a/packages/kokkos/core/unit_test/openmp/TestOpenMP_InterOp.cpp b/packages/kokkos/core/unit_test/openmp/TestOpenMP_InterOp.cpp
index 5f8fd2236680dc79edbd5dd62e031a9ab54c5ffb..9cd7bf8fca8abfe1f2ea9c8b158ed868374c1b37 100644
--- a/packages/kokkos/core/unit_test/openmp/TestOpenMP_InterOp.cpp
+++ b/packages/kokkos/core/unit_test/openmp/TestOpenMP_InterOp.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestOpenMP_Category.hpp>
@@ -71,7 +43,7 @@ TEST(openmp, raw_openmp_interop) {
     count++;
   }
 
-  concurrency = Kokkos::OpenMP::concurrency();
+  concurrency = Kokkos::OpenMP().concurrency();
   ASSERT_EQ(count, concurrency);
 
   Kokkos::finalize();
diff --git a/packages/kokkos/core/unit_test/openmp/TestOpenMP_PartitionMaster.cpp b/packages/kokkos/core/unit_test/openmp/TestOpenMP_PartitionMaster.cpp
index 2978c98b50d4b0950364da8c1481e2450ef401ab..6983fabb2acb226b50e1baad6cdd71e70f19555a 100644
--- a/packages/kokkos/core/unit_test/openmp/TestOpenMP_PartitionMaster.cpp
+++ b/packages/kokkos/core/unit_test/openmp/TestOpenMP_PartitionMaster.cpp
@@ -1,47 +1,18 @@
-
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestOpenMP_Category.hpp>
 #include <Kokkos_Core.hpp>
diff --git a/packages/kokkos/core/unit_test/openmp/TestOpenMP_Task.cpp b/packages/kokkos/core/unit_test/openmp/TestOpenMP_Task.cpp
index 2ddc6a58419040f912ebbd0f9d4f60ae113b9368..e8974d477fac86004e0adbe64fef6a9a4556da14 100644
--- a/packages/kokkos/core/unit_test/openmp/TestOpenMP_Task.cpp
+++ b/packages/kokkos/core/unit_test/openmp/TestOpenMP_Task.cpp
@@ -1,47 +1,18 @@
-
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestOpenMP_Category.hpp>
 #include <TestTaskScheduler.hpp>
diff --git a/packages/kokkos/core/unit_test/openmptarget/TestOpenMPTarget.hpp b/packages/kokkos/core/unit_test/openmptarget/TestOpenMPTarget.hpp
index 3d8c722be4dbc46f7cc6039500b977fe6b68809b..6ae45620f256043787c148fd647664fc684f991e 100644
--- a/packages/kokkos/core/unit_test/openmptarget/TestOpenMPTarget.hpp
+++ b/packages/kokkos/core/unit_test/openmptarget/TestOpenMPTarget.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_TEST_OPENMPTARGET_HPP
 #define KOKKOS_TEST_OPENMPTARGET_HPP
diff --git a/packages/kokkos/core/unit_test/serial/TestSerial_Graph.cpp b/packages/kokkos/core/unit_test/serial/TestSerial_Graph.cpp
index b2dba1c265cab5cfa4b982bf43f920ec666fcaa5..bff64d83e276e874e6b9d7e33031fc1ce46f5619 100644
--- a/packages/kokkos/core/unit_test/serial/TestSerial_Graph.cpp
+++ b/packages/kokkos/core/unit_test/serial/TestSerial_Graph.cpp
@@ -1,47 +1,18 @@
-
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestSerial_Category.hpp>
 #include <TestGraph.hpp>
diff --git a/packages/kokkos/core/unit_test/serial/TestSerial_Task.cpp b/packages/kokkos/core/unit_test/serial/TestSerial_Task.cpp
index c08efbf447b6fe055f7f01e619b2a0b02de0cdf8..60e9d13ce6550960391c11c91343dacfe58119d1 100644
--- a/packages/kokkos/core/unit_test/serial/TestSerial_Task.cpp
+++ b/packages/kokkos/core/unit_test/serial/TestSerial_Task.cpp
@@ -1,47 +1,18 @@
-
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestSerial_Category.hpp>
 #include <TestTaskScheduler.hpp>
diff --git a/packages/kokkos/core/unit_test/standalone/UnitTestMainInit.cpp b/packages/kokkos/core/unit_test/standalone/UnitTestMainInit.cpp
index c1f7398c166bcf738111b1674a83a919293faf6d..8bee512213cd50189f7732a169a4fe5f754a8c8e 100644
--- a/packages/kokkos/core/unit_test/standalone/UnitTestMainInit.cpp
+++ b/packages/kokkos/core/unit_test/standalone/UnitTestMainInit.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 #include <cstdlib>
@@ -68,6 +40,9 @@
 #ifdef KOKKOS_ENABLE_OPENMPTARGET
 #include <TestOpenMPTarget_Category.hpp>
 #endif
+#ifdef KOKKOS_ENABLE_OPENACC
+#include <TestOpenACC_Category.hpp>
+#endif
 #ifndef TEST_EXECSPACE
 #ifdef KOKKOS_ENABLE_SERIAL
 #include <TestSerial_Category.hpp>
diff --git a/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp b/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp
index e45d990745e1ba3cc6c8d7e5e66c434745619872..25c5c9a50ceed9031b600a992737d5e47b22aed8 100644
--- a/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp
+++ b/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestSYCL_Category.hpp>
@@ -52,8 +24,8 @@ namespace Test {
 // Test whether allocations survive Kokkos initialize/finalize if done via Raw
 // SYCL.
 TEST(sycl, raw_sycl_interop) {
+  // Make sure all queues use the same context
   Kokkos::initialize();
-
   Kokkos::Experimental::SYCL default_space;
   sycl::context default_context = default_space.sycl_queue().get_context();
 
diff --git a/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp b/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp
index 114d2a4aa2bd13c1932baf3e812c0373029a5821..336a5d59c32fc0d3043102a50e2a51569633d1d2 100644
--- a/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp
+++ b/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestSYCL_Category.hpp>
@@ -51,6 +23,7 @@ namespace Test {
 
 // Test whether external allocations can be accessed by the default queue.
 TEST(sycl, raw_sycl_interop_context_1) {
+  // Make sure all queues use the same context
   Kokkos::Experimental::SYCL default_space;
   sycl::context default_context = default_space.sycl_queue().get_context();
 
diff --git a/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp b/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp
index 8ffada1dab1d255c3fec8486fe51cef06fb935a5..13810d861ca0b4cb45844e9e602a53de243148bc 100644
--- a/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp
+++ b/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestSYCL_Category.hpp>
 #include <Test_InterOp_Streams.hpp>
@@ -48,9 +20,13 @@
 namespace Test {
 // Test Interoperability with SYCL Streams
 TEST(sycl, raw_sycl_queues) {
-  sycl::default_selector device_selector;
-  sycl::queue queue(device_selector);
+  // Make sure all queues use the same context
   Kokkos::initialize();
+  Kokkos::Experimental::SYCL default_space;
+  sycl::context default_context = default_space.sycl_queue().get_context();
+
+  sycl::default_selector device_selector;
+  sycl::queue queue(default_context, device_selector);
   int* p            = sycl::malloc_device<int>(100, queue);
   using MemorySpace = typename TEST_EXECSPACE::memory_space;
 
diff --git a/packages/kokkos/core/unit_test/sycl/TestSYCL_Spaces.cpp b/packages/kokkos/core/unit_test/sycl/TestSYCL_Spaces.cpp
index 91fdaac6e097fb9b127816301ca2e5c514a4f374..914f8432488db3f82ffed012237b0473263de96b 100644
--- a/packages/kokkos/core/unit_test/sycl/TestSYCL_Spaces.cpp
+++ b/packages/kokkos/core/unit_test/sycl/TestSYCL_Spaces.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <TestSYCL_Category.hpp>
diff --git a/packages/kokkos/core/unit_test/sycl/TestSYCL_Task.cpp b/packages/kokkos/core/unit_test/sycl/TestSYCL_Task.cpp
index 95a7b68088c1238672b2257d285d7329d52cbec7..3c599b95a6f3362c1d8c33de69315ef8cfd3df44 100644
--- a/packages/kokkos/core/unit_test/sycl/TestSYCL_Task.cpp
+++ b/packages/kokkos/core/unit_test/sycl/TestSYCL_Task.cpp
@@ -1,47 +1,18 @@
-
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestSYCL_Category.hpp>
 #include <TestTaskScheduler.hpp>
diff --git a/packages/kokkos/core/unit_test/sycl/TestSYCL_TeamScratchStreams.cpp b/packages/kokkos/core/unit_test/sycl/TestSYCL_TeamScratchStreams.cpp
index 420522caf5036a087b69c928b63ec4100aca0325..11207a5480f0345a24911cf4d8f967e715889508 100644
--- a/packages/kokkos/core/unit_test/sycl/TestSYCL_TeamScratchStreams.cpp
+++ b/packages/kokkos/core/unit_test/sycl/TestSYCL_TeamScratchStreams.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestSYCL_Category.hpp>
 #include <Kokkos_Core.hpp>
diff --git a/packages/kokkos/core/unit_test/tools/TestAllCalls.cpp b/packages/kokkos/core/unit_test/tools/TestAllCalls.cpp
index 7ee8d68e30dd1de252866ff83c4aed8e07bd2ab5..4dbff82834618555ebb51670f3acff4b3381ef81 100644
--- a/packages/kokkos/core/unit_test/tools/TestAllCalls.cpp
+++ b/packages/kokkos/core/unit_test/tools/TestAllCalls.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // This file calls most of the basic Kokkos primitives. When combined with a
 // testing library this tests that our shared-library loading based profiling
diff --git a/packages/kokkos/core/unit_test/tools/TestBuiltinTuners.cpp b/packages/kokkos/core/unit_test/tools/TestBuiltinTuners.cpp
index fbcc6541db745b1b29f29760be2ecec7006f7100..bf6aeeda77e7862af6afaa8cb29851d265dd306e 100644
--- a/packages/kokkos/core/unit_test/tools/TestBuiltinTuners.cpp
+++ b/packages/kokkos/core/unit_test/tools/TestBuiltinTuners.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 #include <Kokkos_Core.hpp>
 #include <impl/Kokkos_Tools_Generic.hpp>
 using ExecSpace  = Kokkos::DefaultHostExecutionSpace;
diff --git a/packages/kokkos/core/unit_test/tools/TestCategoricalTuner.cpp b/packages/kokkos/core/unit_test/tools/TestCategoricalTuner.cpp
index 2177556d392f002ad17499ad08fe93268a3c7937..ecc1277de77725df6f672c55b8ec176bcc4389c7 100644
--- a/packages/kokkos/core/unit_test/tools/TestCategoricalTuner.cpp
+++ b/packages/kokkos/core/unit_test/tools/TestCategoricalTuner.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // This file tests the categorical tuner
 
diff --git a/packages/kokkos/core/unit_test/tools/TestEventCorrectness.cpp b/packages/kokkos/core/unit_test/tools/TestEventCorrectness.cpp
index 2d73aa2e9c3a5bd3599c6c21cfc49dcd4010c959..4d88a5dba3f77b8770a7e5913c80e71648deea50 100644
--- a/packages/kokkos/core/unit_test/tools/TestEventCorrectness.cpp
+++ b/packages/kokkos/core/unit_test/tools/TestEventCorrectness.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <iostream>
 #include "Kokkos_Core.hpp"
diff --git a/packages/kokkos/core/unit_test/tools/TestEventCorrectness.hpp b/packages/kokkos/core/unit_test/tools/TestEventCorrectness.hpp
index bb1d3156f53f5b0470303a9748a02b2e532a736a..408160411327cc67ef9c1b535cff1f47fe38956b 100644
--- a/packages/kokkos/core/unit_test/tools/TestEventCorrectness.hpp
+++ b/packages/kokkos/core/unit_test/tools/TestEventCorrectness.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 #include <iostream>
 #include <gtest/gtest.h>
 #include "Kokkos_Core.hpp"
@@ -55,9 +27,9 @@ class Serial;
 class OpenMP;
 class Cuda;
 class Threads;
+class HIP;
 namespace Experimental {
 class SYCL;
-class HIP;
 class OpenMPTarget;
 class HPX;
 }  // namespace Experimental
@@ -307,9 +279,15 @@ TEST(kokkosp, test_streams) {
 }
 
 #endif
-/** FIXME: OpenMPTarget currently has unexpected fences */
-#ifndef KOKKOS_ENABLE_OPENMPTARGET
 TEST(kokkosp, async_deep_copy) {
+// FIXME_OPENMPTARGET
+#ifdef KOKKOS_ENABLE_OPENMPTARGET
+  if (std::is_same<Kokkos::DefaultExecutionSpace,
+                   Kokkos::Experimental::OpenMPTarget>::value)
+    GTEST_SKIP()
+        << "skipping since the OpenMPTarget backend has unexpected fences";
+#endif
+
   using namespace Kokkos::Test::Tools;
   listen_tool_events(Config::DisableAll(), Config::EnableFences());
   Kokkos::View<float*> left("left", 5), right("right", 5);
@@ -333,7 +311,6 @@ TEST(kokkosp, async_deep_copy) {
       });
   ASSERT_TRUE(success);
 }
-#endif
 TEST(kokkosp, parallel_for) {
   using namespace Kokkos::Test::Tools;
   listen_tool_events(Config::DisableAll(), Config::EnableKernels());
@@ -354,6 +331,8 @@ TEST(kokkosp, parallel_for) {
   ASSERT_TRUE(success);
 }
 
+#ifndef KOKKOS_ENABLE_OPENACC
+// FIXME_OPENACC: not supported reducer type
 TEST(kokkosp, parallel_reduce) {
   using namespace Kokkos::Test::Tools;
   listen_tool_events(Config::DisableAll(), Config::EnableKernels());
@@ -377,8 +356,19 @@ TEST(kokkosp, parallel_reduce) {
       });
   ASSERT_TRUE(success);
 }
+#endif
 
+#ifndef KOKKOS_ENABLE_OPENACC
+// FIXME_OPENACC: parallel_scan not implemented yet
 TEST(kokkosp, parallel_scan) {
+  // FIXME_OPENMPTARGET
+#ifdef KOKKOS_ENABLE_OPENMPTARGET
+  if (std::is_same<Kokkos::DefaultExecutionSpace,
+                   Kokkos::Experimental::OpenMPTarget>::value)
+    GTEST_SKIP()
+        << "skipping since the OpenMPTarget backend reports unexpected events";
+#endif
+
   using namespace Kokkos::Test::Tools;
   listen_tool_events(Config::DisableAll(), Config::EnableKernels());
   auto success = validate_event_set(
@@ -395,13 +385,78 @@ TEST(kokkosp, parallel_scan) {
         }
         return MatchDiagnostic{true};
       });
-// Currently, this test is known to fail with OpenMPTarget
-#ifndef KOKKOS_ENABLE_OPENMPTARGET
   ASSERT_TRUE(success);
-#else
-  (void)success;
+}
+
+TEST(kokkosp, parallel_scan_no_fence) {
+  // FIXME_THREADS
+#ifdef KOKKOS_ENABLE_THREADS
+  if (std::is_same<Kokkos::DefaultExecutionSpace, Kokkos::Threads>::value)
+    GTEST_SKIP() << "skipping since the Thread backend always fences";
+#endif
+    // FIXME_OPENMPTARGET
+#ifdef KOKKOS_ENABLE_OPENMPTARGET
+  if (std::is_same<Kokkos::DefaultExecutionSpace,
+                   Kokkos::Experimental::OpenMPTarget>::value)
+    GTEST_SKIP()
+        << "skipping since the OpenMPTarget backend has unexpected fences";
 #endif
+
+  using namespace Kokkos::Test::Tools;
+  listen_tool_events(Config::DisableAll(), Config::EnableKernels(),
+                     Config::EnableFences());
+  auto success = validate_absence(
+      [=]() {
+        TestScanFunctor tf;
+        Kokkos::parallel_scan("dogs", Kokkos::RangePolicy<>(0, 1), tf);
+      },
+      [=](BeginFenceEvent begin_event) {
+        if (begin_event.name.find("Debug Only Check for Execution Error") !=
+                std::string::npos ||
+            begin_event.name.find("Kokkos Profile Tool Fence") !=
+                std::string::npos)
+          return MatchDiagnostic{false};
+        else
+          return MatchDiagnostic{true};
+      });
+  ASSERT_TRUE(success);
+}
+
+TEST(kokkosp, parallel_scan_no_fence_view) {
+  // FIXME_THREADS
+#ifdef KOKKOS_ENABLE_THREADS
+  if (std::is_same<Kokkos::DefaultExecutionSpace, Kokkos::Threads>::value)
+    GTEST_SKIP() << "skipping since the Thread backend always fences";
+#endif
+    // FIXME_OPENMPTARGET
+#ifdef KOKKOS_ENABLE_OPENMPTARGET
+  if (std::is_same<Kokkos::DefaultExecutionSpace,
+                   Kokkos::Experimental::OpenMPTarget>::value)
+    GTEST_SKIP()
+        << "skipping since the OpenMPTarget backend has unexpected fences";
+#endif
+
+  using namespace Kokkos::Test::Tools;
+  listen_tool_events(Config::DisableAll(), Config::EnableKernels(),
+                     Config::EnableFences());
+  Kokkos::View<typename TestScanFunctor::value_type> v("scan_result");
+  auto success = validate_absence(
+      [=]() {
+        TestScanFunctor tf;
+        Kokkos::parallel_scan("dogs", Kokkos::RangePolicy<>(0, 1), tf, v);
+      },
+      [=](BeginFenceEvent begin_event) {
+        if (begin_event.name.find("Debug Only Check for Execution Error") !=
+                std::string::npos ||
+            begin_event.name.find("Kokkos Profile Tool Fence") !=
+                std::string::npos)
+          return MatchDiagnostic{false};
+        else
+          return MatchDiagnostic{true};
+      });
+  ASSERT_TRUE(success);
 }
+#endif
 
 TEST(kokkosp, regions) {
   using namespace Kokkos::Test::Tools;
@@ -439,6 +494,14 @@ TEST(kokkosp, fences) {
 }
 
 TEST(kokkosp, raw_allocation) {
+  // FIXME_OPENMPTARGET
+#ifdef KOKKOS_ENABLE_OPENMPTARGET
+  if (std::is_same<Kokkos::DefaultExecutionSpace,
+                   Kokkos::Experimental::OpenMPTarget>::value)
+    GTEST_SKIP()
+        << "skipping since the OpenMPTarget backend reports unexpected events";
+#endif
+
   using namespace Kokkos::Test::Tools;
   listen_tool_events(Config::DisableAll(), Config::EnableAllocs());
   auto success = validate_event_set(
@@ -466,15 +529,18 @@ TEST(kokkosp, raw_allocation) {
         }
         return MatchDiagnostic{true};
       });
-// Currently, this test is known to fail with OpenMPTarget
-#ifndef KOKKOS_ENABLE_OPENMPTARGET
   ASSERT_TRUE(success);
-#else
-  (void)success;
-#endif
 }
 
 TEST(kokkosp, view) {
+// FIXME_OPENMPTARGET
+#ifdef KOKKOS_ENABLE_OPENMPTARGET
+  if (std::is_same<Kokkos::DefaultExecutionSpace,
+                   Kokkos::Experimental::OpenMPTarget>::value)
+    GTEST_SKIP()
+        << "skipping since the OpenMPTarget backend reports unexpected events";
+#endif
+
   using namespace Kokkos::Test::Tools;
   listen_tool_events(Config::DisableAll(), Config::EnableAllocs());
   auto success = validate_event_set(
@@ -497,12 +563,7 @@ TEST(kokkosp, view) {
         }
         return MatchDiagnostic{true};
       });
-// Currently, this test is known to fail with OpenMPTarget
-#ifndef KOKKOS_ENABLE_OPENMPTARGET
   ASSERT_TRUE(success);
-#else
-  (void)success;
-#endif
 }
 
 TEST(kokkosp, sections) {
diff --git a/packages/kokkos/core/unit_test/tools/TestIndependence.cpp b/packages/kokkos/core/unit_test/tools/TestIndependence.cpp
index 2579c4ef3afc8b57a41a2e075742754adebbd629..b8b8db1d81555e5db5bf52f8f51f75b3313a03e5 100644
--- a/packages/kokkos/core/unit_test/tools/TestIndependence.cpp
+++ b/packages/kokkos/core/unit_test/tools/TestIndependence.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 #include <impl/Kokkos_Tools.hpp>
 
 int main(int argc, char* argv[]) {
diff --git a/packages/kokkos/core/unit_test/tools/TestLogicalSpaces.cpp b/packages/kokkos/core/unit_test/tools/TestLogicalSpaces.cpp
index 4008fd3d5b54ac2f219b6555210da2aebf2722a1..7cb2b958331c4b90b0d273b25b46f0d9753306ff 100644
--- a/packages/kokkos/core/unit_test/tools/TestLogicalSpaces.cpp
+++ b/packages/kokkos/core/unit_test/tools/TestLogicalSpaces.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <iostream>
 #include "Kokkos_Core.hpp"
diff --git a/packages/kokkos/core/unit_test/tools/TestLogicalSpaces.hpp b/packages/kokkos/core/unit_test/tools/TestLogicalSpaces.hpp
index 2fd43558f674a6760c8125aeeec4381c3da503cd..1b20bd5933885c936efe2e09c75875c0b53d2e11 100644
--- a/packages/kokkos/core/unit_test/tools/TestLogicalSpaces.hpp
+++ b/packages/kokkos/core/unit_test/tools/TestLogicalSpaces.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 #include <iostream>
 #include <gtest/gtest.h>
 #include "Kokkos_Core.hpp"
@@ -131,7 +103,7 @@ void test_malloc_free() {
   auto* temp =
       Kokkos::kokkos_malloc<fake_memory_space>("does_malloc_work", 1000);
   expect_deallocation_event("does_malloc_work", "TestSpace", "Error in free");
-  Kokkos::kokkos_free(temp);
+  Kokkos::kokkos_free<fake_memory_space>(temp);
   Kokkos::Tools::Experimental::pause_tools();
 }
 void test_chained_spaces() {
@@ -167,7 +139,10 @@ struct AccessCheckKernel {
 template <typename Space>
 void test_allowed_access() {
   constexpr const int data_size = 1000;
-  Kokkos::View<double*, Space> test_view("test_view", data_size);
+  // We use an unmananged View here since we want to detect a memory access
+  // violation in the parallel_for and not in the initialization of the View.
+  std::vector<double> test_data(data_size);
+  Kokkos::View<double*, Space> test_view(test_data.data(), data_size);
   AccessCheckKernel<Space> functor{test_view};
   Kokkos::parallel_for(
       "access_allowed",
diff --git a/packages/kokkos/core/unit_test/tools/TestProfilingSection.cpp b/packages/kokkos/core/unit_test/tools/TestProfilingSection.cpp
index b73307832b47d491de503c14467e9bf746f5cda0..318766ac455fe9db899e7b9f984eac984a4ea0e5 100644
--- a/packages/kokkos/core/unit_test/tools/TestProfilingSection.cpp
+++ b/packages/kokkos/core/unit_test/tools/TestProfilingSection.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Profiling_ProfileSection.hpp>
 
diff --git a/packages/kokkos/core/unit_test/tools/TestTuning.cpp b/packages/kokkos/core/unit_test/tools/TestTuning.cpp
index 6bc787023efa95a7208b03632279dc0b8beeeb8b..37dc931aa10b22995b8d14f97fc62343690066b9 100644
--- a/packages/kokkos/core/unit_test/tools/TestTuning.cpp
+++ b/packages/kokkos/core/unit_test/tools/TestTuning.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // This file tests the primitives of the Tuning system
 
diff --git a/packages/kokkos/core/unit_test/tools/TestWithoutInitializing.cpp b/packages/kokkos/core/unit_test/tools/TestWithoutInitializing.cpp
index 8d81098941eaeda73a2f9ac0f87bb412d927b10e..590937f9a5bc6c75123c1c4dcd087e5dddadc341 100644
--- a/packages/kokkos/core/unit_test/tools/TestWithoutInitializing.cpp
+++ b/packages/kokkos/core/unit_test/tools/TestWithoutInitializing.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 #include <Kokkos_Core.hpp>
@@ -58,13 +30,13 @@ TEST(kokkosp, create_mirror_no_init) {
       [&]() {
         auto mirror_device =
             Kokkos::create_mirror(Kokkos::WithoutInitializing, device_view);
-        auto mirror_host =
-            Kokkos::create_mirror(Kokkos::WithoutInitializing,
-                                  Kokkos::DefaultExecutionSpace{}, host_view);
+        auto mirror_host = Kokkos::create_mirror(
+            Kokkos::WithoutInitializing, Kokkos::DefaultHostExecutionSpace{},
+            host_view);
         auto mirror_device_view = Kokkos::create_mirror_view(
             Kokkos::WithoutInitializing, device_view);
         auto mirror_host_view = Kokkos::create_mirror_view(
-            Kokkos::WithoutInitializing, Kokkos::DefaultExecutionSpace{},
+            Kokkos::WithoutInitializing, Kokkos::DefaultHostExecutionSpace{},
             host_view);
       },
       [&](BeginParallelForEvent) {
@@ -91,7 +63,7 @@ TEST(kokkosp, create_mirror_no_init_view_ctor) {
             device_view);
         auto mirror_host = Kokkos::create_mirror(
             Kokkos::view_alloc(Kokkos::HostSpace{}, Kokkos::WithoutInitializing,
-                               Kokkos::DefaultExecutionSpace{}),
+                               Kokkos::DefaultHostExecutionSpace{}),
             host_view);
         auto mirror_device_view = Kokkos::create_mirror_view(
             Kokkos::view_alloc(Kokkos::HostSpace{},
@@ -99,7 +71,7 @@ TEST(kokkosp, create_mirror_no_init_view_ctor) {
             device_view);
         auto mirror_host_view = Kokkos::create_mirror_view(
             Kokkos::view_alloc(Kokkos::HostSpace{}, Kokkos::WithoutInitializing,
-                               Kokkos::DefaultExecutionSpace{}),
+                               Kokkos::DefaultHostExecutionSpace{}),
             host_view);
         mirror_host_view = Kokkos::create_mirror_view(
             Kokkos::view_alloc(Kokkos::WithoutInitializing), host_view);
diff --git a/packages/kokkos/core/unit_test/tools/include/ToolTestingUtilities.hpp b/packages/kokkos/core/unit_test/tools/include/ToolTestingUtilities.hpp
index 10dbea579964a14d7ad0f3acf1b23a8b2eb5221e..24b9bc3739e13d8a3824f013a188aa069a7a55b2 100644
--- a/packages/kokkos/core/unit_test/tools/include/ToolTestingUtilities.hpp
+++ b/packages/kokkos/core/unit_test/tools/include/ToolTestingUtilities.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 /**
  * Before digging in to the code, it's worth taking a moment to review this
  * design. Fundamentally, what we're looking to do is allow people to test that
@@ -92,28 +64,6 @@ struct EventBase;  // forward declaration
 using EventBasePtr = std::shared_ptr<EventBase>;
 using event_vector = std::vector<EventBasePtr>;
 
-/**
- * @brief Base case of a recursive reduction using templates
- * Should be replaced with a fold in C++17
- */
-
-inline bool are_valid() { return true; }
-
-/**
- * @brief Recursive reduction to check whether any pointer in a set is null
- *
- * @tparam Head Type of the pointer to examine
- * @tparam Tail Types of the rest of the pointers
- * @param head The pointer to examine
- * @param tail The rest of the pointers
- * @return true if no pointer is null, false otherwise
- *
- */
-template <class Head, class... Tail>
-bool are_valid(const Head& head, const Tail&... tail) {
-  return (head != nullptr) && (are_valid(tail...));
-}
-
 /**
  * @brief In order to call some arbitrary set of lambdas representing matchers,
  * we need the ability to look at a lambda, and deduce its arguments.
@@ -153,7 +103,7 @@ struct function_traits<R (*)(A...)> {
   constexpr static int num_arguments = sizeof...(A);
   template <class Call, class... Args>
   static auto invoke_as(const Call& call, Args&&... args) {
-    if (!are_valid(std::dynamic_pointer_cast<A>(std::forward<Args>(args))...)) {
+    if (!(std::dynamic_pointer_cast<A>(std::forward<Args>(args)) && ...)) {
       return MatchDiagnostic{false, {"Types didn't match on arguments"}};
     }
     return call(*std::dynamic_pointer_cast<A>(std::forward<Args>(args))...);
@@ -177,7 +127,7 @@ struct function_traits<R (C::*)(A...)> {
   constexpr static int num_arguments = sizeof...(A);
   template <class Call, class... Args>
   static auto invoke_as(const Call& call, Args&&... args) {
-    if (!are_valid(std::dynamic_pointer_cast<A>(std::forward<Args>(args))...)) {
+    if (!(std::dynamic_pointer_cast<A>(std::forward<Args>(args)) && ...)) {
       return MatchDiagnostic{false, {"Types didn't match on arguments"}};
     }
     return call(*std::dynamic_pointer_cast<A>(std::forward<Args>(args))...);
@@ -202,7 +152,7 @@ struct function_traits<R (C::*)(A...) const>  // const
   constexpr static int num_arguments = sizeof...(A);
   template <class Call, class... Args>
   static auto invoke_as(const Call& call, Args&&... args) {
-    if (!are_valid(std::dynamic_pointer_cast<A>(std::forward<Args>(args))...)) {
+    if (!(std::dynamic_pointer_cast<A>(std::forward<Args>(args)) && ...)) {
       return MatchDiagnostic{false, {"Types didn't match on arguments"}};
     }
     return call(*std::dynamic_pointer_cast<A>(std::forward<Args>(args))...);
@@ -218,7 +168,7 @@ struct function_traits<R (C::*)(A...) const>  // const
  * @tparam T The functor type
  */
 template <typename T>
-struct function_traits<T, Kokkos::Impl::void_t<decltype(&T::operator())> >
+struct function_traits<T, std::void_t<decltype(&T::operator())> >
     : public function_traits<decltype(&T::operator())> {};
 
 /**
@@ -1195,8 +1145,7 @@ template <int priority, class Config, class... Configs>
 void listen_tool_events_impl(std::integral_constant<int, priority> prio,
                              ToolValidatorConfiguration& in, Config conf,
                              Configs... configs) {
-  invoke_config(in, conf,
-                std::integral_constant<bool, priority == conf.value>{});
+  invoke_config(in, conf, std::bool_constant<priority == conf.value>{});
   listen_tool_events_impl(prio, in, configs...);
 }
 template <class... Configs>
diff --git a/packages/kokkos/core/unit_test/tools/printing-tool.cpp b/packages/kokkos/core/unit_test/tools/printing-tool.cpp
index 76b7837d0365306201c83eb8e2ae92523d3a6670..65614e04b1cfd4dcb39f67c70a9e4095c9d35b34 100644
--- a/packages/kokkos/core/unit_test/tools/printing-tool.cpp
+++ b/packages/kokkos/core/unit_test/tools/printing-tool.cpp
@@ -1,3 +1,18 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
 
 #include <inttypes.h>
 #include <iostream>
@@ -78,7 +93,7 @@ extern "C" void kokkosp_end_parallel_reduce(const uint64_t kID) {
   std::cout << "kokkosp_end_parallel_reduce:" << kID << "::";
 }
 
-extern "C" void kokkosp_push_profile_region(char* regionName) {
+extern "C" void kokkosp_push_profile_region(const char* regionName) {
   std::cout << "kokkosp_push_profile_region:" << regionName << "::";
 }
 
@@ -87,13 +102,13 @@ extern "C" void kokkosp_pop_profile_region() {
 }
 
 extern "C" void kokkosp_allocate_data(SpaceHandle handle, const char* name,
-                                      void* ptr, uint64_t size) {
+                                      const void* ptr, uint64_t size) {
   std::cout << "kokkosp_allocate_data:" << handle.name << ":" << name << ":"
             << ptr << ":" << size << "::";
 }
 
 extern "C" void kokkosp_deallocate_data(SpaceHandle handle, const char* name,
-                                        void* ptr, uint64_t size) {
+                                        const void* ptr, uint64_t size) {
   std::cout << "kokkosp_deallocate_data:" << handle.name << ":" << name << ":"
             << ptr << ":" << size << "::";
 }
diff --git a/packages/kokkos/core/unit_test/view/TestExtentsDatatypeConversion.cpp b/packages/kokkos/core/unit_test/view/TestExtentsDatatypeConversion.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a48052ab8ae5ab7e837c9ef845221690dd089e1d
--- /dev/null
+++ b/packages/kokkos/core/unit_test/view/TestExtentsDatatypeConversion.cpp
@@ -0,0 +1,89 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#include <Kokkos_Core.hpp>
+#include <type_traits>
+
+#ifdef KOKKOS_ENABLE_IMPL_MDSPAN
+
+namespace {
+
+// Helper to make static tests more succinct
+template <typename DataType, typename Extent>
+constexpr bool datatype_matches_extent =
+    std::is_same_v<typename Kokkos::Experimental::Impl::ExtentsFromDataType<
+                       std::size_t, DataType>::type,
+                   Extent>;
+
+template <typename DataType, typename BaseType, typename Extents>
+constexpr bool extent_matches_datatype =
+    std::is_same_v<DataType, typename Kokkos::Experimental::Impl::
+                                 DataTypeFromExtents<BaseType, Extents>::type>;
+
+// Conversion from DataType to extents
+// 0-rank view
+static_assert(
+    datatype_matches_extent<double, std::experimental::extents<std::size_t>>);
+
+// Only dynamic
+static_assert(datatype_matches_extent<
+              double***, std::experimental::extents<
+                             std::size_t, std::experimental::dynamic_extent,
+                             std::experimental::dynamic_extent,
+                             std::experimental::dynamic_extent>>);
+// Only static
+static_assert(datatype_matches_extent<
+              double[2][3][17],
+              std::experimental::extents<std::size_t, std::size_t{2},
+                                         std::size_t{3}, std::size_t{17}>>);
+
+// Both dynamic and static
+static_assert(datatype_matches_extent<
+              double* * [3][2][8],
+              std::experimental::extents<
+                  std::size_t, std::experimental::dynamic_extent,
+                  std::experimental::dynamic_extent, std::size_t{3},
+                  std::size_t{2}, std::size_t{8}>>);
+
+// Conversion from extents to DataType
+// 0-rank extents
+static_assert(extent_matches_datatype<double, double,
+                                      std::experimental::extents<std::size_t>>);
+
+// only dynamic
+static_assert(
+    extent_matches_datatype<double****, double,
+                            std::experimental::extents<
+                                std::size_t, std::experimental::dynamic_extent,
+                                std::experimental::dynamic_extent,
+                                std::experimental::dynamic_extent,
+                                std::experimental::dynamic_extent>>);
+
+// only static
+static_assert(
+    extent_matches_datatype<double[7][5][3], double,
+                            std::experimental::extents<std::size_t, 7, 5, 3>>);
+
+// both dynamic and static
+static_assert(
+    extent_matches_datatype<double** * [20][45], double,
+                            std::experimental::extents<
+                                std::size_t, std::experimental::dynamic_extent,
+                                std::experimental::dynamic_extent,
+                                std::experimental::dynamic_extent, 20, 45>>);
+}  // namespace
+
+#endif  // KOKKOS_ENABLE_IMPL_MDSPAN
diff --git a/packages/kokkos/doc/Kokkos-Programming-Guide.md b/packages/kokkos/doc/Kokkos-Programming-Guide.md
deleted file mode 100644
index 3992dd8130eff3d961da94b5fb42e2df3ed03658..0000000000000000000000000000000000000000
--- a/packages/kokkos/doc/Kokkos-Programming-Guide.md
+++ /dev/null
@@ -1 +0,0 @@
-[Programming Guide](https://github.com/kokkos/kokkos/wiki)
diff --git a/packages/kokkos/doc/README.md b/packages/kokkos/doc/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..4654a6a4d62b69e7b0e34d33f14b42088bcc1f56
--- /dev/null
+++ b/packages/kokkos/doc/README.md
@@ -0,0 +1,3 @@
+# WARNING
+The content of this directory is wildly outdated.
+Please refer to https://kokkos.github.io/kokkos-core-wiki instead.
diff --git a/packages/kokkos/doc/develop_builds.md b/packages/kokkos/doc/develop_builds.md
deleted file mode 100644
index 3fe4e6f6721c9985bec6d8dce648c516295846ad..0000000000000000000000000000000000000000
--- a/packages/kokkos/doc/develop_builds.md
+++ /dev/null
@@ -1,56 +0,0 @@
-
-# Places to build options: architecture, device, advanced options, cuda options
-
-These are the files that need to be updated when a new architecture or device is
-added:
-
-  + generate_makefile.bash
-      * Interface for makefile system
-  + cmake/kokkos_options.cmake
-      * Interface for cmake system
-  + Makefile.kokkos
-      * Main logic for build (make and cmake) and defines (KokkosCore_config.h)
-
-In general, an architecture is going to be from on of these platforms:
-  + AMD
-  + ARM
-  + IBM
-  + Intel
-  + Intel Xeon Phi
-  + NVIDIA
-Although not strictly necessary, it is helpful to keep things organized by
-grouping by platform.
-
-### generate_makefile.sh
-
-The bash code does not do any error checking on the `--arch=`  or `--device=`
-arguments thus strictly speaking you do not *need* to do anything to add a
-device or architecture; however, you should add it to the help menu.  For the
-archictectures, please group by one of the platforms listed above.
-
-
-### cmake/kokkos_options.cmake and cmake/kokkos_settings.cmake
-
-The options for the CMake build system are: `-DKOKKOS_HOST_ARCH:STRING=` and
-`-DKOKKOS_ENABLE_<device>:BOOL=`.  Although any string can be passed into
-KOKKOS_HOST_ARCH option, it is checked against an accepted list.  Likewise, the
-KOKKOS_ENABLE_<device> must have the option added AND it is formed using the
-list. Thus:
-  + A new architecture should be added to the KOKKOS_HOST_ARCH_LIST variable.
-  + A new device should be added to the KOKKOS_DEVICES_LIST variable **AND** a
-    KOKKOS_ENABLE_<newdevice> option specified (see KOKKOS_ENABLE_CUDA for
-    example).
-  + A new device should be added to the KOKKOS_DEVICES_LIST variable **AND** a
-
-The translation from option to the `KOKKOS_SETTINGS` is done in
-`kokkos_settings.cmake`.  This translation is automated for some types if you ad
-to the list, but for others, it may need to be hand coded.
-
-
-### Makefile.kokkos
-
-This is the main coding used by both the make and cmake system for defining
-the sources (generated makefile and cmake snippets by `core/src/Makefile`), for
-setting the defines in KokkosCore_config.h, and defining various internal
-variables.  To understand how to add to this file, you should work closely with
-the Kokkos development team.
diff --git a/packages/kokkos/doc/hardware_identification/query_cuda_arch.cpp b/packages/kokkos/doc/hardware_identification/query_cuda_arch.cpp
deleted file mode 100644
index 879b3ca1e5c4b6a01539ee5997cdb86a68077388..0000000000000000000000000000000000000000
--- a/packages/kokkos/doc/hardware_identification/query_cuda_arch.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <cstdio>
-#include <cuda_runtime_api.h>
-int main() {
-  cudaDeviceProp prop;
-  const cudaError_t err_code = cudaGetDeviceProperties(&prop, 0);
-  if (cudaSuccess != err_code) {
-    fprintf(stderr, "cudaGetDeviceProperties failed: %s\n",
-            cudaGetErrorString(err_code));
-    return -1;
-  }
-  switch (prop.major) {
-    case 3: printf("Kepler"); break;
-    case 5: printf("Maxwell"); break;
-    case 6: printf("Pascal"); break;
-    default:
-      fprintf(stderr, "Unsupported Device %d%d\n", (int)prop.major,
-              (int)prop.minor);
-      return -1;
-  }
-  printf("%d%d\n", (int)prop.major, (int)prop.minor);
-  return 0;
-}
diff --git a/packages/kokkos/example/build_cmake_in_tree/cmake_example.cpp b/packages/kokkos/example/build_cmake_in_tree/cmake_example.cpp
index 3d3afdc171615dea7a61d8bd526ba3782da2937a..b345c48f53556c3354fd893b3e125f03617a20a5 100644
--- a/packages/kokkos/example/build_cmake_in_tree/cmake_example.cpp
+++ b/packages/kokkos/example/build_cmake_in_tree/cmake_example.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <cstdio>
diff --git a/packages/kokkos/example/build_cmake_installed/CMakeLists.txt b/packages/kokkos/example/build_cmake_installed/CMakeLists.txt
index 780f7e6ac6d110573a8958d567063e32edad3764..aaf745b418de894d3403bd0e3176eb972938ac5b 100644
--- a/packages/kokkos/example/build_cmake_installed/CMakeLists.txt
+++ b/packages/kokkos/example/build_cmake_installed/CMakeLists.txt
@@ -10,6 +10,9 @@ project(Example CXX Fortran)
 find_package(Kokkos REQUIRED)
 
 add_executable(example cmake_example.cpp foo.f)
+if(CMAKE_Fortran_COMPILER_ID STREQUAL LLVMFlang)
+  set_target_properties(example PROPERTIES LINKER_LANGUAGE Fortran)
+endif()
 
 # This is the only thing required to set up compiler/linker flags
 target_link_libraries(example Kokkos::kokkos)
diff --git a/packages/kokkos/example/build_cmake_installed/cmake_example.cpp b/packages/kokkos/example/build_cmake_installed/cmake_example.cpp
index 5101526ab865cdcd2e9e00250530a0db605da756..ca11250edd8b28c40d7fb58bdab1156362f275fb 100644
--- a/packages/kokkos/example/build_cmake_installed/cmake_example.cpp
+++ b/packages/kokkos/example/build_cmake_installed/cmake_example.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <cstdio>
diff --git a/packages/kokkos/example/build_cmake_installed_different_compiler/bar.cpp b/packages/kokkos/example/build_cmake_installed_different_compiler/bar.cpp
index 09ea0e6c4ff702e0a95724bfe7e8c79a951987f3..c50474db9df3bac51a385084eaedfd969d62b60c 100644
--- a/packages/kokkos/example/build_cmake_installed_different_compiler/bar.cpp
+++ b/packages/kokkos/example/build_cmake_installed_different_compiler/bar.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <cstdio>
 
diff --git a/packages/kokkos/example/build_cmake_installed_different_compiler/foo.cpp b/packages/kokkos/example/build_cmake_installed_different_compiler/foo.cpp
index f78f07c6f6ba00fcbbf154dcfcb3088d0be1c8fd..e17d34aab15b8c038b57bb4868673d15ae663d3a 100644
--- a/packages/kokkos/example/build_cmake_installed_different_compiler/foo.cpp
+++ b/packages/kokkos/example/build_cmake_installed_different_compiler/foo.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <cstdio>
diff --git a/packages/kokkos/example/build_cmake_installed_kk_as_language/bar.cpp b/packages/kokkos/example/build_cmake_installed_kk_as_language/bar.cpp
index b0280c1f450377d8602a84a3fcbeec2dbf94e4e7..a26f90ac658d5bd894c6d8320f6ffee81a01d9b7 100644
--- a/packages/kokkos/example/build_cmake_installed_kk_as_language/bar.cpp
+++ b/packages/kokkos/example/build_cmake_installed_kk_as_language/bar.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <cstdio>
 void print_cxx() { printf("Hello From C++\n"); }
diff --git a/packages/kokkos/example/build_cmake_installed_kk_as_language/cmake_example.cpp b/packages/kokkos/example/build_cmake_installed_kk_as_language/cmake_example.cpp
index b9b1c5848d1dd8a1fd082684bfadc8aebd1acb03..c7f24bd5ab6eaa8fe7360028a0fe893d3d595549 100644
--- a/packages/kokkos/example/build_cmake_installed_kk_as_language/cmake_example.cpp
+++ b/packages/kokkos/example/build_cmake_installed_kk_as_language/cmake_example.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <cstdio>
diff --git a/packages/kokkos/example/make_buildlink/main.cpp b/packages/kokkos/example/make_buildlink/main.cpp
index 2dbfb2687c118ba57a3b57d4dceaae6ffee2bea4..f15506d37feb764bfc99dd8e87e338627afd0d62 100644
--- a/packages/kokkos/example/make_buildlink/main.cpp
+++ b/packages/kokkos/example/make_buildlink/main.cpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #include <Kokkos_Core.hpp>
 
 int main(int argc, char* argv[]) {
diff --git a/packages/kokkos/example/query_device/query_device.cpp b/packages/kokkos/example/query_device/query_device.cpp
index 9c4e9a8c835938c0b301fa1927a2cb5d08e654c1..ad6e5f1113e23ca3f1b6b93a58bbbdaafdb76028 100644
--- a/packages/kokkos/example/query_device/query_device.cpp
+++ b/packages/kokkos/example/query_device/query_device.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <iostream>
 #include <sstream>
diff --git a/packages/kokkos/example/tutorial/01_hello_world/hello_world.cpp b/packages/kokkos/example/tutorial/01_hello_world/hello_world.cpp
index 5810e0ee7a267c79a823d00516937b8ccd43c0d9..5b8a21af833bba0ab4d6d3bb6fbf3f3a52ce9e84 100644
--- a/packages/kokkos/example/tutorial/01_hello_world/hello_world.cpp
+++ b/packages/kokkos/example/tutorial/01_hello_world/hello_world.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <cstdio>
diff --git a/packages/kokkos/example/tutorial/01_hello_world_lambda/hello_world_lambda.cpp b/packages/kokkos/example/tutorial/01_hello_world_lambda/hello_world_lambda.cpp
index 06f209774eae10a4a11161d17aae979450d6e850..c78f30763613215b88a78a34c6b5ece9fbfb6cdf 100644
--- a/packages/kokkos/example/tutorial/01_hello_world_lambda/hello_world_lambda.cpp
+++ b/packages/kokkos/example/tutorial/01_hello_world_lambda/hello_world_lambda.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <cstdio>
diff --git a/packages/kokkos/example/tutorial/02_simple_reduce/simple_reduce.cpp b/packages/kokkos/example/tutorial/02_simple_reduce/simple_reduce.cpp
index 2b7668e515bcbb83ec0c073ebb1422df9a85ba7a..c0fb2dc93079b4aa552e6e6afe8f8f41ee316e8f 100644
--- a/packages/kokkos/example/tutorial/02_simple_reduce/simple_reduce.cpp
+++ b/packages/kokkos/example/tutorial/02_simple_reduce/simple_reduce.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <cstdio>
diff --git a/packages/kokkos/example/tutorial/02_simple_reduce_lambda/simple_reduce_lambda.cpp b/packages/kokkos/example/tutorial/02_simple_reduce_lambda/simple_reduce_lambda.cpp
index 7f4c356e0ce90896f709922cc10556a6fa08cd04..5cae6da16cf0325c350c6504168faa211334b2b5 100644
--- a/packages/kokkos/example/tutorial/02_simple_reduce_lambda/simple_reduce_lambda.cpp
+++ b/packages/kokkos/example/tutorial/02_simple_reduce_lambda/simple_reduce_lambda.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <cstdio>
diff --git a/packages/kokkos/example/tutorial/03_simple_view/simple_view.cpp b/packages/kokkos/example/tutorial/03_simple_view/simple_view.cpp
index 46cac62b9df1ab5c9124dffef75089afc1b718ca..8be280f12c19083bbebd40461626d725f003f885 100644
--- a/packages/kokkos/example/tutorial/03_simple_view/simple_view.cpp
+++ b/packages/kokkos/example/tutorial/03_simple_view/simple_view.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 //
 // First Kokkos::View (multidimensional array) example:
diff --git a/packages/kokkos/example/tutorial/03_simple_view_lambda/simple_view_lambda.cpp b/packages/kokkos/example/tutorial/03_simple_view_lambda/simple_view_lambda.cpp
index 33b3a1a7db17740d5f578bace4be2e74e80ed03d..bdcd45b246e2904aea632550354170ce9ee7cb81 100644
--- a/packages/kokkos/example/tutorial/03_simple_view_lambda/simple_view_lambda.cpp
+++ b/packages/kokkos/example/tutorial/03_simple_view_lambda/simple_view_lambda.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 //
 // First Kokkos::View (multidimensional array) example:
diff --git a/packages/kokkos/example/tutorial/04_simple_memoryspaces/simple_memoryspaces.cpp b/packages/kokkos/example/tutorial/04_simple_memoryspaces/simple_memoryspaces.cpp
index 40ad6123e7bb7b1fd8f3b9ad79c01df7105ef5c3..fc9e48e51252beb57493641acccedc7935b219d2 100644
--- a/packages/kokkos/example/tutorial/04_simple_memoryspaces/simple_memoryspaces.cpp
+++ b/packages/kokkos/example/tutorial/04_simple_memoryspaces/simple_memoryspaces.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <cstdio>
diff --git a/packages/kokkos/example/tutorial/05_simple_atomics/simple_atomics.cpp b/packages/kokkos/example/tutorial/05_simple_atomics/simple_atomics.cpp
index 32b18e4d2047c5f3dcc23614109f4440b4686549..5196250c34bd2987f8385cc749d4e3f727326745 100644
--- a/packages/kokkos/example/tutorial/05_simple_atomics/simple_atomics.cpp
+++ b/packages/kokkos/example/tutorial/05_simple_atomics/simple_atomics.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <cstdio>
diff --git a/packages/kokkos/example/tutorial/06_simple_mdrangepolicy/simple_mdrangepolicy.cpp b/packages/kokkos/example/tutorial/06_simple_mdrangepolicy/simple_mdrangepolicy.cpp
index aac3b7eba869280ff09c0c5604ce4e4421d3693f..bef4ed2bc988e6d946af9a3bf616b0a4596403d3 100644
--- a/packages/kokkos/example/tutorial/06_simple_mdrangepolicy/simple_mdrangepolicy.cpp
+++ b/packages/kokkos/example/tutorial/06_simple_mdrangepolicy/simple_mdrangepolicy.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <cstdio>
diff --git a/packages/kokkos/example/tutorial/Advanced_Views/01_data_layouts/data_layouts.cpp b/packages/kokkos/example/tutorial/Advanced_Views/01_data_layouts/data_layouts.cpp
index 75eca5403fd12ae09f2839ef696fafefa9f8f277..dc27f1f537ac2a0573dc68fdf8fc8d33816e15c7 100644
--- a/packages/kokkos/example/tutorial/Advanced_Views/01_data_layouts/data_layouts.cpp
+++ b/packages/kokkos/example/tutorial/Advanced_Views/01_data_layouts/data_layouts.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <Kokkos_Timer.hpp>
diff --git a/packages/kokkos/example/tutorial/Advanced_Views/02_memory_traits/memory_traits.cpp b/packages/kokkos/example/tutorial/Advanced_Views/02_memory_traits/memory_traits.cpp
index 0544e572e7e9785369bfc824db783ea2fcd5af53..753d2fd9db8c757d3a379e494864531c1aff8490 100644
--- a/packages/kokkos/example/tutorial/Advanced_Views/02_memory_traits/memory_traits.cpp
+++ b/packages/kokkos/example/tutorial/Advanced_Views/02_memory_traits/memory_traits.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <Kokkos_Timer.hpp>
diff --git a/packages/kokkos/example/tutorial/Advanced_Views/03_subviews/subviews.cpp b/packages/kokkos/example/tutorial/Advanced_Views/03_subviews/subviews.cpp
index 52af4bd3b5ba84b3b5c1b53111900a9104e41922..d464b963c89675e582174df208f3c14786b9ef85 100644
--- a/packages/kokkos/example/tutorial/Advanced_Views/03_subviews/subviews.cpp
+++ b/packages/kokkos/example/tutorial/Advanced_Views/03_subviews/subviews.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 // This example simulates one timestep of an explicit
 // finite-difference discretization of a time-dependent partial
diff --git a/packages/kokkos/example/tutorial/Advanced_Views/04_dualviews/dual_view.cpp b/packages/kokkos/example/tutorial/Advanced_Views/04_dualviews/dual_view.cpp
index 622b24b93131094ebd3c331d4c4f01ae14cca325..3bf8b3dbf3e809cf7673c3343b8d08d389170ad9 100644
--- a/packages/kokkos/example/tutorial/Advanced_Views/04_dualviews/dual_view.cpp
+++ b/packages/kokkos/example/tutorial/Advanced_Views/04_dualviews/dual_view.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <Kokkos_DualView.hpp>
diff --git a/packages/kokkos/example/tutorial/Advanced_Views/05_NVIDIA_UVM/uvm_example.cpp b/packages/kokkos/example/tutorial/Advanced_Views/05_NVIDIA_UVM/uvm_example.cpp
index 596b25aaade065c9ade57f90107e17d6fda3d06a..b61ee05ca5459868b0fb768e44e712ee8e32c6c6 100644
--- a/packages/kokkos/example/tutorial/Advanced_Views/05_NVIDIA_UVM/uvm_example.cpp
+++ b/packages/kokkos/example/tutorial/Advanced_Views/05_NVIDIA_UVM/uvm_example.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <Kokkos_DualView.hpp>
diff --git a/packages/kokkos/example/tutorial/Advanced_Views/07_Overlapping_DeepCopy/overlapping_deepcopy.cpp b/packages/kokkos/example/tutorial/Advanced_Views/07_Overlapping_DeepCopy/overlapping_deepcopy.cpp
index c03515479d0d7e0365272f87cbe49d11b21f13aa..e0fc2d148009cc86c6b640d3370e17d36a43a90d 100644
--- a/packages/kokkos/example/tutorial/Advanced_Views/07_Overlapping_DeepCopy/overlapping_deepcopy.cpp
+++ b/packages/kokkos/example/tutorial/Advanced_Views/07_Overlapping_DeepCopy/overlapping_deepcopy.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <cstdio>
diff --git a/packages/kokkos/example/tutorial/Algorithms/01_random_numbers/random_numbers.cpp b/packages/kokkos/example/tutorial/Algorithms/01_random_numbers/random_numbers.cpp
index 602122b61f1b94788b95052478a6123ae41fbfd9..f3a752972f96d75b4bf1ed1309c64211926cbcb3 100644
--- a/packages/kokkos/example/tutorial/Algorithms/01_random_numbers/random_numbers.cpp
+++ b/packages/kokkos/example/tutorial/Algorithms/01_random_numbers/random_numbers.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <Kokkos_Random.hpp>
diff --git a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/01_thread_teams/thread_teams.cpp b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/01_thread_teams/thread_teams.cpp
index 735de65e056c84a5290105db39d5369a50f16ec7..b041f8d435b9586c42f59806ad7c2c3d159468f7 100644
--- a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/01_thread_teams/thread_teams.cpp
+++ b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/01_thread_teams/thread_teams.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <cstdio>
diff --git a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/01_thread_teams_lambda/thread_teams_lambda.cpp b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/01_thread_teams_lambda/thread_teams_lambda.cpp
index dcb1e0561bca8b096b528d61128f85c6254c221c..933b254f7c7ba9e2ce8e916c7d9c55e301c7b174 100644
--- a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/01_thread_teams_lambda/thread_teams_lambda.cpp
+++ b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/01_thread_teams_lambda/thread_teams_lambda.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <cstdio>
diff --git a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/02_nested_parallel_for/nested_parallel_for.cpp b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/02_nested_parallel_for/nested_parallel_for.cpp
index a528b71fe33f817b03dc32bacdbe8cd96271eab7..398810d133195c9534ded415e6ea92b1be70968a 100644
--- a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/02_nested_parallel_for/nested_parallel_for.cpp
+++ b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/02_nested_parallel_for/nested_parallel_for.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <cstdio>
diff --git a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/03_vectorization/vectorization.cpp b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/03_vectorization/vectorization.cpp
index 8f76110f086e4ca0e7b11d2fc998fc4354f7008e..ae9430a93b0ec79b37a4ddc999284a976db2c196 100644
--- a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/03_vectorization/vectorization.cpp
+++ b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/03_vectorization/vectorization.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <Kokkos_Random.hpp>
diff --git a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/04_team_scan/team_scan.cpp b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/04_team_scan/team_scan.cpp
index cc20a497b2325825cf5faf01e2fd527e71efee53..f7269d62cc764194e85ef9edbc149b22a3d711ab 100644
--- a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/04_team_scan/team_scan.cpp
+++ b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/04_team_scan/team_scan.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <Kokkos_DualView.hpp>
@@ -127,9 +99,9 @@ int main(int narg, char* args[]) {
 
     Kokkos::Timer timer;
     // threads/team is automatically limited to maximum supported by the device.
-    int team_size = TEAM_SIZE;
-    if (team_size > Device::execution_space::concurrency())
-      team_size = Device::execution_space::concurrency();
+    int const concurrency = Device::execution_space().concurrency();
+    int team_size         = TEAM_SIZE;
+    if (team_size > concurrency) team_size = concurrency;
     Kokkos::parallel_for(team_policy(nchunks, team_size),
                          find_2_tuples(chunk_size, data, histogram));
     Kokkos::fence();
diff --git a/packages/kokkos/example/tutorial/launch_bounds/launch_bounds_reduce.cpp b/packages/kokkos/example/tutorial/launch_bounds/launch_bounds_reduce.cpp
index 92f82111f98c6afc966520f58b1709197bedf429..9471d3c16ac54bba57abad06c7189a51f7adbd02 100644
--- a/packages/kokkos/example/tutorial/launch_bounds/launch_bounds_reduce.cpp
+++ b/packages/kokkos/example/tutorial/launch_bounds/launch_bounds_reduce.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <Kokkos_Core.hpp>
 #include <cstdio>
diff --git a/packages/kokkos/example/virtual_functions/classes.cpp b/packages/kokkos/example/virtual_functions/classes.cpp
index 9041f980ed46e7b05cfe3f2f8c5432fba49890d8..5d855e030d62d5c20d3019a091212b8e69faeee3 100644
--- a/packages/kokkos/example/virtual_functions/classes.cpp
+++ b/packages/kokkos/example/virtual_functions/classes.cpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #include <classes.hpp>
 
 KOKKOS_FUNCTION
diff --git a/packages/kokkos/example/virtual_functions/classes.hpp b/packages/kokkos/example/virtual_functions/classes.hpp
index 4fa9f595024fb5a18fce62e85edaf10e34ddc0c3..c27a4605720914c35022287f771df79d3aa1b302 100644
--- a/packages/kokkos/example/virtual_functions/classes.hpp
+++ b/packages/kokkos/example/virtual_functions/classes.hpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #ifndef KOKKOS_EXAMPLE_VIRTUAL_FUNCTIONS_CLASSES_HPP
 #define KOKKOS_EXAMPLE_VIRTUAL_FUNCTIONS_CLASSES_HPP
 
diff --git a/packages/kokkos/example/virtual_functions/main.cpp b/packages/kokkos/example/virtual_functions/main.cpp
index aaa7afb0340ba308caa84021300fec9e72643aee..3d725a2af543635e36df7d28abdfaf2f3dc367fb 100644
--- a/packages/kokkos/example/virtual_functions/main.cpp
+++ b/packages/kokkos/example/virtual_functions/main.cpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 #include <classes.hpp>
 
 int main(int argc, char* argv[]) {
diff --git a/packages/kokkos/generate_makefile.bash b/packages/kokkos/generate_makefile.bash
index 3b78301fca06e79a6433f57d8eddd2ce9c47ff5e..018426c9b8e9dca8d612a68ca0e6a29b657fccc4 100755
--- a/packages/kokkos/generate_makefile.bash
+++ b/packages/kokkos/generate_makefile.bash
@@ -70,8 +70,6 @@ get_kokkos_cuda_option_list() {
         CUDA_OPT_NAME=CUDA_RELOCATABLE_DEVICE_CODE
      elif  [ "${CUDA_}" == "force_uvm" ]; then
         CUDA_OPT_NAME=CUDA_UVM
-     elif  [ "${CUDA_}" == "use_ldg" ]; then
-        CUDA_OPT_NAME=CUDA_LDG_INTRINSIC
      else
         echo "${CUDA_} is not a valid cuda options..."
      fi
@@ -159,10 +157,11 @@ display_help_text() {
       echo "                 ZEN2            = AMD Zen2-Core CPU"
       echo "                 ZEN3            = AMD Zen3-Core CPU"
       echo "               [AMD: GPU]"
-      echo "                 VEGA900         = AMD GPU MI25 GFX900"
       echo "                 VEGA906         = AMD GPU MI50/MI60 GFX906"
       echo "                 VEGA908         = AMD GPU MI100 GFX908"
       echo "                 VEGA90A         = AMD GPU MI200 GFX90A"
+      echo "                 NAVI1030        = AMD GPU V620/W6800 GFX1030"
+      echo "                 NAVI1100        = AMD GPU RX 7900 XT(X) GFX1100"
       echo "               [ARM]"
       echo "                 ARMV80          = ARMv8.0 Compatible CPU"
       echo "                 ARMV81          = ARMv8.1 Compatible CPU"
@@ -215,9 +214,9 @@ display_help_text() {
       echo "--cxxflags=[FLAGS]            Overwrite CXXFLAGS for library build and test"
       echo "                                build.  This will still set certain required"
       echo "                                flags via KOKKOS_CXXFLAGS (such as -fopenmp,"
-      echo "                                -std=c++14, etc.)."
+      echo "                                -std=c++17, etc.)."
       echo "--cxxstandard=[FLAGS]         Set CMAKE_CXX_STANDARD for library build and test"
-      echo "                                c++14 (default), c++17, c++1y, c++1z, c++2a"
+      echo "                                17 (default), 1z, 20, 2a, 23, 2b"
       echo "--ldflags=[FLAGS]             Overwrite LDFLAGS for library build and test"
       echo "                                build. This will still set certain required"
       echo "                                flags via KOKKOS_LDFLAGS (such as -fopenmp,"
@@ -505,5 +504,5 @@ if [[ ${COMPILER} == *clang* ]]; then
    fi
 fi
 
-echo cmake $COMPILER_CMD  -DCMAKE_CXX_FLAGS="${KOKKOS_CXXFLAGS}" -DCMAKE_EXE_LINKER_FLAGS="${KOKKOS_LDFLAGS}" -DCMAKE_INSTALL_PREFIX=${PREFIX} ${KOKKOS_DEVICE_CMD} ${KOKKOS_ARCH_CMD} -DKokkos_ENABLE_TESTS=${KOKKOS_DO_TESTS} -DKokkos_ENABLE_EXAMPLES=${KOKKOS_DO_EXAMPLES} ${KOKKOS_OPTION_CMD} ${KOKKOS_CUDA_OPTION_CMD} ${KOKKOS_HIP_OPTION_CMD} -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_EXTENSIONS=OFF ${STANDARD_CMD} ${KOKKOS_DEBUG_CMD} ${KOKKOS_BC_CMD} ${KOKKOS_HWLOC_CMD} ${KOKKOS_HWLOC_PATH_CMD} ${KOKKOS_MEMKIND_CMD} ${KOKKOS_MEMKIND_PATH_CMD} -DKokkos_ENABLE_DEPRECATION_WARNINGS=${KOKKOS_DEPRECATED_CODE_WARNINGS} -DKokkos_ENABLE_DEPRECATED_CODE_3=${KOKKOS_DEPRECATED_CODE} ${KOKKOS_PATH}
-cmake $COMPILER_CMD  -DCMAKE_CXX_FLAGS="${KOKKOS_CXXFLAGS//\"}" -DCMAKE_EXE_LINKER_FLAGS="${KOKKOS_LDFLAGS//\"}" -DCMAKE_INSTALL_PREFIX=${PREFIX} ${KOKKOS_DEVICE_CMD} ${KOKKOS_ARCH_CMD} -DKokkos_ENABLE_TESTS=${KOKKOS_DO_TESTS} -DKokkos_ENABLE_EXAMPLES=${KOKKOS_DO_EXAMPLES} ${KOKKOS_OPTION_CMD} ${KOKKOS_CUDA_OPTION_CMD} ${KOKKOS_HIP_OPTION_CMD} -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_EXTENSIONS=OFF ${STANDARD_CMD} ${KOKKOS_DEBUG_CMD} ${KOKKOS_BC_CMD} ${KOKKOS_HWLOC_CMD} ${KOKKOS_HWLOC_PATH_CMD} ${KOKKOS_MEMKIND_CMD} ${KOKKOS_MEMKIND_PATH_CMD} ${PASSTHRU_CMAKE_FLAGS} -DKokkos_ENABLE_DEPRECATION_WARNINGS=${KOKKOS_DEPRECATED_CODE_WARNINGS} -DKokkos_ENABLE_DEPRECATED_CODE_3=${KOKKOS_DEPRECATED_CODE} ${KOKKOS_PATH}
+echo cmake $COMPILER_CMD  -DCMAKE_CXX_FLAGS="${KOKKOS_CXXFLAGS}" -DCMAKE_EXE_LINKER_FLAGS="${KOKKOS_LDFLAGS}" -DCMAKE_INSTALL_PREFIX=${PREFIX} ${KOKKOS_DEVICE_CMD} ${KOKKOS_ARCH_CMD} -DKokkos_ENABLE_TESTS=${KOKKOS_DO_TESTS} -DKokkos_ENABLE_EXAMPLES=${KOKKOS_DO_EXAMPLES} ${KOKKOS_OPTION_CMD} ${KOKKOS_CUDA_OPTION_CMD} ${KOKKOS_HIP_OPTION_CMD} -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_EXTENSIONS=OFF ${STANDARD_CMD} ${KOKKOS_DEBUG_CMD} ${KOKKOS_BC_CMD} ${KOKKOS_HWLOC_CMD} ${KOKKOS_HWLOC_PATH_CMD} ${KOKKOS_MEMKIND_CMD} ${KOKKOS_MEMKIND_PATH_CMD} -DKokkos_ENABLE_DEPRECATION_WARNINGS=${KOKKOS_DEPRECATED_CODE_WARNINGS} -DKokkos_ENABLE_DEPRECATED_CODE_4=${KOKKOS_DEPRECATED_CODE} ${KOKKOS_PATH}
+cmake $COMPILER_CMD  -DCMAKE_CXX_FLAGS="${KOKKOS_CXXFLAGS//\"}" -DCMAKE_EXE_LINKER_FLAGS="${KOKKOS_LDFLAGS//\"}" -DCMAKE_INSTALL_PREFIX=${PREFIX} ${KOKKOS_DEVICE_CMD} ${KOKKOS_ARCH_CMD} -DKokkos_ENABLE_TESTS=${KOKKOS_DO_TESTS} -DKokkos_ENABLE_EXAMPLES=${KOKKOS_DO_EXAMPLES} ${KOKKOS_OPTION_CMD} ${KOKKOS_CUDA_OPTION_CMD} ${KOKKOS_HIP_OPTION_CMD} -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_EXTENSIONS=OFF ${STANDARD_CMD} ${KOKKOS_DEBUG_CMD} ${KOKKOS_BC_CMD} ${KOKKOS_HWLOC_CMD} ${KOKKOS_HWLOC_PATH_CMD} ${KOKKOS_MEMKIND_CMD} ${KOKKOS_MEMKIND_PATH_CMD} ${PASSTHRU_CMAKE_FLAGS} -DKokkos_ENABLE_DEPRECATION_WARNINGS=${KOKKOS_DEPRECATED_CODE_WARNINGS} -DKokkos_ENABLE_DEPRECATED_CODE_4=${KOKKOS_DEPRECATED_CODE} ${KOKKOS_PATH}
diff --git a/packages/kokkos/gnu_generate_makefile.bash b/packages/kokkos/gnu_generate_makefile.bash
index aab95e12e34c71ba2777f63ee30213fb9b62bab9..5ea159cdd47fc48b0872ae7c3061f176e9a88436 100755
--- a/packages/kokkos/gnu_generate_makefile.bash
+++ b/packages/kokkos/gnu_generate_makefile.bash
@@ -188,9 +188,9 @@ do
       echo "--cxxflags=[FLAGS]            Overwrite CXXFLAGS for library build and test"
       echo "                                build.  This will still set certain required"
       echo "                                flags via KOKKOS_CXXFLAGS (such as -fopenmp,"
-      echo "                                -std=c++14, etc.)."
+      echo "                                -std=c++17, etc.)."
       echo "--cxxstandard=[FLAGS]         Overwrite KOKKOS_CXX_STANDARD for library build and test"
-      echo "                                c++14 (default), c++17, c++1y, c++1z, c++2a"
+      echo "                                c++17 (default), c++1z, c++20, c++2a, c++23, c++2b"
       echo "--ldflags=[FLAGS]             Overwrite LDFLAGS for library build and test"
       echo "                                build. This will still set certain required"
       echo "                                flags via KOKKOS_LDFLAGS (such as -fopenmp,"
diff --git a/packages/kokkos/master_history.txt b/packages/kokkos/master_history.txt
index bd639c847e03cdd0909fc83ccf6d0843148d6bea..73e48268b5a6dbeda0bbaa99cd1adf7badc94640 100644
--- a/packages/kokkos/master_history.txt
+++ b/packages/kokkos/master_history.txt
@@ -30,3 +30,5 @@ tag:  3.6.00     date: 04:14:2022    master: 2834f94a    release: 6ea708ff
 tag:  3.6.01     date: 06:16:2022    master: b52f8c83    release: afe9b404
 tag:  3.7.00     date: 08:25:2022    master: d19aab99    release: 0018e5fb
 tag:  3.7.01     date: 12:01:2022    master: 61d7db55    release: d3bb8cfe
+tag:  4.0.00     date: 02:23:2023    master: 5ad60966    release: 52ea2953
+tag:  4.0.01     date: 04:26:2023    master: aa1f48f3    release: 5893754f
diff --git a/packages/kokkos/scripts/apply-clang-format b/packages/kokkos/scripts/apply-clang-format
index d988ca7ae29990cc123f43b36d9c01c05cf5d904..7f7fb82686e448516625b65fdb2350cff0341aba 100755
--- a/packages/kokkos/scripts/apply-clang-format
+++ b/packages/kokkos/scripts/apply-clang-format
@@ -40,4 +40,4 @@ find ${TRACKED_FILES} \
   xargs -n 1 -P 10 -I {} bash -c "sed -i -e 's/\s\+$//g' {} && rm -f '{}-e'"
 
 # Check that we do not introduce any file with the old copyright
-./scripts/update-copyright
+./scripts/check-copyright
diff --git a/packages/kokkos/scripts/check-copyright b/packages/kokkos/scripts/check-copyright
new file mode 100755
index 0000000000000000000000000000000000000000..be696d069aa964df2a187bacb2d509fac8578718
--- /dev/null
+++ b/packages/kokkos/scripts/check-copyright
@@ -0,0 +1,16 @@
+files=`git ls-files | grep -e '.*\.\(cc\|cpp\|hpp\)' | grep -v 'tpls/'`
+echo "" &> scripts/diff_files
+tmp=`cat LICENSE_FILE_HEADER | wc -l`
+NNEW=$(($tmp))
+for file in $files; do
+  head -n +$NNEW $file &> header
+  diff header LICENSE_FILE_HEADER &> header_diff
+  count=`cat header_diff | wc -l`
+  #echo $file " " COUNT " " $count >> diff_headers
+  if [ "$count" -ne "0" ]; then
+    echo $file >> scripts/diff_files
+  fi
+done
+tmpfile=$(mktemp -t kokkos_diff_files.XXXX)
+cat scripts/diff_files | sort &> $tmpfile
+mv $tmpfile scripts/diff_files
diff --git a/packages/kokkos/scripts/diff_files b/packages/kokkos/scripts/diff_files
new file mode 100644
index 0000000000000000000000000000000000000000..125568d34557b7d8b087a5ef8bf9934b60f0813a
--- /dev/null
+++ b/packages/kokkos/scripts/diff_files
@@ -0,0 +1,2 @@
+
+core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics.hpp
diff --git a/packages/kokkos/scripts/docker/Dockerfile.gcc b/packages/kokkos/scripts/docker/Dockerfile.gcc
index 84c432cd2480fa9477c7889b083713186c1a9517..3cfb39dc20ba48417be4fe8100b1eb8dc283ad4f 100644
--- a/packages/kokkos/scripts/docker/Dockerfile.gcc
+++ b/packages/kokkos/scripts/docker/Dockerfile.gcc
@@ -12,9 +12,9 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y \
 
 RUN echo "deb http://dk.archive.ubuntu.com/ubuntu/ xenial main" >> /etc/apt/sources.list && \
     echo "deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe" >> /etc/apt/sources.list && \
-    apt-get update && apt-get install -y g++-5 && \
-    update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 5 && \
-    update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 5 && \
+    apt-get update && apt-get install -y g++-8 && \
+    update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 8 && \
+    update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 8 && \
     apt-get clean && rm -rf /var/lib/apt/lists/*
 
 
diff --git a/packages/kokkos/scripts/docker/Dockerfile.hipcc b/packages/kokkos/scripts/docker/Dockerfile.hipcc
index 3274a59c34ea0f421a717540ce38a01c17279e52..95f76fe89a355d5f6964dc8847a987b50fc455cf 100644
--- a/packages/kokkos/scripts/docker/Dockerfile.hipcc
+++ b/packages/kokkos/scripts/docker/Dockerfile.hipcc
@@ -1,4 +1,4 @@
-ARG BASE=rocm/dev-ubuntu-20.04:4.5
+ARG BASE=rocm/dev-ubuntu-20.04:5.2
 FROM $BASE
 
 RUN apt-get update && apt-get install -y \
diff --git a/packages/kokkos/scripts/docker/Dockerfile.kokkosllvmproject b/packages/kokkos/scripts/docker/Dockerfile.kokkosllvmproject
index e4ab07dbc250b945ce654803409371ff4f6f1db3..9086cba5e8edd734f4d81cd6a18702ed4549ba00 100644
--- a/packages/kokkos/scripts/docker/Dockerfile.kokkosllvmproject
+++ b/packages/kokkos/scripts/docker/Dockerfile.kokkosllvmproject
@@ -13,6 +13,15 @@ RUN apt-get update && apt-get install -y \
     apt-get clean && \
     rm -rf /var/lib/apt/lists/*
 
+# unbuntu18.04-based images have libstdc++ that is lacking filesystem support
+RUN apt-get update && \
+    apt-get install -y software-properties-common && \
+    add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
+    apt-get update && \
+    apt-get install -y g++-9 && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists/*
+
 RUN KEYDUMP_URL=https://cloud.cees.ornl.gov/download && \
     KEYDUMP_FILE=keydump && \
     wget --quiet ${KEYDUMP_URL}/${KEYDUMP_FILE} && \
diff --git a/packages/kokkos/scripts/docker/Dockerfile.openmptarget b/packages/kokkos/scripts/docker/Dockerfile.openmptarget
index e10c3f2208f2bb9368f6f33a82da4b43ef61fa30..44c53fef1dd78f6aafe37321df0004f51b2971ff 100644
--- a/packages/kokkos/scripts/docker/Dockerfile.openmptarget
+++ b/packages/kokkos/scripts/docker/Dockerfile.openmptarget
@@ -38,7 +38,7 @@ RUN CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSIO
     rm ${CMAKE_SCRIPT}
 ENV PATH=${CMAKE_DIR}/bin:$PATH
 
-ARG LLVM_VERSION=llvmorg-14.0.0
+ARG LLVM_VERSION=llvmorg-15.0.0
 ENV LLVM_DIR=/opt/llvm
 RUN LLVM_URL=https://github.com/llvm/llvm-project/archive &&\
     LLVM_ARCHIVE=${LLVM_VERSION}.tar.gz &&\
diff --git a/packages/kokkos/scripts/docker/Dockerfile.sycl b/packages/kokkos/scripts/docker/Dockerfile.sycl
index 0970d2ac5727ce144badf496745c980639185bc4..d7d764e8aa53f89ecb3f93a685a6946ad08f52a2 100644
--- a/packages/kokkos/scripts/docker/Dockerfile.sycl
+++ b/packages/kokkos/scripts/docker/Dockerfile.sycl
@@ -14,6 +14,15 @@ RUN apt-get update && apt-get install -y \
     apt-get clean && \
     rm -rf /var/lib/apt/lists/*
 
+# unbuntu18.04-based images have libstdc++ that is lacking filesystem support
+RUN apt-get update && \
+    apt-get install -y software-properties-common && \
+    add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
+    apt-get update && \
+    apt-get install -y g++-9 && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists/*
+
 RUN KEYDUMP_URL=https://cloud.cees.ornl.gov/download && \
     KEYDUMP_FILE=keydump && \
     wget --quiet ${KEYDUMP_URL}/${KEYDUMP_FILE} && \
@@ -22,7 +31,7 @@ RUN KEYDUMP_URL=https://cloud.cees.ornl.gov/download && \
     gpg --verify ${KEYDUMP_FILE}.sig ${KEYDUMP_FILE} && \
     rm ${KEYDUMP_FILE}*
 
-ARG CMAKE_VERSION=3.18.5
+ARG CMAKE_VERSION=3.23.2
 ENV CMAKE_DIR=/opt/cmake
 RUN CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION} && \
     CMAKE_SCRIPT=cmake-${CMAKE_VERSION}-Linux-x86_64.sh && \
diff --git a/packages/kokkos/scripts/testing_scripts/TestEXEC_TEST.cpp b/packages/kokkos/scripts/testing_scripts/TestEXEC_TEST.cpp
index 883e88b51b7dd6c3f116ea8731934db5b7dde72a..0abfa21eaf1ddb97190ff21fd858319a9bd6960d 100644
--- a/packages/kokkos/scripts/testing_scripts/TestEXEC_TEST.cpp
+++ b/packages/kokkos/scripts/testing_scripts/TestEXEC_TEST.cpp
@@ -1,47 +1,18 @@
-
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <TestEXEC_Category.hpp>
 #include <TestTEST.hpp>
diff --git a/packages/kokkos/scripts/testing_scripts/generate_makefile.bash b/packages/kokkos/scripts/testing_scripts/generate_makefile.bash
index ff9620efa689254af88bf64637e4998ca2d75265..ae1db3186f72df9295535356bfea9a272c861648 100755
--- a/packages/kokkos/scripts/testing_scripts/generate_makefile.bash
+++ b/packages/kokkos/scripts/testing_scripts/generate_makefile.bash
@@ -167,9 +167,9 @@ do
       echo "--cxxflags=[FLAGS]            Overwrite CXXFLAGS for library build and test"
       echo "                                build.  This will still set certain required"
       echo "                                flags via KOKKOS_CXXFLAGS (such as -fopenmp,"
-      echo "                                -std=c++14, etc.)."
+      echo "                                -std=c++17, etc.)."
       echo "--cxxstandard=[FLAGS]         Overwrite KOKKOS_CXX_STANDARD for library build and test"
-      echo "                                c++14 (default), c++17, c++1y, c++1z, c++2a"
+      echo "                                c++17 (default), c++1z, c++20, c++2a, c++23, c++2b"
       echo "--ldflags=[FLAGS]             Overwrite LDFLAGS for library build and test"
       echo "                                build. This will still set certain required"
       echo "                                flags via KOKKOS_LDFLAGS (such as -fopenmp,"
diff --git a/packages/kokkos/scripts/testing_scripts/gnu_test_all_sandia b/packages/kokkos/scripts/testing_scripts/gnu_test_all_sandia
index b2a0677e12fc14bc1b9ecc834e961abee5543efe..57929e897267eb1f12f63de8114f5f9779325254 100755
--- a/packages/kokkos/scripts/testing_scripts/gnu_test_all_sandia
+++ b/packages/kokkos/scripts/testing_scripts/gnu_test_all_sandia
@@ -95,7 +95,7 @@ CXX_FLAGS_EXTRA=""
 LD_FLAGS_EXTRA=""
 KOKKOS_OPTIONS=""
 
-CXX_STANDARD="c++14"
+CXX_STANDARD="c++17"
 
 #
 # Handle arguments.
@@ -518,7 +518,7 @@ if [ "$PRINT_HELP" = "True" ]; then
   echo "--build-only: Just do builds, don't run anything"
   echo "--opt-flag=FLAG: Optimization flag (default: -O3)"
   echo "--cxxflags-extra=FLAGS: Extra flags to be added to CXX_FLAGS"
-  echo "--cxxstandard=OPT: c++14 (default), c++17, c++1y, c++1z, c++2a"
+  echo "--cxxstandard=OPT: c++17 (default), c++1z, c++20, c++2a, c++23, c++2b"
   echo "--ldflags-extra=FLAGS: Extra flags to be added to LD_FLAGS"
   echo "--arch=ARCHITECTURE: overwrite architecture flags"
   echo "--with-cuda-options=OPT: set KOKKOS_CUDA_OPTIONS"
diff --git a/packages/kokkos/scripts/testing_scripts/test_all_sandia b/packages/kokkos/scripts/testing_scripts/test_all_sandia
index 72ee31707ecafed7e6e6bad506b2e16c4ff95ffc..40c30ba7f4588c19365a0f8df2a683ab4c22e998 100755
--- a/packages/kokkos/scripts/testing_scripts/test_all_sandia
+++ b/packages/kokkos/scripts/testing_scripts/test_all_sandia
@@ -25,7 +25,7 @@ print_help() {
   echo "--build-only: Just do builds, don't run anything"
   echo "--opt-flag=FLAG: Optimization flag (default: -O3)"
   echo "--cxxflags-extra=FLAGS: Extra flags to be added to CXX_FLAGS"
-  echo "--cxxstandard=OPT: c++14 (default), c++17, c++1y, c++1z, c++2a"
+  echo "--cxxstandard=OPT: c++17 (default), c++1z, c++20, c++2a, c++23, c++2b"
   echo "--ldflags-extra=FLAGS: Extra flags to be added to LD_FLAGS"
   echo "--arch=ARCHITECTURE: overwrite architecture flags"
   echo "--with-cuda-options=OPT: set KOKKOS_CUDA_OPTIONS"
@@ -73,11 +73,6 @@ HOSTNAME=$(hostname)
 PROCESSOR=`uname -p`
 CUDA_ENABLE_CMD=
 
-if [[ "$HOSTNAME" =~ (white|ride).* ]]; then
-  MACHINE=white
-  module load git
-fi
-
 if [[ "$HOSTNAME" =~ weaver.* ]]; then
   MACHINE=weaver
   module load git
@@ -165,7 +160,7 @@ CXX_FLAGS_EXTRA=""
 LD_FLAGS_EXTRA=""
 KOKKOS_OPTIONS=""
 
-CXX_STANDARD="14"
+CXX_STANDARD="17"
 
 CTESTTIMEOUT=2000
 
@@ -405,84 +400,27 @@ elif [ "$MACHINE" = "kokkos-dev" ]; then
                "cuda/9.2 $CUDA9_MODULE_LIST $CUDA_BUILD_LIST $KOKKOS_PATH/bin/nvcc_wrapper $CUDA_WARNING_FLAGS"
     )
   fi
-elif [ "$MACHINE" = "white" ]; then
-  source /etc/profile.d/modules.sh
-  SKIP_HWLOC=True
-  export SLURM_TASKS_PER_NODE=32
-
-  BASE_MODULE_LIST="cmake/3.19.3,<COMPILER_NAME>/<COMPILER_VERSION>"
-  IBM_MODULE_LIST="cmake/3.19.3,<COMPILER_NAME>/xl/<COMPILER_VERSION>,gcc/7.2.0"
-  CUDA_MODULE_LIST="cmake/3.19.3,<COMPILER_NAME>/<COMPILER_VERSION>,gcc/7.2.0,ibm/xl/16.1.1"
-  CUDA10_MODULE_LIST="cmake/3.19.3,<COMPILER_NAME>/<COMPILER_VERSION>,gcc/7.4.0,ibm/xl/16.1.1"
-
-  # Don't do pthread with Power
-  GCC_BUILD_LIST="OpenMP,Serial,OpenMP_Serial"
-
-  if [ "$SPOT_CHECK" = "True" ]; then
-    # Format: (compiler module-list build-list exe-name warning-flag)
-    COMPILERS=("gcc/6.4.0 $BASE_MODULE_LIST "OpenMP_Serial" g++ $GCC_WARNING_FLAGS"
-               "gcc/7.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
-               "ibm/16.1.1 $IBM_MODULE_LIST "Serial" xlC $IBM_WARNING_FLAGS"
-               "cuda/9.2.88 $CUDA_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS"
-               "cuda/10.1.105 $CUDA10_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS"
-    )
-  else
-    # Format: (compiler module-list build-list exe-name warning-flag)
-    COMPILERS=("gcc/5.4.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
-               "gcc/6.4.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
-               "gcc/7.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
-               "gcc/7.4.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
-               "gcc/9.3.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
-               "ibm/16.1.1 $IBM_MODULE_LIST $IBM_BUILD_LIST xlC $IBM_WARNING_FLAGS"
-               "cuda/9.2.88 $CUDA_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS"
-               "cuda/10.0.130 $CUDA10_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS"
-               "cuda/10.1.105 $CUDA10_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS"
-    )
-  fi
-
-  if [ -z "$ARCH_FLAG" ]; then
-    ARCH_FLAG="--arch=Power8,Pascal60"
-  fi
 
 elif [ "$MACHINE" = "weaver" ]; then
   source /etc/profile.d/modules.sh
   SKIP_HWLOC=True
 
+  # For rhel7W queue
   BASE_MODULE_LIST="cmake/3.19.3,<COMPILER_NAME>/<COMPILER_VERSION>"
-  IBM_MODULE_LIST="cmake/3.19.3,<COMPILER_NAME>/xl/<COMPILER_VERSION>,gcc/7.2.0"
-  CUDA_MODULE_LIST="cmake/3.19.3,<COMPILER_NAME>/<COMPILER_VERSION>,ibm/xl/16.1.1,gcc/7.2.0"
-  CUDA10_MODULE_LIST="cmake/3.19.3,<COMPILER_NAME>/<COMPILER_VERSION>,ibm/xl/16.1.1,gcc/7.4.0"
-  # Cuda/11 modules available only on the dev queue (rhel8 OS); gcc/8.3.1 loaded by default
-  CUDA11_MODULE_LIST="cmake/3.21.2,<COMPILER_NAME>/<COMPILER_VERSION>"
 
-  # Don't do pthread with Power
-  GCC_BUILD_LIST="OpenMP,Serial,OpenMP_Serial"
+  # For rhel8 queue
+  # Cuda/11 modules available only on the rhel8 queue (rhel8 OS)
+  RHEL8_BASE_MODULE_LIST="cmake/3.21.2,<COMPILER_NAME>/<COMPILER_VERSION>"
+  RHEL8_CUDA11_MODULE_LIST="cmake/3.21.2,<COMPILER_NAME>/<COMPILER_VERSION>"
 
-  if [ "$SPOT_CHECK" = "True" ]; then
-    # Format: (compiler module-list build-list exe-name warning-flag)
-    COMPILERS=("gcc/6.4.0 $BASE_MODULE_LIST "OpenMP_Serial" g++ $GCC_WARNING_FLAGS"
-               "gcc/7.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
-               "ibm/16.1.1 $IBM_MODULE_LIST "Serial" xlC $IBM_WARNING_FLAGS"
-               "cuda/9.2.88 $CUDA_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS"
-               "cuda/10.1.243 $CUDA10_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS"
-    )
-  else
-    # Format: (compiler module-list build-list exe-name warning-flag)
-    COMPILERS=("gcc/6.4.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
-               "gcc/7.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
-               "gcc/7.4.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
-               "gcc/9.3.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
-               "ibm/16.1.1 $IBM_MODULE_LIST $IBM_BUILD_LIST xlC $IBM_WARNING_FLAGS"
-               "cuda/9.2.88 $CUDA_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS"
-               "cuda/10.0.130 $CUDA10_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS"
-               "cuda/10.1.105 $CUDA10_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS"
-               "cuda/10.1.243 $CUDA10_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS"
-               "cuda/10.2.089 $CUDA10_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS"
-               "cuda/10.2.2 $CUDA10_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS"
-               "cuda/11.2.2 $CUDA11_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS"
-    )
-  fi
+  # Don't do pthread with Power
+  GCC_IBM_BUILD_LIST="OpenMP,Serial,OpenMP_Serial"
 
+  # Format: (compiler module-list build-list exe-name warning-flag)
+  COMPILERS=("gcc/9.3.0 $BASE_MODULE_LIST $GCC_IBM_BUILD_LIST g++ $GCC_WARNING_FLAGS"
+             "gcc/8.3.1 $RHEL8_BASE_MODULE_LIST $GCC_IBM_BUILD_LIST g++ $GCC_WARNING_FLAGS"
+             "cuda/11.2.2 $RHEL8_CUDA11_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS"
+  )
   if [ -z "$ARCH_FLAG" ]; then
     ARCH_FLAG="--arch=Power9,Volta70"
   fi
@@ -529,10 +467,8 @@ elif [ "$MACHINE" = "caraway" ]; then
   HIPCLANG_WARNING_FLAGS="-Werror -Wno-unused-command-line-argument -DNDEBUG"
 
   # Format: (compiler module-list build-list exe-name warning-flag)
-  COMPILERS=("rocm/4.3.0 $BASE_MODULE_LIST $HIPCLANG_BUILD_LIST hipcc $HIPCLANG_WARNING_FLAGS"
-             "rocm/4.5.0 $BASE_MODULE_LIST $HIPCLANG_BUILD_LIST hipcc $HIPCLANG_WARNING_FLAGS"
+  COMPILERS=("rocm/5.2.0 $BASE_MODULE_LIST $HIPCLANG_BUILD_LIST hipcc $HIPCLANG_WARNING_FLAGS"
              "cuda/11.4 $CUDA11_MODULE_LIST $CUDA_BUILD_LIST $KOKKOS_PATH/bin/nvcc_wrapper $CUDA_WARNING_FLAGS"
-             "gcc/7.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
              "gcc/8.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
              "gcc/9.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
              "gcc/10.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
@@ -540,7 +476,7 @@ elif [ "$MACHINE" = "caraway" ]; then
   )
 
   if [ -z "$ARCH_FLAG" ]; then
-    ARCH_FLAG="--arch=VEGA906"
+    ARCH_FLAG="--arch=VEGA908"
   fi
 
 elif [ "$MACHINE" = "blake" ]; then
@@ -562,16 +498,8 @@ elif [ "$MACHINE" = "blake" ]; then
              "gcc/7.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
   )
   else
-  COMPILERS=("intel/17.4.196 $BASE_MODULE_LIST_INTEL $INTEL_BUILD_LIST icpc $INTEL_WARNING_FLAGS"
-             "intel/18.0.128 $BASE_MODULE_LIST_INTEL $INTEL_BUILD_LIST icpc $INTEL_WARNING_FLAGS"
-             "intel/18.1.163 $BASE_MODULE_LIST_INTEL $INTEL_BUILD_LIST icpc $INTEL_WARNING_FLAGS"
-             "intel/19.1.144 $BASE_MODULE_LIST_INTEL $INTEL_BUILD_LIST icpc $INTEL_WARNING_FLAGS"
-             "intel/19.3.199 $BASE_MODULE_LIST_INTEL $INTEL_BUILD_LIST icpc $INTEL_WARNING_FLAGS"
-             "intel/19.5.281 $BASE_MODULE_LIST_INTEL $INTEL_BUILD_LIST icpc $INTEL_WARNING_FLAGS"
+  COMPILERS=("intel/19.5.281 $BASE_MODULE_LIST_INTEL $INTEL_BUILD_LIST icpc $INTEL_WARNING_FLAGS"
              "intel/2021.1.1 $BASE_MODULE_LIST_ONEAPI $INTEL_BUILD_LIST icpx $ONEAPI_WARNING_FLAGS"
-             "gcc/5.5.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
-             "gcc/6.4.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
-             "gcc/7.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
              "gcc/8.1.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
              "gcc/8.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
              "gcc/9.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS"
@@ -900,9 +828,6 @@ single_build_and_test() {
 
     run_cmd ${KOKKOS_PATH}/generate_makefile.bash --with-devices=$LOCAL_KOKKOS_DEVICES $ARCH_FLAG --compiler=$(which $compiler_exe) --cxxflags=\"$cxxflags\" --cxxstandard=\"$cxx_standard\" --ldflags=\"$ldflags\" $CUDA_ENABLE_CMD --kokkos-path=${KOKKOS_PATH} ${KOKKOS_BOUNDS_CHECK} --no-examples ${KOKKOS_DEPRECATED_CODE} ${KOKKOS_DEPRECATED_CODE_WARNINGS} $extra_args &>> ${desc}.configure.log || { report_and_log_test_result 1 ${desc} configure && return 0; }
     local make_par_lvl=12
-    if [[ "$MACHINE" = white* ]]; then
-      make_par_lvl=48
-    fi
     local -i build_start_time=$(date +%s)
     run_cmd make -j  $make_par_lvl all >& ${desc}.build.log || { report_and_log_test_result 1 ${desc} build && return 0; }
     local -i build_end_time=$(date +%s)
diff --git a/packages/kokkos/scripts/update-copyright b/packages/kokkos/scripts/update-copyright
index 04224f9ec937c2077b501a6e56eccaac67358787..a863d06c042e642d73fb99a37dca55374568f0b4 100755
--- a/packages/kokkos/scripts/update-copyright
+++ b/packages/kokkos/scripts/update-copyright
@@ -1,6 +1,32 @@
-files=`find . -name '*.cpp' -o -name '*.pc.in' -o -name '*.hpp' -o -name 'LICENSE' -o -name 'Copyright.txt' -o -name '*.cc'`
+files=`git ls-files | grep -e '.*\.\(cc\|cpp\|hpp\)' | grep -v 'tpls/'`
+echo "" &> diff_files
+echo "" &> clean_files
+echo "" &> updated_files
+tmp=`cat scripts/new_header | wc -l`
+NNEW=$(($tmp))
+tmp=`cat scripts/old_header | wc -l`
+NOLD=$(($tmp))
+NOLD1=$(($NOLD+1))
 for file in $files; do
-awk '{if($2=="Copyright" && $3=="(2014)" && $4=="Sandia" && $5=="Corporation") {print "//       Copyright (2020) National Technology & Engineering"; print "//               Solutions of Sandia, LLC (NTESS).";} else {print $0}}' $file | sed 's/DE-AC04-94AL85000 with Sandia Corporation/DE-NA0003525 with NTESS/g' | sed 's|Kokkos v. 2.0|Kokkos v. 3.0|g' &> tmp
-sed -i 's|SANDIA CORPORATION|NTESS|g' tmp
-cp tmp $file
+  head -n +$NOLD $file &> header
+  diff header scripts/old_header &> old_header_diff
+  count=`cat old_header_diff | wc -l`
+  #echo $file " " COUNT " " $count >> diff_headers
+  if [ "$count" -eq "0" ]; then
+    echo $file >> clean_files
+    cat old_header_diff >> clean_files
+    { head -n +$NNEW scripts/new_header; tail -n +$NOLD1 $file; } > tmp
+    cp tmp $file
+  else
+    head -n +$NNEW $file &> header
+    diff header scripts/new_header &> new_header_diff  
+    count=`cat new_header_diff | wc -l`
+    if [ "$count" -eq "0" ]; then  
+      echo $file >> updated_files
+    else
+      echo $file >> diff_files
+      #cat header_diff >> diff_files
+      tr -d '\n' < diff_files  | sed 's|\.\/| |g' &> modify_files
+    fi
+  fi
 done
diff --git a/packages/kokkos/simd/src/Kokkos_SIMD.hpp b/packages/kokkos/simd/src/Kokkos_SIMD.hpp
index a15a1b8ebf41ae242b6ac0df86dd8cecdae2365c..92807634076ee1719f6c9b2926811cd9fada2f5f 100644
--- a/packages/kokkos/simd/src/Kokkos_SIMD.hpp
+++ b/packages/kokkos/simd/src/Kokkos_SIMD.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SIMD_HPP
 #define KOKKOS_SIMD_HPP
@@ -49,10 +21,18 @@
 
 #include <Kokkos_SIMD_Scalar.hpp>
 
+#ifdef KOKKOS_ARCH_AVX2
+#include <Kokkos_SIMD_AVX2.hpp>
+#endif
+
 #ifdef KOKKOS_ARCH_AVX512XEON
 #include <Kokkos_SIMD_AVX512.hpp>
 #endif
 
+#ifdef __ARM_NEON
+#include <Kokkos_SIMD_NEON.hpp>
+#endif
+
 namespace Kokkos {
 namespace Experimental {
 
@@ -62,6 +42,10 @@ namespace Impl {
 
 #if defined(KOKKOS_ARCH_AVX512XEON)
 using host_native = avx512_fixed_size<8>;
+#elif defined(KOKKOS_ARCH_AVX2)
+using host_native  = avx2_fixed_size<4>;
+#elif defined(__ARM_NEON)
+using host_native  = neon_fixed_size<2>;
 #else
 using host_native  = scalar;
 #endif
@@ -111,9 +95,16 @@ struct ForSpace<Kokkos::Experimental::OpenMPTarget> {
 };
 #endif
 
+#ifdef KOKKOS_ENABLE_OPENACC
+template <>
+struct ForSpace<Kokkos::Experimental::OpenACC> {
+  using type = scalar;
+};
+#endif
+
 #ifdef KOKKOS_ENABLE_HIP
 template <>
-struct ForSpace<Kokkos::Experimental::HIP> {
+struct ForSpace<Kokkos::HIP> {
   using type = scalar;
 };
 #endif
@@ -145,8 +136,12 @@ namespace Impl {
 template <class... Abis>
 class abi_set {};
 
-#ifdef KOKKOS_ARCH_AVX512XEON
+#if defined(KOKKOS_ARCH_AVX512XEON)
 using host_abi_set = abi_set<simd_abi::scalar, simd_abi::avx512_fixed_size<8>>;
+#elif defined(KOKKOS_ARCH_AVX2)
+using host_abi_set = abi_set<simd_abi::scalar, simd_abi::avx2_fixed_size<4>>;
+#elif defined(__ARM_NEON)
+using host_abi_set = abi_set<simd_abi::scalar, simd_abi::neon_fixed_size<2>>;
 #else
 using host_abi_set = abi_set<simd_abi::scalar>;
 #endif
diff --git a/packages/kokkos/simd/src/Kokkos_SIMD_AVX2.hpp b/packages/kokkos/simd/src/Kokkos_SIMD_AVX2.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..86b944efa5408fdf9a886081cc31b81e5441eb1c
--- /dev/null
+++ b/packages/kokkos/simd/src/Kokkos_SIMD_AVX2.hpp
@@ -0,0 +1,1020 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_SIMD_AVX2_HPP
+#define KOKKOS_SIMD_AVX2_HPP
+
+#include <functional>
+#include <type_traits>
+
+#include <Kokkos_SIMD_Common.hpp>
+
+#include <immintrin.h>
+
+namespace Kokkos {
+
+namespace Experimental {
+
+namespace simd_abi {
+
+template <int N>
+class avx2_fixed_size {};
+
+}  // namespace simd_abi
+
+template <>
+class simd_mask<double, simd_abi::avx2_fixed_size<4>> {
+  __m256d m_value;
+
+ public:
+  class reference {
+    __m256d& m_mask;
+    int m_lane;
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION __m256d bit_mask() const {
+      return _mm256_castsi256_pd(_mm256_setr_epi64x(
+          -std::int64_t(m_lane == 0), -std::int64_t(m_lane == 1),
+          -std::int64_t(m_lane == 2), -std::int64_t(m_lane == 3)));
+    }
+
+   public:
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(__m256d& mask_arg,
+                                                    int lane_arg)
+        : m_mask(mask_arg), m_lane(lane_arg) {}
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference
+    operator=(bool value) const {
+      if (value) {
+        m_mask = _mm256_or_pd(bit_mask(), m_mask);
+      } else {
+        m_mask = _mm256_andnot_pd(bit_mask(), m_mask);
+      }
+      return *this;
+    }
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator bool() const {
+      return (_mm256_movemask_pd(m_mask) & (1 << m_lane)) != 0;
+    }
+  };
+  using value_type = bool;
+  using abi_type   = simd_abi::avx2_fixed_size<4>;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask() = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd_mask(value_type value)
+      : m_value(_mm256_castsi256_pd(_mm256_set1_epi64x(-std::int64_t(value)))) {
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask(
+      simd_mask<std::int32_t, simd_abi::avx2_fixed_size<4>> const& i32_mask);
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() {
+    return 4;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd_mask(
+      __m256d const& value_in)
+      : m_value(value_in) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator __m256d()
+      const {
+    return m_value;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) {
+    return reference(m_value, int(i));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type
+  operator[](std::size_t i) const {
+    return static_cast<value_type>(
+        reference(const_cast<__m256d&>(m_value), int(i)));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask
+  operator||(simd_mask const& other) const {
+    return simd_mask(_mm256_or_pd(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask
+  operator&&(simd_mask const& other) const {
+    return simd_mask(_mm256_and_pd(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask operator!() const {
+    auto const true_value = static_cast<__m256d>(simd_mask(true));
+    return simd_mask(_mm256_andnot_pd(m_value, true_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator==(
+      simd_mask const& other) const {
+    return _mm256_movemask_pd(m_value) == _mm256_movemask_pd(other.m_value);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator!=(
+      simd_mask const& other) const {
+    return !operator==(other);
+  }
+};
+
+template <>
+class simd_mask<std::int32_t, simd_abi::avx2_fixed_size<4>> {
+  __m128i m_value;
+
+ public:
+  class reference {
+    __m128i& m_mask;
+    int m_lane;
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION __m128i bit_mask() const {
+      return _mm_setr_epi32(
+          -std::int32_t(m_lane == 0), -std::int32_t(m_lane == 1),
+          -std::int32_t(m_lane == 2), -std::int32_t(m_lane == 3));
+    }
+
+   public:
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(__m128i& mask_arg,
+                                                    int lane_arg)
+        : m_mask(mask_arg), m_lane(lane_arg) {}
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference
+    operator=(bool value) const {
+      if (value) {
+        m_mask = _mm_or_si128(bit_mask(), m_mask);
+      } else {
+        m_mask = _mm_andnot_si128(bit_mask(), m_mask);
+      }
+      return *this;
+    }
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator bool() const {
+      return (_mm_movemask_ps(_mm_castsi128_ps(m_mask)) & (1 << m_lane)) != 0;
+    }
+  };
+  using value_type = bool;
+  using abi_type   = simd_abi::avx2_fixed_size<4>;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask()                 = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask(simd_mask const&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask(simd_mask&&)      = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd_mask(value_type value)
+      : m_value(_mm_set1_epi32(-std::int32_t(value))) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() {
+    return 4;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd_mask(
+      __m128i const& value_in)
+      : m_value(value_in) {}
+  template <class U>
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask(
+      simd_mask<U, abi_type> const& other) {
+    for (std::size_t i = 0; i < size(); ++i) (*this)[i] = other[i];
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator __m128i()
+      const {
+    return m_value;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) {
+    return reference(m_value, int(i));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type
+  operator[](std::size_t i) const {
+    return static_cast<value_type>(
+        reference(const_cast<__m128i&>(m_value), int(i)));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask
+  operator||(simd_mask const& other) const {
+    return simd_mask(_mm_or_si128(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask
+  operator&&(simd_mask const& other) const {
+    return simd_mask(_mm_and_si128(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask operator!() const {
+    auto const true_value = static_cast<__m128i>(simd_mask(true));
+    return simd_mask(_mm_andnot_si128(m_value, true_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator==(
+      simd_mask const& other) const {
+    return _mm_movemask_ps(_mm_castsi128_ps(m_value)) ==
+           _mm_movemask_ps(_mm_castsi128_ps(other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator!=(
+      simd_mask const& other) const {
+    return !operator==(other);
+  }
+};
+
+template <>
+class simd_mask<std::int64_t, simd_abi::avx2_fixed_size<4>> {
+  __m256i m_value;
+
+ public:
+  class reference {
+    __m256i& m_mask;
+    int m_lane;
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION __m256i bit_mask() const {
+      return _mm256_setr_epi64x(
+          -std::int64_t(m_lane == 0), -std::int64_t(m_lane == 1),
+          -std::int64_t(m_lane == 2), -std::int64_t(m_lane == 3));
+    }
+
+   public:
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(__m256i& mask_arg,
+                                                    int lane_arg)
+        : m_mask(mask_arg), m_lane(lane_arg) {}
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference
+    operator=(bool value) const {
+      if (value) {
+        m_mask = _mm256_or_si256(bit_mask(), m_mask);
+      } else {
+        m_mask = _mm256_andnot_si256(bit_mask(), m_mask);
+      }
+      return *this;
+    }
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator bool() const {
+      return (_mm256_movemask_pd(_mm256_castsi256_pd(m_mask)) &
+              (1 << m_lane)) != 0;
+    }
+  };
+  using value_type = bool;
+  using abi_type   = simd_abi::avx2_fixed_size<4>;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask()                 = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask(simd_mask const&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask(simd_mask&&)      = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd_mask(value_type value)
+      : m_value(_mm256_set1_epi64x(-std::int64_t(value))) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() {
+    return 4;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd_mask(
+      __m256i const& value_in)
+      : m_value(value_in) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask(
+      simd_mask<std::int32_t, abi_type> const& other)
+      : m_value(_mm256_cvtepi32_epi64(static_cast<__m128i>(other))) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator __m256i()
+      const {
+    return m_value;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) {
+    return reference(m_value, int(i));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type
+  operator[](std::size_t i) const {
+    return static_cast<value_type>(
+        reference(const_cast<__m256i&>(m_value), int(i)));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask
+  operator||(simd_mask const& other) const {
+    return simd_mask(_mm256_or_si256(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask
+  operator&&(simd_mask const& other) const {
+    return simd_mask(_mm256_and_si256(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask operator!() const {
+    auto const true_value = static_cast<__m256i>(simd_mask(true));
+    return simd_mask(_mm256_andnot_si256(m_value, true_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator==(
+      simd_mask const& other) const {
+    return _mm256_movemask_pd(_mm256_castsi256_pd(m_value)) ==
+           _mm256_movemask_pd(_mm256_castsi256_pd(other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator!=(
+      simd_mask const& other) const {
+    return !operator==(other);
+  }
+};
+
+template <>
+class simd_mask<std::uint64_t, simd_abi::avx2_fixed_size<4>> {
+  __m256i m_value;
+
+ public:
+  class reference {
+    __m256i& m_mask;
+    int m_lane;
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION __m256i bit_mask() const {
+      return _mm256_setr_epi64x(
+          -std::int64_t(m_lane == 0), -std::int64_t(m_lane == 1),
+          -std::int64_t(m_lane == 2), -std::int64_t(m_lane == 3));
+    }
+
+   public:
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(__m256i& mask_arg,
+                                                    int lane_arg)
+        : m_mask(mask_arg), m_lane(lane_arg) {}
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference
+    operator=(bool value) const {
+      if (value) {
+        m_mask = _mm256_or_si256(bit_mask(), m_mask);
+      } else {
+        m_mask = _mm256_andnot_si256(bit_mask(), m_mask);
+      }
+      return *this;
+    }
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator bool() const {
+      return (_mm256_movemask_pd(_mm256_castsi256_pd(m_mask)) &
+              (1 << m_lane)) != 0;
+    }
+  };
+  using value_type = bool;
+  using abi_type   = simd_abi::avx2_fixed_size<4>;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask() = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd_mask(value_type value)
+      : m_value(_mm256_set1_epi64x(-std::int64_t(value))) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask(
+      simd_mask<std::int32_t, abi_type> const& other)
+      : m_value(_mm256_cvtepi32_epi64(static_cast<__m128i>(other))) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() {
+    return 4;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd_mask(
+      __m256i const& value_in)
+      : m_value(value_in) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator __m256i()
+      const {
+    return m_value;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) {
+    return reference(m_value, int(i));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type
+  operator[](std::size_t i) const {
+    return static_cast<value_type>(
+        reference(const_cast<__m256i&>(m_value), int(i)));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask
+  operator||(simd_mask const& other) const {
+    return simd_mask(_mm256_or_si256(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask
+  operator&&(simd_mask const& other) const {
+    return simd_mask(_mm256_and_si256(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask operator!() const {
+    auto const true_value = static_cast<__m256i>(simd_mask(true));
+    return simd_mask(_mm256_andnot_si256(m_value, true_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator==(
+      simd_mask const& other) const {
+    return _mm256_movemask_pd(_mm256_castsi256_pd(m_value)) ==
+           _mm256_movemask_pd(_mm256_castsi256_pd(other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator!=(
+      simd_mask const& other) const {
+    return !operator==(other);
+  }
+};
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd_mask<double, simd_abi::avx2_fixed_size<4>>::simd_mask(
+    simd_mask<std::int32_t, simd_abi::avx2_fixed_size<4>> const& i32_mask)
+    : m_value(_mm256_castsi256_pd(
+          _mm256_cvtepi32_epi64(static_cast<__m128i>(i32_mask)))) {}
+
+template <>
+class simd<double, simd_abi::avx2_fixed_size<4>> {
+  __m256d m_value;
+
+ public:
+  using value_type = double;
+  using abi_type   = simd_abi::avx2_fixed_size<4>;
+  using mask_type  = simd_mask<value_type, abi_type>;
+  using reference  = value_type&;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd()            = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd const&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd&&)      = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd const&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd&&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() {
+    return 4;
+  }
+  template <class U, std::enable_if_t<std::is_convertible_v<U, value_type>,
+                                      bool> = false>
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(U&& value)
+      : m_value(_mm256_set1_pd(value_type(value))) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(double a, double b, double c,
+                                             double d)
+      : m_value(_mm256_setr_pd(a, b, c, d)) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd(
+      __m256d const& value_in)
+      : m_value(value_in) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) {
+    return reinterpret_cast<value_type*>(&m_value)[i];
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type
+  operator[](std::size_t i) const {
+    return reinterpret_cast<value_type const*>(&m_value)[i];
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_from(value_type const* ptr,
+                                                       element_aligned_tag) {
+    m_value = _mm256_loadu_pd(ptr);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_to(
+      value_type* ptr, element_aligned_tag) const {
+    _mm256_storeu_pd(ptr, m_value);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator __m256d()
+      const {
+    return m_value;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator<(simd const& other) const {
+    return mask_type(_mm256_cmp_pd(m_value, other.m_value, _CMP_LT_OS));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator>(simd const& other) const {
+    return mask_type(_mm256_cmp_pd(m_value, other.m_value, _CMP_GT_OS));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator<=(simd const& other) const {
+    return mask_type(_mm256_cmp_pd(m_value, other.m_value, _CMP_LE_OS));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator>=(simd const& other) const {
+    return mask_type(_mm256_cmp_pd(m_value, other.m_value, _CMP_GE_OS));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator==(simd const& other) const {
+    return mask_type(_mm256_cmp_pd(m_value, other.m_value, _CMP_EQ_OS));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator!=(simd const& other) const {
+    return mask_type(_mm256_cmp_pd(m_value, other.m_value, _CMP_NEQ_OS));
+  }
+};
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<double, simd_abi::avx2_fixed_size<4>>
+    operator*(simd<double, simd_abi::avx2_fixed_size<4>> const& lhs,
+              simd<double, simd_abi::avx2_fixed_size<4>> const& rhs) {
+  return simd<double, simd_abi::avx2_fixed_size<4>>(
+      _mm256_mul_pd(static_cast<__m256d>(lhs), static_cast<__m256d>(rhs)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<double, simd_abi::avx2_fixed_size<4>>
+    operator/(simd<double, simd_abi::avx2_fixed_size<4>> const& lhs,
+              simd<double, simd_abi::avx2_fixed_size<4>> const& rhs) {
+  return simd<double, simd_abi::avx2_fixed_size<4>>(
+      _mm256_div_pd(static_cast<__m256d>(lhs), static_cast<__m256d>(rhs)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<double, simd_abi::avx2_fixed_size<4>>
+    operator+(simd<double, simd_abi::avx2_fixed_size<4>> const& lhs,
+              simd<double, simd_abi::avx2_fixed_size<4>> const& rhs) {
+  return simd<double, simd_abi::avx2_fixed_size<4>>(
+      _mm256_add_pd(static_cast<__m256d>(lhs), static_cast<__m256d>(rhs)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<double, simd_abi::avx2_fixed_size<4>>
+    operator-(simd<double, simd_abi::avx2_fixed_size<4>> const& lhs,
+              simd<double, simd_abi::avx2_fixed_size<4>> const& rhs) {
+  return simd<double, simd_abi::avx2_fixed_size<4>>(
+      _mm256_sub_pd(static_cast<__m256d>(lhs), static_cast<__m256d>(rhs)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<double, simd_abi::avx2_fixed_size<4>>
+    operator-(simd<double, simd_abi::avx2_fixed_size<4>> const& a) {
+  return simd<double, simd_abi::avx2_fixed_size<4>>(
+      _mm256_sub_pd(_mm256_set1_pd(0.0), static_cast<__m256d>(a)));
+}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<double, simd_abi::avx2_fixed_size<4>> copysign(
+    simd<double, simd_abi::avx2_fixed_size<4>> const& a,
+    simd<double, simd_abi::avx2_fixed_size<4>> const& b) {
+  __m256d const sign_mask = _mm256_set1_pd(-0.0);
+  return simd<double, simd_abi::avx2_fixed_size<4>>(
+      _mm256_xor_pd(_mm256_andnot_pd(sign_mask, static_cast<__m256d>(a)),
+                    _mm256_and_pd(sign_mask, static_cast<__m256d>(b))));
+}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<double, simd_abi::avx2_fixed_size<4>> abs(
+    simd<double, simd_abi::avx2_fixed_size<4>> const& a) {
+  __m256d const sign_mask = _mm256_set1_pd(-0.0);
+  return simd<double, simd_abi::avx2_fixed_size<4>>(
+      _mm256_andnot_pd(sign_mask, static_cast<__m256d>(a)));
+}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<double, simd_abi::avx2_fixed_size<4>> sqrt(
+    simd<double, simd_abi::avx2_fixed_size<4>> const& a) {
+  return simd<double, simd_abi::avx2_fixed_size<4>>(
+      _mm256_sqrt_pd(static_cast<__m256d>(a)));
+}
+
+#ifdef __INTEL_COMPILER
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<double, simd_abi::avx2_fixed_size<4>> cbrt(
+    simd<double, simd_abi::avx2_fixed_size<4>> const& a) {
+  return simd<double, simd_abi::avx2_fixed_size<4>>(
+      _mm256_cbrt_pd(static_cast<__m256d>(a)));
+}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<double, simd_abi::avx2_fixed_size<4>> exp(
+    simd<double, simd_abi::avx2_fixed_size<4>> const& a) {
+  return simd<double, simd_abi::avx2_fixed_size<4>>(
+      _mm256_exp_pd(static_cast<__m256d>(a)));
+}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<double, simd_abi::avx2_fixed_size<4>> log(
+    simd<double, simd_abi::avx2_fixed_size<4>> const& a) {
+  return simd<double, simd_abi::avx2_fixed_size<4>>(
+      _mm256_log_pd(static_cast<__m256d>(a)));
+}
+
+#endif
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<double, simd_abi::avx2_fixed_size<4>> fma(
+    simd<double, simd_abi::avx2_fixed_size<4>> const& a,
+    simd<double, simd_abi::avx2_fixed_size<4>> const& b,
+    simd<double, simd_abi::avx2_fixed_size<4>> const& c) {
+  return simd<double, simd_abi::avx2_fixed_size<4>>(
+      _mm256_fmadd_pd(static_cast<__m256d>(a), static_cast<__m256d>(b),
+                      static_cast<__m256d>(c)));
+}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<double, simd_abi::avx2_fixed_size<4>> max(
+    simd<double, simd_abi::avx2_fixed_size<4>> const& a,
+    simd<double, simd_abi::avx2_fixed_size<4>> const& b) {
+  return simd<double, simd_abi::avx2_fixed_size<4>>(
+      _mm256_max_pd(static_cast<__m256d>(a), static_cast<__m256d>(b)));
+}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<double, simd_abi::avx2_fixed_size<4>> min(
+    simd<double, simd_abi::avx2_fixed_size<4>> const& a,
+    simd<double, simd_abi::avx2_fixed_size<4>> const& b) {
+  return simd<double, simd_abi::avx2_fixed_size<4>>(
+      _mm256_min_pd(static_cast<__m256d>(a), static_cast<__m256d>(b)));
+}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<double, simd_abi::avx2_fixed_size<4>> condition(
+    simd_mask<double, simd_abi::avx2_fixed_size<4>> const& a,
+    simd<double, simd_abi::avx2_fixed_size<4>> const& b,
+    simd<double, simd_abi::avx2_fixed_size<4>> const& c) {
+  return simd<double, simd_abi::avx2_fixed_size<4>>(
+      _mm256_blendv_pd(static_cast<__m256d>(c), static_cast<__m256d>(b),
+                       static_cast<__m256d>(a)));
+}
+
+template <>
+class simd<std::int32_t, simd_abi::avx2_fixed_size<4>> {
+  __m128i m_value;
+
+ public:
+  using value_type = std::int32_t;
+  using abi_type   = simd_abi::avx2_fixed_size<4>;
+  using mask_type  = simd_mask<value_type, abi_type>;
+  using reference  = value_type&;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd()            = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd const&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd&&)      = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd const&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd&&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() {
+    return 4;
+  }
+  template <class U, std::enable_if_t<std::is_convertible_v<U, value_type>,
+                                      bool> = false>
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(U&& value)
+      : m_value(_mm_set1_epi32(value_type(value))) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(std::int32_t a, std::int32_t b,
+                                             std::int32_t c, std::int32_t d)
+      : m_value(_mm_setr_epi32(a, b, c, d)) {}
+  template <class G,
+            std::enable_if_t<
+                std::is_invocable_r_v<value_type, G,
+                                      std::integral_constant<std::size_t, 0>>,
+                bool> = false>
+  KOKKOS_FORCEINLINE_FUNCTION simd(G&& gen)
+      : simd(gen(std::integral_constant<std::size_t, 0>()),
+             gen(std::integral_constant<std::size_t, 1>()),
+             gen(std::integral_constant<std::size_t, 2>()),
+             gen(std::integral_constant<std::size_t, 3>())) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd(
+      __m128i const& value_in)
+      : m_value(value_in) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd(
+      simd<std::uint64_t, abi_type> const& other);
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) {
+    return reinterpret_cast<value_type*>(&m_value)[i];
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type
+  operator[](std::size_t i) const {
+    return reinterpret_cast<value_type const*>(&m_value)[i];
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_from(value_type const* ptr,
+                                                       element_aligned_tag) {
+    m_value = _mm_maskload_epi32(ptr, static_cast<__m128i>(mask_type(true)));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_to(
+      value_type* ptr, element_aligned_tag) const {
+    _mm_maskstore_epi32(ptr, static_cast<__m128i>(mask_type(true)), m_value);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator __m128i()
+      const {
+    return m_value;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator==(simd const& other) const {
+    return mask_type(_mm_cmpeq_epi32(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator>(simd const& other) const {
+    return mask_type(_mm_cmpgt_epi32(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator<(simd const& other) const {
+    return mask_type(_mm_cmplt_epi32(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator<=(simd const& other) const {
+    return ((*this) < other) || ((*this) == other);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator>=(simd const& other) const {
+    return ((*this) > other) || ((*this) == other);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator!=(simd const& other) const {
+    return !((*this) == other);
+  }
+};
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<std::int32_t, simd_abi::avx2_fixed_size<4>>
+    operator-(simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& lhs,
+              simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& rhs) {
+  return simd<std::int32_t, simd_abi::avx2_fixed_size<4>>(
+      _mm_sub_epi32(static_cast<__m128i>(lhs), static_cast<__m128i>(rhs)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<std::int32_t, simd_abi::avx2_fixed_size<4>>
+    operator+(simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& lhs,
+              simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& rhs) {
+  return simd<std::int32_t, simd_abi::avx2_fixed_size<4>>(
+      _mm_add_epi32(static_cast<__m128i>(lhs), static_cast<__m128i>(rhs)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<std::int32_t, simd_abi::avx2_fixed_size<4>>
+    condition(simd_mask<std::int32_t, simd_abi::avx2_fixed_size<4>> const& a,
+              simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& b,
+              simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& c) {
+  return simd<std::int32_t, simd_abi::avx2_fixed_size<4>>(_mm_castps_si128(
+      _mm_blendv_ps(_mm_castsi128_ps(static_cast<__m128i>(c)),
+                    _mm_castsi128_ps(static_cast<__m128i>(b)),
+                    _mm_castsi128_ps(static_cast<__m128i>(a)))));
+}
+
+template <>
+class simd<std::int64_t, simd_abi::avx2_fixed_size<4>> {
+  __m256i m_value;
+
+ public:
+  using value_type = std::int64_t;
+  using abi_type   = simd_abi::avx2_fixed_size<4>;
+  using mask_type  = simd_mask<value_type, abi_type>;
+  using reference  = value_type&;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd()            = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd const&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd&&)      = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd const&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd&&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() {
+    return 4;
+  }
+  template <class U, std::enable_if_t<std::is_convertible_v<U, value_type>,
+                                      bool> = false>
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(U&& value)
+      : m_value(_mm256_set1_epi64x(value_type(value))) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(std::int64_t a, std::int64_t b,
+                                             std::int64_t c, std::int64_t d)
+      : m_value(_mm256_setr_epi64x(a, b, c, d)) {}
+  template <class G,
+            std::enable_if_t<
+                std::is_invocable_r_v<value_type, G,
+                                      std::integral_constant<std::size_t, 0>>,
+                bool> = false>
+  KOKKOS_FORCEINLINE_FUNCTION simd(G&& gen)
+      : simd(gen(std::integral_constant<std::size_t, 0>()),
+             gen(std::integral_constant<std::size_t, 1>()),
+             gen(std::integral_constant<std::size_t, 2>()),
+             gen(std::integral_constant<std::size_t, 3>())) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd(
+      __m256i const& value_in)
+      : m_value(value_in) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(
+      simd<std::uint64_t, abi_type> const& other);
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(
+      simd<std::int32_t, abi_type> const& other)
+      : m_value(_mm256_cvtepi32_epi64(static_cast<__m128i>(other))) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) {
+    return reinterpret_cast<value_type*>(&m_value)[i];
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type
+  operator[](std::size_t i) const {
+    return reinterpret_cast<value_type const*>(&m_value)[i];
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_from(value_type const* ptr,
+                                                       element_aligned_tag) {
+    m_value = _mm256_maskload_epi64(ptr, static_cast<__m256i>(mask_type(true)));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_to(
+      value_type* ptr, element_aligned_tag) const {
+    _mm256_maskstore_epi64(ptr, static_cast<__m256i>(mask_type(true)), m_value);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator __m256i()
+      const {
+    return m_value;
+  }
+  // AVX2 only has eq and gt comparisons for int64
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator==(simd const& other) const {
+    return mask_type(_mm256_cmpeq_epi64(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator>(simd const& other) const {
+    return mask_type(_mm256_cmpgt_epi64(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator<(simd const& other) const {
+    return other > (*this);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator<=(simd const& other) const {
+    return ((*this) < other) || ((*this) == other);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator>=(simd const& other) const {
+    return ((*this) > other) || ((*this) == other);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator!=(simd const& other) const {
+    return !((*this) == other);
+  }
+};
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<std::int64_t, simd_abi::avx2_fixed_size<4>>
+    operator-(simd<std::int64_t, simd_abi::avx2_fixed_size<4>> const& lhs,
+              simd<std::int64_t, simd_abi::avx2_fixed_size<4>> const& rhs) {
+  return simd<std::int64_t, simd_abi::avx2_fixed_size<4>>(
+      _mm256_sub_epi64(static_cast<__m256i>(lhs), static_cast<__m256i>(rhs)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<std::int64_t, simd_abi::avx2_fixed_size<4>>
+    operator-(simd<std::int64_t, simd_abi::avx2_fixed_size<4>> const& a) {
+  return simd<std::int64_t, simd_abi::avx2_fixed_size<4>>(0) - a;
+}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<std::int64_t, simd_abi::avx2_fixed_size<4>> condition(
+    simd_mask<std::int64_t, simd_abi::avx2_fixed_size<4>> const& a,
+    simd<std::int64_t, simd_abi::avx2_fixed_size<4>> const& b,
+    simd<std::int64_t, simd_abi::avx2_fixed_size<4>> const& c) {
+  return simd<std::int64_t, simd_abi::avx2_fixed_size<4>>(_mm256_castpd_si256(
+      _mm256_blendv_pd(_mm256_castsi256_pd(static_cast<__m256i>(c)),
+                       _mm256_castsi256_pd(static_cast<__m256i>(b)),
+                       _mm256_castsi256_pd(static_cast<__m256i>(a)))));
+}
+
+template <>
+class simd<std::uint64_t, simd_abi::avx2_fixed_size<4>> {
+  __m256i m_value;
+
+ public:
+  using value_type = std::uint64_t;
+  using abi_type   = simd_abi::avx2_fixed_size<4>;
+  using mask_type  = simd_mask<value_type, abi_type>;
+  using reference  = value_type&;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd()            = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd const&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd&&)      = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd const&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd&&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() {
+    return 4;
+  }
+  template <class U, std::enable_if_t<std::is_convertible_v<U, value_type>,
+                                      bool> = false>
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(U&& value)
+      : m_value(_mm256_set1_epi64x(bit_cast<std::int64_t>(value_type(value)))) {
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr simd(__m256i const& value_in)
+      : m_value(value_in) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd(
+      simd<std::int32_t, abi_type> const& other)
+      : m_value(_mm256_cvtepi32_epi64(static_cast<__m128i>(other))) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd(
+      simd<std::int64_t, abi_type> const& other)
+      : m_value(static_cast<__m256i>(other)) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) {
+    return reinterpret_cast<value_type*>(&m_value)[i];
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type
+  operator[](std::size_t i) const {
+    return reinterpret_cast<value_type const*>(&m_value)[i];
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd
+  operator>>(unsigned int rhs) const {
+    return _mm256_srli_epi64(m_value, rhs);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd operator>>(
+      simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& rhs) const {
+    return _mm256_srlv_epi64(m_value,
+                             _mm256_cvtepi32_epi64(static_cast<__m128i>(rhs)));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd
+  operator<<(unsigned int rhs) const {
+    return _mm256_slli_epi64(m_value, rhs);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd operator<<(
+      simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& rhs) const {
+    return _mm256_sllv_epi64(m_value,
+                             _mm256_cvtepi32_epi64(static_cast<__m128i>(rhs)));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd
+  operator&(simd const& other) const {
+    return _mm256_and_si256(m_value, other.m_value);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd
+  operator|(simd const& other) const {
+    return _mm256_or_si256(m_value, other.m_value);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator __m256i()
+      const {
+    return m_value;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator==(simd const& other) const {
+    return mask_type(_mm256_cmpeq_epi64(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator!=(simd const& other) const {
+    return !((*this) == other);
+  }
+};
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<std::int64_t, simd_abi::avx2_fixed_size<4>>::simd(
+    simd<std::uint64_t, simd_abi::avx2_fixed_size<4>> const& other)
+    : m_value(static_cast<__m256i>(other)) {}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<std::uint64_t, simd_abi::avx2_fixed_size<4>> condition(
+    simd_mask<std::uint64_t, simd_abi::avx2_fixed_size<4>> const& a,
+    simd<std::uint64_t, simd_abi::avx2_fixed_size<4>> const& b,
+    simd<std::uint64_t, simd_abi::avx2_fixed_size<4>> const& c) {
+  return simd<std::uint64_t, simd_abi::avx2_fixed_size<4>>(_mm256_castpd_si256(
+      _mm256_blendv_pd(_mm256_castsi256_pd(static_cast<__m256i>(c)),
+                       _mm256_castsi256_pd(static_cast<__m256i>(b)),
+                       _mm256_castsi256_pd(static_cast<__m256i>(a)))));
+}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<std::int32_t, simd_abi::avx2_fixed_size<4>>::simd(
+    simd<std::uint64_t, simd_abi::avx2_fixed_size<4>> const& other) {
+  for (std::size_t i = 0; i < 4; ++i) {
+    (*this)[i] = std::int32_t(other[i]);
+  }
+}
+
+template <>
+class const_where_expression<simd_mask<double, simd_abi::avx2_fixed_size<4>>,
+                             simd<double, simd_abi::avx2_fixed_size<4>>> {
+ public:
+  using abi_type   = simd_abi::avx2_fixed_size<4>;
+  using value_type = simd<double, abi_type>;
+  using mask_type  = simd_mask<double, abi_type>;
+
+ protected:
+  value_type& m_value;
+  mask_type const& m_mask;
+
+ public:
+  const_where_expression(mask_type const& mask_arg, value_type const& value_arg)
+      : m_value(const_cast<value_type&>(value_arg)), m_mask(mask_arg) {}
+  [[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr mask_type const&
+  mask() const {
+    return m_mask;
+  }
+  [[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr value_type const&
+  value() const {
+    return m_value;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+  void copy_to(double* mem, element_aligned_tag) const {
+    _mm256_maskstore_pd(mem, _mm256_castpd_si256(static_cast<__m256d>(m_mask)),
+                        static_cast<__m256d>(m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+  void scatter_to(
+      double* mem,
+      simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& index) const {
+    for (std::size_t lane = 0; lane < 4; ++lane) {
+      if (m_mask[lane]) mem[index[lane]] = m_value[lane];
+    }
+  }
+};
+
+template <>
+class where_expression<simd_mask<double, simd_abi::avx2_fixed_size<4>>,
+                       simd<double, simd_abi::avx2_fixed_size<4>>>
+    : public const_where_expression<
+          simd_mask<double, simd_abi::avx2_fixed_size<4>>,
+          simd<double, simd_abi::avx2_fixed_size<4>>> {
+ public:
+  where_expression(
+      simd_mask<double, simd_abi::avx2_fixed_size<4>> const& mask_arg,
+      simd<double, simd_abi::avx2_fixed_size<4>>& value_arg)
+      : const_where_expression(mask_arg, value_arg) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+  void copy_from(double const* mem, element_aligned_tag) {
+    m_value = value_type(_mm256_maskload_pd(
+        mem, _mm256_castpd_si256(static_cast<__m256d>(m_mask))));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+  void gather_from(
+      double const* mem,
+      simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& index) {
+    m_value = value_type(_mm256_mask_i32gather_pd(
+        _mm256_set1_pd(0.0), mem, static_cast<__m128i>(index),
+        static_cast<__m256d>(m_mask), 8));
+  }
+  template <class U,
+            std::enable_if_t<std::is_convertible_v<
+                                 U, simd<double, simd_abi::avx2_fixed_size<4>>>,
+                             bool> = false>
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void operator=(U&& x) {
+    auto const x_as_value_type =
+        static_cast<simd<double, simd_abi::avx2_fixed_size<4>>>(
+            std::forward<U>(x));
+    m_value = simd<double, simd_abi::avx2_fixed_size<4>>(_mm256_blendv_pd(
+        static_cast<__m256d>(m_value), static_cast<__m256d>(x_as_value_type),
+        static_cast<__m256d>(m_mask)));
+  }
+};
+
+template <>
+class const_where_expression<
+    simd_mask<std::int32_t, simd_abi::avx2_fixed_size<4>>,
+    simd<std::int32_t, simd_abi::avx2_fixed_size<4>>> {
+ public:
+  using abi_type   = simd_abi::avx2_fixed_size<4>;
+  using value_type = simd<std::int32_t, abi_type>;
+  using mask_type  = simd_mask<std::int32_t, abi_type>;
+
+ protected:
+  value_type& m_value;
+  mask_type const& m_mask;
+
+ public:
+  const_where_expression(mask_type const& mask_arg, value_type const& value_arg)
+      : m_value(const_cast<value_type&>(value_arg)), m_mask(mask_arg) {}
+  [[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr mask_type const&
+  mask() const {
+    return m_mask;
+  }
+  [[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr value_type const&
+  value() const {
+    return m_value;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+  void copy_to(std::int32_t* mem, element_aligned_tag) const {
+    _mm_maskstore_epi32(mem, static_cast<__m128i>(m_mask),
+                        static_cast<__m128i>(m_value));
+  }
+};
+
+template <>
+class where_expression<simd_mask<std::int32_t, simd_abi::avx2_fixed_size<4>>,
+                       simd<std::int32_t, simd_abi::avx2_fixed_size<4>>>
+    : public const_where_expression<
+          simd_mask<std::int32_t, simd_abi::avx2_fixed_size<4>>,
+          simd<std::int32_t, simd_abi::avx2_fixed_size<4>>> {
+ public:
+  where_expression(
+      simd_mask<std::int32_t, simd_abi::avx2_fixed_size<4>> const& mask_arg,
+      simd<std::int32_t, simd_abi::avx2_fixed_size<4>>& value_arg)
+      : const_where_expression(mask_arg, value_arg) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+  void copy_from(std::int32_t const* mem, element_aligned_tag) {
+    m_value = value_type(_mm_maskload_epi32(mem, static_cast<__m128i>(m_mask)));
+  }
+};
+
+}  // namespace Experimental
+}  // namespace Kokkos
+
+#endif
diff --git a/packages/kokkos/simd/src/Kokkos_SIMD_AVX512.hpp b/packages/kokkos/simd/src/Kokkos_SIMD_AVX512.hpp
index 1df0730ac48aa1fa51109942f4c210d84e426f4f..b63bb569bb7573282db1d298988d0041f2929474 100644
--- a/packages/kokkos/simd/src/Kokkos_SIMD_AVX512.hpp
+++ b/packages/kokkos/simd/src/Kokkos_SIMD_AVX512.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SIMD_AVX512_HPP
 #define KOKKOS_SIMD_AVX512_HPP
diff --git a/packages/kokkos/simd/src/Kokkos_SIMD_Common.hpp b/packages/kokkos/simd/src/Kokkos_SIMD_Common.hpp
index ae2843b3055a6d602460dfb31031807cb7abe7d4..c29d49fb3ab4a781605f0be164b39413ffe9c989 100644
--- a/packages/kokkos/simd/src/Kokkos_SIMD_Common.hpp
+++ b/packages/kokkos/simd/src/Kokkos_SIMD_Common.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SIMD_COMMON_HPP
 #define KOKKOS_SIMD_COMMON_HPP
@@ -154,6 +126,44 @@ template <class T>
   return const_where_expression(mask, value);
 }
 
+// fallback simd multiplication using generator constructor
+// At the time of this writing, this fallback is only used
+// to multiply vectors of 64-bit signed integers for the AVX2 backend
+
+template <class T, class Abi>
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd<T, Abi> operator*(
+    simd<T, Abi> const& lhs, simd<T, Abi> const& rhs) {
+  return simd<T, Abi>([&](std::size_t i) { return lhs[i] * rhs[i]; });
+}
+
+// fallback simd shift using generator constructor
+// At the time of this writing, these fallbacks are only used
+// to shift vectors of 64-bit unsigned integers for the NEON backend
+
+template <class T, class U, class Abi>
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd<T, Abi> operator>>(
+    simd<T, Abi> const& lhs, unsigned int rhs) {
+  return simd<T, Abi>([&](std::size_t i) { return lhs[i] >> rhs; });
+}
+
+template <class T, class U, class Abi>
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd<T, Abi> operator<<(
+    simd<T, Abi> const& lhs, unsigned int rhs) {
+  return simd<T, Abi>([&](std::size_t i) { return lhs[i] << rhs; });
+}
+
+template <class T, class U, class Abi>
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd<T, Abi> operator>>(
+    simd<T, Abi> const& lhs, simd<U, Abi> const& rhs) {
+  return simd<T, Abi>([&](std::size_t i) { return lhs[i] >> rhs[i]; });
+}
+
+template <class T, class U, class Abi>
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd<T, Abi> operator<<(
+    simd<T, Abi> const& lhs, simd<U, Abi> const& rhs) {
+  return simd<T, Abi>([&](std::size_t i) { return lhs[i] << rhs[i]; });
+}
+
 // The code below provides:
 // operator@(simd<T, Abi>, Arithmetic)
 // operator@(Arithmetic, simd<T, Abi>)
@@ -323,6 +333,43 @@ template <class T, class Abi>
   return a == simd_mask<T, Abi>(false);
 }
 
+template <class T, class Abi>
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION T
+hmin(const_where_expression<simd_mask<T, Abi>, simd<T, Abi>> const& x) {
+  auto const& v = x.value();
+  auto const& m = x.mask();
+  auto result   = Kokkos::reduction_identity<T>::min();
+  for (std::size_t i = 0; i < v.size(); ++i) {
+    if (m[i]) result = Kokkos::min(result, v[i]);
+  }
+  return result;
+}
+
+template <class T, class Abi>
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION T
+hmax(const_where_expression<simd_mask<T, Abi>, simd<T, Abi>> const& x) {
+  auto const& v = x.value();
+  auto const& m = x.mask();
+  auto result   = Kokkos::reduction_identity<T>::max();
+  for (std::size_t i = 0; i < v.size(); ++i) {
+    if (m[i]) result = Kokkos::max(result, v[i]);
+  }
+  return result;
+}
+
+template <class T, class Abi>
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION T
+reduce(const_where_expression<simd_mask<T, Abi>, simd<T, Abi>> const& x, T,
+       std::plus<>) {
+  auto const& v = x.value();
+  auto const& m = x.mask();
+  auto result   = Kokkos::reduction_identity<T>::sum();
+  for (std::size_t i = 0; i < v.size(); ++i) {
+    if (m[i]) result += v[i];
+  }
+  return result;
+}
+
 }  // namespace Experimental
 
 template <class T, class Abi>
diff --git a/packages/kokkos/simd/src/Kokkos_SIMD_NEON.hpp b/packages/kokkos/simd/src/Kokkos_SIMD_NEON.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..2473004098e23e0be990ef9535a1c23d3970aeed
--- /dev/null
+++ b/packages/kokkos/simd/src/Kokkos_SIMD_NEON.hpp
@@ -0,0 +1,995 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
+#ifndef KOKKOS_SIMD_NEON_HPP
+#define KOKKOS_SIMD_NEON_HPP
+
+#include <functional>
+#include <type_traits>
+
+#include <Kokkos_SIMD_Common.hpp>
+
+#include <arm_neon.h>
+
+namespace Kokkos {
+
+namespace Experimental {
+
+namespace simd_abi {
+
+template <int N>
+class neon_fixed_size {};
+
+}  // namespace simd_abi
+
+namespace Impl {
+
+template <class Derived, int Bits>
+class neon_mask;
+
+template <class Derived>
+class neon_mask<Derived, 64> {
+  uint64x2_t m_value;
+
+ public:
+  class reference {
+    uint64x2_t& m_mask;
+    int m_lane;
+
+   public:
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(uint64x2_t& mask_arg,
+                                                    int lane_arg)
+        : m_mask(mask_arg), m_lane(lane_arg) {}
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference
+    operator=(bool value) const {
+      // this switch statement is needed because the lane argument has to be a
+      // constant
+      switch (m_lane) {
+        case 0:
+          m_mask = vsetq_lane_u64(value ? 0xFFFFFFFFFFFFFFFFULL : 0, m_mask, 0);
+          break;
+        case 1:
+          m_mask = vsetq_lane_u64(value ? 0xFFFFFFFFFFFFFFFFULL : 0, m_mask, 1);
+          break;
+      }
+      return *this;
+    }
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator bool() const {
+      switch (m_lane) {
+        case 0: return vgetq_lane_u64(m_mask, 0) != 0;
+        case 1: return vgetq_lane_u64(m_mask, 1) != 0;
+      }
+      return false;
+    }
+  };
+  using value_type          = bool;
+  using abi_type            = simd_abi::neon_fixed_size<2>;
+  using implementation_type = uint64x2_t;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION neon_mask() = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit neon_mask(value_type value)
+      : m_value(vmovq_n_u64(value ? 0xFFFFFFFFFFFFFFFFULL : 0)) {}
+  template <class U>
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION neon_mask(
+      neon_mask<U, 32> const& other) {
+    operator[](0) = bool(other[0]);
+    operator[](1) = bool(other[1]);
+  }
+  template <class U>
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION neon_mask(neon_mask<U, 64> const& other)
+      : neon_mask(static_cast<uint64x2_t>(other)) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() {
+    return 2;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit neon_mask(
+      uint64x2_t const& value_in)
+      : m_value(value_in) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator uint64x2_t()
+      const {
+    return m_value;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) {
+    return reference(m_value, int(i));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type
+  operator[](std::size_t i) const {
+    return static_cast<value_type>(
+        reference(const_cast<uint64x2_t&>(m_value), int(i)));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION Derived
+  operator||(neon_mask const& other) const {
+    return Derived(vorrq_u64(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION Derived
+  operator&&(neon_mask const& other) const {
+    return Derived(vandq_u64(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION Derived operator!() const {
+    auto const true_value = static_cast<uint64x2_t>(neon_mask(true));
+    return Derived(veorq_u64(m_value, true_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator==(
+      neon_mask const& other) const {
+    uint64x2_t const elementwise_equality = vceqq_u64(m_value, other.m_value);
+    uint32x2_t const narrow_elementwise_equality =
+        vqmovn_u64(elementwise_equality);
+    uint64x1_t const overall_equality_neon =
+        vreinterpret_u64_u32(narrow_elementwise_equality);
+    uint64_t const overall_equality = vget_lane_u64(overall_equality_neon, 0);
+    return overall_equality == 0xFFFFFFFFFFFFFFFFULL;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator!=(
+      neon_mask const& other) const {
+    return !operator==(other);
+  }
+};
+
+template <class Derived>
+class neon_mask<Derived, 32> {
+  uint32x2_t m_value;
+
+ public:
+  class reference {
+    uint32x2_t& m_mask;
+    int m_lane;
+
+   public:
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(uint32x2_t& mask_arg,
+                                                    int lane_arg)
+        : m_mask(mask_arg), m_lane(lane_arg) {}
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference
+    operator=(bool value) const {
+      switch (m_lane) {
+        case 0:
+          m_mask = vset_lane_u32(value ? 0xFFFFFFFFU : 0, m_mask, 0);
+          break;
+        case 1:
+          m_mask = vset_lane_u32(value ? 0xFFFFFFFFU : 0, m_mask, 1);
+          break;
+      }
+      return *this;
+    }
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator bool() const {
+      switch (m_lane) {
+        case 0: return vget_lane_u32(m_mask, 0) != 0;
+        case 1: return vget_lane_u32(m_mask, 1) != 0;
+      }
+      return false;
+    }
+  };
+  using value_type          = bool;
+  using abi_type            = simd_abi::neon_fixed_size<2>;
+  using implementation_type = uint32x2_t;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION neon_mask() = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit neon_mask(value_type value)
+      : m_value(vmov_n_u32(value ? 0xFFFFFFFFU : 0)) {}
+  template <class U>
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION neon_mask(neon_mask<U, 64> const& other)
+      : m_value(vqmovn_u64(static_cast<uint64x2_t>(other))) {}
+  template <class U>
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION neon_mask(neon_mask<U, 32> const& other)
+      : m_value(static_cast<uint32x2_t>(other)) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() {
+    return 2;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit neon_mask(
+      uint32x2_t const& value_in)
+      : m_value(value_in) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator uint32x2_t()
+      const {
+    return m_value;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) {
+    return reference(m_value, int(i));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type
+  operator[](std::size_t i) const {
+    return static_cast<value_type>(
+        reference(const_cast<uint32x2_t&>(m_value), int(i)));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION Derived
+  operator||(neon_mask const& other) const {
+    return Derived(vorr_u32(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION Derived
+  operator&&(neon_mask const& other) const {
+    return Derived(vand_u32(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION Derived operator!() const {
+    auto const true_value = static_cast<uint32x2_t>(neon_mask(true));
+    return Derived(veor_u32(m_value, true_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator==(
+      neon_mask const& other) const {
+    uint32x2_t const elementwise_equality = vceq_u32(m_value, other.m_value);
+    uint64x1_t const overall_equality_neon =
+        vreinterpret_u64_u32(elementwise_equality);
+    uint64_t const overall_equality = vget_lane_u64(overall_equality_neon, 0);
+    return overall_equality == 0xFFFFFFFFFFFFFFFFULL;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator!=(
+      neon_mask const& other) const {
+    return !operator==(other);
+  }
+};
+
+}  // namespace Impl
+
+template <class T>
+class simd_mask<T, simd_abi::neon_fixed_size<2>>
+    : public Impl::neon_mask<simd_mask<T, simd_abi::neon_fixed_size<2>>,
+                             sizeof(T) * 8> {
+  using base_type = Impl::neon_mask<simd_mask<T, simd_abi::neon_fixed_size<2>>,
+                                    sizeof(T) * 8>;
+
+ public:
+  using implementation_type = typename base_type::implementation_type;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask() = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd_mask(bool value)
+      : base_type(value) {}
+  template <class U>
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask(
+      simd_mask<U, simd_abi::neon_fixed_size<2>> const& other)
+      : base_type(other) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd_mask(
+      implementation_type const& value)
+      : base_type(value) {}
+};
+
+template <>
+class simd<double, simd_abi::neon_fixed_size<2>> {
+  float64x2_t m_value;
+
+ public:
+  using value_type = double;
+  using abi_type   = simd_abi::neon_fixed_size<2>;
+  using mask_type  = simd_mask<value_type, abi_type>;
+  class reference {
+    float64x2_t& m_value;
+    int m_lane;
+
+   public:
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(float64x2_t& mask_arg,
+                                                    int lane_arg)
+        : m_value(mask_arg), m_lane(lane_arg) {}
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference
+    operator=(double value) const {
+      switch (m_lane) {
+        case 0: m_value = vsetq_lane_f64(value, m_value, 0); break;
+        case 1: m_value = vsetq_lane_f64(value, m_value, 1); break;
+      }
+      return *this;
+    }
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator double() const {
+      switch (m_lane) {
+        case 0: return vgetq_lane_f64(m_value, 0);
+        case 1: return vgetq_lane_f64(m_value, 1);
+      }
+      return 0;
+    }
+  };
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd()            = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd const&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd&&)      = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd const&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd&&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() {
+    return 2;
+  }
+  template <class U, std::enable_if_t<std::is_convertible_v<U, value_type>,
+                                      bool> = false>
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(U&& value)
+      : m_value(vmovq_n_f64(value_type(value))) {}
+  template <class G,
+            std::enable_if_t<
+                // basically, can you do { value_type r =
+                // gen(std::integral_constant<std::size_t, i>()); }
+                std::is_invocable_r_v<value_type, G,
+                                      std::integral_constant<std::size_t, 0>>,
+                bool> = false>
+  KOKKOS_FORCEINLINE_FUNCTION simd(G&& gen) {
+    m_value = vsetq_lane_f64(gen(std::integral_constant<std::size_t, 0>()),
+                             m_value, 0);
+    m_value = vsetq_lane_f64(gen(std::integral_constant<std::size_t, 1>()),
+                             m_value, 1);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd(
+      float64x2_t const& value_in)
+      : m_value(value_in) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) {
+    return reference(m_value, int(i));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type
+  operator[](std::size_t i) const {
+    return reference(const_cast<simd*>(this)->m_value, int(i));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_from(value_type const* ptr,
+                                                       element_aligned_tag) {
+    m_value = vld1q_f64(ptr);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_to(
+      value_type* ptr, element_aligned_tag) const {
+    vst1q_f64(ptr, m_value);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit
+  operator float64x2_t() const {
+    return m_value;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator<(simd const& other) const {
+    return mask_type(vcltq_f64(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator>(simd const& other) const {
+    return mask_type(vcgtq_f64(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator<=(simd const& other) const {
+    return mask_type(vcleq_f64(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator>=(simd const& other) const {
+    return mask_type(vcgeq_f64(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator==(simd const& other) const {
+    return mask_type(vceqq_f64(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator!=(simd const& other) const {
+    return !(operator==(other));
+  }
+};
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<double, simd_abi::neon_fixed_size<2>>
+    operator*(simd<double, simd_abi::neon_fixed_size<2>> const& lhs,
+              simd<double, simd_abi::neon_fixed_size<2>> const& rhs) {
+  return simd<double, simd_abi::neon_fixed_size<2>>(
+      vmulq_f64(static_cast<float64x2_t>(lhs), static_cast<float64x2_t>(rhs)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<double, simd_abi::neon_fixed_size<2>>
+    operator/(simd<double, simd_abi::neon_fixed_size<2>> const& lhs,
+              simd<double, simd_abi::neon_fixed_size<2>> const& rhs) {
+  return simd<double, simd_abi::neon_fixed_size<2>>(
+      vdivq_f64(static_cast<float64x2_t>(lhs), static_cast<float64x2_t>(rhs)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<double, simd_abi::neon_fixed_size<2>>
+    operator+(simd<double, simd_abi::neon_fixed_size<2>> const& lhs,
+              simd<double, simd_abi::neon_fixed_size<2>> const& rhs) {
+  return simd<double, simd_abi::neon_fixed_size<2>>(
+      vaddq_f64(static_cast<float64x2_t>(lhs), static_cast<float64x2_t>(rhs)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<double, simd_abi::neon_fixed_size<2>>
+    operator-(simd<double, simd_abi::neon_fixed_size<2>> const& lhs,
+              simd<double, simd_abi::neon_fixed_size<2>> const& rhs) {
+  return simd<double, simd_abi::neon_fixed_size<2>>(
+      vsubq_f64(static_cast<float64x2_t>(lhs), static_cast<float64x2_t>(rhs)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<double, simd_abi::neon_fixed_size<2>>
+    operator-(simd<double, simd_abi::neon_fixed_size<2>> const& a) {
+  return simd<double, simd_abi::neon_fixed_size<2>>(
+      vnegq_f64(static_cast<float64x2_t>(a)));
+}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<double, simd_abi::neon_fixed_size<2>> abs(
+    simd<double, simd_abi::neon_fixed_size<2>> const& a) {
+  return simd<double, simd_abi::neon_fixed_size<2>>(
+      vabsq_f64(static_cast<float64x2_t>(a)));
+}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<double, simd_abi::neon_fixed_size<2>> copysign(
+    simd<double, simd_abi::neon_fixed_size<2>> const& a,
+    simd<double, simd_abi::neon_fixed_size<2>> const& b) {
+  uint64x2_t const sign_mask = vreinterpretq_u64_f64(vmovq_n_f64(-0.0));
+  return simd<double, simd_abi::neon_fixed_size<2>>(vreinterpretq_f64_u64(
+      vorrq_u64(vreinterpretq_u64_f64(static_cast<float64x2_t>(abs(a))),
+                vandq_u64(sign_mask, vreinterpretq_u64_f64(
+                                         static_cast<float64x2_t>(b))))));
+}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<double, simd_abi::neon_fixed_size<2>> sqrt(
+    simd<double, simd_abi::neon_fixed_size<2>> const& a) {
+  return simd<double, simd_abi::neon_fixed_size<2>>(
+      vsqrtq_f64(static_cast<float64x2_t>(a)));
+}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<double, simd_abi::neon_fixed_size<2>> fma(
+    simd<double, simd_abi::neon_fixed_size<2>> const& a,
+    simd<double, simd_abi::neon_fixed_size<2>> const& b,
+    simd<double, simd_abi::neon_fixed_size<2>> const& c) {
+  return simd<double, simd_abi::neon_fixed_size<2>>(
+      vfmaq_f64(static_cast<float64x2_t>(c), static_cast<float64x2_t>(b),
+                static_cast<float64x2_t>(a)));
+}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<double, simd_abi::neon_fixed_size<2>> max(
+    simd<double, simd_abi::neon_fixed_size<2>> const& a,
+    simd<double, simd_abi::neon_fixed_size<2>> const& b) {
+  return simd<double, simd_abi::neon_fixed_size<2>>(
+      vmaxq_f64(static_cast<float64x2_t>(a), static_cast<float64x2_t>(b)));
+}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<double, simd_abi::neon_fixed_size<2>> min(
+    simd<double, simd_abi::neon_fixed_size<2>> const& a,
+    simd<double, simd_abi::neon_fixed_size<2>> const& b) {
+  return simd<double, simd_abi::neon_fixed_size<2>>(
+      vminq_f64(static_cast<float64x2_t>(a), static_cast<float64x2_t>(b)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<double, simd_abi::neon_fixed_size<2>>
+    condition(simd_mask<double, simd_abi::neon_fixed_size<2>> const& a,
+              simd<double, simd_abi::neon_fixed_size<2>> const& b,
+              simd<double, simd_abi::neon_fixed_size<2>> const& c) {
+  return simd<double, simd_abi::neon_fixed_size<2>>(
+      vbslq_f64(static_cast<uint64x2_t>(a), static_cast<float64x2_t>(b),
+                static_cast<float64x2_t>(c)));
+}
+
+template <>
+class simd<std::int32_t, simd_abi::neon_fixed_size<2>> {
+  int32x2_t m_value;
+
+ public:
+  using value_type = std::int32_t;
+  using abi_type   = simd_abi::neon_fixed_size<2>;
+  using mask_type  = simd_mask<value_type, abi_type>;
+  class reference {
+    int32x2_t& m_value;
+    int m_lane;
+
+   public:
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(int32x2_t& value_arg,
+                                                    int lane_arg)
+        : m_value(value_arg), m_lane(lane_arg) {}
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference
+    operator=(std::int32_t value) const {
+      switch (m_lane) {
+        case 0: m_value = vset_lane_s32(value, m_value, 0); break;
+        case 1: m_value = vset_lane_s32(value, m_value, 1); break;
+      }
+      return *this;
+    }
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator std::int32_t() const {
+      switch (m_lane) {
+        case 0: return vget_lane_s32(m_value, 0);
+        case 1: return vget_lane_s32(m_value, 1);
+      }
+      return 0;
+    }
+  };
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd()            = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd const&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd&&)      = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd const&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd&&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() {
+    return 2;
+  }
+  template <class U, std::enable_if_t<std::is_convertible_v<U, value_type>,
+                                      bool> = false>
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(U&& value)
+      : m_value(vmov_n_s32(value_type(value))) {}
+  template <class G,
+            std::enable_if_t<
+                std::is_invocable_r_v<value_type, G,
+                                      std::integral_constant<std::size_t, 0>>,
+                bool> = false>
+  KOKKOS_FORCEINLINE_FUNCTION simd(G&& gen) {
+    m_value = vset_lane_s32(gen(std::integral_constant<std::size_t, 0>()),
+                            m_value, 0);
+    m_value = vset_lane_s32(gen(std::integral_constant<std::size_t, 1>()),
+                            m_value, 1);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd(
+      int32x2_t const& value_in)
+      : m_value(value_in) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd(
+      simd<std::uint64_t, abi_type> const& other);
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) {
+    return reference(m_value, int(i));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type
+  operator[](std::size_t i) const {
+    return reference(const_cast<simd*>(this)->m_value, int(i));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_from(value_type const* ptr,
+                                                       element_aligned_tag) {
+    m_value = vld1_s32(ptr);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_to(
+      value_type* ptr, element_aligned_tag) const {
+    vst1_s32(ptr, m_value);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator int32x2_t()
+      const {
+    return m_value;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator==(simd const& other) const {
+    return mask_type(vceq_s32(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator>(simd const& other) const {
+    return mask_type(vcgt_s32(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator<(simd const& other) const {
+    return mask_type(vclt_s32(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator<=(simd const& other) const {
+    return mask_type(vcle_s32(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator>=(simd const& other) const {
+    return mask_type(vcge_s32(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator!=(simd const& other) const {
+    return !((*this) == other);
+  }
+};
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<std::int32_t, simd_abi::neon_fixed_size<2>>
+    operator-(simd<std::int32_t, simd_abi::neon_fixed_size<2>> const& a) {
+  return simd<std::int32_t, simd_abi::neon_fixed_size<2>>(
+      vneg_s32(static_cast<int32x2_t>(a)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<std::int32_t, simd_abi::neon_fixed_size<2>>
+    operator-(simd<std::int32_t, simd_abi::neon_fixed_size<2>> const& lhs,
+              simd<std::int32_t, simd_abi::neon_fixed_size<2>> const& rhs) {
+  return simd<std::int32_t, simd_abi::neon_fixed_size<2>>(
+      vsub_s32(static_cast<int32x2_t>(lhs), static_cast<int32x2_t>(rhs)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<std::int32_t, simd_abi::neon_fixed_size<2>>
+    operator+(simd<std::int32_t, simd_abi::neon_fixed_size<2>> const& lhs,
+              simd<std::int32_t, simd_abi::neon_fixed_size<2>> const& rhs) {
+  return simd<std::int32_t, simd_abi::neon_fixed_size<2>>(
+      vadd_s32(static_cast<int32x2_t>(lhs), static_cast<int32x2_t>(rhs)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<std::int32_t, simd_abi::neon_fixed_size<2>>
+    condition(simd_mask<std::int32_t, simd_abi::neon_fixed_size<2>> const& a,
+              simd<std::int32_t, simd_abi::neon_fixed_size<2>> const& b,
+              simd<std::int32_t, simd_abi::neon_fixed_size<2>> const& c) {
+  return simd<std::int32_t, simd_abi::neon_fixed_size<2>>(
+      vbsl_s32(static_cast<uint32x2_t>(a), static_cast<int32x2_t>(b),
+               static_cast<int32x2_t>(c)));
+}
+
+template <>
+class simd<std::int64_t, simd_abi::neon_fixed_size<2>> {
+  int64x2_t m_value;
+
+ public:
+  using value_type = std::int64_t;
+  using abi_type   = simd_abi::neon_fixed_size<2>;
+  using mask_type  = simd_mask<value_type, abi_type>;
+  class reference {
+    int64x2_t& m_value;
+    int m_lane;
+
+   public:
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(int64x2_t& value_arg,
+                                                    int lane_arg)
+        : m_value(value_arg), m_lane(lane_arg) {}
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference
+    operator=(std::int64_t value) const {
+      switch (m_lane) {
+        case 0: m_value = vsetq_lane_s64(value, m_value, 0); break;
+        case 1: m_value = vsetq_lane_s64(value, m_value, 1); break;
+      }
+      return *this;
+    }
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator std::int64_t() const {
+      switch (m_lane) {
+        case 0: return vgetq_lane_s64(m_value, 0);
+        case 1: return vgetq_lane_s64(m_value, 1);
+      }
+      return 0;
+    }
+  };
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd()            = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd const&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd&&)      = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd const&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd&&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() {
+    return 2;
+  }
+  template <class U, std::enable_if_t<std::is_convertible_v<U, value_type>,
+                                      bool> = false>
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(U&& value)
+      : m_value(vmovq_n_s64(value_type(value))) {}
+  template <class G,
+            std::enable_if_t<
+                std::is_invocable_r_v<value_type, G,
+                                      std::integral_constant<std::size_t, 0>>,
+                bool> = false>
+  KOKKOS_FORCEINLINE_FUNCTION simd(G&& gen) {
+    m_value = vsetq_lane_s64(gen(std::integral_constant<std::size_t, 0>()),
+                             m_value, 0);
+    m_value = vsetq_lane_s64(gen(std::integral_constant<std::size_t, 1>()),
+                             m_value, 1);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd(
+      int64x2_t const& value_in)
+      : m_value(value_in) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd(
+      simd<std::uint64_t, abi_type> const&);
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) {
+    return reference(m_value, int(i));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type
+  operator[](std::size_t i) const {
+    return reference(const_cast<simd*>(this)->m_value, int(i));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_from(value_type const* ptr,
+                                                       element_aligned_tag) {
+    m_value = vld1q_s64(ptr);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_to(
+      value_type* ptr, element_aligned_tag) const {
+    vst1q_s64(ptr, m_value);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator int64x2_t()
+      const {
+    return m_value;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator==(simd const& other) const {
+    return mask_type(vceqq_s64(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator>(simd const& other) const {
+    return mask_type(vcgtq_s64(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator<(simd const& other) const {
+    return mask_type(vcltq_s64(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator<=(simd const& other) const {
+    return mask_type(vcleq_s64(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator>=(simd const& other) const {
+    return mask_type(vcgeq_s64(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator!=(simd const& other) const {
+    return !((*this) == other);
+  }
+};
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<std::int64_t, simd_abi::neon_fixed_size<2>>
+    operator-(simd<std::int64_t, simd_abi::neon_fixed_size<2>> const& a) {
+  return simd<std::int64_t, simd_abi::neon_fixed_size<2>>(
+      vnegq_s64(static_cast<int64x2_t>(a)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<std::int64_t, simd_abi::neon_fixed_size<2>>
+    operator-(simd<std::int64_t, simd_abi::neon_fixed_size<2>> const& lhs,
+              simd<std::int64_t, simd_abi::neon_fixed_size<2>> const& rhs) {
+  return simd<std::int64_t, simd_abi::neon_fixed_size<2>>(
+      vsubq_s64(static_cast<int64x2_t>(lhs), static_cast<int64x2_t>(rhs)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<std::int64_t, simd_abi::neon_fixed_size<2>>
+    operator+(simd<std::int64_t, simd_abi::neon_fixed_size<2>> const& lhs,
+              simd<std::int64_t, simd_abi::neon_fixed_size<2>> const& rhs) {
+  return simd<std::int64_t, simd_abi::neon_fixed_size<2>>(
+      vaddq_s64(static_cast<int64x2_t>(lhs), static_cast<int64x2_t>(rhs)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<std::int64_t, simd_abi::neon_fixed_size<2>>
+    condition(simd_mask<std::int64_t, simd_abi::neon_fixed_size<2>> const& a,
+              simd<std::int64_t, simd_abi::neon_fixed_size<2>> const& b,
+              simd<std::int64_t, simd_abi::neon_fixed_size<2>> const& c) {
+  return simd<std::int64_t, simd_abi::neon_fixed_size<2>>(
+      vbslq_s64(static_cast<uint64x2_t>(a), static_cast<int64x2_t>(b),
+                static_cast<int64x2_t>(c)));
+}
+
+template <>
+class simd<std::uint64_t, simd_abi::neon_fixed_size<2>> {
+  uint64x2_t m_value;
+
+ public:
+  using value_type = std::uint64_t;
+  using abi_type   = simd_abi::neon_fixed_size<2>;
+  using mask_type  = simd_mask<value_type, abi_type>;
+  class reference {
+    uint64x2_t& m_value;
+    int m_lane;
+
+   public:
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(uint64x2_t& value_arg,
+                                                    int lane_arg)
+        : m_value(value_arg), m_lane(lane_arg) {}
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference
+    operator=(std::uint64_t value) const {
+      switch (m_lane) {
+        case 0: m_value = vsetq_lane_u64(value, m_value, 0); break;
+        case 1: m_value = vsetq_lane_u64(value, m_value, 1); break;
+      }
+      return *this;
+    }
+    KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator std::uint64_t() const {
+      switch (m_lane) {
+        case 0: return vgetq_lane_u64(m_value, 0);
+        case 1: return vgetq_lane_u64(m_value, 1);
+      }
+      return 0;
+    }
+  };
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd()            = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd const&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd&&)      = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd const&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd&&) = default;
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() {
+    return 2;
+  }
+  template <class U, std::enable_if_t<std::is_convertible_v<U, value_type>,
+                                      bool> = false>
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(U&& value)
+      : m_value(vmovq_n_u64(value_type(value))) {}
+  template <class G,
+            std::enable_if_t<
+                std::is_invocable_r_v<value_type, G,
+                                      std::integral_constant<std::size_t, 0>>,
+                bool> = false>
+  KOKKOS_FORCEINLINE_FUNCTION simd(G&& gen) {
+    m_value = vsetq_lane_u64(gen(std::integral_constant<std::size_t, 0>()),
+                             m_value, 0);
+    m_value = vsetq_lane_u64(gen(std::integral_constant<std::size_t, 1>()),
+                             m_value, 1);
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd(
+      uint64x2_t const& value_in)
+      : m_value(value_in) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd(
+      simd<std::int32_t, abi_type> const& other)
+      : m_value(
+            vreinterpretq_u64_s64(vmovl_s32(static_cast<int32x2_t>(other)))) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) {
+    return reference(m_value, int(i));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type
+  operator[](std::size_t i) const {
+    return reference(const_cast<simd*>(this)->m_value, int(i));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd
+  operator&(simd const& other) const {
+    return simd(vandq_u64(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd
+  operator|(simd const& other) const {
+    return simd(vorrq_u64(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator uint64x2_t()
+      const {
+    return m_value;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd
+  operator<<(unsigned int rhs) const {
+    return simd(vshlq_u64(m_value, vmovq_n_s64(std::int64_t(rhs))));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd
+  operator>>(unsigned int rhs) const {
+    return simd(vshlq_u64(m_value, vmovq_n_s64(-std::int64_t(rhs))));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator==(simd const& other) const {
+    return mask_type(vceqq_u64(m_value, other.m_value));
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
+  operator!=(simd const& other) const {
+    return !((*this) == other);
+  }
+};
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<std::uint64_t, simd_abi::neon_fixed_size<2>>
+    operator-(simd<std::uint64_t, simd_abi::neon_fixed_size<2>> const& lhs,
+              simd<std::uint64_t, simd_abi::neon_fixed_size<2>> const& rhs) {
+  return simd<std::uint64_t, simd_abi::neon_fixed_size<2>>(
+      vsubq_u64(static_cast<uint64x2_t>(lhs), static_cast<uint64x2_t>(rhs)));
+}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<std::uint64_t, simd_abi::neon_fixed_size<2>>
+    operator+(simd<std::uint64_t, simd_abi::neon_fixed_size<2>> const& lhs,
+              simd<std::uint64_t, simd_abi::neon_fixed_size<2>> const& rhs) {
+  return simd<std::uint64_t, simd_abi::neon_fixed_size<2>>(
+      vaddq_u64(static_cast<uint64x2_t>(lhs), static_cast<uint64x2_t>(rhs)));
+}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<std::int32_t, simd_abi::neon_fixed_size<2>>::simd(
+    simd<std::uint64_t, simd_abi::neon_fixed_size<2>> const& other)
+    : m_value(
+          vmovn_s64(vreinterpretq_s64_u64(static_cast<uint64x2_t>(other)))) {}
+
+KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+simd<std::int64_t, simd_abi::neon_fixed_size<2>>::simd(
+    simd<std::uint64_t, simd_abi::neon_fixed_size<2>> const& other)
+    : m_value(vreinterpretq_s64_u64(static_cast<uint64x2_t>(other))) {}
+
+[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+    simd<std::uint64_t, simd_abi::neon_fixed_size<2>>
+    condition(simd_mask<std::uint64_t, simd_abi::neon_fixed_size<2>> const& a,
+              simd<std::uint64_t, simd_abi::neon_fixed_size<2>> const& b,
+              simd<std::uint64_t, simd_abi::neon_fixed_size<2>> const& c) {
+  return simd<std::uint64_t, simd_abi::neon_fixed_size<2>>(
+      vbslq_u64(static_cast<uint64x2_t>(a), static_cast<uint64x2_t>(b),
+                static_cast<uint64x2_t>(c)));
+}
+
+template <>
+class const_where_expression<simd_mask<double, simd_abi::neon_fixed_size<2>>,
+                             simd<double, simd_abi::neon_fixed_size<2>>> {
+ public:
+  using abi_type   = simd_abi::neon_fixed_size<2>;
+  using value_type = simd<double, abi_type>;
+  using mask_type  = simd_mask<double, abi_type>;
+
+ protected:
+  value_type& m_value;
+  mask_type const& m_mask;
+
+ public:
+  const_where_expression(mask_type const& mask_arg, value_type const& value_arg)
+      : m_value(const_cast<value_type&>(value_arg)), m_mask(mask_arg) {}
+  [[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr mask_type const&
+  mask() const {
+    return m_mask;
+  }
+  [[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr value_type const&
+  value() const {
+    return m_value;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+  void copy_to(double* mem, element_aligned_tag) const {
+    if (m_mask[0]) mem[0] = m_value[0];
+    if (m_mask[1]) mem[1] = m_value[1];
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+  void scatter_to(
+      double* mem,
+      simd<std::int32_t, simd_abi::neon_fixed_size<2>> const& index) const {
+    if (m_mask[0]) mem[index[0]] = m_value[0];
+    if (m_mask[1]) mem[index[1]] = m_value[1];
+  }
+};
+
+template <>
+class where_expression<simd_mask<double, simd_abi::neon_fixed_size<2>>,
+                       simd<double, simd_abi::neon_fixed_size<2>>>
+    : public const_where_expression<
+          simd_mask<double, simd_abi::neon_fixed_size<2>>,
+          simd<double, simd_abi::neon_fixed_size<2>>> {
+ public:
+  where_expression(
+      simd_mask<double, simd_abi::neon_fixed_size<2>> const& mask_arg,
+      simd<double, simd_abi::neon_fixed_size<2>>& value_arg)
+      : const_where_expression(mask_arg, value_arg) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+  void copy_from(double const* mem, element_aligned_tag) {
+    if (m_mask[0]) m_value[0] = mem[0];
+    if (m_mask[1]) m_value[1] = mem[1];
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+  void gather_from(
+      double const* mem,
+      simd<std::int32_t, simd_abi::neon_fixed_size<2>> const& index) {
+    if (m_mask[0]) m_value[0] = mem[index[0]];
+    if (m_mask[1]) m_value[1] = mem[index[1]];
+  }
+  template <class U,
+            std::enable_if_t<std::is_convertible_v<
+                                 U, simd<double, simd_abi::neon_fixed_size<2>>>,
+                             bool> = false>
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void operator=(U&& x) {
+    auto const x_as_value_type =
+        static_cast<simd<double, simd_abi::neon_fixed_size<2>>>(
+            std::forward<U>(x));
+    m_value = static_cast<simd<double, simd_abi::neon_fixed_size<2>>>(
+        vbslq_f64(static_cast<uint64x2_t>(m_mask),
+                  static_cast<float64x2_t>(x_as_value_type),
+                  static_cast<float64x2_t>(m_value)));
+  }
+};
+
+template <>
+class const_where_expression<
+    simd_mask<std::int32_t, simd_abi::neon_fixed_size<2>>,
+    simd<std::int32_t, simd_abi::neon_fixed_size<2>>> {
+ public:
+  using abi_type   = simd_abi::neon_fixed_size<2>;
+  using value_type = simd<std::int32_t, abi_type>;
+  using mask_type  = simd_mask<std::int32_t, abi_type>;
+
+ protected:
+  value_type& m_value;
+  mask_type const& m_mask;
+
+ public:
+  const_where_expression(mask_type const& mask_arg, value_type const& value_arg)
+      : m_value(const_cast<value_type&>(value_arg)), m_mask(mask_arg) {}
+  [[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr mask_type const&
+  mask() const {
+    return m_mask;
+  }
+  [[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr value_type const&
+  value() const {
+    return m_value;
+  }
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+  void copy_to(std::int32_t* mem, element_aligned_tag) const {
+    if (m_mask[0]) mem[0] = m_value[0];
+    if (m_mask[1]) mem[1] = m_value[1];
+  }
+};
+
+template <>
+class where_expression<simd_mask<std::int32_t, simd_abi::neon_fixed_size<2>>,
+                       simd<std::int32_t, simd_abi::neon_fixed_size<2>>>
+    : public const_where_expression<
+          simd_mask<std::int32_t, simd_abi::neon_fixed_size<2>>,
+          simd<std::int32_t, simd_abi::neon_fixed_size<2>>> {
+ public:
+  where_expression(
+      simd_mask<std::int32_t, simd_abi::neon_fixed_size<2>> const& mask_arg,
+      simd<std::int32_t, simd_abi::neon_fixed_size<2>>& value_arg)
+      : const_where_expression(mask_arg, value_arg) {}
+  KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
+  void copy_from(std::int32_t const* mem, element_aligned_tag) {
+    if (m_mask[0]) m_value[0] = mem[0];
+    if (m_mask[1]) m_value[1] = mem[1];
+  }
+};
+
+}  // namespace Experimental
+}  // namespace Kokkos
+
+#endif
diff --git a/packages/kokkos/simd/src/Kokkos_SIMD_Scalar.hpp b/packages/kokkos/simd/src/Kokkos_SIMD_Scalar.hpp
index f0d06695e50750874a68aa68af0f06e61c688feb..e878eec296880d8383761e3449494b74e8b216e8 100644
--- a/packages/kokkos/simd/src/Kokkos_SIMD_Scalar.hpp
+++ b/packages/kokkos/simd/src/Kokkos_SIMD_Scalar.hpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #ifndef KOKKOS_SIMD_SCALAR_HPP
 #define KOKKOS_SIMD_SCALAR_HPP
@@ -322,11 +294,11 @@ class where_expression<simd_mask<T, simd_abi::scalar>,
   }
 };
 
-template <class T, class BinaryOp>
+template <class T>
 [[nodiscard]] KOKKOS_FORCEINLINE_FUNCTION T
 reduce(const_where_expression<simd_mask<T, simd_abi::scalar>,
                               simd<T, simd_abi::scalar>> const& x,
-       T identity_element, BinaryOp) {
+       T identity_element, std::plus<>) {
   return static_cast<bool>(x.mask()) ? static_cast<T>(x.value())
                                      : identity_element;
 }
diff --git a/packages/kokkos/simd/src/Kokkos_SIMD_dummy.cpp b/packages/kokkos/simd/src/Kokkos_SIMD_dummy.cpp
index d273cb6d54d70f2e816c341525eee366744ae6b8..8d14900dba80c936d8c6c6145ec7f16ed1ab5706 100644
--- a/packages/kokkos/simd/src/Kokkos_SIMD_dummy.cpp
+++ b/packages/kokkos/simd/src/Kokkos_SIMD_dummy.cpp
@@ -1,3 +1,19 @@
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
+//               Solutions of Sandia, LLC (NTESS).
+//
+// Under the terms of Contract DE-NA0003525 with NTESS,
+// the U.S. Government retains certain rights in this software.
+//
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//@HEADER
+
 // This file is needed in order to get the linker language
 // for the header only submodule.
 // While we set the language properties in our normal cmake
diff --git a/packages/kokkos/simd/unit_tests/TestSIMD.cpp b/packages/kokkos/simd/unit_tests/TestSIMD.cpp
index fdf72e91c84af4c8ba757703aa2fe7353b3d9e62..92c77033b9a84eecdb0c0782ae86619ea1272318 100644
--- a/packages/kokkos/simd/unit_tests/TestSIMD.cpp
+++ b/packages/kokkos/simd/unit_tests/TestSIMD.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 
@@ -198,7 +170,7 @@ void host_check_binary_op_one_loader(BinaryOp binary_op, std::size_t n,
     simd_type expected_result;
     for (std::size_t lane = 0; lane < nlanes; ++lane) {
       expected_result[lane] =
-          binary_op.on_host(first_arg[lane], second_arg[lane]);
+          binary_op.on_host(T(first_arg[lane]), T(second_arg[lane]));
     }
     simd_type const computed_result = binary_op.on_host(first_arg, second_arg);
     host_check_equality(expected_result, computed_result, nlanes);
@@ -317,6 +289,70 @@ inline void host_check_math_ops() {
   host_check_binary_op_all_loaders<Abi>(divides(), n, first_args, second_args);
 }
 
+template <class Abi>
+inline void host_check_mask_ops() {
+  using mask_type = Kokkos::Experimental::simd_mask<double, Abi>;
+  EXPECT_FALSE(none_of(mask_type(true)));
+  EXPECT_TRUE(none_of(mask_type(false)));
+  EXPECT_TRUE(all_of(mask_type(true)));
+  EXPECT_FALSE(all_of(mask_type(false)));
+}
+
+template <class Abi>
+inline void host_check_conversions() {
+  {
+    auto a = Kokkos::Experimental::simd<std::uint64_t, Abi>(1);
+    auto b = Kokkos::Experimental::simd<std::int64_t, Abi>(a);
+    EXPECT_TRUE(all_of(b == decltype(b)(1)));
+  }
+  {
+    auto a = Kokkos::Experimental::simd<std::int32_t, Abi>(1);
+    auto b = Kokkos::Experimental::simd<std::uint64_t, Abi>(a);
+    EXPECT_TRUE(all_of(b == decltype(b)(1)));
+  }
+  {
+    auto a = Kokkos::Experimental::simd<std::uint64_t, Abi>(1);
+    auto b = Kokkos::Experimental::simd<std::int32_t, Abi>(a);
+    EXPECT_TRUE(all_of(b == decltype(b)(1)));
+  }
+  {
+    auto a = Kokkos::Experimental::simd_mask<double, Abi>(true);
+    auto b = Kokkos::Experimental::simd_mask<std::int32_t, Abi>(a);
+    EXPECT_TRUE(b == decltype(b)(true));
+  }
+  {
+    auto a = Kokkos::Experimental::simd_mask<std::int32_t, Abi>(true);
+    auto b = Kokkos::Experimental::simd_mask<std::uint64_t, Abi>(a);
+    EXPECT_TRUE(b == decltype(b)(true));
+  }
+  {
+    auto a = Kokkos::Experimental::simd_mask<std::int32_t, Abi>(true);
+    auto b = Kokkos::Experimental::simd_mask<std::int64_t, Abi>(a);
+    EXPECT_TRUE(b == decltype(b)(true));
+  }
+  {
+    auto a = Kokkos::Experimental::simd_mask<std::int32_t, Abi>(true);
+    auto b = Kokkos::Experimental::simd_mask<double, Abi>(a);
+    EXPECT_TRUE(b == decltype(b)(true));
+  }
+}
+
+template <class Abi>
+inline void host_check_shifts() {
+  auto a = Kokkos::Experimental::simd<std::uint64_t, Abi>(8);
+  auto b = a >> 1;
+  EXPECT_TRUE(all_of(b == decltype(b)(4)));
+}
+
+template <class Abi>
+inline void host_check_condition() {
+  auto a = Kokkos::Experimental::condition(
+      Kokkos::Experimental::simd<std::int32_t, Abi>(1) > 0,
+      Kokkos::Experimental::simd<std::uint64_t, Abi>(16),
+      Kokkos::Experimental::simd<std::uint64_t, Abi>(20));
+  EXPECT_TRUE(all_of(a == decltype(a)(16)));
+}
+
 template <class Abi>
 KOKKOS_INLINE_FUNCTION void device_check_math_ops() {
   std::size_t constexpr n     = 11;
@@ -330,14 +366,90 @@ KOKKOS_INLINE_FUNCTION void device_check_math_ops() {
                                           second_args);
 }
 
+template <class Abi>
+KOKKOS_INLINE_FUNCTION void device_check_mask_ops() {
+  using mask_type = Kokkos::Experimental::simd_mask<double, Abi>;
+  kokkos_checker checker;
+  checker.truth(!none_of(mask_type(true)));
+  checker.truth(none_of(mask_type(false)));
+  checker.truth(all_of(mask_type(true)));
+  checker.truth(!all_of(mask_type(false)));
+}
+
+template <class Abi>
+KOKKOS_INLINE_FUNCTION void device_check_conversions() {
+  kokkos_checker checker;
+  {
+    auto a = Kokkos::Experimental::simd<std::uint64_t, Abi>(1);
+    auto b = Kokkos::Experimental::simd<std::int64_t, Abi>(a);
+    checker.truth(all_of(b == decltype(b)(1)));
+  }
+  {
+    auto a = Kokkos::Experimental::simd<std::int32_t, Abi>(1);
+    auto b = Kokkos::Experimental::simd<std::uint64_t, Abi>(a);
+    checker.truth(all_of(b == decltype(b)(1)));
+  }
+  {
+    auto a = Kokkos::Experimental::simd<std::uint64_t, Abi>(1);
+    auto b = Kokkos::Experimental::simd<std::int32_t, Abi>(a);
+    checker.truth(all_of(b == decltype(b)(1)));
+  }
+  {
+    auto a = Kokkos::Experimental::simd_mask<double, Abi>(true);
+    auto b = Kokkos::Experimental::simd_mask<std::int32_t, Abi>(a);
+    checker.truth(b == decltype(b)(true));
+  }
+  {
+    auto a = Kokkos::Experimental::simd_mask<std::int32_t, Abi>(true);
+    auto b = Kokkos::Experimental::simd_mask<std::uint64_t, Abi>(a);
+    checker.truth(b == decltype(b)(true));
+  }
+  {
+    auto a = Kokkos::Experimental::simd_mask<std::int32_t, Abi>(true);
+    auto b = Kokkos::Experimental::simd_mask<std::int64_t, Abi>(a);
+    checker.truth(b == decltype(b)(true));
+  }
+  {
+    auto a = Kokkos::Experimental::simd_mask<std::int32_t, Abi>(true);
+    auto b = Kokkos::Experimental::simd_mask<double, Abi>(a);
+    checker.truth(b == decltype(b)(true));
+  }
+}
+
+template <class Abi>
+KOKKOS_INLINE_FUNCTION void device_check_shifts() {
+  kokkos_checker checker;
+  auto a = Kokkos::Experimental::simd<std::uint64_t, Abi>(8);
+  auto b = a >> 1;
+  checker.truth(all_of(b == decltype(b)(4)));
+}
+
+template <class Abi>
+KOKKOS_INLINE_FUNCTION void device_check_condition() {
+  kokkos_checker checker;
+  auto a = Kokkos::Experimental::condition(
+      Kokkos::Experimental::simd<std::int32_t, Abi>(1) > 0,
+      Kokkos::Experimental::simd<std::uint64_t, Abi>(16),
+      Kokkos::Experimental::simd<std::uint64_t, Abi>(20));
+  checker.truth(all_of(a == decltype(a)(16)));
+}
+
 template <class Abi>
 inline void host_check_abi() {
   host_check_math_ops<Abi>();
+  host_check_mask_ops<Abi>();
+  host_check_conversions<Abi>();
+  host_check_shifts<Abi>();
+  host_check_condition<Abi>();
 }
 
 template <class Abi>
 KOKKOS_INLINE_FUNCTION void device_check_abi() {
   device_check_math_ops<Abi>();
+  device_check_mask_ops<Abi>();
+  device_check_conversions<Abi>();
+  device_check_shifts<Abi>();
+  device_check_condition<Abi>();
 }
 
 inline void host_check_abis(Kokkos::Experimental::Impl::abi_set<>) {}
@@ -374,3 +486,32 @@ TEST(simd, device) {
   Kokkos::parallel_for(Kokkos::RangePolicy<Kokkos::IndexType<int>>(0, 1),
                        simd_device_functor());
 }
+
+TEST(simd, test_size) {
+#if defined(KOKKOS_ARCH_AVX512XEON)
+  constexpr auto width = 8;
+  using Abi = Kokkos::Experimental::simd_abi::avx512_fixed_size<width>;
+  static_assert(width ==
+                Kokkos::Experimental::simd<std::uint32_t, Abi>::size());
+
+#elif defined(KOKKOS_ARCH_AVX2)
+  constexpr auto width = 4;
+  using Abi            = Kokkos::Experimental::simd_abi::avx2_fixed_size<width>;
+
+#elif defined(__ARM_NEON)
+  constexpr auto width = 2;
+  using Abi            = Kokkos::Experimental::simd_abi::neon_fixed_size<width>;
+
+#else
+  constexpr auto width = 1;
+  using Abi            = Kokkos::Experimental::simd_abi::scalar;
+  static_assert(width ==
+                Kokkos::Experimental::simd<std::uint32_t, Abi>::size());
+#endif
+
+  static_assert(width == Kokkos::Experimental::simd<double, Abi>::size());
+  static_assert(width == Kokkos::Experimental::simd<std::int64_t, Abi>::size());
+  static_assert(width ==
+                Kokkos::Experimental::simd<std::uint64_t, Abi>::size());
+  static_assert(width == Kokkos::Experimental::simd<std::int32_t, Abi>::size());
+}
diff --git a/packages/kokkos/simd/unit_tests/UnitTestMain.cpp b/packages/kokkos/simd/unit_tests/UnitTestMain.cpp
index e245aad35fc33a595a16f711dbd4a63a0c7f8948..11a1cb717a3414b42aec8cda20e13be5ab99ce09 100644
--- a/packages/kokkos/simd/unit_tests/UnitTestMain.cpp
+++ b/packages/kokkos/simd/unit_tests/UnitTestMain.cpp
@@ -1,46 +1,18 @@
-/*
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
+//                        Kokkos v. 4.0
+//       Copyright (2022) National Technology & Engineering
 //               Solutions of Sandia, LLC (NTESS).
 //
 // Under the terms of Contract DE-NA0003525 with NTESS,
 // the U.S. Government retains certain rights in this software.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
+// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
+// See https://kokkos.org/LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the Corporation nor the names of the
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// 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 Christian R. Trott (crtrott@sandia.gov)
-//
-// ************************************************************************
 //@HEADER
-*/
 
 #include <gtest/gtest.h>
 #include <Kokkos_Core.hpp>
diff --git a/packages/kokkos/tpls/desul/Config.hpp.cmake.in b/packages/kokkos/tpls/desul/Config.hpp.cmake.in
new file mode 100644
index 0000000000000000000000000000000000000000..40ab5c1c6cb1f4a042b945202434594a8f810181
--- /dev/null
+++ b/packages/kokkos/tpls/desul/Config.hpp.cmake.in
@@ -0,0 +1,17 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_CONFIG_HPP_
+#define DESUL_ATOMICS_CONFIG_HPP_
+
+#cmakedefine DESUL_ATOMICS_ENABLE_CUDA
+#cmakedefine DESUL_ATOMICS_ENABLE_HIP
+#cmakedefine DESUL_ATOMICS_ENABLE_SYCL
+#cmakedefine DESUL_ATOMICS_ENABLE_OPENMP
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Adapt_CXX.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Adapt_CXX.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..8115a967a87023a4afdbadf05e3a409d3fc5edcd
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Adapt_CXX.hpp
@@ -0,0 +1,49 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_ADAPT_CXX_HPP_
+#define DESUL_ATOMICS_ADAPT_CXX_HPP_
+
+#include <atomic>
+#include <desul/atomics/Common.hpp>
+
+namespace desul {
+namespace Impl {
+
+template <class MemoryOrderDesul>
+struct CXXMemoryOrder;
+
+template <>
+struct CXXMemoryOrder<MemoryOrderRelaxed> {
+  static constexpr std::memory_order value = std::memory_order_relaxed;
+};
+
+template <>
+struct CXXMemoryOrder<MemoryOrderAcquire> {
+  static constexpr std::memory_order value = std::memory_order_acquire;
+};
+
+template <>
+struct CXXMemoryOrder<MemoryOrderRelease> {
+  static constexpr std::memory_order value = std::memory_order_release;
+};
+
+template <>
+struct CXXMemoryOrder<MemoryOrderAcqRel> {
+  static constexpr std::memory_order value = std::memory_order_acq_rel;
+};
+
+template <>
+struct CXXMemoryOrder<MemoryOrderSeqCst> {
+  static constexpr std::memory_order value = std::memory_order_seq_cst;
+};
+
+}  // namespace Impl
+}  // namespace desul
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Adapt_GCC.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Adapt_GCC.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..baf220a0b07725469d7d67a8a01652dcdfed18b1
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Adapt_GCC.hpp
@@ -0,0 +1,48 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_ADAPT_GCC_HPP_
+#define DESUL_ATOMICS_ADAPT_GCC_HPP_
+
+#include <desul/atomics/Common.hpp>
+
+namespace desul {
+namespace Impl {
+
+template <class MemoryOrder>
+struct GCCMemoryOrder;
+
+template <>
+struct GCCMemoryOrder<MemoryOrderRelaxed> {
+  static constexpr int value = __ATOMIC_RELAXED;
+};
+
+template <>
+struct GCCMemoryOrder<MemoryOrderAcquire> {
+  static constexpr int value = __ATOMIC_ACQUIRE;
+};
+
+template <>
+struct GCCMemoryOrder<MemoryOrderRelease> {
+  static constexpr int value = __ATOMIC_RELEASE;
+};
+
+template <>
+struct GCCMemoryOrder<MemoryOrderAcqRel> {
+  static constexpr int value = __ATOMIC_ACQ_REL;
+};
+
+template <>
+struct GCCMemoryOrder<MemoryOrderSeqCst> {
+  static constexpr int value = __ATOMIC_SEQ_CST;
+};
+
+}  // namespace Impl
+}  // namespace desul
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/SYCLConversions.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Adapt_SYCL.hpp
similarity index 60%
rename from packages/kokkos/tpls/desul/include/desul/atomics/SYCLConversions.hpp
rename to packages/kokkos/tpls/desul/include/desul/atomics/Adapt_SYCL.hpp
index 7debf91d6debc6354b16e2ccc7b5aafad0629983..c8449d495dccf072c00ba65c87d0f09711748923 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/SYCLConversions.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Adapt_SYCL.hpp
@@ -6,15 +6,18 @@ Source: https://github.com/desul/desul
 SPDX-License-Identifier: (BSD-3-Clause)
 */
 
-#ifndef DESUL_ATOMICS_SYCL_CONVERSIONS_HPP_
-#define DESUL_ATOMICS_SYCL_CONVERSIONS_HPP_
-#ifdef DESUL_HAVE_SYCL_ATOMICS
+#ifndef DESUL_ATOMICS_ADAPT_SYCL_HPP_
+#define DESUL_ATOMICS_ADAPT_SYCL_HPP_
 
-// clang-format off
-#include "desul/atomics/Common.hpp"
+#include <desul/atomics/Common.hpp>
 
+// FIXME_SYCL SYCL2020 dictates that <sycl/sycl.hpp> is the header to include
+// but icpx 2022.1.0 and earlier versions only provide <CL/sycl.hpp>
+#if __has_include(<sycl/sycl.hpp>)
+#include <sycl/sycl.hpp>
+#else
 #include <CL/sycl.hpp>
-// clang-format on
+#endif
 
 namespace desul {
 namespace Impl {
@@ -34,68 +37,81 @@ using sycl_memory_scope = std::conditional_t<extended_namespace,
                                              sycl_sync_and_atomics::memory_scope,
                                              sycl::memory_scope>;
 
+//<editor-fold desc="SYCL memory order">
+// The default memory order for sycl::atomic_ref
+// can be seq_cst, acq_rel, or relaxed according to the
+// "SYCL 2020 Specification (revision 6)", see
+// https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:atomic-references.
+// Thus, we map MemoryOrderAcquire and MemoryOrderRelease to acq_rel.
 template <class MemoryOrder, bool extended_namespace = true>
-struct DesulToSYCLMemoryOrder;
+struct SYCLMemoryOrder;
+
 template <bool extended_namespace>
-struct DesulToSYCLMemoryOrder<MemoryOrderSeqCst, extended_namespace> {
+struct SYCLMemoryOrder<MemoryOrderSeqCst, extended_namespace> {
   static constexpr sycl_memory_order<extended_namespace> value =
       sycl_memory_order<extended_namespace>::seq_cst;
 };
 template <bool extended_namespace>
-struct DesulToSYCLMemoryOrder<MemoryOrderAcquire, extended_namespace> {
+struct SYCLMemoryOrder<MemoryOrderAcquire, extended_namespace> {
   static constexpr sycl_memory_order<extended_namespace> value =
-      sycl_memory_order<extended_namespace>::acquire;
+      sycl_memory_order<extended_namespace>::acq_rel;
 };
 template <bool extended_namespace>
-struct DesulToSYCLMemoryOrder<MemoryOrderRelease, extended_namespace> {
+struct SYCLMemoryOrder<MemoryOrderRelease, extended_namespace> {
   static constexpr sycl_memory_order<extended_namespace> value =
-      sycl_memory_order<extended_namespace>::release;
+      sycl_memory_order<extended_namespace>::acq_rel;
 };
 template <bool extended_namespace>
-struct DesulToSYCLMemoryOrder<MemoryOrderAcqRel, extended_namespace> {
+struct SYCLMemoryOrder<MemoryOrderAcqRel, extended_namespace> {
   static constexpr sycl_memory_order<extended_namespace> value =
       sycl_memory_order<extended_namespace>::acq_rel;
 };
 template <bool extended_namespace>
-struct DesulToSYCLMemoryOrder<MemoryOrderRelaxed, extended_namespace> {
+struct SYCLMemoryOrder<MemoryOrderRelaxed, extended_namespace> {
   static constexpr sycl_memory_order<extended_namespace> value =
       sycl_memory_order<extended_namespace>::relaxed;
 };
+//</editor-fold>
 
+//<editor-fold desc="SYCL memory scope">
 template <class MemoryScope, bool extended_namespace = true>
-struct DesulToSYCLMemoryScope;
+struct SYCLMemoryScope;
+
 template <bool extended_namespace>
-struct DesulToSYCLMemoryScope<MemoryScopeCore, extended_namespace> {
+struct SYCLMemoryScope<MemoryScopeCore, extended_namespace> {
   static constexpr sycl_memory_scope<extended_namespace> value =
       sycl_memory_scope<extended_namespace>::work_group;
 };
+
 template <bool extended_namespace>
-struct DesulToSYCLMemoryScope<MemoryScopeDevice, extended_namespace> {
+struct SYCLMemoryScope<MemoryScopeDevice, extended_namespace> {
   static constexpr sycl_memory_scope<extended_namespace> value =
       sycl_memory_scope<extended_namespace>::device;
 };
+
 template <bool extended_namespace>
-struct DesulToSYCLMemoryScope<MemoryScopeSystem, extended_namespace> {
+struct SYCLMemoryScope<MemoryScopeSystem, extended_namespace> {
   static constexpr sycl_memory_scope<extended_namespace> value =
       sycl_memory_scope<extended_namespace>::system;
 };
+//</editor-fold>
 
 // FIXME_SYCL generic_space isn't available yet for CUDA.
 #ifdef __NVPTX__
 template <class T, class MemoryOrder, class MemoryScope>
 using sycl_atomic_ref = sycl::atomic_ref<T,
-                                         DesulToSYCLMemoryOrder<MemoryOrder>::value,
-                                         DesulToSYCLMemoryScope<MemoryScope>::value,
+                                         SYCLMemoryOrder<MemoryOrder>::value,
+                                         SYCLMemoryScope<MemoryScope>::value,
                                          sycl::access::address_space::global_space>;
 #else
 template <class T, class MemoryOrder, class MemoryScope>
 using sycl_atomic_ref = sycl::atomic_ref<T,
-                                         DesulToSYCLMemoryOrder<MemoryOrder>::value,
-                                         DesulToSYCLMemoryScope<MemoryScope>::value,
+                                         SYCLMemoryOrder<MemoryOrder>::value,
+                                         SYCLMemoryScope<MemoryScope>::value,
                                          sycl::access::address_space::generic_space>;
 #endif
+
 }  // namespace Impl
 }  // namespace desul
 
 #endif
-#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Atomic_Ref.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Atomic_Ref.hpp
index fbf2dcf6b7cb2972f2d43b81f0b55b45951ee03c..3d69dcf6c50ce0ab034f125ac979bd37a4ac1a56 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/Atomic_Ref.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Atomic_Ref.hpp
@@ -10,13 +10,12 @@ SPDX-License-Identifier: (BSD-3-Clause)
 #define DESUL_ATOMIC_REF_IMPL_HPP_
 
 #include <cstddef>
+#include <desul/atomics/Common.hpp>
+#include <desul/atomics/Generic.hpp>
+#include <desul/atomics/Macros.hpp>
 #include <memory>
 #include <type_traits>
 
-#include "desul/atomics/Common.hpp"
-#include "desul/atomics/Generic.hpp"
-#include "desul/atomics/Macros.hpp"
-
 namespace desul {
 namespace Impl {
 
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/CUDA.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/CUDA.hpp
deleted file mode 100644
index 87c0df4af91827793e0d95c43b1af08df88263fe..0000000000000000000000000000000000000000
--- a/packages/kokkos/tpls/desul/include/desul/atomics/CUDA.hpp
+++ /dev/null
@@ -1,664 +0,0 @@
-/*
-Copyright (c) 2019, Lawrence Livermore National Security, LLC
-and DESUL project contributors. See the COPYRIGHT file for details.
-Source: https://github.com/desul/desul
-
-SPDX-License-Identifier: (BSD-3-Clause)
-*/
-#ifndef DESUL_ATOMICS_CUDA_HPP_
-#define DESUL_ATOMICS_CUDA_HPP_
-
-#ifdef DESUL_HAVE_CUDA_ATOMICS
-// When building with Clang we need to include the device functions always since Clang
-// must see a consistent overload set in both device and host compilation, but that
-// means we need to know on the host what to make visible, i.e. we need a host side
-// compile knowledge of architecture.
-#if (defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 700)) || \
-    (!defined(__NVCC__) && !defined(DESUL_CUDA_ARCH_IS_PRE_VOLTA))
-#define DESUL_HAVE_CUDA_ATOMICS_ASM
-#include <desul/atomics/cuda/CUDA_asm.hpp>
-#endif
-
-#if (defined(__CUDA_ARCH__) && (__CUDA_ARCH__ < 700)) || \
-    (!defined(__NVCC__) && !defined(DESUL_HAVE_CUDA_ATOMICS_ASM))
-namespace desul {
-namespace Impl {
-template <class T>
-struct is_cuda_atomic_integer_type {
-  static constexpr bool value = std::is_same<T, int>::value ||
-                                std::is_same<T, unsigned int>::value ||
-                                std::is_same<T, unsigned long long int>::value;
-};
-
-template <class T>
-struct is_cuda_atomic_add_type {
-  static constexpr bool value = is_cuda_atomic_integer_type<T>::value ||
-#if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 600)
-                                std::is_same<T, double>::value ||
-#endif
-                                std::is_same<T, float>::value;
-};
-
-template <class T>
-struct is_cuda_atomic_sub_type {
-  static constexpr bool value =
-      std::is_same<T, int>::value || std::is_same<T, unsigned int>::value;
-};
-}  // namespace Impl
-
-// Atomic Add
-template <class T>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_add_type<T>::value, T>
-    atomic_fetch_add(T* dest, T val, MemoryOrderRelaxed, MemoryScopeDevice) {
-  return atomicAdd(dest, val);
-}
-
-template <class T, class MemoryOrder>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_add_type<T>::value, T>
-    atomic_fetch_add(T* dest, T val, MemoryOrder, MemoryScopeDevice) {
-  __threadfence();
-  T return_val = atomicAdd(dest, val);
-  __threadfence();
-  return return_val;
-}
-
-template <class T, class MemoryOrder>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_add_type<T>::value, T>
-    atomic_fetch_add(T* dest, T val, MemoryOrder, MemoryScopeCore) {
-  return atomic_fetch_add(dest, val, MemoryOrder(), MemoryScopeDevice());
-}
-
-// Atomic Sub
-template <class T>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_sub_type<T>::value, T>
-    atomic_fetch_sub(T* dest, T val, MemoryOrderRelaxed, MemoryScopeDevice) {
-  return atomicSub(dest, val);
-}
-
-template <class T, class MemoryOrder>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_sub_type<T>::value, T>
-    atomic_fetch_sub(T* dest, T val, MemoryOrder, MemoryScopeDevice) {
-  __threadfence();
-  T return_val = atomicSub(dest, val);
-  __threadfence();
-  return return_val;
-}
-
-template <class T, class MemoryOrder>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_sub_type<T>::value, T>
-    atomic_fetch_sub(T* dest, T val, MemoryOrder, MemoryScopeCore) {
-  return atomic_fetch_sub(dest, val, MemoryOrder(), MemoryScopeDevice());
-}
-
-// Wrap around atomic add
-__device__ inline unsigned int atomic_fetch_inc_mod(unsigned int* dest,
-                                                    unsigned int val,
-                                                    MemoryOrderRelaxed,
-                                                    MemoryScopeDevice) {
-  return atomicInc(dest, val);
-}
-
-template <typename MemoryOrder>
-__device__ inline unsigned int atomic_fetch_inc_mod(unsigned int* dest,
-                                                    unsigned int val,
-                                                    MemoryOrder,
-                                                    MemoryScopeDevice) {
-  __threadfence();
-  unsigned int return_val = atomicInc(dest, val);
-  __threadfence();
-  return return_val;
-}
-
-template <typename MemoryOrder>
-__device__ inline unsigned int atomic_fetch_inc_mod(unsigned int* dest,
-                                                    unsigned int val,
-                                                    MemoryOrder,
-                                                    MemoryScopeCore) {
-  return atomic_fetch_inc_mod(dest, val, MemoryOrder(), MemoryScopeDevice());
-}
-
-// Wrap around atomic sub
-__device__ inline unsigned int atomic_fetch_dec_mod(unsigned int* dest,
-                                                    unsigned int val,
-                                                    MemoryOrderRelaxed,
-                                                    MemoryScopeDevice) {
-  return atomicDec(dest, val);
-}
-
-template <typename MemoryOrder>
-__device__ inline unsigned int atomic_fetch_dec_mod(unsigned int* dest,
-                                                    unsigned int val,
-                                                    MemoryOrder,
-                                                    MemoryScopeDevice) {
-  __threadfence();
-  unsigned int return_val = atomicDec(dest, val);
-  __threadfence();
-  return return_val;
-}
-
-template <typename MemoryOrder>
-__device__ inline unsigned int atomic_fetch_dec_mod(unsigned int* dest,
-                                                    unsigned int val,
-                                                    MemoryOrder,
-                                                    MemoryScopeCore) {
-  return atomic_fetch_dec_mod(dest, val, MemoryOrder(), MemoryScopeDevice());
-}
-
-// Atomic Inc
-template <typename T>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_add_type<T>::value, T>
-    atomic_fetch_inc(T* dest, MemoryOrderRelaxed, MemoryScopeDevice) {
-  return atomicAdd(dest, T(1));
-}
-
-template <typename T, typename MemoryOrder>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_add_type<T>::value, T>
-    atomic_fetch_inc(T* dest, MemoryOrder, MemoryScopeDevice) {
-  __threadfence();
-  T return_val = atomicAdd(dest, T(1));
-  __threadfence();
-
-  return return_val;
-}
-
-template <typename T, typename MemoryOrder>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_add_type<T>::value, T>
-    atomic_fetch_inc(T* dest, MemoryOrder, MemoryScopeCore) {
-  return atomic_fetch_add(dest, T(1), MemoryOrder(), MemoryScopeDevice());
-}
-
-// Atomic Dec
-template <typename T>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_sub_type<T>::value, T>
-    atomic_fetch_dec(T* dest, MemoryOrderRelaxed, MemoryScopeDevice) {
-  return atomicSub(dest, T(1));
-}
-
-template <typename T, typename MemoryOrder>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_sub_type<T>::value, T>
-    atomic_fetch_dec(T* dest, MemoryOrder, MemoryScopeDevice) {
-  __threadfence();
-  T return_val = atomicSub(dest, T(1));
-  __threadfence();
-  return return_val;
-}
-
-template <typename T, typename MemoryOrder>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_sub_type<T>::value, T>
-    atomic_fetch_dec(T* dest, MemoryOrder, MemoryScopeCore) {
-  return atomic_fetch_sub(dest, T(1), MemoryOrder(), MemoryScopeDevice());
-}
-
-// Atomic Max
-template <class T>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T>
-    atomic_fetch_max(T* dest, T val, MemoryOrderRelaxed, MemoryScopeDevice) {
-  return atomicMax(dest, val);
-}
-
-template <class T, class MemoryOrder>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T>
-    atomic_fetch_max(T* dest, T val, MemoryOrder, MemoryScopeDevice) {
-  __threadfence();
-  T return_val = atomicMax(dest, val);
-  __threadfence();
-  return return_val;
-}
-
-template <class T, class MemoryOrder>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T>
-    atomic_fetch_max(T* dest, T val, MemoryOrder, MemoryScopeCore) {
-  return atomic_fetch_max(dest, val, MemoryOrder(), MemoryScopeDevice());
-}
-
-// Atomic Min
-template <class T>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T>
-    atomic_fetch_min(T* dest, T val, MemoryOrderRelaxed, MemoryScopeDevice) {
-  return atomicMin(dest, val);
-}
-
-template <class T, class MemoryOrder>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T>
-    atomic_fetch_min(T* dest, T val, MemoryOrder, MemoryScopeDevice) {
-  __threadfence();
-  T return_val = atomicMin(dest, val);
-  __threadfence();
-  return return_val;
-}
-
-template <class T, class MemoryOrder>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T>
-    atomic_fetch_min(T* dest, T val, MemoryOrder, MemoryScopeCore) {
-  return atomic_fetch_min(dest, val, MemoryOrder(), MemoryScopeDevice());
-}
-
-// Atomic And
-template <class T>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T>
-    atomic_fetch_and(T* dest, T val, MemoryOrderRelaxed, MemoryScopeDevice) {
-  return atomicAnd(dest, val);
-}
-
-template <class T, class MemoryOrder>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T>
-    atomic_fetch_and(T* dest, T val, MemoryOrder, MemoryScopeDevice) {
-  __threadfence();
-  T return_val = atomicAnd(dest, val);
-  __threadfence();
-  return return_val;
-}
-
-template <class T, class MemoryOrder>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T>
-    atomic_fetch_and(T* dest, T val, MemoryOrder, MemoryScopeCore) {
-  return atomic_fetch_and(dest, val, MemoryOrder(), MemoryScopeDevice());
-}
-
-// Atomic XOR
-template <class T>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T>
-    atomic_fetch_xor(T* dest, T val, MemoryOrderRelaxed, MemoryScopeDevice) {
-  return atomicXor(dest, val);
-}
-
-template <class T, class MemoryOrder>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T>
-    atomic_fetch_xor(T* dest, T val, MemoryOrder, MemoryScopeDevice) {
-  __threadfence();
-  T return_val = atomicXor(dest, val);
-  __threadfence();
-  return return_val;
-}
-
-template <class T, class MemoryOrder>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T>
-    atomic_fetch_xor(T* dest, T val, MemoryOrder, MemoryScopeCore) {
-  return atomic_fetch_xor(dest, val, MemoryOrder(), MemoryScopeDevice());
-}
-
-// Atomic OR
-template <class T>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T>
-    atomic_fetch_or(T* dest, T val, MemoryOrderRelaxed, MemoryScopeDevice) {
-  return atomicOr(dest, val);
-}
-
-template <class T, class MemoryOrder>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T>
-    atomic_fetch_or(T* dest, T val, MemoryOrder, MemoryScopeDevice) {
-  __threadfence();
-  T return_val = atomicOr(dest, val);
-  __threadfence();
-  return return_val;
-}
-
-template <class T, class MemoryOrder>
-__device__ inline
-    std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T>
-    atomic_fetch_or(T* dest, T val, MemoryOrder, MemoryScopeCore) {
-  return atomic_fetch_or(dest, val, MemoryOrder(), MemoryScopeDevice());
-}
-}  // namespace desul
-#endif
-
-#if !defined(__NVCC__)
-// Functions defined as device functions in CUDA which don't exist in the GCC overload
-// set
-namespace desul {
-
-#if defined(DESUL_HAVE_CUDA_ATOMICS_ASM)
-#define DESUL_IMPL_CUDA_HOST_ATOMIC_ADD(TYPE, ORDER, SCOPE)                      \
-  inline void atomic_add(TYPE* const dest, TYPE val, ORDER order, SCOPE scope) { \
-    (void)atomic_fetch_add(dest, val, order, scope);                             \
-  }
-DESUL_IMPL_CUDA_HOST_ATOMIC_ADD(int32_t, MemoryOrderRelaxed, MemoryScopeDevice);
-DESUL_IMPL_CUDA_HOST_ATOMIC_ADD(long,
-                                MemoryOrderRelaxed,
-                                MemoryScopeDevice);  // only for ASM?
-DESUL_IMPL_CUDA_HOST_ATOMIC_ADD(unsigned int, MemoryOrderRelaxed, MemoryScopeDevice);
-DESUL_IMPL_CUDA_HOST_ATOMIC_ADD(unsigned long long,
-                                MemoryOrderRelaxed,
-                                MemoryScopeDevice);
-DESUL_IMPL_CUDA_HOST_ATOMIC_ADD(float, MemoryOrderRelaxed, MemoryScopeDevice);
-DESUL_IMPL_CUDA_HOST_ATOMIC_ADD(double, MemoryOrderRelaxed, MemoryScopeDevice);
-
-#define DESUL_IMPL_CUDA_HOST_ATOMIC_SUB(TYPE, ORDER, SCOPE)                      \
-  inline void atomic_sub(TYPE* const dest, TYPE val, ORDER order, SCOPE scope) { \
-    (void)atomic_fetch_sub(dest, val, order, scope);                             \
-  }
-DESUL_IMPL_CUDA_HOST_ATOMIC_SUB(int32_t, MemoryOrderRelaxed, MemoryScopeDevice);
-DESUL_IMPL_CUDA_HOST_ATOMIC_SUB(long,
-                                MemoryOrderRelaxed,
-                                MemoryScopeDevice);  // only for ASM?
-DESUL_IMPL_CUDA_HOST_ATOMIC_SUB(unsigned int, MemoryOrderRelaxed, MemoryScopeDevice);
-DESUL_IMPL_CUDA_HOST_ATOMIC_SUB(float, MemoryOrderRelaxed, MemoryScopeDevice);
-DESUL_IMPL_CUDA_HOST_ATOMIC_SUB(double, MemoryOrderRelaxed, MemoryScopeDevice);
-
-#define DESUL_IMPL_CUDA_HOST_ATOMIC_INC(TYPE, ORDER, SCOPE)            \
-  inline void atomic_inc(TYPE* const dest, ORDER order, SCOPE scope) { \
-    (void)atomic_fetch_inc(dest, order, scope);                        \
-  }
-DESUL_IMPL_CUDA_HOST_ATOMIC_INC(unsigned int,
-                                MemoryOrderRelaxed,
-                                MemoryScopeDevice);  // only for ASM?
-
-#define DESUL_IMPL_CUDA_HOST_ATOMIC_DEC(TYPE, ORDER, SCOPE)            \
-  inline void atomic_dec(TYPE* const dest, ORDER order, SCOPE scope) { \
-    (void)atomic_fetch_dec(dest, order, scope);                        \
-  }
-DESUL_IMPL_CUDA_HOST_ATOMIC_DEC(unsigned,
-                                MemoryOrderRelaxed,
-                                MemoryScopeDevice);  // only for ASM?
-
-#endif  // DESUL_HAVE_CUDA_ATOMICS_ASM
-
-#define DESUL_IMPL_CUDA_HOST_ATOMIC_INC_MOD(TYPE, ORDER, SCOPE)                      \
-  inline TYPE atomic_fetch_inc_mod(TYPE* dest, TYPE val, ORDER order, SCOPE scope) { \
-    using cas_t = typename Impl::atomic_compare_exchange_type<sizeof(TYPE)>::type;   \
-    cas_t oldval = reinterpret_cast<cas_t&>(*dest);                                  \
-    cas_t assume = oldval;                                                           \
-    do {                                                                             \
-      assume = oldval;                                                               \
-      TYPE newval = (reinterpret_cast<TYPE&>(assume) >= val)                         \
-                        ? static_cast<TYPE>(0)                                       \
-                        : reinterpret_cast<TYPE&>(assume) + static_cast<TYPE>(1);    \
-      oldval = desul::atomic_compare_exchange(reinterpret_cast<cas_t*>(dest),        \
-                                              assume,                                \
-                                              reinterpret_cast<cas_t&>(newval),      \
-                                              order,                                 \
-                                              scope);                                \
-    } while (assume != oldval);                                                      \
-    return reinterpret_cast<TYPE&>(oldval);                                          \
-  }
-DESUL_IMPL_CUDA_HOST_ATOMIC_INC_MOD(unsigned int,
-                                    MemoryOrderRelaxed,
-                                    MemoryScopeDevice);
-#define DESUL_IMPL_CUDA_HOST_ATOMIC_DEC_MOD(TYPE, ORDER, SCOPE)                      \
-  inline TYPE atomic_fetch_dec_mod(TYPE* dest, TYPE val, ORDER order, SCOPE scope) { \
-    using cas_t = typename Impl::atomic_compare_exchange_type<sizeof(TYPE)>::type;   \
-    cas_t oldval = reinterpret_cast<cas_t&>(*dest);                                  \
-    cas_t assume = oldval;                                                           \
-    do {                                                                             \
-      assume = oldval;                                                               \
-      TYPE newval = ((reinterpret_cast<TYPE&>(assume) == static_cast<TYPE>(0)) |     \
-                     (reinterpret_cast<TYPE&>(assume) > val))                        \
-                        ? val                                                        \
-                        : reinterpret_cast<TYPE&>(assume) - static_cast<TYPE>(1);    \
-      oldval = desul::atomic_compare_exchange(reinterpret_cast<cas_t*>(dest),        \
-                                              assume,                                \
-                                              reinterpret_cast<cas_t&>(newval),      \
-                                              order,                                 \
-                                              scope);                                \
-    } while (assume != oldval);                                                      \
-    return reinterpret_cast<TYPE&>(oldval);                                          \
-  }
-DESUL_IMPL_CUDA_HOST_ATOMIC_DEC_MOD(unsigned int,
-                                    MemoryOrderRelaxed,
-                                    MemoryScopeDevice);
-
-#define DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_ADD(TYPE, ORDER, SCOPE)                      \
-  inline TYPE atomic_fetch_add(TYPE* const dest, TYPE val, ORDER order, SCOPE scope) { \
-    return Impl::atomic_fetch_oper(                                                    \
-        Impl::AddOper<TYPE, const TYPE>(), dest, val, order, scope);                   \
-  }
-DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_ADD(float, MemoryOrderRelaxed, MemoryScopeDevice);
-DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_ADD(double, MemoryOrderRelaxed, MemoryScopeDevice);
-
-#define DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_SUB(TYPE, ORDER, SCOPE)                      \
-  inline TYPE atomic_fetch_sub(TYPE* const dest, TYPE val, ORDER order, SCOPE scope) { \
-    return Impl::atomic_fetch_oper(                                                    \
-        Impl::SubOper<TYPE, const TYPE>(), dest, val, order, scope);                   \
-  }
-DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_SUB(float, MemoryOrderRelaxed, MemoryScopeDevice);
-DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_SUB(double, MemoryOrderRelaxed, MemoryScopeDevice);
-
-#define DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MAX(TYPE, ORDER, SCOPE)                      \
-  inline TYPE atomic_fetch_max(TYPE* const dest, TYPE val, ORDER order, SCOPE scope) { \
-    return Impl::atomic_fetch_oper(                                                    \
-        Impl::MaxOper<TYPE, const TYPE>(), dest, val, order, scope);                   \
-  }
-DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MAX(int, MemoryOrderRelaxed, MemoryScopeDevice);
-DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MAX(long,
-                                      MemoryOrderRelaxed,
-                                      MemoryScopeDevice);  // only for ASM?
-DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MAX(unsigned int,
-                                      MemoryOrderRelaxed,
-                                      MemoryScopeDevice);
-DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MAX(unsigned long,
-                                      MemoryOrderRelaxed,
-                                      MemoryScopeDevice);
-//  DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MAX(unsigned long
-//  long,MemoryOrderRelaxed,MemoryScopeDevice);
-
-#define DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MIN(TYPE, ORDER, SCOPE)                      \
-  inline TYPE atomic_fetch_min(TYPE* const dest, TYPE val, ORDER order, SCOPE scope) { \
-    return Impl::atomic_fetch_oper(                                                    \
-        Impl::MinOper<TYPE, const TYPE>(), dest, val, order, scope);                   \
-  }
-DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MIN(int, MemoryOrderRelaxed, MemoryScopeDevice);
-DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MIN(long,
-                                      MemoryOrderRelaxed,
-                                      MemoryScopeDevice);  // only for ASM?
-DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MIN(unsigned int,
-                                      MemoryOrderRelaxed,
-                                      MemoryScopeDevice);
-DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MIN(unsigned long,
-                                      MemoryOrderRelaxed,
-                                      MemoryScopeDevice);
-//  DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MIN(unsigned long
-//  long,MemoryOrderRelaxed,MemoryScopeDevice); inline void atomic_fetch_max(int32_t*
-//  const dest, int32_t val, MemoryOrderRelaxed order, MemoryScopeDevice scope) {
-
-}  // namespace desul
-
-// Functions defined int the GCC overload set but not in the device overload set
-namespace desul {
-__device__ inline unsigned long long atomic_fetch_add(unsigned long long* const dest,
-                                                      unsigned long long val,
-                                                      MemoryOrderRelaxed order,
-                                                      MemoryScopeDevice scope) {
-  return Impl::atomic_fetch_oper(
-      Impl::AddOper<unsigned long long, const unsigned long long>(),
-      dest,
-      val,
-      order,
-      scope);
-}
-__device__ inline long long atomic_fetch_add(long long* const dest,
-                                             long long val,
-                                             MemoryOrderRelaxed order,
-                                             MemoryScopeDevice scope) {
-  return Impl::atomic_fetch_oper(
-      Impl::AddOper<long long, const long long>(), dest, val, order, scope);
-}
-__device__ inline long atomic_fetch_add(long* const dest,
-                                        long val,
-                                        MemoryOrderRelaxed order,
-                                        MemoryScopeDevice scope) {
-  return Impl::atomic_fetch_oper(
-      Impl::AddOper<long, const long>(), dest, val, order, scope);
-}
-__device__ inline long long atomic_fetch_sub(long long* const dest,
-                                             long long val,
-                                             MemoryOrderRelaxed order,
-                                             MemoryScopeDevice scope) {
-  return Impl::atomic_fetch_oper(
-      Impl::SubOper<long long, const long long>(), dest, val, order, scope);
-}
-__device__ inline long atomic_fetch_sub(long* const dest,
-                                        long val,
-                                        MemoryOrderRelaxed order,
-                                        MemoryScopeDevice scope) {
-  return Impl::atomic_fetch_oper(
-      Impl::SubOper<long, const long>(), dest, val, order, scope);
-}
-__device__ inline long atomic_fetch_max(long* const dest,
-                                        long val,
-                                        MemoryOrderRelaxed order,
-                                        MemoryScopeDevice scope) {
-  return Impl::atomic_fetch_oper(
-      Impl::MaxOper<long, const long>(), dest, val, order, scope);
-}
-__device__ inline long atomic_fetch_min(long* const dest,
-                                        long val,
-                                        MemoryOrderRelaxed order,
-                                        MemoryScopeDevice scope) {
-  return Impl::atomic_fetch_oper(
-      Impl::MinOper<long, const long>(), dest, val, order, scope);
-}
-__device__ inline long atomic_fetch_or(long* const dest,
-                                       long val,
-                                       MemoryOrderRelaxed order,
-                                       MemoryScopeDevice scope) {
-  return Impl::atomic_fetch_oper(
-      Impl::OrOper<long, const long>(), dest, val, order, scope);
-}
-__device__ inline long long atomic_fetch_or(long long* const dest,
-                                            long long val,
-                                            MemoryOrderRelaxed order,
-                                            MemoryScopeDevice scope) {
-  return Impl::atomic_fetch_oper(
-      Impl::OrOper<long long, const long long>(), dest, val, order, scope);
-}
-__device__ inline long atomic_fetch_xor(long* const dest,
-                                        long val,
-                                        MemoryOrderRelaxed order,
-                                        MemoryScopeDevice scope) {
-  return Impl::atomic_fetch_oper(
-      Impl::XorOper<long, const long>(), dest, val, order, scope);
-}
-__device__ inline long long atomic_fetch_xor(long long* const dest,
-                                             long long val,
-                                             MemoryOrderRelaxed order,
-                                             MemoryScopeDevice scope) {
-  return Impl::atomic_fetch_oper(
-      Impl::XorOper<long long, const long long>(), dest, val, order, scope);
-}
-__device__ inline long atomic_fetch_and(long* const dest,
-                                        long val,
-                                        MemoryOrderRelaxed order,
-                                        MemoryScopeDevice scope) {
-  return Impl::atomic_fetch_oper(
-      Impl::AndOper<long, const long>(), dest, val, order, scope);
-}
-__device__ inline long long atomic_fetch_and(long long* const dest,
-                                             long long val,
-                                             MemoryOrderRelaxed order,
-                                             MemoryScopeDevice scope) {
-  return Impl::atomic_fetch_oper(
-      Impl::AndOper<long long, const long long>(), dest, val, order, scope);
-}
-
-__device__ inline unsigned long long atomic_add_fetch(unsigned long long* const dest,
-                                                      unsigned long long val,
-                                                      MemoryOrderRelaxed order,
-                                                      MemoryScopeDevice scope) {
-  return Impl::atomic_oper_fetch(
-      Impl::AddOper<unsigned long long, const unsigned long long>(),
-      dest,
-      val,
-      order,
-      scope);
-}
-__device__ inline long long atomic_add_fetch(long long* const dest,
-                                             long long val,
-                                             MemoryOrderRelaxed order,
-                                             MemoryScopeDevice scope) {
-  return Impl::atomic_oper_fetch(
-      Impl::AddOper<long long, const long long>(), dest, val, order, scope);
-}
-__device__ inline long atomic_add_fetch(long* const dest,
-                                        long val,
-                                        MemoryOrderRelaxed order,
-                                        MemoryScopeDevice scope) {
-  return Impl::atomic_oper_fetch(
-      Impl::AddOper<long, const long>(), dest, val, order, scope);
-}
-__device__ inline long long atomic_sub_fetch(long long* const dest,
-                                             long long val,
-                                             MemoryOrderRelaxed order,
-                                             MemoryScopeDevice scope) {
-  return Impl::atomic_oper_fetch(
-      Impl::SubOper<long long, const long long>(), dest, val, order, scope);
-}
-__device__ inline long atomic_sub_fetch(long* const dest,
-                                        long val,
-                                        MemoryOrderRelaxed order,
-                                        MemoryScopeDevice scope) {
-  return Impl::atomic_oper_fetch(
-      Impl::SubOper<long, const long>(), dest, val, order, scope);
-}
-__device__ inline long long atomic_or_fetch(long long* const dest,
-                                            long long val,
-                                            MemoryOrderRelaxed order,
-                                            MemoryScopeDevice scope) {
-  return Impl::atomic_oper_fetch(
-      Impl::OrOper<long long, const long long>(), dest, val, order, scope);
-}
-__device__ inline long atomic_or_fetch(long* const dest,
-                                       long val,
-                                       MemoryOrderRelaxed order,
-                                       MemoryScopeDevice scope) {
-  return Impl::atomic_oper_fetch(
-      Impl::OrOper<long, const long>(), dest, val, order, scope);
-}
-__device__ inline long long atomic_xor_fetch(long long* const dest,
-                                             long long val,
-                                             MemoryOrderRelaxed order,
-                                             MemoryScopeDevice scope) {
-  return Impl::atomic_oper_fetch(
-      Impl::XorOper<long long, const long long>(), dest, val, order, scope);
-}
-__device__ inline long atomic_xor_fetch(long* const dest,
-                                        long val,
-                                        MemoryOrderRelaxed order,
-                                        MemoryScopeDevice scope) {
-  return Impl::atomic_oper_fetch(
-      Impl::XorOper<long, const long>(), dest, val, order, scope);
-}
-__device__ inline long long atomic_and_fetch(long long* const dest,
-                                             long val,
-                                             MemoryOrderRelaxed order,
-                                             MemoryScopeDevice scope) {
-  return Impl::atomic_oper_fetch(
-      Impl::AndOper<long long, const long long>(), dest, val, order, scope);
-}
-__device__ inline long atomic_and_fetch(long* const dest,
-                                        long val,
-                                        MemoryOrderRelaxed order,
-                                        MemoryScopeDevice scope) {
-  return Impl::atomic_oper_fetch(
-      Impl::AndOper<long, const long>(), dest, val, order, scope);
-}
-}  // namespace desul
-#endif
-
-#endif  // DESUL_HAVE_CUDA_ATOMICS
-#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Common.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Common.hpp
index aef098e4d8caf6b0d7e9a418cdeff0a9349acce0..b7353e7dba8318255a733a12f7bbcdc1806e121d 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/Common.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Common.hpp
@@ -8,12 +8,11 @@ SPDX-License-Identifier: (BSD-3-Clause)
 
 #ifndef DESUL_ATOMICS_COMMON_HPP_
 #define DESUL_ATOMICS_COMMON_HPP_
-#include <atomic>
+
 #include <cstdint>
+#include <desul/atomics/Macros.hpp>
 #include <type_traits>
 
-#include "desul/atomics/Macros.hpp"
-
 namespace desul {
 struct alignas(16) Dummy16ByteValue {
   int64_t value1;
@@ -27,8 +26,7 @@ struct alignas(16) Dummy16ByteValue {
 };
 }  // namespace desul
 
-// MemoryOrder Tags
-
+//<editor-fold desc="Memory Order Tags">
 namespace desul {
 // Memory order sequential consistent
 struct MemoryOrderSeqCst {};
@@ -41,9 +39,9 @@ struct MemoryOrderRelease {};
 // Memory order relaxed
 struct MemoryOrderRelaxed {};
 }  // namespace desul
+//</editor-fold>
 
-// Memory Scope Tags
-
+//<editor-fold desc="Memory Scope Tags">
 namespace desul {
 // Entire machine scope (e.g. for global arrays)
 struct MemoryScopeSystem {};
@@ -56,75 +54,11 @@ struct MemoryScopeCore {};
 // Caller scoped (i.e. NOT atomic!)
 struct MemoryScopeCaller {};
 }  // namespace desul
-
-#ifndef __ATOMIC_RELAXED
-#define __ATOMIC_RELAXED 0
-#define __ATOMIC_CONSUME 1
-#define __ATOMIC_ACQUIRE 2
-#define __ATOMIC_RELEASE 3
-#define __ATOMIC_ACQ_REL 4
-#define __ATOMIC_SEQ_CST 5
-#endif
+//</editor-fold>
 
 namespace desul {
-template <class MemoryOrderDesul>
-struct GCCMemoryOrder;
-
-template <>
-struct GCCMemoryOrder<MemoryOrderRelaxed> {
-  static constexpr int value = __ATOMIC_RELAXED;
-};
-
-template <>
-struct GCCMemoryOrder<MemoryOrderAcquire> {
-  static constexpr int value = __ATOMIC_ACQUIRE;
-};
-
-template <>
-struct GCCMemoryOrder<MemoryOrderRelease> {
-  static constexpr int value = __ATOMIC_RELEASE;
-};
-
-template <>
-struct GCCMemoryOrder<MemoryOrderAcqRel> {
-  static constexpr int value = __ATOMIC_ACQ_REL;
-};
-
-template <>
-struct GCCMemoryOrder<MemoryOrderSeqCst> {
-  static constexpr int value = __ATOMIC_SEQ_CST;
-};
-
-template <class MemoryOrderDesul>
-struct CXXMemoryOrder;
-
-template <>
-struct CXXMemoryOrder<MemoryOrderRelaxed> {
-  static constexpr std::memory_order value = std::memory_order_relaxed;
-};
-
-template <>
-struct CXXMemoryOrder<MemoryOrderAcquire> {
-  static constexpr std::memory_order value = std::memory_order_acquire;
-};
-
-template <>
-struct CXXMemoryOrder<MemoryOrderRelease> {
-  static constexpr std::memory_order value = std::memory_order_release;
-};
-
-template <>
-struct CXXMemoryOrder<MemoryOrderAcqRel> {
-  static constexpr std::memory_order value = std::memory_order_acq_rel;
-};
-
-template <>
-struct CXXMemoryOrder<MemoryOrderSeqCst> {
-  static constexpr std::memory_order value = std::memory_order_seq_cst;
-};
-
 namespace Impl {
-template <typename MemoryOrder>
+template <class MemoryOrder>
 struct CmpExchFailureOrder {
   using memory_order = std::conditional_t<
       std::is_same<MemoryOrder, MemoryOrderAcqRel>{},
@@ -133,15 +67,14 @@ struct CmpExchFailureOrder {
                          MemoryOrderRelaxed,
                          MemoryOrder>>;
 };
-template <typename MemoryOrder>
+template <class MemoryOrder>
 using cmpexch_failure_memory_order =
     typename CmpExchFailureOrder<MemoryOrder>::memory_order;
 }  // namespace Impl
-
 }  // namespace desul
 
 // We should in principle use std::numeric_limits, but that requires constexpr function
-// support on device Currently that is still considered experimetal on CUDA and
+// support on device Currently that is still considered experimental on CUDA and
 // sometimes not reliable.
 namespace desul {
 namespace Impl {
@@ -150,11 +83,11 @@ struct numeric_limits_max;
 
 template <>
 struct numeric_limits_max<uint32_t> {
-  static constexpr uint32_t value = 0xffffffffu;
+  static constexpr auto value = static_cast<uint32_t>(-1);
 };
 template <>
 struct numeric_limits_max<uint64_t> {
-  static constexpr uint64_t value = 0xfffffffflu;
+  static constexpr auto value = static_cast<uint64_t>(-1);
 };
 
 constexpr bool atomic_always_lock_free(std::size_t size) {
@@ -174,24 +107,30 @@ DESUL_INLINE_FUNCTION bool atomic_is_lock_free() noexcept {
       ;
 }
 
-template <std::size_t N>
-struct atomic_compare_exchange_type;
+//<editor-fold desc="Underlying type for atomic compare exchange">
+template <std::size_t Bytes>
+struct atomic_compare_exchange_helper;
 
 template <>
-struct atomic_compare_exchange_type<4> {
+struct atomic_compare_exchange_helper<4> {
   using type = int32_t;
 };
 
 template <>
-struct atomic_compare_exchange_type<8> {
+struct atomic_compare_exchange_helper<8> {
   using type = int64_t;
 };
 
 template <>
-struct atomic_compare_exchange_type<16> {
+struct atomic_compare_exchange_helper<16> {
   using type = Dummy16ByteValue;
 };
 
+template <class T>
+using atomic_compare_exchange_t =
+    typename atomic_compare_exchange_helper<sizeof(T)>::type;
+//</editor-fold>
+
 template <class T>
 struct dont_deduce_this_parameter {
   using type = T;
@@ -202,4 +141,5 @@ using dont_deduce_this_parameter_t = typename dont_deduce_this_parameter<T>::typ
 
 }  // namespace Impl
 }  // namespace desul
+
 #endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange.hpp
index d947dac27500fb1ebc63b89465de4b8f3bb8d77c..e91569e1dee8e6073f06e018aa5d75b0e13075d3 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange.hpp
@@ -9,28 +9,27 @@ SPDX-License-Identifier: (BSD-3-Clause)
 #ifndef DESUL_ATOMICS_COMPARE_EXCHANGE_HPP_
 #define DESUL_ATOMICS_COMPARE_EXCHANGE_HPP_
 
-#include "desul/atomics/Compare_Exchange_ScopeCaller.hpp"
-#include "desul/atomics/Macros.hpp"
+#include <desul/atomics/Macros.hpp>
 
 #ifdef DESUL_HAVE_GCC_ATOMICS
-#include "desul/atomics/Compare_Exchange_GCC.hpp"
+#include <desul/atomics/Compare_Exchange_GCC.hpp>
 #endif
 #ifdef DESUL_HAVE_MSVC_ATOMICS
-#include "desul/atomics/Compare_Exchange_MSVC.hpp"
-#endif
-#ifdef DESUL_HAVE_SERIAL_ATOMICS
-#include "desul/atomics/Compare_Exchange_Serial.hpp"
+#include <desul/atomics/Compare_Exchange_MSVC.hpp>
 #endif
 #ifdef DESUL_HAVE_CUDA_ATOMICS
-#include "desul/atomics/Compare_Exchange_CUDA.hpp"
+#include <desul/atomics/Compare_Exchange_CUDA.hpp>
 #endif
 #ifdef DESUL_HAVE_HIP_ATOMICS
-#include "desul/atomics/Compare_Exchange_HIP.hpp"
+#include <desul/atomics/Compare_Exchange_HIP.hpp>
 #endif
 #ifdef DESUL_HAVE_OPENMP_ATOMICS
-#include "desul/atomics/Compare_Exchange_OpenMP.hpp"
+#include <desul/atomics/Compare_Exchange_OpenMP.hpp>
 #endif
 #ifdef DESUL_HAVE_SYCL_ATOMICS
-#include "desul/atomics/Compare_Exchange_SYCL.hpp"
+#include <desul/atomics/Compare_Exchange_SYCL.hpp>
 #endif
+
+#include <desul/atomics/Compare_Exchange_ScopeCaller.hpp>
+
 #endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_CUDA.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_CUDA.hpp
index 310c59f55ef4ca1342a7e1a113535f185b38692a..456d6b011e681ea8bbac80bbc1b158fb57d25b9d 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_CUDA.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_CUDA.hpp
@@ -8,65 +8,31 @@ SPDX-License-Identifier: (BSD-3-Clause)
 
 #ifndef DESUL_ATOMICS_COMPARE_EXCHANGE_CUDA_HPP_
 #define DESUL_ATOMICS_COMPARE_EXCHANGE_CUDA_HPP_
-#include "desul/atomics/Common.hpp"
-#include "desul/atomics/Lock_Array_Cuda.hpp"
 
-#ifdef DESUL_HAVE_CUDA_ATOMICS
-namespace desul {
-// Only include if compiling device code, or the CUDA compiler is not NVCC (i.e. Clang)
-// atomic_thread_fence implementation
-#if defined(__CUDA_ARCH__) || !defined(__NVCC__)
-__device__ inline void atomic_thread_fence(MemoryOrderRelease, MemoryScopeDevice) {
-  __threadfence();
-}
-__device__ inline void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeDevice) {
-  __threadfence();
-}
-__device__ inline void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeDevice) {
-  __threadfence();
-}
-__device__ inline void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeDevice) {
-  __threadfence();
-}
-__device__ inline void atomic_thread_fence(MemoryOrderRelease, MemoryScopeCore) {
-  __threadfence_block();
-}
-__device__ inline void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeCore) {
-  __threadfence_block();
-}
-__device__ inline void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeCore) {
-  __threadfence_block();
-}
-__device__ inline void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeCore) {
-  __threadfence_block();
-}
-#if (__CUDA_ARCH__ >= 600) || !defined(__NVCC__)
-__device__ inline void atomic_thread_fence(MemoryOrderRelease, MemoryScopeNode) {
-  __threadfence_system();
-}
-__device__ inline void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeNode) {
-  __threadfence_system();
-}
-__device__ inline void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeNode) {
-  __threadfence_system();
-}
-__device__ inline void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeNode) {
-  __threadfence_system();
-}
-#endif
-#endif
-}  // namespace desul
+#include <desul/atomics/Common.hpp>
+#include <desul/atomics/Lock_Array_CUDA.hpp>
+#include <desul/atomics/Thread_Fence_CUDA.hpp>
+#include <type_traits>
+
+// Including CUDA ptx based exchange atomics
+// When building with clang we need to include the device functions always
+// since clang must see a consistent overload set in both device and host compilation
+// but that means we need to know on the host what to make visible, i.e. we need
+// a host side compile knowledge of architecture.
+// We simply can say DESUL proper doesn't support clang CUDA build pre Volta,
+// Kokkos has that knowledge and so I use it here, allowing in Kokkos to use
+// clang with pre Volta as CUDA compiler
+#ifndef DESUL_CUDA_ARCH_IS_PRE_VOLTA
+
+#include <desul/atomics/cuda/CUDA_asm_exchange.hpp>
+
+#else
 
-// Compare Exchange for PRE Volta, not supported with CLANG as CUDA compiler, since we
-// do NOT have a way of having the code included for clang only when the CC is smaller
-// than 700 But on Clang the device side symbol list must be independent of
-// __CUDA_ARCH__
-// FIXME temporary fix for https://github.com/kokkos/kokkos/issues/4390
-#if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ < 700) || \
-    (!defined(__NVCC__) && defined(DESUL_CUDA_ARCH_IS_PRE_VOLTA) && 0)
 namespace desul {
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_compare_exchange(
+namespace Impl {
+
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4, T> device_atomic_compare_exchange(
     T* const dest, T compare, T value, MemoryOrderRelaxed, MemoryScope) {
   static_assert(sizeof(unsigned int) == 4,
                 "this function assumes an unsigned int is 32-bit");
@@ -75,11 +41,11 @@ __device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_compare_excha
                                       reinterpret_cast<unsigned int&>(value));
   return reinterpret_cast<T&>(return_val);
 }
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 8, T>::type atomic_compare_exchange(
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 8, T> device_atomic_compare_exchange(
     T* const dest, T compare, T value, MemoryOrderRelaxed, MemoryScope) {
   static_assert(sizeof(unsigned long long int) == 8,
-                "this function assumes an unsigned long long  is 64-bit");
+                "this function assumes an unsigned long long is 64-bit");
   unsigned long long int return_val =
       atomicCAS(reinterpret_cast<unsigned long long int*>(dest),
                 reinterpret_cast<unsigned long long int&>(compare),
@@ -87,39 +53,39 @@ __device__ typename std::enable_if<sizeof(T) == 8, T>::type atomic_compare_excha
   return reinterpret_cast<T&>(return_val);
 }
 
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type
-atomic_compare_exchange(
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T>
+device_atomic_compare_exchange(
     T* const dest, T compare, T value, MemoryOrderRelease, MemoryScope) {
-  T return_val = atomic_compare_exchange(
+  T return_val = device_atomic_compare_exchange(
       dest, compare, value, MemoryOrderRelaxed(), MemoryScope());
-  atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
+  device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
   return return_val;
 }
 
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type
-atomic_compare_exchange(
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T>
+device_atomic_compare_exchange(
     T* const dest, T compare, T value, MemoryOrderAcquire, MemoryScope) {
-  atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
-  T return_val = atomic_compare_exchange(
+  device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
+  T return_val = device_atomic_compare_exchange(
       dest, compare, value, MemoryOrderRelaxed(), MemoryScope());
   return return_val;
 }
 
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type
-atomic_compare_exchange(
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T>
+device_atomic_compare_exchange(
     T* const dest, T compare, T value, MemoryOrderAcqRel, MemoryScope) {
-  atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
-  T return_val = atomic_compare_exchange(
+  device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
+  T return_val = device_atomic_compare_exchange(
       dest, compare, value, MemoryOrderRelaxed(), MemoryScope());
-  atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
+  device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
   return return_val;
 }
 
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_exchange(
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4, T> device_atomic_exchange(
     T* const dest, T value, MemoryOrderRelaxed, MemoryScope) {
   static_assert(sizeof(unsigned int) == 4,
                 "this function assumes an unsigned int is 32-bit");
@@ -127,157 +93,151 @@ __device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_exchange(
                                        reinterpret_cast<unsigned int&>(value));
   return reinterpret_cast<T&>(return_val);
 }
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 8, T>::type atomic_exchange(
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 8, T> device_atomic_exchange(
     T* const dest, T value, MemoryOrderRelaxed, MemoryScope) {
   static_assert(sizeof(unsigned long long int) == 8,
-                "this function assumes an unsigned long long  is 64-bit");
+                "this function assumes an unsigned long long is 64-bit");
   unsigned long long int return_val =
       atomicExch(reinterpret_cast<unsigned long long int*>(dest),
                  reinterpret_cast<unsigned long long int&>(value));
   return reinterpret_cast<T&>(return_val);
 }
 
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type
-atomic_exchange(T* const dest, T value, MemoryOrderRelease, MemoryScope) {
-  T return_val = atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope());
-  atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> device_atomic_exchange(
+    T* const dest, T value, MemoryOrderRelease, MemoryScope) {
+  T return_val =
+      device_atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope());
+  device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
   return reinterpret_cast<T&>(return_val);
 }
 
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type
-atomic_exchange(T* const dest, T value, MemoryOrderAcquire, MemoryScope) {
-  atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
-  T return_val = atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope());
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> device_atomic_exchange(
+    T* const dest, T value, MemoryOrderAcquire, MemoryScope) {
+  device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
+  T return_val =
+      device_atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope());
   return reinterpret_cast<T&>(return_val);
 }
 
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type
-atomic_exchange(T* const dest, T value, MemoryOrderAcqRel, MemoryScope) {
-  atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
-  T return_val = atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope());
-  atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> device_atomic_exchange(
+    T* const dest, T value, MemoryOrderAcqRel, MemoryScope) {
+  device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
+  T return_val =
+      device_atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope());
+  device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
   return reinterpret_cast<T&>(return_val);
 }
+}  // namespace Impl
 }  // namespace desul
-#endif
 
-// Including CUDA ptx based exchange atomics
-// When building with clang we need to include the device functions always
-// since clang must see a consistent overload set in both device and host compilation
-// but that means we need to know on the host what to make visible, i.e. we need
-// a host side compile knowledge of architecture.
-// We simply can say DESUL proper doesn't support clang CUDA build pre Volta,
-// Kokkos has that knowledge and so I use it here, allowing in Kokkos to use
-// clang with pre Volta as CUDA compiler
-#if (defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 700)) || \
-    (!defined(__NVCC__) && !defined(DESUL_CUDA_ARCH_IS_PRE_VOLTA))
-#include <desul/atomics/cuda/CUDA_asm_exchange.hpp>
 #endif
 
 // SeqCst is not directly supported by PTX, need the additional fences:
 
-#if defined(__CUDA_ARCH__) || !defined(__NVCC__)
 namespace desul {
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_exchange(
-    T* const dest, T value, MemoryOrderSeqCst, MemoryScope) {
-  atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
-  T return_val = atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope());
-  atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
+namespace Impl {
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4, T> device_atomic_exchange(T* const dest,
+                                                                      T value,
+                                                                      MemoryOrderSeqCst,
+                                                                      MemoryScope) {
+  device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
+  T return_val =
+      device_atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope());
+  device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
   return return_val;
 }
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 8, T>::type atomic_exchange(
-    T* const dest, T value, MemoryOrderSeqCst, MemoryScope) {
-  atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
-  T return_val = atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope());
-  atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 8, T> device_atomic_exchange(T* const dest,
+                                                                      T value,
+                                                                      MemoryOrderSeqCst,
+                                                                      MemoryScope) {
+  device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
+  T return_val =
+      device_atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope());
+  device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
   return return_val;
 }
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_compare_exchange(
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4, T> device_atomic_compare_exchange(
     T* const dest, T compare, T value, MemoryOrderSeqCst, MemoryScope) {
-  atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
-  T return_val = atomic_compare_exchange(
+  device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
+  T return_val = device_atomic_compare_exchange(
       dest, compare, value, MemoryOrderRelaxed(), MemoryScope());
-  atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
+  device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
   return return_val;
 }
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 8, T>::type atomic_compare_exchange(
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 8, T> device_atomic_compare_exchange(
     T* const dest, T compare, T value, MemoryOrderSeqCst, MemoryScope) {
-  atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
-  T return_val = atomic_compare_exchange(
+  device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
+  T return_val = device_atomic_compare_exchange(
       dest, compare, value, MemoryOrderRelaxed(), MemoryScope());
-  atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
+  device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
   return return_val;
 }
-}  // namespace desul
-#endif
 
-#if defined(__CUDA_ARCH__) || !defined(__NVCC__)
-namespace desul {
-template <typename T, class MemoryOrder, class MemoryScope>
-__device__ typename std::enable_if<(sizeof(T) != 8) && (sizeof(T) != 4), T>::type
-atomic_compare_exchange(
+template <class T, class MemoryOrder, class MemoryScope>
+__device__ std::enable_if_t<(sizeof(T) != 8) && (sizeof(T) != 4), T>
+device_atomic_compare_exchange(
     T* const dest, T compare, T value, MemoryOrder, MemoryScope scope) {
-  // This is a way to avoid dead lock in a warp or wave front
+  // This is a way to avoid deadlock in a warp or wave front
   T return_val;
   int done = 0;
-  unsigned int mask = DESUL_IMPL_ACTIVEMASK;
-  unsigned int active = DESUL_IMPL_BALLOT_MASK(mask, 1);
+  unsigned int mask = __activemask();
+  unsigned int active = __ballot_sync(mask, 1);
   unsigned int done_active = 0;
   while (active != done_active) {
     if (!done) {
-      if (Impl::lock_address_cuda((void*)dest, scope)) {
+      if (lock_address_cuda((void*)dest, scope)) {
         if (std::is_same<MemoryOrder, MemoryOrderSeqCst>::value)
-          atomic_thread_fence(MemoryOrderRelease(), scope);
-        atomic_thread_fence(MemoryOrderAcquire(), scope);
+          device_atomic_thread_fence(MemoryOrderRelease(), scope);
+        device_atomic_thread_fence(MemoryOrderAcquire(), scope);
         return_val = *dest;
         if (return_val == compare) {
           *dest = value;
-          atomic_thread_fence(MemoryOrderRelease(), scope);
+          device_atomic_thread_fence(MemoryOrderRelease(), scope);
         }
-        Impl::unlock_address_cuda((void*)dest, scope);
+        unlock_address_cuda((void*)dest, scope);
         done = 1;
       }
     }
-    done_active = DESUL_IMPL_BALLOT_MASK(mask, done);
+    done_active = __ballot_sync(mask, done);
   }
   return return_val;
 }
-template <typename T, class MemoryOrder, class MemoryScope>
-__device__ typename std::enable_if<(sizeof(T) != 8) && (sizeof(T) != 4), T>::type
-atomic_exchange(T* const dest, T value, MemoryOrder, MemoryScope scope) {
-  // This is a way to avoid dead lock in a warp or wave front
+
+template <class T, class MemoryOrder, class MemoryScope>
+__device__ std::enable_if_t<(sizeof(T) != 8) && (sizeof(T) != 4), T>
+device_atomic_exchange(T* const dest, T value, MemoryOrder, MemoryScope scope) {
+  // This is a way to avoid deadlock in a warp or wave front
   T return_val;
   int done = 0;
-  unsigned int mask = DESUL_IMPL_ACTIVEMASK;
-  unsigned int active = DESUL_IMPL_BALLOT_MASK(mask, 1);
+  unsigned int mask = __activemask();
+  unsigned int active = __ballot_sync(mask, 1);
   unsigned int done_active = 0;
   while (active != done_active) {
     if (!done) {
-      if (Impl::lock_address_cuda((void*)dest, scope)) {
+      if (lock_address_cuda((void*)dest, scope)) {
         if (std::is_same<MemoryOrder, MemoryOrderSeqCst>::value)
-          atomic_thread_fence(MemoryOrderRelease(), scope);
-        atomic_thread_fence(MemoryOrderAcquire(), scope);
+          device_atomic_thread_fence(MemoryOrderRelease(), scope);
+        device_atomic_thread_fence(MemoryOrderAcquire(), scope);
         return_val = *dest;
         *dest = value;
-        atomic_thread_fence(MemoryOrderRelease(), scope);
-        Impl::unlock_address_cuda((void*)dest, scope);
+        device_atomic_thread_fence(MemoryOrderRelease(), scope);
+        unlock_address_cuda((void*)dest, scope);
         done = 1;
       }
     }
-    done_active = DESUL_IMPL_BALLOT_MASK(mask, done);
+    done_active = __ballot_sync(mask, done);
   }
   return return_val;
 }
+}  // namespace Impl
 }  // namespace desul
-#endif
 
 #endif
-#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_GCC.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_GCC.hpp
index fad3c43b046feb67ee05a3a86fe9986e349d5686..d8bac620bd95b44165865c759cb72535c30cc820 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_GCC.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_GCC.hpp
@@ -8,18 +8,17 @@ SPDX-License-Identifier: (BSD-3-Clause)
 
 #ifndef DESUL_ATOMICS_COMPARE_EXCHANGE_GCC_HPP_
 #define DESUL_ATOMICS_COMPARE_EXCHANGE_GCC_HPP_
-#include "desul/atomics/Common.hpp"
 
-#ifdef DESUL_HAVE_GCC_ATOMICS
-#if !defined(DESUL_HAVE_16BYTE_COMPARE_AND_SWAP) && !defined(__CUDACC__)
-// This doesn't work in WSL??
-//#define DESUL_HAVE_16BYTE_COMPARE_AND_SWAP
-#endif
-namespace desul {
+#include <desul/atomics/Common.hpp>
+#include <desul/atomics/Lock_Array.hpp>
+#include <desul/atomics/Thread_Fence_GCC.hpp>
+#include <type_traits>
 
+namespace desul {
 namespace Impl {
+
 template <class T>
-struct atomic_exchange_available_gcc {
+struct host_atomic_exchange_available_gcc {
   constexpr static bool value =
 #ifndef DESUL_HAVE_LIBATOMIC
       ((sizeof(T) == 4 && alignof(T) == 4) ||
@@ -30,35 +29,30 @@ struct atomic_exchange_available_gcc {
 #endif
       std::is_trivially_copyable<T>::value;
 };
-}  // namespace Impl
 
-#if defined(__clang__) && (__clang_major__ >= 7) && !defined(__APPLE__)
 // clang-format off
 // Disable warning for large atomics on clang 7 and up (checked with godbolt)
 // error: large atomic operation may incur significant performance penalty [-Werror,-Watomic-alignment]
 // https://godbolt.org/z/G7YhqhbG6
 // clang-format on
+#if defined(__clang__) && (__clang_major__ >= 7) && !defined(__APPLE__)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Watomic-alignment"
 #endif
-template <class MemoryOrder, class MemoryScope>
-void atomic_thread_fence(MemoryOrder, MemoryScope) {
-  __atomic_thread_fence(GCCMemoryOrder<MemoryOrder>::value);
-}
 
-template <typename T, class MemoryOrder, class MemoryScope>
-std::enable_if_t<Impl::atomic_exchange_available_gcc<T>::value, T> atomic_exchange(
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<host_atomic_exchange_available_gcc<T>::value, T> host_atomic_exchange(
     T* dest, T value, MemoryOrder, MemoryScope) {
   T return_val;
   __atomic_exchange(dest, &value, &return_val, GCCMemoryOrder<MemoryOrder>::value);
   return return_val;
 }
 
-// Failure mode for atomic_compare_exchange_n cannot be RELEASE nor ACQREL so
-// Those two get handled separatly.
-template <typename T, class MemoryOrder, class MemoryScope>
-std::enable_if_t<Impl::atomic_exchange_available_gcc<T>::value, T>
-atomic_compare_exchange(T* dest, T compare, T value, MemoryOrder, MemoryScope) {
+// Failure mode for host_atomic_compare_exchange_n cannot be RELEASE nor ACQREL so
+// Those two get handled separately.
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<host_atomic_exchange_available_gcc<T>::value, T>
+host_atomic_compare_exchange(T* dest, T compare, T value, MemoryOrder, MemoryScope) {
   (void)__atomic_compare_exchange(dest,
                                   &compare,
                                   &value,
@@ -68,25 +62,70 @@ atomic_compare_exchange(T* dest, T compare, T value, MemoryOrder, MemoryScope) {
   return compare;
 }
 
-template <typename T, class MemoryScope>
-std::enable_if_t<Impl::atomic_exchange_available_gcc<T>::value, T>
-atomic_compare_exchange(T* dest, T compare, T value, MemoryOrderRelease, MemoryScope) {
+template <class T, class MemoryScope>
+std::enable_if_t<host_atomic_exchange_available_gcc<T>::value, T>
+host_atomic_compare_exchange(
+    T* dest, T compare, T value, MemoryOrderRelease, MemoryScope) {
   (void)__atomic_compare_exchange(
       dest, &compare, &value, false, __ATOMIC_RELEASE, __ATOMIC_RELAXED);
   return compare;
 }
 
-template <typename T, class MemoryScope>
-std::enable_if_t<Impl::atomic_exchange_available_gcc<T>::value, T>
-atomic_compare_exchange(T* dest, T compare, T value, MemoryOrderAcqRel, MemoryScope) {
+template <class T, class MemoryScope>
+std::enable_if_t<host_atomic_exchange_available_gcc<T>::value, T>
+host_atomic_compare_exchange(
+    T* dest, T compare, T value, MemoryOrderAcqRel, MemoryScope) {
   (void)__atomic_compare_exchange(
       dest, &compare, &value, false, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE);
   return compare;
 }
 
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<!host_atomic_exchange_available_gcc<T>::value, T> host_atomic_exchange(
+    T* const dest,
+    dont_deduce_this_parameter_t<const T> val,
+    MemoryOrder /*order*/,
+    MemoryScope scope) {
+  // Acquire a lock for the address
+  // clang-format off
+  while (!lock_address((void*)dest, scope)) {}
+  // clang-format on
+
+  host_atomic_thread_fence(MemoryOrderAcquire(), scope);
+  T return_val = *dest;
+  *dest = val;
+  host_atomic_thread_fence(MemoryOrderRelease(), scope);
+  unlock_address((void*)dest, scope);
+  return return_val;
+}
+
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<!host_atomic_exchange_available_gcc<T>::value, T>
+host_atomic_compare_exchange(T* const dest,
+                             dont_deduce_this_parameter_t<const T> compare,
+                             dont_deduce_this_parameter_t<const T> val,
+                             MemoryOrder /*order*/,
+                             MemoryScope scope) {
+  // Acquire a lock for the address
+  // clang-format off
+  while (!lock_address((void*)dest, scope)) {}
+  // clang-format on
+
+  host_atomic_thread_fence(MemoryOrderAcquire(), scope);
+  T return_val = *dest;
+  if (return_val == compare) {
+    *dest = val;
+    host_atomic_thread_fence(MemoryOrderRelease(), scope);
+  }
+  unlock_address((void*)dest, scope);
+  return return_val;
+}
+
 #if defined(__clang__) && (__clang_major__ >= 7) && !defined(__APPLE__)
 #pragma GCC diagnostic pop
 #endif
+
+}  // namespace Impl
 }  // namespace desul
-#endif
+
 #endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_HIP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_HIP.hpp
index 96739bc1fc705d04d7df05a5ddd91b72069de508..8c909bacdf41d10bc3d342ef740f339c107e132e 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_HIP.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_HIP.hpp
@@ -8,50 +8,17 @@ SPDX-License-Identifier: (BSD-3-Clause)
 
 #ifndef DESUL_ATOMICS_COMPARE_EXCHANGE_HIP_HPP_
 #define DESUL_ATOMICS_COMPARE_EXCHANGE_HIP_HPP_
-#include "desul/atomics/Common.hpp"
-#include "desul/atomics/Lock_Array_HIP.hpp"
 
-#ifdef DESUL_HAVE_HIP_ATOMICS
+#include <desul/atomics/Common.hpp>
+#include <desul/atomics/Lock_Array_HIP.hpp>
+#include <desul/atomics/Thread_Fence_HIP.hpp>
+#include <type_traits>
+
 namespace desul {
-inline __device__ void atomic_thread_fence(MemoryOrderRelease, MemoryScopeDevice) {
-  __threadfence();
-}
-inline __device__ void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeDevice) {
-  __threadfence();
-}
-inline __device__ void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeDevice) {
-  __threadfence();
-}
-inline __device__ void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeDevice) {
-  __threadfence();
-}
-inline __device__ void atomic_thread_fence(MemoryOrderRelease, MemoryScopeCore) {
-  __threadfence_block();
-}
-inline __device__ void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeCore) {
-  __threadfence_block();
-}
-inline __device__ void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeCore) {
-  __threadfence_block();
-}
-inline __device__ void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeCore) {
-  __threadfence_block();
-}
-inline __device__ void atomic_thread_fence(MemoryOrderRelease, MemoryScopeNode) {
-  __threadfence_system();
-}
-inline __device__ void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeNode) {
-  __threadfence_system();
-}
-inline __device__ void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeNode) {
-  __threadfence_system();
-}
-inline __device__ void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeNode) {
-  __threadfence_system();
-}
+namespace Impl {
 
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_compare_exchange(
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4, T> device_atomic_compare_exchange(
     T* const dest, T compare, T value, MemoryOrderRelaxed, MemoryScope) {
   static_assert(sizeof(unsigned int) == 4,
                 "this function assumes an unsigned int is 32-bit");
@@ -60,11 +27,11 @@ __device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_compare_excha
                                       reinterpret_cast<unsigned int&>(value));
   return reinterpret_cast<T&>(return_val);
 }
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 8, T>::type atomic_compare_exchange(
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 8, T> device_atomic_compare_exchange(
     T* const dest, T compare, T value, MemoryOrderRelaxed, MemoryScope) {
   static_assert(sizeof(unsigned long long int) == 8,
-                "this function assumes an unsigned long long  is 64-bit");
+                "this function assumes an unsigned long long is 64-bit");
   unsigned long long int return_val =
       atomicCAS(reinterpret_cast<unsigned long long int*>(dest),
                 reinterpret_cast<unsigned long long int&>(compare),
@@ -72,9 +39,9 @@ __device__ typename std::enable_if<sizeof(T) == 8, T>::type atomic_compare_excha
   return reinterpret_cast<T&>(return_val);
 }
 
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type
-atomic_compare_exchange(
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T>
+device_atomic_compare_exchange(
     T* const dest, T compare, T value, MemoryOrderRelease, MemoryScope) {
   T return_val = atomic_compare_exchange(
       dest, compare, value, MemoryOrderRelaxed(), MemoryScope());
@@ -82,9 +49,9 @@ atomic_compare_exchange(
   return return_val;
 }
 
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type
-atomic_compare_exchange(
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T>
+device_atomic_compare_exchange(
     T* const dest, T compare, T value, MemoryOrderAcquire, MemoryScope) {
   atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
   T return_val = atomic_compare_exchange(
@@ -92,9 +59,9 @@ atomic_compare_exchange(
   return return_val;
 }
 
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type
-atomic_compare_exchange(
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T>
+device_atomic_compare_exchange(
     T* const dest, T compare, T value, MemoryOrderAcqRel, MemoryScope) {
   atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
   T return_val = atomic_compare_exchange(
@@ -103,8 +70,8 @@ atomic_compare_exchange(
   return return_val;
 }
 
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_exchange(
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4, T> device_atomic_exchange(
     T* const dest, T value, MemoryOrderRelaxed, MemoryScope) {
   static_assert(sizeof(unsigned int) == 4,
                 "this function assumes an unsigned int is 32-bit");
@@ -112,118 +79,122 @@ __device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_exchange(
                                        reinterpret_cast<unsigned int&>(value));
   return reinterpret_cast<T&>(return_val);
 }
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 8, T>::type atomic_exchange(
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 8, T> device_atomic_exchange(
     T* const dest, T value, MemoryOrderRelaxed, MemoryScope) {
   static_assert(sizeof(unsigned long long int) == 8,
-                "this function assumes an unsigned long long  is 64-bit");
+                "this function assumes an unsigned long long is 64-bit");
   unsigned long long int return_val =
       atomicExch(reinterpret_cast<unsigned long long int*>(dest),
                  reinterpret_cast<unsigned long long int&>(value));
   return reinterpret_cast<T&>(return_val);
 }
 
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type
-atomic_exchange(T* const dest, T compare, T value, MemoryOrderRelease, MemoryScope) {
-  T return_val = atomic_compare_exchange(
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> device_atomic_exchange(
+    T* const dest, T compare, T value, MemoryOrderRelease, MemoryScope) {
+  T return_val = device_atomic_compare_exchange(
       dest, compare, value, MemoryOrderRelaxed(), MemoryScope());
-  atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
+  device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
   return reinterpret_cast<T&>(return_val);
 }
 
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type
-atomic_exchange(
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> device_atomic_exchange(
     T* const dest, T /*compare*/, T value, MemoryOrderAcquire, MemoryScope) {
-  atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
-  T return_val = atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope());
+  device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
+  T return_val =
+      device_atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope());
   return reinterpret_cast<T&>(return_val);
 }
 
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type
-atomic_exchange(T* const dest, T value, MemoryOrderAcqRel, MemoryScope) {
-  atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
-  T return_val = atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope());
-  atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> device_atomic_exchange(
+    T* const dest, T value, MemoryOrderAcqRel, MemoryScope) {
+  device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
+  T return_val =
+      device_atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope());
+  device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
   return reinterpret_cast<T&>(return_val);
 }
 
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type
-atomic_exchange(T* const dest, T value, MemoryOrderSeqCst, MemoryScope) {
-  atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
-  T return_val = atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope());
-  atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> device_atomic_exchange(
+    T* const dest, T value, MemoryOrderSeqCst, MemoryScope) {
+  device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
+  T return_val =
+      device_atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope());
+  device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
   return reinterpret_cast<T&>(return_val);
 }
 
-template <typename T, class MemoryScope>
-__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type
-atomic_compare_exchange(
+template <class T, class MemoryScope>
+__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T>
+device_atomic_compare_exchange(
     T* const dest, T compare, T value, MemoryOrderSeqCst, MemoryScope) {
-  atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
-  T return_val = atomic_compare_exchange(
+  device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
+  T return_val = device_atomic_compare_exchange(
       dest, compare, value, MemoryOrderRelaxed(), MemoryScope());
-  atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
+  device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
   return return_val;
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
-__device__ typename std::enable_if<(sizeof(T) != 8) && (sizeof(T) != 4), T>::type
-atomic_compare_exchange(
+template <class T, class MemoryOrder, class MemoryScope>
+__device__ std::enable_if_t<(sizeof(T) != 8) && (sizeof(T) != 4), T>
+device_atomic_compare_exchange(
     T* const dest, T compare, T value, MemoryOrder, MemoryScope scope) {
-  // This is a way to avoid dead lock in a warp or wave front
+  // This is a way to avoid deadlock in a warp or wave front
   T return_val;
   int done = 0;
-  unsigned long long int active = DESUL_IMPL_BALLOT_MASK(1);
+  unsigned long long int active = __ballot(1);
   unsigned long long int done_active = 0;
   while (active != done_active) {
     if (!done) {
-      if (Impl::lock_address_hip((void*)dest, scope)) {
+      if (lock_address_hip((void*)dest, scope)) {
         if (std::is_same<MemoryOrder, MemoryOrderSeqCst>::value)
           atomic_thread_fence(MemoryOrderRelease(), scope);
         atomic_thread_fence(MemoryOrderAcquire(), scope);
         return_val = *dest;
         if (return_val == compare) {
           *dest = value;
-          atomic_thread_fence(MemoryOrderRelease(), scope);
+          device_atomic_thread_fence(MemoryOrderRelease(), scope);
         }
-        Impl::unlock_address_hip((void*)dest, scope);
+        unlock_address_hip((void*)dest, scope);
         done = 1;
       }
     }
-    done_active = DESUL_IMPL_BALLOT_MASK(done);
+    done_active = __ballot(done);
   }
   return return_val;
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
-__device__ typename std::enable_if<(sizeof(T) != 8) && (sizeof(T) != 4), T>::type
-atomic_exchange(T* const dest, T value, MemoryOrder, MemoryScope scope) {
-  // This is a way to avoid dead lock in a warp or wave front
+template <class T, class MemoryOrder, class MemoryScope>
+__device__ std::enable_if_t<(sizeof(T) != 8) && (sizeof(T) != 4), T>
+device_atomic_exchange(T* const dest, T value, MemoryOrder, MemoryScope scope) {
+  // This is a way to avoid deadlock in a warp or wave front
   T return_val;
   int done = 0;
-  unsigned long long int active = DESUL_IMPL_BALLOT_MASK(1);
+  unsigned long long int active = __ballot(1);
   unsigned long long int done_active = 0;
   while (active != done_active) {
     if (!done) {
-      if (Impl::lock_address_hip((void*)dest, scope)) {
+      if (lock_address_hip((void*)dest, scope)) {
         if (std::is_same<MemoryOrder, MemoryOrderSeqCst>::value)
           atomic_thread_fence(MemoryOrderRelease(), scope);
-        atomic_thread_fence(MemoryOrderAcquire(), scope);
+        device_atomic_thread_fence(MemoryOrderAcquire(), scope);
         return_val = *dest;
         *dest = value;
-        atomic_thread_fence(MemoryOrderRelease(), scope);
-        Impl::unlock_address_hip((void*)dest, scope);
+        device_atomic_thread_fence(MemoryOrderRelease(), scope);
+        unlock_address_hip((void*)dest, scope);
         done = 1;
       }
     }
-    done_active = DESUL_IMPL_BALLOT_MASK(done);
+    done_active = __ballot(done);
   }
   return return_val;
 }
+
+}  // namespace Impl
 }  // namespace desul
-#endif
+
 #endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_MSVC.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_MSVC.hpp
index edf72f13db8d2ea80af5cb35b64230e362290372..12a70735e84afa6d5a5fd89d10c68f2e7daae2ab 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_MSVC.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_MSVC.hpp
@@ -8,157 +8,120 @@ SPDX-License-Identifier: (BSD-3-Clause)
 
 #ifndef DESUL_ATOMICS_COMPARE_EXCHANGE_MSVC_HPP_
 #define DESUL_ATOMICS_COMPARE_EXCHANGE_MSVC_HPP_
-#include <type_traits>
 
-#include "desul/atomics/Common.hpp"
-#ifdef DESUL_HAVE_MSVC_ATOMICS
+#include <desul/atomics/Common.hpp>
+#include <desul/atomics/Thread_Fence_MSVC.hpp>
+#include <type_traits>
 
 #ifndef DESUL_HAVE_16BYTE_COMPARE_AND_SWAP
 #define DESUL_HAVE_16BYTE_COMPARE_AND_SWAP
 #endif
 
 namespace desul {
+namespace Impl {
 
 // Forward declare these functions. They use compare_exchange themselves
 // so the actual header file with them comes after this file is included.
-namespace Impl {
-template <typename MemoryScope>
-inline bool lock_address(void* ptr, MemoryScope ms);
+template <class MemoryScope>
+bool lock_address(void* ptr, MemoryScope ms);
 
-template <typename MemoryScope>
+template <class MemoryScope>
 void unlock_address(void* ptr, MemoryScope ms);
-}  // namespace Impl
-
-template <class MemoryOrder, class MemoryScope>
-void atomic_thread_fence(MemoryOrder, MemoryScope) {
-  std::atomic_thread_fence(CXXMemoryOrder<MemoryOrder>::value);
-}
-
-template <typename T, class MemoryScope>
-typename std::enable_if<sizeof(T) == 1, T>::type atomic_exchange(T* const dest,
-                                                                 T val,
-                                                                 MemoryOrderRelaxed,
-                                                                 MemoryScope) {
-  char return_val = _InterlockedExchange8((char*)dest, *((char*)&val));
-  return *(reinterpret_cast<T*>(&return_val));
-}
-
-template <typename T, class MemoryScope>
-typename std::enable_if<sizeof(T) == 2, T>::type atomic_exchange(T* const dest,
-                                                                 T val,
-                                                                 MemoryOrderRelaxed,
-                                                                 MemoryScope) {
-  short return_val = _InterlockedExchange16((short*)dest, *((short*)&val));
-  return *(reinterpret_cast<T*>(&return_val));
-}
 
-template <typename T, class MemoryScope>
-typename std::enable_if<sizeof(T) == 4, T>::type atomic_exchange(T* const dest,
-                                                                 T val,
-                                                                 MemoryOrderRelaxed,
-                                                                 MemoryScope) {
-  long return_val = _InterlockedExchange((long*)dest, *((long*)&val));
-  return *(reinterpret_cast<T*>(&return_val));
-}
+}  // namespace Impl
+}  // namespace desul
 
-template <typename T, class MemoryScope>
-typename std::enable_if<sizeof(T) == 8, T>::type atomic_exchange(T* const dest,
-                                                                 T val,
-                                                                 MemoryOrderRelaxed,
-                                                                 MemoryScope) {
-  __int64 return_val = _InterlockedExchange64((__int64*)dest, *((__int64*)&val));
-  return *(reinterpret_cast<T*>(&return_val));
-}
+namespace desul {
+namespace Impl {
 
-template <typename T, class MemoryScope>
-typename std::enable_if<sizeof(T) == 1, T>::type atomic_exchange(T* const dest,
-                                                                 T val,
-                                                                 MemoryOrderSeqCst,
-                                                                 MemoryScope) {
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<sizeof(T) == 1, T> host_atomic_exchange(T* const dest,
+                                                         T val,
+                                                         MemoryOrder,
+                                                         MemoryScope) {
   char return_val = _InterlockedExchange8((char*)dest, *((char*)&val));
   return *(reinterpret_cast<T*>(&return_val));
 }
 
-template <typename T, class MemoryScope>
-typename std::enable_if<sizeof(T) == 2, T>::type atomic_exchange(T* const dest,
-                                                                 T val,
-                                                                 MemoryOrderSeqCst,
-                                                                 MemoryScope) {
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<sizeof(T) == 2, T> host_atomic_exchange(T* const dest,
+                                                         T val,
+                                                         MemoryOrder,
+                                                         MemoryScope) {
   short return_val = _InterlockedExchange16((short*)dest, *((short*)&val));
   return *(reinterpret_cast<T*>(&return_val));
 }
 
-template <typename T, class MemoryScope>
-typename std::enable_if<sizeof(T) == 4, T>::type atomic_exchange(T* const dest,
-                                                                 T val,
-                                                                 MemoryOrderSeqCst,
-                                                                 MemoryScope) {
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<sizeof(T) == 4, T> host_atomic_exchange(T* const dest,
+                                                         T val,
+                                                         MemoryOrder,
+                                                         MemoryScope) {
   long return_val = _InterlockedExchange((long*)dest, *((long*)&val));
   return *(reinterpret_cast<T*>(&return_val));
 }
 
-template <typename T, class MemoryScope>
-typename std::enable_if<sizeof(T) == 8, T>::type atomic_exchange(T* const dest,
-                                                                 T val,
-                                                                 MemoryOrderSeqCst,
-                                                                 MemoryScope) {
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<sizeof(T) == 8, T> host_atomic_exchange(T* const dest,
+                                                         T val,
+                                                         MemoryOrder,
+                                                         MemoryScope) {
   __int64 return_val = _InterlockedExchange64((__int64*)dest, *((__int64*)&val));
   return *(reinterpret_cast<T*>(&return_val));
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
-typename std::enable_if<(sizeof(T) != 1 && sizeof(T) != 2 && sizeof(T) != 4 &&
-                         sizeof(T) != 8),
-                        T>::type
-atomic_exchange(T* const dest, T val, MemoryOrder, MemoryScope scope) {
-  while (!Impl::lock_address((void*)dest, scope)) {
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<(sizeof(T) != 1 && sizeof(T) != 2 && sizeof(T) != 4 && sizeof(T) != 8),
+                 T>
+host_atomic_exchange(T* const dest, T val, MemoryOrder, MemoryScope scope) {
+  while (!lock_address((void*)dest, scope)) {
   }
   if (std::is_same<MemoryOrder, MemoryOrderSeqCst>::value)
-    atomic_thread_fence(MemoryOrderRelease(), scope);
-  atomic_thread_fence(MemoryOrderAcquire(), scope);
+    host_atomic_thread_fence(MemoryOrderRelease(), scope);
+  host_atomic_thread_fence(MemoryOrderAcquire(), scope);
   T return_val = *dest;
   *dest = val;
-  atomic_thread_fence(MemoryOrderRelease(), scope);
+  host_atomic_thread_fence(MemoryOrderRelease(), scope);
 
-  Impl::unlock_address((void*)dest, scope);
+  unlock_address((void*)dest, scope);
   return return_val;
 }
 
-template <typename T, class MemoryScope>
-typename std::enable_if<sizeof(T) == 1, T>::type atomic_compare_exchange(
-    T* const dest, T compare, T val, MemoryOrderRelaxed, MemoryScope) {
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<sizeof(T) == 1, T> host_atomic_compare_exchange(
+    T* const dest, T compare, T val, MemoryOrder, MemoryScope) {
   char return_val =
       _InterlockedCompareExchange8((char*)dest, *((char*)&val), *((char*)&compare));
   return *(reinterpret_cast<T*>(&return_val));
 }
 
-template <typename T, class MemoryScope>
-typename std::enable_if<sizeof(T) == 2, T>::type atomic_compare_exchange(
-    T* const dest, T compare, T val, MemoryOrderRelaxed, MemoryScope) {
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<sizeof(T) == 2, T> host_atomic_compare_exchange(
+    T* const dest, T compare, T val, MemoryOrder, MemoryScope) {
   short return_val =
       _InterlockedCompareExchange16((short*)dest, *((short*)&val), *((short*)&compare));
   return *(reinterpret_cast<T*>(&return_val));
 }
 
-template <typename T, class MemoryScope>
-typename std::enable_if<sizeof(T) == 4, T>::type atomic_compare_exchange(
-    T* const dest, T compare, T val, MemoryOrderRelaxed, MemoryScope) {
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<sizeof(T) == 4, T> host_atomic_compare_exchange(
+    T* const dest, T compare, T val, MemoryOrder, MemoryScope) {
   long return_val =
       _InterlockedCompareExchange((long*)dest, *((long*)&val), *((long*)&compare));
   return *(reinterpret_cast<T*>(&return_val));
 }
 
-template <typename T, class MemoryScope>
-typename std::enable_if<sizeof(T) == 8, T>::type atomic_compare_exchange(
-    T* const dest, T compare, T val, MemoryOrderRelaxed, MemoryScope) {
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<sizeof(T) == 8, T> host_atomic_compare_exchange(
+    T* const dest, T compare, T val, MemoryOrder, MemoryScope) {
   __int64 return_val = _InterlockedCompareExchange64(
       (__int64*)dest, *((__int64*)&val), *((__int64*)&compare));
   return *(reinterpret_cast<T*>(&return_val));
 }
 
-template <typename T, class MemoryScope>
-typename std::enable_if<sizeof(T) == 16, T>::type atomic_compare_exchange(
-    T* const dest, T compare, T val, MemoryOrderRelaxed, MemoryScope) {
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<sizeof(T) == 16, T> host_atomic_compare_exchange(
+    T* const dest, T compare, T val, MemoryOrder, MemoryScope) {
   Dummy16ByteValue* val16 = reinterpret_cast<Dummy16ByteValue*>(&val);
   (void)_InterlockedCompareExchange128(reinterpret_cast<__int64*>(dest),
                                        val16->value2,
@@ -167,71 +130,28 @@ typename std::enable_if<sizeof(T) == 16, T>::type atomic_compare_exchange(
   return compare;
 }
 
-template <typename T, class MemoryScope>
-typename std::enable_if<sizeof(T) == 1, T>::type atomic_compare_exchange(
-    T* const dest, T compare, T val, MemoryOrderSeqCst, MemoryScope) {
-  char return_val =
-      _InterlockedCompareExchange8((char*)dest, *((char*)&val), *((char*)&compare));
-  return *(reinterpret_cast<T*>(&return_val));
-}
-
-template <typename T, class MemoryScope>
-typename std::enable_if<sizeof(T) == 2, T>::type atomic_compare_exchange(
-    T* const dest, T compare, T val, MemoryOrderSeqCst, MemoryScope) {
-  short return_val =
-      _InterlockedCompareExchange16((short*)dest, *((short*)&val), *((short*)&compare));
-  return *(reinterpret_cast<T*>(&return_val));
-}
-
-template <typename T, class MemoryScope>
-typename std::enable_if<sizeof(T) == 4, T>::type atomic_compare_exchange(
-    T* const dest, T compare, T val, MemoryOrderSeqCst, MemoryScope) {
-  long return_val =
-      _InterlockedCompareExchange((long*)dest, *((long*)&val), *((long*)&compare));
-  return *(reinterpret_cast<T*>(&return_val));
-}
-
-template <typename T, class MemoryScope>
-typename std::enable_if<sizeof(T) == 8, T>::type atomic_compare_exchange(
-    T* const dest, T compare, T val, MemoryOrderSeqCst, MemoryScope) {
-  __int64 return_val = _InterlockedCompareExchange64(
-      (__int64*)dest, *((__int64*)&val), *((__int64*)&compare));
-  return *(reinterpret_cast<T*>(&return_val));
-}
-
-template <typename T, class MemoryScope>
-typename std::enable_if<sizeof(T) == 16, T>::type atomic_compare_exchange(
-    T* const dest, T compare, T val, MemoryOrderSeqCst, MemoryScope) {
-  Dummy16ByteValue* val16 = reinterpret_cast<Dummy16ByteValue*>(&val);
-  (void)_InterlockedCompareExchange128(reinterpret_cast<__int64*>(dest),
-                                       val16->value2,
-                                       val16->value1,
-                                       (reinterpret_cast<__int64*>(&compare)));
-  return compare;
-}
-
-template <typename T, class MemoryOrder, class MemoryScope>
-typename std::enable_if<(sizeof(T) != 1 && sizeof(T) != 2 && sizeof(T) != 4 &&
-                         sizeof(T) != 8 && sizeof(T) != 16),
-                        T>::type
-atomic_compare_exchange(
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<(sizeof(T) != 1 && sizeof(T) != 2 && sizeof(T) != 4 &&
+                  sizeof(T) != 8 && sizeof(T) != 16),
+                 T>
+host_atomic_compare_exchange(
     T* const dest, T compare, T val, MemoryOrder, MemoryScope scope) {
-  while (!Impl::lock_address((void*)dest, scope)) {
+  while (!lock_address((void*)dest, scope)) {
   }
   if (std::is_same<MemoryOrder, MemoryOrderSeqCst>::value)
-    atomic_thread_fence(MemoryOrderRelease(), scope);
-  atomic_thread_fence(MemoryOrderAcquire(), scope);
+    host_atomic_thread_fence(MemoryOrderRelease(), scope);
+  host_atomic_thread_fence(MemoryOrderAcquire(), scope);
   T return_val = *dest;
   if (return_val == compare) {
     *dest = val;
-    atomic_thread_fence(MemoryOrderRelease(), scope);
+    host_atomic_thread_fence(MemoryOrderRelease(), scope);
   }
 
-  Impl::unlock_address((void*)dest, scope);
+  unlock_address((void*)dest, scope);
   return return_val;
 }
 
+}  // namespace Impl
 }  // namespace desul
 
 #endif
-#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_OpenMP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_OpenMP.hpp
index dfea81a4d6cb507f0d13d8972ab757b9853ddeea..115740d4c54b8c846d168ed5458337b5ff191cd3 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_OpenMP.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_OpenMP.hpp
@@ -5,115 +5,82 @@ Source: https://github.com/desul/desul
 
 SPDX-License-Identifier: (BSD-3-Clause)
 */
+
 #ifndef DESUL_ATOMICS_COMPARE_EXCHANGE_OPENMP_HPP_
 #define DESUL_ATOMICS_COMPARE_EXCHANGE_OPENMP_HPP_
+
 #include <omp.h>
 
-#include "desul/atomics/Common.hpp"
+#include <desul/atomics/Adapt_GCC.hpp>
+#include <desul/atomics/Common.hpp>
+#include <desul/atomics/Thread_Fence_OpenMP.hpp>
 
-#ifdef DESUL_HAVE_OPENMP_ATOMICS
 namespace desul {
+namespace Impl {
 
-#if _OPENMP > 201800
-// atomic_thread_fence for Core Scope
-inline void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeCore) {
-// There is no seq_cst flush in OpenMP, isn't it the same anyway for fence?
-#pragma omp flush acq_rel
-}
-inline void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeCore) {
-#pragma omp flush acq_rel
-}
-inline void atomic_thread_fence(MemoryOrderRelease, MemoryScopeCore) {
-#pragma omp flush release
-}
-inline void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeCore) {
-#pragma omp flush acquire
-}
-// atomic_thread_fence for Device Scope
-inline void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeDevice) {
-// There is no seq_cst flush in OpenMP, isn't it the same anyway for fence?
-#pragma omp flush acq_rel
-}
-inline void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeDevice) {
-#pragma omp flush acq_rel
-}
-inline void atomic_thread_fence(MemoryOrderRelease, MemoryScopeDevice) {
-#pragma omp flush release
-}
-inline void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeDevice) {
-#pragma omp flush acquire
-}
-#else
-// atomic_thread_fence for Core Scope
-inline void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeCore) {
-#pragma omp flush
-}
-inline void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeCore) {
-#pragma omp flush
-}
-inline void atomic_thread_fence(MemoryOrderRelease, MemoryScopeCore) {
-#pragma omp flush
-}
-inline void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeCore) {
-#pragma omp flush
-}
-// atomic_thread_fence for Device Scope
-inline void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeDevice) {
-#pragma omp flush
-}
-inline void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeDevice) {
-#pragma omp flush
-}
-inline void atomic_thread_fence(MemoryOrderRelease, MemoryScopeDevice) {
-#pragma omp flush
-}
-inline void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeDevice) {
-#pragma omp flush
-}
-#endif
-
-template <typename T, class MemoryOrder, class MemoryScope>
-T atomic_exchange(T* dest, T value, MemoryOrder, MemoryScope) {
+template <class T, class MemoryOrder, class MemoryScope>
+T host_atomic_exchange(T* dest, T value, MemoryOrder, MemoryScope) {
   T return_val;
-  if (!std::is_same<MemoryOrder, MemoryOrderRelaxed>::value)
+  if (!std::is_same<MemoryOrder, MemoryOrderRelaxed>::value) {
     atomic_thread_fence(MemoryOrderAcquire(), MemoryScope());
+  }
   T& x = *dest;
 #pragma omp atomic capture
   {
     return_val = x;
     x = value;
   }
-  if (!std::is_same<MemoryOrder, MemoryOrderRelaxed>::value)
+  if (!std::is_same<MemoryOrder, MemoryOrderRelaxed>::value) {
     atomic_thread_fence(MemoryOrderRelease(), MemoryScope());
+  }
   return return_val;
 }
 
-// OpenMP doesn't have compare exchange, so we use build-ins and rely on testing that
-// this works Note that means we test this in OpenMPTarget offload regions!
-template <typename T, class MemoryOrder, class MemoryScope>
-std::enable_if_t<Impl::atomic_always_lock_free(sizeof(T)), T> atomic_compare_exchange(
+// OpenMP doesn't have compare exchange, so we use built-in functions and rely on
+// testing that this works Note that means we test this in OpenMPTarget offload regions!
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<atomic_always_lock_free(sizeof(T)), T> host_atomic_compare_exchange(
     T* dest, T compare, T value, MemoryOrder, MemoryScope) {
-  using cas_t = typename Impl::atomic_compare_exchange_type<sizeof(T)>::type;
+  using cas_t = atomic_compare_exchange_t<T>;
   cas_t retval = __sync_val_compare_and_swap(reinterpret_cast<volatile cas_t*>(dest),
                                              reinterpret_cast<cas_t&>(compare),
                                              reinterpret_cast<cas_t&>(value));
   return reinterpret_cast<T&>(retval);
 }
 
-#if defined(__clang__) && (__clang_major__ >= 7)
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<!atomic_always_lock_free(sizeof(T)), T>  // FIXME_OPENMP
+host_atomic_compare_exchange(T* dest, T compare, T value, MemoryOrder, MemoryScope) {
+#if 0
+  (void)__atomic_compare_exchange(dest,
+                                  &compare,
+                                  &value,
+                                  false,
+                                  GCCMemoryOrder<MemoryOrder>::value,
+                                  GCCMemoryOrder<MemoryOrder>::value);
+#else
+  (void)dest;
+  (void)value;
+#endif
+  return compare;
+}
+
+#if 0  // FIXME_OPENMP
+
 // Disable warning for large atomics on clang 7 and up (checked with godbolt)
 // clang-format off
 // error: large atomic operation may incur significant performance penalty [-Werror,-Watomic-alignment]
 // clang-format on
+#if defined(__clang__) && (__clang_major__ >= 7)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Watomic-alignment"
 #endif
 
 // Make 16 byte cas work on host at least
 #pragma omp begin declare variant match(device = {kind(host)})
-template <typename T, class MemoryOrder, class MemoryScope>
-std::enable_if_t<!Impl::atomic_always_lock_free(sizeof(T)) && (sizeof(T) == 16), T>
-atomic_compare_exchange(T* dest, T compare, T value, MemoryOrder, MemoryScope) {
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<!atomic_always_lock_free(sizeof(T)) && (sizeof(T) == 16), T>
+host_atomic_compare_exchange(T* dest, T compare, T value, MemoryOrder, MemoryScope) {
   (void)__atomic_compare_exchange(dest,
                                   &compare,
                                   &value,
@@ -125,10 +92,11 @@ atomic_compare_exchange(T* dest, T compare, T value, MemoryOrder, MemoryScope) {
 #pragma omp end declare variant
 
 #pragma omp begin declare variant match(device = {kind(nohost)})
-template <typename T, class MemoryOrder, class MemoryScope>
-std::enable_if_t<!Impl::atomic_always_lock_free(sizeof(T)) && (sizeof(T) == 16), T>
-atomic_compare_exchange(T* /*dest*/, T /*compare*/, T value, MemoryOrder, MemoryScope) {
-  // FIXME make sure this never gets called
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<!atomic_always_lock_free(sizeof(T)) && (sizeof(T) == 16), T>
+device_atomic_compare_exchange(
+    T* /*dest*/, T /*compare*/, T value, MemoryOrder, MemoryScope) {
+  // FIXME_OPENMP make sure this never gets called
   return value;
 }
 #pragma omp end declare variant
@@ -137,6 +105,9 @@ atomic_compare_exchange(T* /*dest*/, T /*compare*/, T value, MemoryOrder, Memory
 #pragma GCC diagnostic pop
 #endif
 
-}  // namespace desul
 #endif
+
+}  // namespace Impl
+}  // namespace desul
+
 #endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_SYCL.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_SYCL.hpp
index 6c8c68511001962e4d3a56ab425ee982560971a5..34e36bc4e4bfc5720061bbc024cd7b480cb4a6bf 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_SYCL.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_SYCL.hpp
@@ -9,91 +9,88 @@ SPDX-License-Identifier: (BSD-3-Clause)
 #ifndef DESUL_ATOMICS_COMPARE_EXCHANGE_SYCL_HPP_
 #define DESUL_ATOMICS_COMPARE_EXCHANGE_SYCL_HPP_
 
-// clang-format off
-#include "desul/atomics/SYCLConversions.hpp"
-#include "desul/atomics/Common.hpp"
+#include <desul/atomics/Adapt_SYCL.hpp>
+#include <desul/atomics/Common.hpp>
+#include <desul/atomics/Thread_Fence_SYCL.hpp>
 
+// FIXME_SYCL SYCL2020 dictates that <sycl/sycl.hpp> is the header to include
+// but icpx 2022.1.0 and earlier versions only provide <CL/sycl.hpp>
+#if __has_include(<sycl/sycl.hpp>)
+#include <sycl/sycl.hpp>
+#else
 #include <CL/sycl.hpp>
-// clang-format on
-
-#ifdef DESUL_HAVE_SYCL_ATOMICS
+#endif
 
 namespace desul {
+namespace Impl {
 
-template <class MemoryOrder, class MemoryScope>
-inline void atomic_thread_fence(MemoryOrder, MemoryScope) {
-  sycl::atomic_fence(
-      Impl::DesulToSYCLMemoryOrder<MemoryOrder, /*extended namespace*/ false>::value,
-      Impl::DesulToSYCLMemoryScope<MemoryScope, /*extended namespace*/ false>::value);
-}
-
-template <typename T, class MemoryOrder, class MemoryScope>
-typename std::enable_if<sizeof(T) == 4, T>::type atomic_compare_exchange(
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<sizeof(T) == 4, T> device_atomic_compare_exchange(
     T* const dest, T compare, T value, MemoryOrder, MemoryScope) {
   static_assert(sizeof(unsigned int) == 4,
                 "this function assumes an unsigned int is 32-bit");
-  Impl::sycl_atomic_ref<unsigned int, MemoryOrder, MemoryScope> dest_ref(
+  sycl_atomic_ref<unsigned int, MemoryOrder, MemoryScope> dest_ref(
       *reinterpret_cast<unsigned int*>(dest));
   dest_ref.compare_exchange_strong(*reinterpret_cast<unsigned int*>(&compare),
                                    *reinterpret_cast<unsigned int*>(&value));
   return compare;
 }
-template <typename T, class MemoryOrder, class MemoryScope>
-typename std::enable_if<sizeof(T) == 8, T>::type atomic_compare_exchange(
+
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<sizeof(T) == 8, T> device_atomic_compare_exchange(
     T* const dest, T compare, T value, MemoryOrder, MemoryScope) {
   static_assert(sizeof(unsigned long long int) == 8,
                 "this function assumes an unsigned long long is 64-bit");
-  Impl::sycl_atomic_ref<unsigned long long int, MemoryOrder, MemoryScope> dest_ref(
+  sycl_atomic_ref<unsigned long long int, MemoryOrder, MemoryScope> dest_ref(
       *reinterpret_cast<unsigned long long int*>(dest));
   dest_ref.compare_exchange_strong(*reinterpret_cast<unsigned long long int*>(&compare),
                                    *reinterpret_cast<unsigned long long int*>(&value));
   return compare;
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
-typename std::enable_if<sizeof(T) == 4, T>::type atomic_exchange(T* const dest,
-                                                                 T value,
-                                                                 MemoryOrder,
-                                                                 MemoryScope) {
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<sizeof(T) == 4, T> device_atomic_exchange(T* const dest,
+                                                           T value,
+                                                           MemoryOrder,
+                                                           MemoryScope) {
   static_assert(sizeof(unsigned int) == 4,
                 "this function assumes an unsigned int is 32-bit");
-  Impl::sycl_atomic_ref<unsigned int, MemoryOrder, MemoryScope> dest_ref(
+  sycl_atomic_ref<unsigned int, MemoryOrder, MemoryScope> dest_ref(
       *reinterpret_cast<unsigned int*>(dest));
   unsigned int return_val = dest_ref.exchange(*reinterpret_cast<unsigned int*>(&value));
   return reinterpret_cast<T&>(return_val);
 }
-template <typename T, class MemoryOrder, class MemoryScope>
-typename std::enable_if<sizeof(T) == 8, T>::type atomic_exchange(T* const dest,
-                                                                 T value,
-                                                                 MemoryOrder,
-                                                                 MemoryScope) {
+
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<sizeof(T) == 8, T> device_atomic_exchange(T* const dest,
+                                                           T value,
+                                                           MemoryOrder,
+                                                           MemoryScope) {
   static_assert(sizeof(unsigned long long int) == 8,
                 "this function assumes an unsigned long long is 64-bit");
-  Impl::sycl_atomic_ref<unsigned long long int, MemoryOrder, MemoryScope> dest_ref(
+  sycl_atomic_ref<unsigned long long int, MemoryOrder, MemoryScope> dest_ref(
       *reinterpret_cast<unsigned long long int*>(dest));
   unsigned long long int return_val =
       dest_ref.exchange(reinterpret_cast<unsigned long long int&>(value));
   return reinterpret_cast<T&>(return_val);
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
-typename std::enable_if<(sizeof(T) != 8) && (sizeof(T) != 4), T>::type
-atomic_compare_exchange(
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<(sizeof(T) != 8) && (sizeof(T) != 4), T>
+device_atomic_compare_exchange(
     T* const /*dest*/, T compare, T /*value*/, MemoryOrder, MemoryScope) {
-  // FIXME_SYCL not implemented
-  assert(false);
+  assert(false);  // FIXME_SYCL not implemented
   return compare;
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
-typename std::enable_if<(sizeof(T) != 8) && (sizeof(T) != 4), T>::type atomic_exchange(
+template <class T, class MemoryOrder, class MemoryScope>
+std::enable_if_t<(sizeof(T) != 8) && (sizeof(T) != 4), T> device_atomic_exchange(
     T* const /*dest*/, T value, MemoryOrder, MemoryScope) {
-  // FIXME_SYCL not implemented
-  assert(false);
+  assert(false);  // FIXME_SYCL not implemented
   return value;
 }
 
+}  // namespace Impl
 }  // namespace desul
 
 #endif
-#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_ScopeCaller.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_ScopeCaller.hpp
index fff6320c51bbd3ba3d39e019161af96a59ab1902..2bfb4651a847e39f0b64ce4ce6ebe1090e739298 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_ScopeCaller.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_ScopeCaller.hpp
@@ -8,15 +8,13 @@ SPDX-License-Identifier: (BSD-3-Clause)
 
 #ifndef DESUL_ATOMICS_COMPARE_EXCHANGE_SCOPECALLER_HPP_
 #define DESUL_ATOMICS_COMPARE_EXCHANGE_SCOPECALLER_HPP_
-#include "desul/atomics/Common.hpp"
 
-namespace desul {
+#include <desul/atomics/Common.hpp>
 
-template <class MemoryOrder>
-DESUL_INLINE_FUNCTION void atomic_thread_fence(MemoryOrder, MemoryScopeCaller) {}
+namespace desul {
 
 #define DESUL_ATOMIC_EXCHANGE_SCOPECALLER(MEMORY_ORDER)               \
-  template <typename T>                                               \
+  template <class T>                                                  \
   DESUL_INLINE_FUNCTION T atomic_exchange(                            \
       T* dest, T value, MEMORY_ORDER, MemoryScopeCaller) {            \
     T return_val = *dest;                                             \
@@ -24,7 +22,7 @@ DESUL_INLINE_FUNCTION void atomic_thread_fence(MemoryOrder, MemoryScopeCaller) {
     return return_val;                                                \
   }                                                                   \
                                                                       \
-  template <typename T>                                               \
+  template <class T>                                                  \
   DESUL_INLINE_FUNCTION T atomic_compare_exchange(                    \
       T* dest, T compare, T value, MEMORY_ORDER, MemoryScopeCaller) { \
     T current_val = *dest;                                            \
@@ -39,5 +37,7 @@ DESUL_ATOMIC_EXCHANGE_SCOPECALLER(MemoryOrderAcquire)
 DESUL_ATOMIC_EXCHANGE_SCOPECALLER(MemoryOrderRelaxed)
 
 #undef DESUL_ATOMIC_EXCHANGE_SCOPECALLER
+
 }  // namespace desul
+
 #endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_Serial.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_Serial.hpp
deleted file mode 100644
index 9d0db5c9e1318e8350e621dbf17f5e6c2c2de83d..0000000000000000000000000000000000000000
--- a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_Serial.hpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-Copyright (c) 2019, Lawrence Livermore National Security, LLC
-and DESUL project contributors. See the COPYRIGHT file for details.
-Source: https://github.com/desul/desul
-
-SPDX-License-Identifier: (BSD-3-Clause)
-*/
-#ifndef DESUL_ATOMICS_COMPARE_EXCHANGE_SERIAL_HPP_
-#define DESUL_ATOMICS_COMPARE_EXCHANGE_SERIAL_HPP_
-
-#ifdef DESUL_HAVE_SERIAL_ATOMICS
-namespace desul {
-template <class MemoryScope>
-void atomic_thread_fence(MemoryOrderAcquire, MemoryScope) {}
-
-template <class MemoryScope>
-void atomic_thread_fence(MemoryOrderRelease, MemoryScope) {}
-
-template <typename T, class MemoryScope>
-T atomic_compare_exchange(
-    T* const dest, T compare, T value, MemoryOrderRelaxed, MemoryScope) {
-  T old = *dest;
-  if (old == compare) {
-    *dest = value;
-  } else {
-    old = compare;
-  }
-  return compare;
-}
-template <typename T, class MemoryScope>
-T atomic_compare_exchange(
-    T* const dest, T compare, T value, MemoryOrderSeqCst, MemoryScope) {
-  T old = *dest;
-  if (old == compare) {
-    *dest = value;
-  } else {
-    old = compare;
-  }
-  return compare;
-}
-}  // namespace desul
-#endif
-#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..adf75c574371d9946f4d3d9c345f38ee549397c5
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op.hpp
@@ -0,0 +1,35 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_FETCH_OP_HPP_
+#define DESUL_ATOMICS_FETCH_OP_HPP_
+
+#include <desul/atomics/Macros.hpp>
+
+#ifdef DESUL_HAVE_GCC_ATOMICS
+#include <desul/atomics/Fetch_Op_GCC.hpp>
+#endif
+#ifdef DESUL_HAVE_CUDA_ATOMICS
+#include <desul/atomics/Fetch_Op_CUDA.hpp>
+#endif
+#ifdef DESUL_HAVE_HIP_ATOMICS
+#include <desul/atomics/Fetch_Op_HIP.hpp>
+#endif
+#ifdef DESUL_HAVE_OPENMP_ATOMICS
+#include <desul/atomics/Fetch_Op_OpenMP.hpp>
+#endif
+#ifdef DESUL_HAVE_SYCL_ATOMICS
+#include <desul/atomics/Fetch_Op_SYCL.hpp>
+#endif
+
+#include <desul/atomics/Fetch_Op_ScopeCaller.hpp>
+
+// Must come last
+#include <desul/atomics/Fetch_Op_Generic.hpp>
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_CUDA.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_CUDA.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..5c662bfc58ba63702568efa19da928efa9823161
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_CUDA.hpp
@@ -0,0 +1,132 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_FETCH_OP_CUDA_HPP_
+#define DESUL_ATOMICS_FETCH_OP_CUDA_HPP_
+
+#ifndef DESUL_CUDA_ARCH_IS_PRE_VOLTA
+
+#define DESUL_HAVE_CUDA_ATOMICS_ASM
+
+#include <desul/atomics/cuda/CUDA_asm.hpp>
+
+#else
+
+namespace desul {
+namespace Impl {
+
+// clang-format off
+inline __device__                int device_atomic_fetch_add(               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr,  val); }
+inline __device__       unsigned int device_atomic_fetch_add(      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr,  val); }
+inline __device__ unsigned long long device_atomic_fetch_add(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr,  val); }
+inline __device__              float device_atomic_fetch_add(             float* ptr,              float val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr,  val); }
+#ifndef DESUL_CUDA_ARCH_IS_PRE_PASCAL
+inline __device__             double device_atomic_fetch_add(            double* ptr,             double val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr,  val); }
+#endif
+
+inline __device__                int device_atomic_fetch_sub(               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr,  val); }
+inline __device__       unsigned int device_atomic_fetch_sub(      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr,  val); }
+inline __device__ unsigned long long device_atomic_fetch_sub(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -val); }
+inline __device__              float device_atomic_fetch_sub(             float* ptr,              float val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -val); }
+#ifndef DESUL_CUDA_ARCH_IS_PRE_PASCAL
+inline __device__             double device_atomic_fetch_sub(            double* ptr,             double val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -val); }
+#endif
+
+inline __device__                int device_atomic_fetch_min(               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMin(ptr,  val); }
+inline __device__       unsigned int device_atomic_fetch_min(      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMin(ptr,  val); }
+inline __device__ unsigned long long device_atomic_fetch_min(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMin(ptr,  val); }
+
+inline __device__                int device_atomic_fetch_max(               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMax(ptr,  val); }
+inline __device__       unsigned int device_atomic_fetch_max(      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMax(ptr,  val); }
+inline __device__ unsigned long long device_atomic_fetch_max(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMax(ptr,  val); }
+
+inline __device__                int device_atomic_fetch_and(               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAnd(ptr,  val); }
+inline __device__       unsigned int device_atomic_fetch_and(      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAnd(ptr,  val); }
+inline __device__ unsigned long long device_atomic_fetch_and(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAnd(ptr,  val); }
+
+inline __device__                int device_atomic_fetch_or (               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicOr (ptr,  val); }
+inline __device__       unsigned int device_atomic_fetch_or (      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicOr (ptr,  val); }
+inline __device__ unsigned long long device_atomic_fetch_or (unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicOr (ptr,  val); }
+
+inline __device__                int device_atomic_fetch_xor(               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicXor(ptr,  val); }
+inline __device__       unsigned int device_atomic_fetch_xor(      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicXor(ptr,  val); }
+inline __device__ unsigned long long device_atomic_fetch_xor(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicXor(ptr,  val); }
+
+inline __device__                int device_atomic_fetch_inc(               int* ptr,                         MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, 1   ); }
+inline __device__       unsigned int device_atomic_fetch_inc(      unsigned int* ptr,                         MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, 1u  ); }
+inline __device__ unsigned long long device_atomic_fetch_inc(unsigned long long* ptr,                         MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, 1ull); }
+
+inline __device__                int device_atomic_fetch_dec(               int* ptr,                         MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr,  1  ); }
+inline __device__       unsigned int device_atomic_fetch_dec(      unsigned int* ptr,                         MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr,  1u ); }
+inline __device__ unsigned long long device_atomic_fetch_dec(unsigned long long* ptr,                         MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -1  ); }
+
+inline __device__       unsigned int device_atomic_fetch_inc_mod(  unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicInc(ptr,  val); }
+inline __device__       unsigned int device_atomic_fetch_dec_mod(  unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicDec(ptr,  val); }
+// clang-format on
+
+#define DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP(OP, TYPE)                               \
+  template <class MemoryOrder>                                                         \
+  __device__ TYPE device_atomic_fetch_##OP(                                            \
+      TYPE* ptr, TYPE val, MemoryOrder, MemoryScopeDevice) {                           \
+    __threadfence();                                                                   \
+    TYPE return_val =                                                                  \
+        device_atomic_fetch_##OP(ptr, val, MemoryOrderRelaxed(), MemoryScopeDevice()); \
+    __threadfence();                                                                   \
+    return return_val;                                                                 \
+  }                                                                                    \
+  template <class MemoryOrder>                                                         \
+  __device__ TYPE device_atomic_fetch_##OP(                                            \
+      TYPE* ptr, TYPE val, MemoryOrder, MemoryScopeCore) {                             \
+    return device_atomic_fetch_##OP(ptr, val, MemoryOrder(), MemoryScopeDevice());     \
+  }
+
+#define DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(OP) \
+  DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP(OP, int)           \
+  DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP(OP, unsigned int)  \
+  DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP(OP, unsigned long long)
+
+#ifdef DESUL_CUDA_ARCH_IS_PRE_PASCAL
+
+#define DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(OP) \
+  DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP(OP, float)
+
+#else
+
+#define DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(OP) \
+  DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP(OP, float)               \
+  DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP(OP, double)
+
+#endif
+
+DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(min)
+DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(max)
+DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(and)
+DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(or)
+DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(xor)
+
+DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(add)
+DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(add)
+DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(sub)
+DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(sub)
+
+DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(inc)
+DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(dec)
+
+DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP(inc_mod, unsigned int)
+DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP(dec_mod, unsigned int)
+
+#undef DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT
+#undef DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL
+#undef DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP
+
+}  // namespace Impl
+}  // namespace desul
+
+#endif
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_GCC.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_GCC.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..51e0634051166a8a120fff0fbc26bc0753e8a0b1
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_GCC.hpp
@@ -0,0 +1,51 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_FETCH_OP_GCC_HPP_
+#define DESUL_ATOMICS_FETCH_OP_GCC_HPP_
+
+#include <desul/atomics/Adapt_GCC.hpp>
+#include <type_traits>
+
+namespace desul {
+namespace Impl {
+
+// clang-format off
+#define DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL_ORDER_SCOPE(OP, MEMORY_ORDER, MEMORY_SCOPE)                                 \
+  template <class T>                                                                                                          \
+  std::enable_if_t<std::is_integral<T>::value, T> host_atomic_fetch_##OP  (T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { \
+    return __atomic_fetch_##OP  (dest, value, GCCMemoryOrder<MEMORY_ORDER>::value);                                              \
+  }                                                                                                                              \
+  template <class T>                                                                                                          \
+  std::enable_if_t<std::is_integral<T>::value, T> host_atomic_##OP##_fetch(T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { \
+    return __atomic_##OP##_fetch(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value);                                              \
+  }
+
+#define DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL(OP) \
+   DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL_ORDER_SCOPE(OP, MemoryOrderRelaxed, MemoryScopeNode  ) \
+   DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL_ORDER_SCOPE(OP, MemoryOrderRelaxed, MemoryScopeDevice) \
+   DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL_ORDER_SCOPE(OP, MemoryOrderRelaxed, MemoryScopeCore  ) \
+   DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL_ORDER_SCOPE(OP, MemoryOrderSeqCst , MemoryScopeNode  ) \
+   DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL_ORDER_SCOPE(OP, MemoryOrderSeqCst , MemoryScopeDevice) \
+   DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL_ORDER_SCOPE(OP, MemoryOrderSeqCst , MemoryScopeCore  )
+// clang-format on
+
+DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL(add)
+DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL(sub)
+DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL(and)
+DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL(xor)
+DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL(or)
+DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL(nand)
+
+#undef DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL
+#undef DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL_ORDER_SCOPE
+
+}  // namespace Impl
+}  // namespace desul
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_Generic.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_Generic.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..a94ff8ef1875ed5ce96e7440e2c41292878bb63c
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_Generic.hpp
@@ -0,0 +1,167 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_FETCH_OP_GENERIC_HPP_
+#define DESUL_ATOMICS_FETCH_OP_GENERIC_HPP_
+
+#include <desul/atomics/Common.hpp>
+#include <desul/atomics/Lock_Based_Fetch_Op.hpp>
+#include <desul/atomics/Lock_Free_Fetch_Op.hpp>
+#include <desul/atomics/Operator_Function_Objects.hpp>
+#include <type_traits>
+
+namespace desul {
+namespace Impl {
+
+#define DESUL_IMPL_ATOMIC_FETCH_OP(ANNOTATION, HOST_OR_DEVICE, OP)        \
+  template <class T, class MemoryOrder, class MemoryScope>                \
+  ANNOTATION T HOST_OR_DEVICE##_atomic_fetch_##OP(                        \
+      T* const dest, const T val, MemoryOrder order, MemoryScope scope) { \
+    return HOST_OR_DEVICE##_atomic_fetch_oper(                            \
+        OP##_operator<T, const T>(), dest, val, order, scope);            \
+  }                                                                       \
+  template <class T, class MemoryOrder, class MemoryScope>                \
+  ANNOTATION T HOST_OR_DEVICE##_atomic_##OP##_fetch(                      \
+      T* const dest, const T val, MemoryOrder order, MemoryScope scope) { \
+    return HOST_OR_DEVICE##_atomic_oper_fetch(                            \
+        OP##_operator<T, const T>(), dest, val, order, scope);            \
+  }
+
+#define DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(OP)           \
+  DESUL_IMPL_ATOMIC_FETCH_OP(DESUL_IMPL_HOST_FUNCTION, host, OP) \
+  DESUL_IMPL_ATOMIC_FETCH_OP(DESUL_IMPL_DEVICE_FUNCTION, device, OP)
+
+DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(add)
+DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(sub)
+DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(max)
+DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(min)
+DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(mul)
+DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(div)
+DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(mod)
+DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(and)
+DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(or)
+DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(xor)
+DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(nand)
+
+DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(inc_mod)
+DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(dec_mod)
+
+#undef DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE
+#undef DESUL_IMPL_ATOMIC_FETCH_OP
+
+#define DESUL_IMPL_ATOMIC_FETCH_OP_SHIFT(ANNOTATION, HOST_OR_DEVICE, OP)             \
+  template <class T, class MemoryOrder, class MemoryScope>                           \
+  ANNOTATION T HOST_OR_DEVICE##_atomic_fetch_##OP(                                   \
+      T* const dest, const unsigned int val, MemoryOrder order, MemoryScope scope) { \
+    return HOST_OR_DEVICE##_atomic_fetch_oper(                                       \
+        OP##_operator<T, const unsigned int>(), dest, val, order, scope);            \
+  }                                                                                  \
+  template <class T, class MemoryOrder, class MemoryScope>                           \
+  ANNOTATION T HOST_OR_DEVICE##_atomic_##OP##_fetch(                                 \
+      T* const dest, const unsigned int val, MemoryOrder order, MemoryScope scope) { \
+    return HOST_OR_DEVICE##_atomic_oper_fetch(                                       \
+        OP##_operator<T, const unsigned int>(), dest, val, order, scope);            \
+  }
+
+#define DESUL_IMPL_ATOMIC_FETCH_OP_SHIFT_HOST_AND_DEVICE(OP)           \
+  DESUL_IMPL_ATOMIC_FETCH_OP_SHIFT(DESUL_IMPL_HOST_FUNCTION, host, OP) \
+  DESUL_IMPL_ATOMIC_FETCH_OP_SHIFT(DESUL_IMPL_DEVICE_FUNCTION, device, OP)
+
+DESUL_IMPL_ATOMIC_FETCH_OP_SHIFT_HOST_AND_DEVICE(lshift)
+DESUL_IMPL_ATOMIC_FETCH_OP_SHIFT_HOST_AND_DEVICE(rshift)
+
+#undef DESUL_IMPL_ATOMIC_FETCH_OP_SHIFT_HOST_AND_DEVICE
+#undef DESUL_IMPL_ATOMIC_FETCH_OP_SHIFT
+
+#define DESUL_IMPL_ATOMIC_LOAD_AND_STORE(ANNOTATION, HOST_OR_DEVICE)           \
+  template <class T, class MemoryOrder, class MemoryScope>                     \
+  ANNOTATION T HOST_OR_DEVICE##_atomic_load(                                   \
+      const T* const dest, MemoryOrder order, MemoryScope scope) {             \
+    return HOST_OR_DEVICE##_atomic_fetch_oper(                                 \
+        load_operator<T, const T>(), const_cast<T*>(dest), T(), order, scope); \
+  }                                                                            \
+                                                                               \
+  template <class T, class MemoryOrder, class MemoryScope>                     \
+  ANNOTATION void HOST_OR_DEVICE##_atomic_store(                               \
+      T* const dest, const T val, MemoryOrder order, MemoryScope scope) {      \
+    (void)HOST_OR_DEVICE##_atomic_fetch_oper(                                  \
+        store_operator<T, const T>(), dest, val, order, scope);                \
+  }
+
+DESUL_IMPL_ATOMIC_LOAD_AND_STORE(DESUL_IMPL_HOST_FUNCTION, host)
+DESUL_IMPL_ATOMIC_LOAD_AND_STORE(DESUL_IMPL_DEVICE_FUNCTION, device)
+
+#undef DESUL_IMPL_ATOMIC_LOAD_AND_STORE
+
+#define DESUL_IMPL_ATOMIC_OP(ANNOTATION, HOST_OR_DEVICE, OP)              \
+  template <class T, class MemoryOrder, class MemoryScope>                \
+  ANNOTATION void HOST_OR_DEVICE##_atomic_##OP(                           \
+      T* const dest, const T val, MemoryOrder order, MemoryScope scope) { \
+    (void)HOST_OR_DEVICE##_atomic_fetch_##OP(dest, val, order, scope);    \
+  }
+
+#define DESUL_IMPL_ATOMIC_OP_HOST_AND_DEVICE(OP)           \
+  DESUL_IMPL_ATOMIC_OP(DESUL_IMPL_HOST_FUNCTION, host, OP) \
+  DESUL_IMPL_ATOMIC_OP(DESUL_IMPL_DEVICE_FUNCTION, device, OP)
+
+DESUL_IMPL_ATOMIC_OP_HOST_AND_DEVICE(add)
+DESUL_IMPL_ATOMIC_OP_HOST_AND_DEVICE(sub)
+DESUL_IMPL_ATOMIC_OP_HOST_AND_DEVICE(mul)
+DESUL_IMPL_ATOMIC_OP_HOST_AND_DEVICE(div)
+DESUL_IMPL_ATOMIC_OP_HOST_AND_DEVICE(min)
+DESUL_IMPL_ATOMIC_OP_HOST_AND_DEVICE(max)
+
+#undef DESUL_IMPL_ATOMIC_OP_HOST_AND_DEVICE
+#undef DESUL_IMPL_ATOMIC_OP
+
+#define DESUL_IMPL_ATOMIC_INCREMENT_DECREMENT(ANNOTATION, HOST_OR_DEVICE) \
+  template <class T, class MemoryOrder, class MemoryScope>                \
+  ANNOTATION T HOST_OR_DEVICE##_atomic_inc_fetch(                         \
+      T* const dest, MemoryOrder order, MemoryScope scope) {              \
+    return HOST_OR_DEVICE##_atomic_add_fetch(dest, T(1), order, scope);   \
+  }                                                                       \
+                                                                          \
+  template <class T, class MemoryOrder, class MemoryScope>                \
+  ANNOTATION T HOST_OR_DEVICE##_atomic_dec_fetch(                         \
+      T* const dest, MemoryOrder order, MemoryScope scope) {              \
+    return HOST_OR_DEVICE##_atomic_sub_fetch(dest, T(1), order, scope);   \
+  }                                                                       \
+                                                                          \
+  template <class T, class MemoryOrder, class MemoryScope>                \
+  ANNOTATION T HOST_OR_DEVICE##_atomic_fetch_inc(                         \
+      T* const dest, MemoryOrder order, MemoryScope scope) {              \
+    return HOST_OR_DEVICE##_atomic_fetch_add(dest, T(1), order, scope);   \
+  }                                                                       \
+                                                                          \
+  template <class T, class MemoryOrder, class MemoryScope>                \
+  ANNOTATION T HOST_OR_DEVICE##_atomic_fetch_dec(                         \
+      T* const dest, MemoryOrder order, MemoryScope scope) {              \
+    return HOST_OR_DEVICE##_atomic_fetch_sub(dest, T(1), order, scope);   \
+  }                                                                       \
+                                                                          \
+  template <class T, class MemoryOrder, class MemoryScope>                \
+  ANNOTATION void HOST_OR_DEVICE##_atomic_inc(                            \
+      T* const dest, MemoryOrder order, MemoryScope scope) {              \
+    return HOST_OR_DEVICE##_atomic_add(dest, T(1), order, scope);         \
+  }                                                                       \
+                                                                          \
+  template <class T, class MemoryOrder, class MemoryScope>                \
+  ANNOTATION void HOST_OR_DEVICE##_atomic_dec(                            \
+      T* const dest, MemoryOrder order, MemoryScope scope) {              \
+    return HOST_OR_DEVICE##_atomic_sub(dest, T(1), order, scope);         \
+  }
+
+DESUL_IMPL_ATOMIC_INCREMENT_DECREMENT(DESUL_IMPL_HOST_FUNCTION, host)
+DESUL_IMPL_ATOMIC_INCREMENT_DECREMENT(DESUL_IMPL_DEVICE_FUNCTION, device)
+
+#undef DESUL_IMPL_ATOMIC_INCREMENT_DECREMENT
+
+}  // namespace Impl
+}  // namespace desul
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_HIP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_HIP.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..e9c749809de5910368a7694e354d50874e58fa9d
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_HIP.hpp
@@ -0,0 +1,109 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_FECH_OP_HIP_HPP_
+#define DESUL_ATOMICS_FECH_OP_HIP_HPP_
+
+namespace desul {
+namespace Impl {
+
+// clang-format off
+inline __device__                int device_atomic_fetch_add(               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr,  val); }
+inline __device__       unsigned int device_atomic_fetch_add(      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr,  val); }
+inline __device__ unsigned long long device_atomic_fetch_add(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr,  val); }
+inline __device__              float device_atomic_fetch_add(             float* ptr,              float val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr,  val); }
+inline __device__             double device_atomic_fetch_add(            double* ptr,             double val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr,  val); }
+
+inline __device__                int device_atomic_fetch_sub(               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr,  val); }
+inline __device__       unsigned int device_atomic_fetch_sub(      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr,  val); }
+inline __device__ unsigned long long device_atomic_fetch_sub(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -val); }
+inline __device__              float device_atomic_fetch_sub(             float* ptr,              float val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -val); }
+inline __device__             double device_atomic_fetch_sub(            double* ptr,             double val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -val); }
+
+inline __device__                int device_atomic_fetch_min(               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMin(ptr,  val); }
+inline __device__       unsigned int device_atomic_fetch_min(      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMin(ptr,  val); }
+inline __device__ unsigned long long device_atomic_fetch_min(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMin(ptr,  val); }
+
+inline __device__                int device_atomic_fetch_max(               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMax(ptr,  val); }
+inline __device__       unsigned int device_atomic_fetch_max(      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMax(ptr,  val); }
+inline __device__ unsigned long long device_atomic_fetch_max(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMax(ptr,  val); }
+
+inline __device__                int device_atomic_fetch_and(               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAnd(ptr,  val); }
+inline __device__       unsigned int device_atomic_fetch_and(      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAnd(ptr,  val); }
+inline __device__ unsigned long long device_atomic_fetch_and(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAnd(ptr,  val); }
+
+inline __device__                int device_atomic_fetch_or (               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicOr (ptr,  val); }
+inline __device__       unsigned int device_atomic_fetch_or (      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicOr (ptr,  val); }
+inline __device__ unsigned long long device_atomic_fetch_or (unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicOr (ptr,  val); }
+
+inline __device__                int device_atomic_fetch_xor(               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicXor(ptr,  val); }
+inline __device__       unsigned int device_atomic_fetch_xor(      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicXor(ptr,  val); }
+inline __device__ unsigned long long device_atomic_fetch_xor(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicXor(ptr,  val); }
+
+inline __device__                int device_atomic_fetch_inc(               int* ptr,                         MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, 1   ); }
+inline __device__       unsigned int device_atomic_fetch_inc(      unsigned int* ptr,                         MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, 1u  ); }
+inline __device__ unsigned long long device_atomic_fetch_inc(unsigned long long* ptr,                         MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, 1ull); }
+
+inline __device__                int device_atomic_fetch_dec(               int* ptr,                         MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr,  1  ); }
+inline __device__       unsigned int device_atomic_fetch_dec(      unsigned int* ptr,                         MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr,  1u ); }
+inline __device__ unsigned long long device_atomic_fetch_dec(unsigned long long* ptr,                         MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -1  ); }
+
+inline __device__       unsigned int device_atomic_fetch_inc_mod(  unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicInc(ptr,  val); }
+inline __device__       unsigned int device_atomic_fetch_dec_mod(  unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicDec(ptr,  val); }
+// clang-format on
+
+#define DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, TYPE)                                \
+  template <class MemoryOrder>                                                         \
+  __device__ TYPE device_atomic_fetch_##OP(                                            \
+      TYPE* ptr, TYPE val, MemoryOrder, MemoryScopeDevice) {                           \
+    __threadfence();                                                                   \
+    TYPE return_val =                                                                  \
+        device_atomic_fetch_##OP(ptr, val, MemoryOrderRelaxed(), MemoryScopeDevice()); \
+    __threadfence();                                                                   \
+    return return_val;                                                                 \
+  }                                                                                    \
+  template <class MemoryOrder>                                                         \
+  __device__ TYPE device_atomic_fetch_##OP(                                            \
+      TYPE* ptr, TYPE val, MemoryOrder, MemoryScopeCore) {                             \
+    return device_atomic_fetch_##OP(ptr, val, MemoryOrder(), MemoryScopeDevice());     \
+  }
+
+#define DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(OP) \
+  DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, int)           \
+  DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, unsigned int)  \
+  DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, unsigned long long)
+
+#define DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(OP) \
+  DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, float)               \
+  DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, double)
+
+DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(min)
+DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(max)
+DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(and)
+DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(or)
+DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(xor)
+
+DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(add)
+DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(add)
+DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(sub)
+DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(sub)
+
+DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(inc)
+DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(dec)
+
+DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(inc_mod, unsigned int)
+DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(dec_mod, unsigned int)
+
+#undef DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT
+#undef DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL
+#undef DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP
+
+}  // namespace Impl
+}  // namespace desul
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_OpenMP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_OpenMP.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..042d555642be031c2dd2c8dc8b15356ebf234b02
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_OpenMP.hpp
@@ -0,0 +1,132 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+#ifndef DESUL_ATOMICS_FETCH_OP_OPENMP_HPP_
+#define DESUL_ATOMICS_FETCH_OP_OPENMP_HPP_
+
+#include <desul/atomics/Common.hpp>
+#include <desul/atomics/openmp/OpenMP_40.hpp>
+
+#if 0  // FIXME_OPENMP
+namespace desul {
+namespace Impl {
+
+// clang-format off
+//<editor-fold desc="atomic_fetch_{add,sub,and,or,xor}">
+template <class T>
+std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_fetch_add(
+T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) {
+  T tmp;
+#pragma omp atomic capture
+  { tmp = *ptr; *ptr += val; }
+  return tmp;
+}
+
+template <class T>
+std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_fetch_sub(
+T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) {
+  T tmp;
+#pragma omp atomic capture
+  { tmp = *ptr; *ptr -= val; }
+  return tmp;
+}
+
+template <class T>
+std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_fetch_and(
+T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) {
+  T tmp;
+#pragma omp atomic capture
+  { tmp = *ptr; *ptr &= val; }
+  return tmp;
+}
+
+template <class T>
+std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_fetch_or(
+T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) {
+  T tmp;
+#pragma omp atomic capture
+  { tmp = *ptr; *ptr |= val; }
+  return tmp;
+}
+
+template <class T>
+std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_fetch_xor(
+T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) {
+  T tmp;
+#pragma omp atomic capture
+  { tmp = *ptr; *ptr ^= val; }
+  return tmp;
+}
+//</editor-fold>
+
+//<editor-fold desc="atomic_{add,sub,and,or,xor}_fetch">
+template <class T>
+std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_add_fetch(
+    T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) {
+  T tmp;
+#pragma omp atomic capture
+  { *ptr += val; tmp = *ptr; }
+  return tmp;
+}
+
+template <class T>
+std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_sub_fetch(
+    T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) {
+  T tmp;
+#pragma omp atomic capture
+  { *ptr -= val; tmp = *ptr; }
+  return tmp;
+}
+
+template <class T>
+std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_and_fetch(
+    T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) {
+  T tmp;
+#pragma omp atomic capture
+  { *ptr &= val; tmp = *ptr; }
+  return tmp;
+}
+
+template <class T>
+std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_or_fetch(
+    T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) {
+  T tmp;
+#pragma omp atomic capture
+  { *ptr |= val; tmp = *ptr; }
+  return tmp;
+}
+
+template <class T>
+std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_xor_fetch(
+    T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) {
+  T tmp;
+#pragma omp atomic capture
+  { *ptr ^= val; tmp = *ptr; }
+  return tmp;
+}
+//</editor-fold>
+// clang-format on
+
+#define DESUL_IMPL_OPENMP_HOST_ATOMIC_FETCH_OP_ARITHMETIC(OP, MEMORY_ORDER)   \
+  template <class T>                                                          \
+  std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_fetch_##OP(   \
+      T* ptr, T val, MemoryOrderRelaxed, MemoryScopeCore) {                   \
+    return host_atomic_fetch_##OP(                                            \
+        ptr, val, MemoryOrderRelaxed(), MemoryScopeDevice());                 \
+  }                                                                           \
+  template <class T>                                                          \
+  std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_##OP##_fetch( \
+      T* ptr, T val, MemoryOrderRelaxed, MemoryScopeCore) {                   \
+    return host_atomic_##OP##_fetch(                                          \
+        ptr, val, MemoryOrderRelaxed(), MemoryScopeDevice());                 \
+  }
+
+}  // namespace Impl
+}  // namespace desul
+#endif
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/SYCL.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_SYCL.hpp
similarity index 72%
rename from packages/kokkos/tpls/desul/include/desul/atomics/SYCL.hpp
rename to packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_SYCL.hpp
index da34564f6967313e9c7c8ea1e215feec67b40197..afe5861551a4076cb245123d9277fc76ca1052a7 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/SYCL.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_SYCL.hpp
@@ -5,29 +5,29 @@ Source: https://github.com/desul/desul
 
 SPDX-License-Identifier: (BSD-3-Clause)
 */
-#ifndef DESUL_ATOMICS_SYCL_HPP_
-#define DESUL_ATOMICS_SYCL_HPP_
 
-#ifdef DESUL_HAVE_SYCL_ATOMICS
+#ifndef DESUL_ATOMICS_FETCH_OP_SYCL_HPP_
+#define DESUL_ATOMICS_FETCH_OP_SYCL_HPP_
 
-// clang-format off
-#include "desul/atomics/SYCLConversions.hpp"
-#include "desul/atomics/Common.hpp"
-// clang-format on
+#include <desul/atomics/Adapt_SYCL.hpp>
+#include <desul/atomics/Common.hpp>
 
 namespace desul {
+namespace Impl {
 
-#define DESUL_IMPL_SYCL_ATOMIC_FETCH_OPER(OPER, TYPE)                              \
-  template <class MemoryOrder>                                                     \
-  TYPE atomic_fetch_##OPER(TYPE* dest, TYPE val, MemoryOrder, MemoryScopeDevice) { \
-    Impl::sycl_atomic_ref<TYPE, MemoryOrder, MemoryScopeDevice> dest_ref(*dest);   \
-    return dest_ref.fetch_##OPER(val);                                             \
-  }                                                                                \
-  template <class MemoryOrder>                                                     \
-  TYPE atomic_fetch_##OPER(TYPE* dest, TYPE val, MemoryOrder, MemoryScopeCore) {   \
-    Impl::sycl_atomic_ref<TYPE, MemoryOrder, MemoryScopeCore> dest_ref(*dest);     \
-    return dest_ref.fetch_##OPER(val);                                             \
+// clang-format off
+#define DESUL_IMPL_SYCL_ATOMIC_FETCH_OPER(OPER, TYPE)                                     \
+  template <class MemoryOrder>                                                            \
+  TYPE device_atomic_fetch_##OPER(TYPE* dest, TYPE val, MemoryOrder, MemoryScopeDevice) { \
+    sycl_atomic_ref<TYPE, MemoryOrder, MemoryScopeDevice> dest_ref(*dest);                \
+    return dest_ref.fetch_##OPER(val);                                                    \
+  }                                                                                       \
+  template <class MemoryOrder>                                                            \
+  TYPE device_atomic_fetch_##OPER(TYPE* dest, TYPE val, MemoryOrder, MemoryScopeCore  ) { \
+    sycl_atomic_ref<TYPE, MemoryOrder, MemoryScopeCore> dest_ref(*dest);                  \
+    return dest_ref.fetch_##OPER(val);                                                    \
   }
+// clang-format on
 
 #define DESUL_IMPL_SYCL_ATOMIC_FETCH_OPER_INTEGRAL(OPER) \
   DESUL_IMPL_SYCL_ATOMIC_FETCH_OPER(OPER, int)           \
@@ -58,7 +58,7 @@ DESUL_IMPL_SYCL_ATOMIC_FETCH_OPER_FLOATING_POINT(max)
 #undef DESUL_IMPL_SYCL_ATOMIC_FETCH_OPER_INTEGRAL
 #undef DESUL_IMPL_SYCL_ATOMIC_FETCH_OPER
 
+}  // namespace Impl
 }  // namespace desul
 
-#endif  // DESUL_HAVE_SYCL_ATOMICS
-#endif  // DESUL_ATOMICS_SYCL_HPP_
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_ScopeCaller.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_ScopeCaller.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..6d4623e35bc5033cdf6a461166b2b2fffbad7a92
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_ScopeCaller.hpp
@@ -0,0 +1,55 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_FETCH_OP_SCOPECALLER_HPP_
+#define DESUL_ATOMICS_FETCH_OP_SCOPECALLER_HPP_
+
+#include <desul/atomics/Common.hpp>
+#include <desul/atomics/Macros.hpp>
+
+namespace desul {
+namespace Impl {
+
+#define DESUL_IMPL_ATOMIC_FETCH_OPER(ANNOTATION, HOST_OR_DEVICE) \
+  template <class Oper, class T, class MemoryOrder>              \
+  ANNOTATION T HOST_OR_DEVICE##_atomic_fetch_oper(               \
+      const Oper& op,                                            \
+      T* const dest,                                             \
+      dont_deduce_this_parameter_t<const T> val,                 \
+      MemoryOrder /*order*/,                                     \
+      MemoryScopeCaller /*scope*/) {                             \
+    T oldval = *dest;                                            \
+    *dest = op.apply(oldval, val);                               \
+    return oldval;                                               \
+  }                                                              \
+                                                                 \
+  template <class Oper, class T, class MemoryOrder>              \
+  ANNOTATION T HOST_OR_DEVICE##_atomic_oper_fetch(               \
+      const Oper& op,                                            \
+      T* const dest,                                             \
+      dont_deduce_this_parameter_t<const T> val,                 \
+      MemoryOrder /*order*/,                                     \
+      MemoryScopeCaller /*scope*/) {                             \
+    T oldval = *dest;                                            \
+    T newval = op.apply(oldval, val);                            \
+    *dest = newval;                                              \
+    return newval;                                               \
+  }
+
+DESUL_IMPL_ATOMIC_FETCH_OPER(DESUL_IMPL_HOST_FUNCTION, host)
+DESUL_IMPL_ATOMIC_FETCH_OPER(DESUL_IMPL_DEVICE_FUNCTION, device)
+
+#undef DESUL_IMPL_ATOMIC_FETCH_OPER
+
+}  // namespace Impl
+}  // namespace desul
+
+// FIXME consider implementing directly atomic_fetch_##OP and atomic_##OP##_fetch or
+// dropping this placeholder
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/GCC.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/GCC.hpp
deleted file mode 100644
index 239c84fd30dc899c85109d82a3de7d9e66b3b73d..0000000000000000000000000000000000000000
--- a/packages/kokkos/tpls/desul/include/desul/atomics/GCC.hpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
-Copyright (c) 2019, Lawrence Livermore National Security, LLC
-and DESUL project contributors. See the COPYRIGHT file for details.
-Source: https://github.com/desul/desul
-
-SPDX-License-Identifier: (BSD-3-Clause)
-*/
-#ifndef DESUL_ATOMICS_GCC_HPP_
-#define DESUL_ATOMICS_GCC_HPP_
-
-#ifdef DESUL_HAVE_GCC_ATOMICS
-
-#include <type_traits>
-/*
-Built - in Function : type __atomic_add_fetch(type * ptr, type val, int memorder)
-Built - in Function : type __atomic_sub_fetch(type * ptr, type val, int memorder)
-Built - in Function : type __atomic_and_fetch(type * ptr, type val, int memorder)
-Built - in Function : type __atomic_xor_fetch(type * ptr, type val, int memorder)
-Built - in Function : type __atomic_or_fetch(type * ptr, type val, int memorder)
-Built - in Function : type __atomic_nand_fetch(type * ptr, type val, int memorder)
-*/
-
-#define DESUL_GCC_INTEGRAL_OP_ATOMICS(MEMORY_ORDER, MEMORY_SCOPE)                 \
-  template <typename T>                                                           \
-  typename std::enable_if<std::is_integral<T>::value, T>::type atomic_fetch_add(  \
-      T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       \
-    return __atomic_fetch_add(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value);  \
-  }                                                                               \
-  template <typename T>                                                           \
-  typename std::enable_if<std::is_integral<T>::value, T>::type atomic_fetch_sub(  \
-      T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       \
-    return __atomic_fetch_sub(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value);  \
-  }                                                                               \
-  template <typename T>                                                           \
-  typename std::enable_if<std::is_integral<T>::value, T>::type atomic_fetch_and(  \
-      T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       \
-    return __atomic_fetch_and(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value);  \
-  }                                                                               \
-  template <typename T>                                                           \
-  typename std::enable_if<std::is_integral<T>::value, T>::type atomic_fetch_or(   \
-      T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       \
-    return __atomic_fetch_or(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value);   \
-  }                                                                               \
-  template <typename T>                                                           \
-  typename std::enable_if<std::is_integral<T>::value, T>::type atomic_fetch_xor(  \
-      T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       \
-    return __atomic_fetch_xor(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value);  \
-  }                                                                               \
-  template <typename T>                                                           \
-  typename std::enable_if<std::is_integral<T>::value, T>::type atomic_fetch_nand( \
-      T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       \
-    return __atomic_fetch_nand(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value); \
-  }                                                                               \
-  template <typename T>                                                           \
-  typename std::enable_if<std::is_integral<T>::value, T>::type atomic_add_fetch(  \
-      T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       \
-    return __atomic_add_fetch(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value);  \
-  }                                                                               \
-  template <typename T>                                                           \
-  typename std::enable_if<std::is_integral<T>::value, T>::type atomic_sub_fetch(  \
-      T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       \
-    return __atomic_sub_fetch(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value);  \
-  }                                                                               \
-  template <typename T>                                                           \
-  typename std::enable_if<std::is_integral<T>::value, T>::type atomic_and_fetch(  \
-      T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       \
-    return __atomic_and_fetch(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value);  \
-  }                                                                               \
-  template <typename T>                                                           \
-  typename std::enable_if<std::is_integral<T>::value, T>::type atomic_or_fetch(   \
-      T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       \
-    return __atomic_or_fetch(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value);   \
-  }                                                                               \
-  template <typename T>                                                           \
-  typename std::enable_if<std::is_integral<T>::value, T>::type atomic_xor_fetch(  \
-      T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       \
-    return __atomic_xor_fetch(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value);  \
-  }                                                                               \
-  template <typename T>                                                           \
-  typename std::enable_if<std::is_integral<T>::value, T>::type atomic_nand_fetch( \
-      T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       \
-    return __atomic_nand_fetch(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value); \
-  }
-
-namespace desul {
-DESUL_GCC_INTEGRAL_OP_ATOMICS(MemoryOrderRelaxed, MemoryScopeNode)
-DESUL_GCC_INTEGRAL_OP_ATOMICS(MemoryOrderRelaxed, MemoryScopeDevice)
-DESUL_GCC_INTEGRAL_OP_ATOMICS(MemoryOrderRelaxed, MemoryScopeCore)
-DESUL_GCC_INTEGRAL_OP_ATOMICS(MemoryOrderSeqCst, MemoryScopeNode)
-DESUL_GCC_INTEGRAL_OP_ATOMICS(MemoryOrderSeqCst, MemoryScopeDevice)
-DESUL_GCC_INTEGRAL_OP_ATOMICS(MemoryOrderSeqCst, MemoryScopeCore)
-
-template <typename T, class MemoryOrder, class MemoryScope>
-std::enable_if_t<!Impl::atomic_exchange_available_gcc<T>::value, T> atomic_exchange(
-    T* const dest,
-    Impl::dont_deduce_this_parameter_t<const T> val,
-    MemoryOrder /*order*/,
-    MemoryScope scope) {
-  // Acquire a lock for the address
-  // clang-format off
-  while (!Impl::lock_address((void*)dest, scope)) {}
-  // clang-format on
-
-  atomic_thread_fence(MemoryOrderAcquire(), scope);
-  T return_val = *dest;
-  *dest = val;
-  atomic_thread_fence(MemoryOrderRelease(), scope);
-  Impl::unlock_address((void*)dest, scope);
-  return return_val;
-}
-
-template <typename T, class MemoryOrder, class MemoryScope>
-std::enable_if_t<!Impl::atomic_exchange_available_gcc<T>::value, T>
-atomic_compare_exchange(T* const dest,
-                        Impl::dont_deduce_this_parameter_t<const T> compare,
-                        Impl::dont_deduce_this_parameter_t<const T> val,
-                        MemoryOrder /*order*/,
-                        MemoryScope scope) {
-  // Acquire a lock for the address
-  // clang-format off
-  while (!Impl::lock_address((void*)dest, scope)) {}
-  // clang-format on
-
-  atomic_thread_fence(MemoryOrderAcquire(), scope);
-  T return_val = *dest;
-  if (return_val == compare) {
-    *dest = val;
-    atomic_thread_fence(MemoryOrderRelease(), scope);
-  }
-  Impl::unlock_address((void*)dest, scope);
-  return return_val;
-}
-}  // namespace desul
-#endif
-#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Generic.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Generic.hpp
index 1fffd3b2931c3f78ee6ca5911cdff31b55e9e566..fef10222e34ed056b89dc0cc8babfb91fd504d00 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/Generic.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Generic.hpp
@@ -8,718 +8,366 @@ SPDX-License-Identifier: (BSD-3-Clause)
 
 #ifndef DESUL_ATOMICS_GENERIC_HPP_
 #define DESUL_ATOMICS_GENERIC_HPP_
-
+#include <desul/atomics/Common.hpp>
+#include <desul/atomics/Compare_Exchange.hpp>
+#include <desul/atomics/Fetch_Op.hpp>
+#include <desul/atomics/Lock_Array.hpp>
+#include <desul/atomics/Macros.hpp>
+#include <desul/atomics/Thread_Fence.hpp>
 #include <type_traits>
-#if defined(__GNUC__) && (!defined(__clang__))
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wstrict-aliasing"
-#endif
-#include "desul/atomics/Common.hpp"
-#include "desul/atomics/Compare_Exchange.hpp"
-#include "desul/atomics/Lock_Array.hpp"
-#include "desul/atomics/Macros.hpp"
-// Combination operands to be used in an Compare and Exchange based atomic
-// operation
-namespace desul {
-namespace Impl {
-
-template <class Scalar1, class Scalar2>
-struct MaxOper {
-  DESUL_FORCEINLINE_FUNCTION
-  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) {
-    return (val1 > val2 ? val1 : val2);
-  }
-  DESUL_FORCEINLINE_FUNCTION
-  static constexpr bool check_early_exit(Scalar1 const& val1, Scalar2 const& val2) {
-    return val1 > val2;
-  }
-};
-
-template <class Scalar1, class Scalar2>
-struct MinOper {
-  DESUL_FORCEINLINE_FUNCTION
-  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) {
-    return (val1 < val2 ? val1 : val2);
-  }
-  DESUL_FORCEINLINE_FUNCTION
-  static constexpr bool check_early_exit(Scalar1 const& val1, Scalar2 const& val2) {
-    return val1 < val2;
-  }
-};
-
-template <typename Op, typename Scalar1, typename Scalar2, typename = bool>
-struct may_exit_early : std::false_type {};
-
-// This exit early optimization causes weird compiler errors with MSVC 2019
-#ifndef DESUL_HAVE_MSVC_ATOMICS
-template <typename Op, typename Scalar1, typename Scalar2>
-struct may_exit_early<Op,
-                      Scalar1,
-                      Scalar2,
-                      decltype(Op::check_early_exit(std::declval<Scalar1 const&>(),
-                                                    std::declval<Scalar2 const&>()))>
-    : std::true_type {};
-#endif
-
-template <typename Op, typename Scalar1, typename Scalar2>
-constexpr DESUL_FUNCTION
-    typename std::enable_if<may_exit_early<Op, Scalar1, Scalar2>::value, bool>::type
-    check_early_exit(Op const&, Scalar1 const& val1, Scalar2 const& val2) {
-  return Op::check_early_exit(val1, val2);
-}
-
-template <typename Op, typename Scalar1, typename Scalar2>
-constexpr DESUL_FUNCTION
-    typename std::enable_if<!may_exit_early<Op, Scalar1, Scalar2>::value, bool>::type
-    check_early_exit(Op const&, Scalar1 const&, Scalar2 const&) {
-  return false;
-}
-
-template <class Scalar1, class Scalar2>
-struct AddOper {
-  DESUL_FORCEINLINE_FUNCTION
-  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 + val2; }
-};
-
-template <class Scalar1, class Scalar2>
-struct SubOper {
-  DESUL_FORCEINLINE_FUNCTION
-  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 - val2; }
-};
-
-template <class Scalar1, class Scalar2>
-struct MulOper {
-  DESUL_FORCEINLINE_FUNCTION
-  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 * val2; }
-};
-
-template <class Scalar1, class Scalar2>
-struct DivOper {
-  DESUL_FORCEINLINE_FUNCTION
-  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 / val2; }
-};
-
-template <class Scalar1, class Scalar2>
-struct ModOper {
-  DESUL_FORCEINLINE_FUNCTION
-  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 % val2; }
-};
-
-template <class Scalar1, class Scalar2>
-struct AndOper {
-  DESUL_FORCEINLINE_FUNCTION
-  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 & val2; }
-};
-
-template <class Scalar1, class Scalar2>
-struct OrOper {
-  DESUL_FORCEINLINE_FUNCTION
-  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 | val2; }
-};
-
-template <class Scalar1, class Scalar2>
-struct XorOper {
-  DESUL_FORCEINLINE_FUNCTION
-  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 ^ val2; }
-};
-
-template <class Scalar1, class Scalar2>
-struct NandOper {
-  DESUL_FORCEINLINE_FUNCTION
-  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) {
-    return ~(val1 & val2);
-  }
-};
-
-template <class Scalar1, class Scalar2>
-struct LShiftOper {
-  DESUL_FORCEINLINE_FUNCTION
-  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) {
-    return val1 << val2;
-  }
-};
-
-template <class Scalar1, class Scalar2>
-struct RShiftOper {
-  DESUL_FORCEINLINE_FUNCTION
-  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) {
-    return val1 >> val2;
-  }
-};
-
-template <class Scalar1, class Scalar2>
-struct IncModOper {
-  DESUL_FORCEINLINE_FUNCTION
-  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) {
-    return ((val1 >= val2) ? Scalar1(0) : val1 + Scalar1(1));
-  }
-};
-
-template <class Scalar1, class Scalar2>
-struct DecModOper {
-  DESUL_FORCEINLINE_FUNCTION
-  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) {
-    return (((val1 == Scalar1(0)) | (val1 > val2)) ? val2 : (val1 - Scalar1(1)));
-  }
-};
-
-template <class Scalar1, class Scalar2>
-struct StoreOper {
-  DESUL_FORCEINLINE_FUNCTION
-  static Scalar1 apply(const Scalar1&, const Scalar2& val2) { return val2; }
-};
-
-template <class Scalar1, class Scalar2>
-struct LoadOper {
-  DESUL_FORCEINLINE_FUNCTION
-  static Scalar1 apply(const Scalar1& val1, const Scalar2&) { return val1; }
-};
-
-template <class Oper,
-          typename T,
-          class MemoryOrder,
-          class MemoryScope,
-          // equivalent to:
-          //   requires atomic_always_lock_free(sizeof(T))
-          std::enable_if_t<atomic_always_lock_free(sizeof(T)), int> = 0>
-DESUL_INLINE_FUNCTION T atomic_fetch_oper(const Oper& op,
-                                          T* const dest,
-                                          dont_deduce_this_parameter_t<const T> val,
-                                          MemoryOrder order,
-                                          MemoryScope scope) {
-  using cas_t = typename atomic_compare_exchange_type<sizeof(T)>::type;
-  cas_t oldval = reinterpret_cast<cas_t&>(*dest);
-  cas_t assume = oldval;
-
-  do {
-    if (Impl::check_early_exit(op, reinterpret_cast<T&>(oldval), val))
-      return reinterpret_cast<T&>(oldval);
-    assume = oldval;
-    T newval = op.apply(reinterpret_cast<T&>(assume), val);
-    oldval = desul::atomic_compare_exchange(reinterpret_cast<cas_t*>(dest),
-                                            assume,
-                                            reinterpret_cast<cas_t&>(newval),
-                                            order,
-                                            scope);
-  } while (assume != oldval);
-
-  return reinterpret_cast<T&>(oldval);
-}
-
-template <class Oper,
-          typename T,
-          class MemoryOrder,
-          class MemoryScope,
-          // equivalent to:
-          //   requires atomic_always_lock_free(sizeof(T))
-          std::enable_if_t<atomic_always_lock_free(sizeof(T)), int> = 0>
-DESUL_INLINE_FUNCTION T atomic_oper_fetch(const Oper& op,
-                                          T* const dest,
-                                          dont_deduce_this_parameter_t<const T> val,
-                                          MemoryOrder order,
-                                          MemoryScope scope) {
-  using cas_t = typename atomic_compare_exchange_type<sizeof(T)>::type;
-  cas_t oldval = reinterpret_cast<cas_t&>(*dest);
-  T newval = val;
-  cas_t assume = oldval;
-  do {
-    if (Impl::check_early_exit(op, reinterpret_cast<T&>(oldval), val))
-      return reinterpret_cast<T&>(oldval);
-    assume = oldval;
-    newval = op.apply(reinterpret_cast<T&>(assume), val);
-    oldval = desul::atomic_compare_exchange(reinterpret_cast<cas_t*>(dest),
-                                            assume,
-                                            reinterpret_cast<cas_t&>(newval),
-                                            order,
-                                            scope);
-  } while (assume != oldval);
-
-  return newval;
-}
-
-template <class Oper,
-          typename T,
-          class MemoryOrder,
-          class MemoryScope,
-          // equivalent to:
-          //   requires !atomic_always_lock_free(sizeof(T))
-          std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0>
-DESUL_INLINE_FUNCTION T atomic_fetch_oper(const Oper& op,
-                                          T* const dest,
-                                          dont_deduce_this_parameter_t<const T> val,
-                                          MemoryOrder /*order*/,
-                                          MemoryScope scope) {
-#if defined(DESUL_HAVE_FORWARD_PROGRESS)
-  // Acquire a lock for the address
-  while (!Impl::lock_address((void*)dest, scope)) {
-  }
 
-  atomic_thread_fence(MemoryOrderAcquire(), scope);
-  T return_val = *dest;
-  *dest = op.apply(return_val, val);
-  atomic_thread_fence(MemoryOrderRelease(), scope);
-  Impl::unlock_address((void*)dest, scope);
-  return return_val;
-#elif defined(DESUL_HAVE_GPU_LIKE_PROGRESS)
-  // This is a way to avoid dead lock in a warp or wave front
-  T return_val;
-  int done = 0;
-#ifdef __HIPCC__
-  unsigned long long int active = DESUL_IMPL_BALLOT_MASK(1);
-  unsigned long long int done_active = 0;
-  while (active != done_active) {
-    if (!done) {
-      if (Impl::lock_address_hip((void*)dest, scope)) {
-        atomic_thread_fence(MemoryOrderAcquire(), scope);
-        return_val = *dest;
-        *dest = op.apply(return_val, val);
-        atomic_thread_fence(MemoryOrderRelease(), scope);
-        Impl::unlock_address_hip((void*)dest, scope);
-        done = 1;
-      }
-    }
-    done_active = DESUL_IMPL_BALLOT_MASK(done);
-  }
-  return return_val;
-// FIXME_SYCL not implemented
-#elif defined(__SYCL_DEVICE_ONLY__)
-  (void)op;
-  (void)dest;
-  (void)scope;
-  (void)return_val;
-  (void)done;
-
-  assert(false);
-  return val;
-#else
-  unsigned int mask = DESUL_IMPL_ACTIVEMASK;
-  unsigned int active = DESUL_IMPL_BALLOT_MASK(mask, 1);
-  unsigned int done_active = 0;
-  while (active != done_active) {
-    if (!done) {
-      if (Impl::lock_address_cuda((void*)dest, scope)) {
-        atomic_thread_fence(MemoryOrderAcquire(), scope);
-        return_val = *dest;
-        *dest = op.apply(return_val, val);
-        atomic_thread_fence(MemoryOrderRelease(), scope);
-        Impl::unlock_address_cuda((void*)dest, scope);
-        done = 1;
-      }
-    }
-    done_active = DESUL_IMPL_BALLOT_MASK(mask, done);
-  }
-  return return_val;
-#endif
-#else
-  static_assert(false, "Unimplemented lock based atomic\n");
-  return val;
-#endif
-}
-
-template <class Oper,
-          typename T,
-          class MemoryOrder,
-          class MemoryScope,
-          // equivalent to:
-          //   requires !atomic_always_lock_free(sizeof(T))
-          std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0>
-DESUL_INLINE_FUNCTION T atomic_oper_fetch(const Oper& op,
-                                          T* const dest,
-                                          dont_deduce_this_parameter_t<const T> val,
-                                          MemoryOrder /*order*/,
-                                          MemoryScope scope) {
-#if defined(DESUL_HAVE_FORWARD_PROGRESS)
-  // Acquire a lock for the address
-  while (!Impl::lock_address((void*)dest, scope)) {
-  }
+namespace desul {
 
-  atomic_thread_fence(MemoryOrderAcquire(), scope);
-  T return_val = op.apply(*dest, val);
-  *dest = return_val;
-  atomic_thread_fence(MemoryOrderRelease(), scope);
-  Impl::unlock_address((void*)dest, scope);
-  return return_val;
-#elif defined(DESUL_HAVE_GPU_LIKE_PROGRESS)
-  // This is a way to avoid dead lock in a warp or wave front
-  T return_val;
-  int done = 0;
-#ifdef __HIPCC__
-  unsigned long long int active = DESUL_IMPL_BALLOT_MASK(1);
-  unsigned long long int done_active = 0;
-  while (active != done_active) {
-    if (!done) {
-      if (Impl::lock_address_hip((void*)dest, scope)) {
-        atomic_thread_fence(MemoryOrderAcquire(), scope);
-        return_val = op.apply(*dest, val);
-        *dest = return_val;
-        atomic_thread_fence(MemoryOrderRelease(), scope);
-        Impl::unlock_address_hip((void*)dest, scope);
-        done = 1;
-      }
-    }
-    done_active = DESUL_IMPL_BALLOT_MASK(done);
-  }
-  return return_val;
-  // FIXME_SYCL not implemented
-#elif defined(__SYCL_DEVICE_ONLY__)
-  (void)op;
-  (void)dest;
-  (void)scope;
-  (void)done;
-
-  assert(false);
-  return val;
-#else
-  unsigned int mask = DESUL_IMPL_ACTIVEMASK;
-  unsigned int active = DESUL_IMPL_BALLOT_MASK(mask, 1);
-  unsigned int done_active = 0;
-  while (active != done_active) {
-    if (!done) {
-      if (Impl::lock_address_cuda((void*)dest, scope)) {
-        atomic_thread_fence(MemoryOrderAcquire(), scope);
-        return_val = op.apply(*dest, val);
-        *dest = return_val;
-        atomic_thread_fence(MemoryOrderRelease(), scope);
-        Impl::unlock_address_cuda((void*)dest, scope);
-        done = 1;
-      }
-    }
-    done_active = DESUL_IMPL_BALLOT_MASK(mask, done);
-  }
-  return return_val;
-#endif
-#else
-  static_assert(false, "Unimplemented lock based atomic\n");
-  return val;
-#endif
+template <class MemoryOrder, class MemoryScope>
+DESUL_INLINE_FUNCTION void atomic_thread_fence(MemoryOrder order, MemoryScope scope) {
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_thread_fence(order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_thread_fence(order, scope);)
 }
-
-template <class Oper, typename T, class MemoryOrder>
-DESUL_INLINE_FUNCTION T atomic_fetch_oper(const Oper& op,
-                                          T* const dest,
-                                          dont_deduce_this_parameter_t<const T> val,
-                                          MemoryOrder /*order*/,
-                                          MemoryScopeCaller /*scope*/) {
-  T oldval = *dest;
-  *dest = op.apply(oldval, val);
-  return oldval;
+template <class T, class MemoryOrder, class MemoryScope>
+DESUL_INLINE_FUNCTION T
+atomic_exchange(T* dest, T val, MemoryOrder order, MemoryScope scope) {
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_exchange(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_exchange(dest, val, order, scope);)
 }
 
-template <class Oper, typename T, class MemoryOrder>
-DESUL_INLINE_FUNCTION T atomic_oper_fetch(const Oper& op,
-                                          T* const dest,
-                                          dont_deduce_this_parameter_t<const T> val,
-                                          MemoryOrder /*order*/,
-                                          MemoryScopeCaller /*scope*/) {
-  T oldval = *dest;
-  T newval = op.apply(oldval, val);
-  *dest = newval;
-  return newval;
+template <class T, class MemoryOrder, class MemoryScope>
+DESUL_INLINE_FUNCTION T
+atomic_compare_exchange(T* dest, T cmp, T val, MemoryOrder order, MemoryScope scope) {
+  DESUL_IF_ON_DEVICE(
+      return Impl::device_atomic_compare_exchange(dest, cmp, val, order, scope);)
+  DESUL_IF_ON_HOST(
+      return Impl::host_atomic_compare_exchange(dest, cmp, val, order, scope);)
 }
 
-}  // namespace Impl
-}  // namespace desul
-
-namespace desul {
-
 // Fetch_Oper atomics: return value before operation
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_fetch_add(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_fetch_oper(Impl::AddOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_add(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_add(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_fetch_sub(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_fetch_oper(Impl::SubOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_sub(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_sub(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_fetch_max(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_fetch_oper(Impl::MaxOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_max(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_max(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_fetch_min(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_fetch_oper(Impl::MinOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_min(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_min(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_fetch_mul(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_fetch_oper(Impl::MulOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_mul(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_mul(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_fetch_div(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_fetch_oper(Impl::DivOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_div(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_div(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_fetch_mod(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_fetch_oper(Impl::ModOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_mod(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_mod(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_fetch_and(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_fetch_oper(Impl::AndOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_and(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_and(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_fetch_or(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_fetch_oper(Impl::OrOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_or(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_or(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_fetch_xor(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_fetch_oper(Impl::XorOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_xor(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_xor(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_fetch_nand(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_fetch_oper(Impl::NandOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_nand(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_nand(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T atomic_fetch_lshift(T* const dest,
                                             const unsigned int val,
                                             MemoryOrder order,
                                             MemoryScope scope) {
-  return Impl::atomic_fetch_oper(
-      Impl::LShiftOper<T, const unsigned int>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_lshift(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_lshift(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T atomic_fetch_rshift(T* const dest,
                                             const unsigned int val,
                                             MemoryOrder order,
                                             MemoryScope scope) {
-  return Impl::atomic_fetch_oper(
-      Impl::RShiftOper<T, const unsigned int>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_rshift(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_rshift(dest, val, order, scope);)
 }
 
 // Oper Fetch atomics: return value after operation
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_add_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_oper_fetch(Impl::AddOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_add_fetch(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_add_fetch(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_sub_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_oper_fetch(Impl::SubOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_sub_fetch(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_sub_fetch(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_max_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_oper_fetch(Impl::MaxOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_max_fetch(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_max_fetch(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_min_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_oper_fetch(Impl::MinOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_min_fetch(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_min_fetch(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_mul_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_oper_fetch(Impl::MulOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_mul_fetch(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_mul_fetch(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_div_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_oper_fetch(Impl::DivOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_div_fetch(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_div_fetch(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_mod_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_oper_fetch(Impl::ModOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_mod_fetch(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_mod_fetch(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_and_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_oper_fetch(Impl::AndOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_and_fetch(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_and_fetch(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_or_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_oper_fetch(Impl::OrOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_or_fetch(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_or_fetch(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_xor_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_oper_fetch(Impl::XorOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_xor_fetch(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_xor_fetch(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_nand_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) {
-  return Impl::atomic_oper_fetch(Impl::NandOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_nand_fetch(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_nand_fetch(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T atomic_lshift_fetch(T* const dest,
                                             const unsigned int val,
                                             MemoryOrder order,
                                             MemoryScope scope) {
-  return Impl::atomic_oper_fetch(
-      Impl::LShiftOper<T, const unsigned int>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_lshift_fetch(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_lshift_fetch(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T atomic_rshift_fetch(T* const dest,
                                             const unsigned int val,
                                             MemoryOrder order,
                                             MemoryScope scope) {
-  return Impl::atomic_oper_fetch(
-      Impl::RShiftOper<T, const unsigned int>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_rshift_fetch(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_rshift_fetch(dest, val, order, scope);)
 }
 
 // Other atomics
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T atomic_load(const T* const dest,
                                     MemoryOrder order,
                                     MemoryScope scope) {
-  return Impl::atomic_fetch_oper(
-      Impl::LoadOper<T, const T>(), const_cast<T*>(dest), T(), order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_load(dest, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_load(dest, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION void atomic_store(T* const dest,
                                         const T val,
                                         MemoryOrder order,
                                         MemoryScope scope) {
-  (void)Impl::atomic_fetch_oper(Impl::StoreOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_store(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_store(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION void atomic_add(T* const dest,
                                       const T val,
                                       MemoryOrder order,
                                       MemoryScope scope) {
-  (void)atomic_fetch_add(dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_add(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_add(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION void atomic_sub(T* const dest,
                                       const T val,
                                       MemoryOrder order,
                                       MemoryScope scope) {
-  (void)atomic_fetch_sub(dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_sub(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_sub(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION void atomic_mul(T* const dest,
                                       const T val,
                                       MemoryOrder order,
                                       MemoryScope scope) {
-  (void)atomic_fetch_mul(dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_mul(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_mul(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION void atomic_div(T* const dest,
                                       const T val,
                                       MemoryOrder order,
                                       MemoryScope scope) {
-  (void)atomic_fetch_div(dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_div(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_div(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION void atomic_min(T* const dest,
                                       const T val,
                                       MemoryOrder order,
                                       MemoryScope scope) {
-  (void)atomic_fetch_min(dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_min(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_min(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION void atomic_max(T* const dest,
                                       const T val,
                                       MemoryOrder order,
                                       MemoryScope scope) {
-  (void)atomic_fetch_max(dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_max(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_max(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T atomic_inc_fetch(T* const dest,
                                          MemoryOrder order,
                                          MemoryScope scope) {
-  return atomic_add_fetch(dest, T(1), order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_inc_fetch(dest, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_inc_fetch(dest, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T atomic_dec_fetch(T* const dest,
                                          MemoryOrder order,
                                          MemoryScope scope) {
-  return atomic_sub_fetch(dest, T(1), order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_dec_fetch(dest, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_dec_fetch(dest, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T atomic_fetch_inc(T* const dest,
                                          MemoryOrder order,
                                          MemoryScope scope) {
-  return atomic_fetch_add(dest, T(1), order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_inc(dest, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_inc(dest, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_fetch_inc_mod(T* const dest, T val, MemoryOrder order, MemoryScope scope) {
-  static_assert(std::is_unsigned<T>::value,
-                "Signed types not supported by atomic_fetch_inc_mod.");
-  return Impl::atomic_fetch_oper(
-      Impl::IncModOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_inc_mod(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_inc_mod(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T atomic_fetch_dec(T* const dest,
                                          MemoryOrder order,
                                          MemoryScope scope) {
-  return atomic_fetch_sub(dest, T(1), order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_dec(dest, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_dec(dest, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION T
 atomic_fetch_dec_mod(T* const dest, T val, MemoryOrder order, MemoryScope scope) {
-  static_assert(std::is_unsigned<T>::value,
-                "Signed types not supported by atomic_fetch_dec_mod.");
-  return Impl::atomic_fetch_oper(
-      Impl::DecModOper<T, const T>(), dest, val, order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_dec_mod(dest, val, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_dec_mod(dest, val, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION void atomic_inc(T* const dest,
                                       MemoryOrder order,
                                       MemoryScope scope) {
-  return atomic_add(dest, T(1), order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_inc(dest, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_inc(dest, order, scope);)
 }
 
-template <typename T, class MemoryOrder, class MemoryScope>
+template <class T, class MemoryOrder, class MemoryScope>
 DESUL_INLINE_FUNCTION void atomic_dec(T* const dest,
                                       MemoryOrder order,
                                       MemoryScope scope) {
-  return atomic_sub(dest, T(1), order, scope);
+  DESUL_IF_ON_DEVICE(return Impl::device_atomic_dec(dest, order, scope);)
+  DESUL_IF_ON_HOST(return Impl::host_atomic_dec(dest, order, scope);)
 }
 
 // FIXME
-template <typename T,
+template <class T,
           class SuccessMemoryOrder,
           class FailureMemoryOrder,
           class MemoryScope>
@@ -739,7 +387,7 @@ DESUL_INLINE_FUNCTION bool atomic_compare_exchange_strong(
   }
 }
 
-template <typename T,
+template <class T,
           class SuccessMemoryOrder,
           class FailureMemoryOrder,
           class MemoryScope>
@@ -755,12 +403,4 @@ DESUL_INLINE_FUNCTION bool atomic_compare_exchange_weak(T* const dest,
 
 }  // namespace desul
 
-#include <desul/atomics/CUDA.hpp>
-#include <desul/atomics/GCC.hpp>
-#include <desul/atomics/HIP.hpp>
-#include <desul/atomics/OpenMP.hpp>
-#include <desul/atomics/SYCL.hpp>
-#if defined(__GNUC__) && (!defined(__clang__))
-#pragma GCC diagnostic pop
-#endif
 #endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/HIP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/HIP.hpp
deleted file mode 100644
index e51406e54dfd8661e9b8ec9cdfed5e3e293f00d7..0000000000000000000000000000000000000000
--- a/packages/kokkos/tpls/desul/include/desul/atomics/HIP.hpp
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
-Copyright (c) 2019, Lawrence Livermore National Security, LLC
-and DESUL project contributors. See the COPYRIGHT file for details.
-Source: https://github.com/desul/desul
-
-SPDX-License-Identifier: (BSD-3-Clause)
-*/
-#ifndef DESUL_ATOMICS_HIP_HPP_
-#define DESUL_ATOMICS_HIP_HPP_
-
-#ifdef __HIP_DEVICE_COMPILE__
-namespace desul {
-
-// header file is organized as follows:
-//   1/ device-side overload set from atomic functions provided by HIP
-//   2/ fallback implementation on host-side for atomic functions defined in 1/ that are
-//      not included in the GCC overload set
-//   3/ fallback implementation on device-side for atomic functions from the GCC
-//      overload set that are not defined in 1/
-
-// clang-format off
-inline __device__                int atomic_fetch_add(               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); }
-inline __device__       unsigned int atomic_fetch_add(      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); }
-inline __device__ unsigned long long atomic_fetch_add(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); }
-inline __device__              float atomic_fetch_add(             float* ptr,              float val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); }
-inline __device__             double atomic_fetch_add(            double* ptr,             double val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); }
-
-inline __device__                int atomic_fetch_sub(               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr, val); }
-inline __device__       unsigned int atomic_fetch_sub(      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr, val); }
-inline __device__ unsigned long long atomic_fetch_sub(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -val); }
-inline __device__              float atomic_fetch_sub(             float* ptr,              float val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -val); }
-inline __device__             double atomic_fetch_sub(            double* ptr,             double val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -val); }
-
-inline __device__                int atomic_fetch_min(               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMin(ptr, val); }
-inline __device__       unsigned int atomic_fetch_min(      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMin(ptr, val); }
-inline __device__ unsigned long long atomic_fetch_min(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMin(ptr, val); }
-
-inline __device__                int atomic_fetch_max(               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMax(ptr, val); }
-inline __device__       unsigned int atomic_fetch_max(      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMax(ptr, val); }
-inline __device__ unsigned long long atomic_fetch_max(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMax(ptr, val); }
-
-inline __device__                int atomic_fetch_and(               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAnd(ptr, val); }
-inline __device__       unsigned int atomic_fetch_and(      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAnd(ptr, val); }
-inline __device__ unsigned long long atomic_fetch_and(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAnd(ptr, val); }
-
-inline __device__                int atomic_fetch_or (               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicOr (ptr, val); }
-inline __device__       unsigned int atomic_fetch_or (      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicOr (ptr, val); }
-inline __device__ unsigned long long atomic_fetch_or (unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicOr (ptr, val); }
-
-inline __device__                int atomic_fetch_xor(               int* ptr,                int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicXor(ptr, val); }
-inline __device__       unsigned int atomic_fetch_xor(      unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicXor(ptr, val); }
-inline __device__ unsigned long long atomic_fetch_xor(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicXor(ptr, val); }
-
-inline __device__                int atomic_fetch_inc(               int* ptr,                         MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, 1   ); }
-inline __device__       unsigned int atomic_fetch_inc(      unsigned int* ptr,                         MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, 1u  ); }
-inline __device__ unsigned long long atomic_fetch_inc(unsigned long long* ptr,                         MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, 1ull); }
-
-inline __device__                int atomic_fetch_dec(               int* ptr,                         MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr, 1   ); }
-inline __device__       unsigned int atomic_fetch_dec(      unsigned int* ptr,                         MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr, 1u  ); }
-inline __device__ unsigned long long atomic_fetch_dec(unsigned long long* ptr,                         MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -1  ); }
-
-inline __device__       unsigned int atomic_fetch_inc_mod(  unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicInc(ptr, val); }
-inline __device__       unsigned int atomic_fetch_dec_mod(  unsigned int* ptr,       unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicDec(ptr, val); }
-// clang-format on
-
-#define DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, TYPE)                         \
-  template <class MemoryOrder>                                                  \
-  inline __device__ TYPE atomic_fetch_##OP(                                     \
-      TYPE* ptr, TYPE val, MemoryOrder, MemoryScopeDevice) {                    \
-    __threadfence();                                                            \
-    TYPE return_val =                                                           \
-        atomic_fetch_##OP(ptr, val, MemoryOrderRelaxed(), MemoryScopeDevice()); \
-    __threadfence();                                                            \
-    return return_val;                                                          \
-  }                                                                             \
-  template <class MemoryOrder>                                                  \
-  inline __device__ TYPE atomic_fetch_##OP(                                     \
-      TYPE* ptr, TYPE val, MemoryOrder, MemoryScopeCore) {                      \
-    return atomic_fetch_##OP(ptr, val, MemoryOrder(), MemoryScopeDevice());     \
-  }
-
-#define DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(OP) \
-  DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, int)           \
-  DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, unsigned int)  \
-  DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, unsigned long long)
-
-#define DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(OP) \
-  DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, float)               \
-  DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, double)
-
-DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(min)
-DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(max)
-DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(and)
-DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(or)
-DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(xor)
-
-DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(add)
-DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(add)
-DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(sub)
-DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(sub)
-
-DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(inc)
-DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(dec)
-
-DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(inc_mod, unsigned int)
-DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(dec_mod, unsigned int)
-
-#undef DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT
-#undef DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL
-#undef DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP
-
-// 2/ host-side fallback implementation for atomic functions not provided by GCC
-
-#define DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN(OP_LOWERCASE, OP_PASCAL_CASE, TYPE) \
-  template <class MemoryOrder>                                                      \
-  inline __host__ TYPE atomic_fetch_##OP_LOWERCASE(                                 \
-      TYPE* ptr, TYPE val, MemoryOrder order, MemoryScopeDevice scope) {            \
-    return Impl::atomic_fetch_oper(                                                 \
-        Impl::OP_PASCAL_CASE##Oper<TYPE, const TYPE>(), ptr, val, order, scope);    \
-  }                                                                                 \
-  template <class MemoryOrder>                                                      \
-  inline __host__ TYPE atomic_fetch_##OP_LOWERCASE(                                 \
-      TYPE* ptr, TYPE val, MemoryOrder order, MemoryScopeCore scope) {              \
-    return Impl::atomic_fetch_oper(                                                 \
-        Impl::OP_PASCAL_CASE##Oper<TYPE, const TYPE>(), ptr, val, order, scope);    \
-  }
-
-#define DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN_INTEGRAL(OP_LOWERCASE, OP_PASCAL_CASE) \
-  DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN(OP_LOWERCASE, OP_PASCAL_CASE, int)           \
-  DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN(OP_LOWERCASE, OP_PASCAL_CASE, unsigned int)  \
-  DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN(                                             \
-      OP_LOWERCASE, OP_PASCAL_CASE, unsigned long long)
-
-#define DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN_FLOATING_POINT(OP_LOWERCASE,   \
-                                                               OP_PASCAL_CASE) \
-  DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN(OP_LOWERCASE, OP_PASCAL_CASE, float) \
-  DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN(OP_LOWERCASE, OP_PASCAL_CASE, double)
-
-DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN_INTEGRAL(min, Min)
-DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN_INTEGRAL(max, Max)
-DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN_FLOATING_POINT(add, Add)
-DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN_FLOATING_POINT(sub, Sub)
-
-DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN(inc_mod, IncMod, unsigned int)
-DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN(dec_mod, DecMod, unsigned int)
-
-#undef DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN_FLOATING_POINT
-#undef DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN_INTEGRAL
-#undef DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN
-
-#define DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_INCREMENT_DECREMENT(TYPE) \
-  template <class MemoryOrder>                                        \
-  inline __host__ TYPE atomic_fetch_inc(                              \
-      TYPE* ptr, MemoryOrder order, MemoryScopeDevice scope) {        \
-    return atomic_fetch_add(ptr, static_cast<TYPE>(1), order, scope); \
-  }                                                                   \
-  template <class MemoryOrder>                                        \
-  inline __host__ TYPE atomic_fetch_inc(                              \
-      TYPE* ptr, MemoryOrder order, MemoryScopeCore scope) {          \
-    return atomic_fetch_add(ptr, static_cast<TYPE>(1), order, scope); \
-  }                                                                   \
-  template <class MemoryOrder>                                        \
-  inline __host__ TYPE atomic_fetch_dec(                              \
-      TYPE* ptr, MemoryOrder order, MemoryScopeDevice scope) {        \
-    return atomic_fetch_sub(ptr, static_cast<TYPE>(1), order, scope); \
-  }                                                                   \
-  template <class MemoryOrder>                                        \
-  inline __host__ TYPE atomic_fetch_dec(                              \
-      TYPE* ptr, MemoryOrder order, MemoryScopeCore scope) {          \
-    return atomic_fetch_sub(ptr, static_cast<TYPE>(1), order, scope); \
-  }
-
-DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_INCREMENT_DECREMENT(int)
-DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_INCREMENT_DECREMENT(unsigned int)
-DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_INCREMENT_DECREMENT(unsigned long long)
-
-#undef DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_INCREMENT_DECREMENT
-
-// 3/ device-side fallback implementation for atomic functions defined in GCC overload
-// set
-
-#define DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN_ORDER_SCOPE(             \
-    OP_LOWERCASE, OP_PASCAL_CASE, MEMORY_ORDER, MEMORY_SCOPE)              \
-  template <class T>                                                       \
-  inline __device__ std::enable_if_t<std::is_integral<T>::value, T>        \
-      atomic_##OP_LOWERCASE##_fetch(                                       \
-          T* ptr, T val, MEMORY_ORDER order, MEMORY_SCOPE scope) {         \
-    return Impl::atomic_oper_fetch(                                        \
-        Impl::OP_PASCAL_CASE##Oper<T, const T>(), ptr, val, order, scope); \
-  }                                                                        \
-  template <class T>                                                       \
-  inline __device__ std::enable_if_t<std::is_integral<T>::value, T>        \
-      atomic_fetch_##OP_LOWERCASE(                                         \
-          T* ptr, T val, MEMORY_ORDER order, MEMORY_SCOPE scope) {         \
-    return Impl::atomic_fetch_oper(                                        \
-        Impl::OP_PASCAL_CASE##Oper<T, const T>(), ptr, val, order, scope); \
-  }
-
-// clang-format off
-#define DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN(OP_LOWERCASE, OP_PASCAL_CASE) \
-  DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN_ORDER_SCOPE(OP_LOWERCASE, OP_PASCAL_CASE, MemoryOrderRelaxed, MemoryScopeNode) \
-  DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN_ORDER_SCOPE(OP_LOWERCASE, OP_PASCAL_CASE, MemoryOrderRelaxed, MemoryScopeDevice) \
-  DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN_ORDER_SCOPE(OP_LOWERCASE, OP_PASCAL_CASE, MemoryOrderRelaxed, MemoryScopeCore) \
-  DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN_ORDER_SCOPE(OP_LOWERCASE, OP_PASCAL_CASE, MemoryOrderSeqCst,  MemoryScopeNode) \
-  DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN_ORDER_SCOPE(OP_LOWERCASE, OP_PASCAL_CASE, MemoryOrderSeqCst,  MemoryScopeDevice) \
-  DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN_ORDER_SCOPE(OP_LOWERCASE, OP_PASCAL_CASE, MemoryOrderSeqCst,  MemoryScopeCore)
-// clang-format on
-
-DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN(add, Add)
-DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN(sub, Sub)
-DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN(and, And)
-DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN(or, Or)
-DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN(xor, Xor)
-DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN(nand, Nand)
-
-#undef DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN
-#undef DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN_ORDER_SCOPE
-
-}  // namespace desul
-
-#endif
-#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array.hpp
index 6b2d4e74bd3cf28c9d5c8389e2153758f097e3b1..a5af4c48c2eb0a652548c53c9bc4a49f791a952a 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array.hpp
@@ -9,19 +9,24 @@ SPDX-License-Identifier: (BSD-3-Clause)
 #ifndef DESUL_ATOMICS_LOCK_ARRAY_HPP_
 #define DESUL_ATOMICS_LOCK_ARRAY_HPP_
 
-#include "desul/atomics/Compare_Exchange.hpp"
-#include "desul/atomics/Lock_Array_Cuda.hpp"
-#include "desul/atomics/Lock_Array_HIP.hpp"
-#include "desul/atomics/Macros.hpp"
+#include <desul/atomics/Compare_Exchange.hpp>
+#include <desul/atomics/Macros.hpp>
+#ifdef DESUL_HAVE_CUDA_ATOMICS
+#include <desul/atomics/Lock_Array_CUDA.hpp>
+#endif
+#ifdef DESUL_HAVE_HIP_ATOMICS
+#include <desul/atomics/Lock_Array_HIP.hpp>
+#endif
 
 namespace desul {
 namespace Impl {
-struct host_locks__ {
+
+struct HostLocks {
   static constexpr uint32_t HOST_SPACE_ATOMIC_MASK = 0xFFFF;
   static constexpr uint32_t HOST_SPACE_ATOMIC_XOR_MASK = 0x5A39;
-  template <typename is_always_void = void>
+  template <class is_always_void = void>
   static int32_t* get_host_locks_() {
-    static int32_t HOST_SPACE_ATOMIC_LOCKS_DEVICE[HOST_SPACE_ATOMIC_MASK + 1] = {0};
+    static int32_t HOST_SPACE_ATOMIC_LOCKS_DEVICE[HOST_SPACE_ATOMIC_MASK + 1] = {};
     return HOST_SPACE_ATOMIC_LOCKS_DEVICE;
   }
   static inline int32_t* get_host_lock_(void* ptr) {
@@ -33,7 +38,7 @@ struct host_locks__ {
 inline void init_lock_arrays() {
   static bool is_initialized = false;
   if (!is_initialized) {
-    host_locks__::get_host_locks_();
+    HostLocks::get_host_locks_();
     is_initialized = true;
   }
 
@@ -55,17 +60,29 @@ inline void finalize_lock_arrays() {
   finalize_lock_arrays_hip();
 #endif
 }
-template <typename MemoryScope>
-inline bool lock_address(void* ptr, MemoryScope ms) {
-  return 0 ==
-         atomic_exchange(
-             host_locks__::get_host_lock_(ptr), int32_t(1), MemoryOrderSeqCst(), ms);
+
+inline void ensure_lock_arrays_on_device() {
+#ifdef DESUL_HAVE_CUDA_ATOMICS
+  ensure_cuda_lock_arrays_on_device();
+#endif
+
+#ifdef DESUL_HAVE_HIP_ATOMICS
+  DESUL_ENSURE_HIP_LOCK_ARRAYS_ON_DEVICE();
+#endif
 }
-template <typename MemoryScope>
+
+template <class MemoryScope>
+bool lock_address(void* ptr, MemoryScope ms) {
+  return 0 == atomic_exchange(
+                  HostLocks::get_host_lock_(ptr), int32_t(1), MemoryOrderSeqCst(), ms);
+}
+
+template <class MemoryScope>
 void unlock_address(void* ptr, MemoryScope ms) {
   (void)atomic_exchange(
-      host_locks__::get_host_lock_(ptr), int32_t(0), MemoryOrderSeqCst(), ms);
+      HostLocks::get_host_lock_(ptr), int32_t(0), MemoryOrderSeqCst(), ms);
 }
+
 }  // namespace Impl
 }  // namespace desul
 
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_CUDA.hpp
similarity index 75%
rename from packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp
rename to packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_CUDA.hpp
index 1815adb4a7621c8b4b3d93ac626c417f1c42644b..e0e4e129acc9f18e27393c82b2be6ab1154cc059 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_CUDA.hpp
@@ -19,14 +19,6 @@ SPDX-License-Identifier: (BSD-3-Clause)
 namespace desul {
 namespace Impl {
 
-#ifdef __CUDA_ARCH__
-#define DESUL_IMPL_BALLOT_MASK(m, x) __ballot_sync(m, x)
-#define DESUL_IMPL_ACTIVEMASK __activemask()
-#else
-#define DESUL_IMPL_BALLOT_MASK(m, x) m == 0 ? 0 : 1
-#define DESUL_IMPL_ACTIVEMASK 0
-#endif
-
 /// \brief This global variable in Host space is the central definition
 ///        of these arrays.
 extern int32_t* CUDA_SPACE_ATOMIC_LOCKS_DEVICE_h;
@@ -76,7 +68,7 @@ namespace Impl {
 /// instances in other translation units, we must update this CUDA global
 /// variable based on the Host global variable prior to running any kernels
 /// that will use it.
-/// That is the purpose of the KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE macro.
+/// That is the purpose of the ensure_cuda_lock_arrays_on_device function.
 __device__
 #ifdef __CUDACC_RDC__
     __constant__ extern
@@ -138,33 +130,42 @@ namespace {
 static int lock_array_copied = 0;
 inline int eliminate_warning_for_lock_array() { return lock_array_copied; }
 }  // namespace
+
+#ifdef __CUDACC_RDC__
+inline
+#else
+inline static
+#endif
+    void
+    copy_cuda_lock_arrays_to_device() {
+  if (lock_array_copied == 0) {
+    cudaMemcpyToSymbol(CUDA_SPACE_ATOMIC_LOCKS_DEVICE,
+                       &CUDA_SPACE_ATOMIC_LOCKS_DEVICE_h,
+                       sizeof(int32_t*));
+    cudaMemcpyToSymbol(CUDA_SPACE_ATOMIC_LOCKS_NODE,
+                       &CUDA_SPACE_ATOMIC_LOCKS_NODE_h,
+                       sizeof(int32_t*));
+  }
+  lock_array_copied = 1;
+}
+
 }  // namespace Impl
 }  // namespace desul
-/* It is critical that this code be a macro, so that it will
-   capture the right address for desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_DEVICE
-   putting this in an inline function will NOT do the right thing! */
-#define DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE()                       \
-  {                                                                        \
-    if (::desul::Impl::lock_array_copied == 0) {                           \
-      cudaMemcpyToSymbol(::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_DEVICE,    \
-                         &::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_DEVICE_h, \
-                         sizeof(int32_t*));                                \
-      cudaMemcpyToSymbol(::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_NODE,      \
-                         &::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_NODE_h,   \
-                         sizeof(int32_t*));                                \
-    }                                                                      \
-    ::desul::Impl::lock_array_copied = 1;                                  \
-  }
 
 #endif /* defined( __CUDACC__ ) */
 
 #endif /* defined( DESUL_HAVE_CUDA_ATOMICS ) */
 
+namespace desul {
+
 #if defined(__CUDACC_RDC__) || (!defined(__CUDACC__))
-#define DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE()
+inline void ensure_cuda_lock_arrays_on_device() {}
 #else
-#define DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() \
-  DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE()
+static inline void ensure_cuda_lock_arrays_on_device() {
+  Impl::copy_cuda_lock_arrays_to_device();
+}
 #endif
 
-#endif /* #ifndef KOKKOS_CUDA_LOCKS_HPP_ */
+}  // namespace desul
+
+#endif /* #ifndef DESUL_ATOMICS_LOCK_ARRAY_CUDA_HPP_ */
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_HIP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_HIP.hpp
index 7c843f23c9547db6dc818a6d762ac3d7fa2c58ca..1ab9544eb4ed71299d9dd4fb72cbed6f514370e8 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_HIP.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_HIP.hpp
@@ -9,24 +9,16 @@ SPDX-License-Identifier: (BSD-3-Clause)
 #ifndef DESUL_ATOMICS_LOCK_ARRAY_HIP_HPP_
 #define DESUL_ATOMICS_LOCK_ARRAY_HIP_HPP_
 
-#include "desul/atomics/Common.hpp"
-#include "desul/atomics/Macros.hpp"
-
-#ifdef DESUL_HAVE_HIP_ATOMICS
-
 #include <hip/hip_runtime.h>
 
 #include <cstdint>
 
+#include "desul/atomics/Common.hpp"
+#include "desul/atomics/Macros.hpp"
+
 namespace desul {
 namespace Impl {
 
-#ifdef __HIP_DEVICE_COMPILE__
-#define DESUL_IMPL_BALLOT_MASK(x) __ballot(x)
-#else
-#define DESUL_IMPL_BALLOT_MASK(x) 0
-#endif
-
 /**
  * \brief This global variable in Host space is the central definition of these
  * arrays.
@@ -161,8 +153,6 @@ inline int eliminate_warning_for_lock_array() { return lock_array_copied; }
     ::desul::Impl::lock_array_copied = 1;                                             \
   }
 
-#endif
-
 #if defined(DESUL_HIP_RDC) || (!defined(__HIPCC__))
 #define DESUL_ENSURE_HIP_LOCK_ARRAYS_ON_DEVICE()
 #else
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..e7c36673e282e5f8543ea3876eb8b649893d4e92
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op.hpp
@@ -0,0 +1,26 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_LOCK_BASED_FETCH_OP_HPP_
+#define DESUL_ATOMICS_LOCK_BASED_FETCH_OP_HPP_
+
+#include <desul/atomics/Macros.hpp>
+
+#ifdef DESUL_HAVE_CUDA_ATOMICS
+#include <desul/atomics/Lock_Based_Fetch_Op_CUDA.hpp>
+#endif
+#ifdef DESUL_HAVE_HIP_ATOMICS
+#include <desul/atomics/Lock_Based_Fetch_Op_HIP.hpp>
+#endif
+#ifdef DESUL_HAVE_SYCL_ATOMICS
+#include <desul/atomics/Lock_Based_Fetch_Op_Unimplemented.hpp>
+#endif
+
+#include <desul/atomics/Lock_Based_Fetch_Op_Host.hpp>
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_CUDA.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_CUDA.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..44d8149fcb1e2cec660eb4b18c8e42a0986797b2
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_CUDA.hpp
@@ -0,0 +1,91 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_LOCK_BASED_FETCH_OP_CUDA_HPP_
+#define DESUL_ATOMICS_LOCK_BASED_FETCH_OP_CUDA_HPP_
+
+#include <desul/atomics/Common.hpp>
+#include <desul/atomics/Lock_Array_CUDA.hpp>
+#include <desul/atomics/Thread_Fence_CUDA.hpp>
+#include <type_traits>
+
+namespace desul {
+namespace Impl {
+
+template <class Oper,
+          class T,
+          class MemoryOrder,
+          class MemoryScope,
+          // equivalent to:
+          //   requires !atomic_always_lock_free(sizeof(T))
+          std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0>
+__device__ T device_atomic_fetch_oper(const Oper& op,
+                                      T* const dest,
+                                      dont_deduce_this_parameter_t<const T> val,
+                                      MemoryOrder /*order*/,
+                                      MemoryScope scope) {
+  // This is a way to avoid deadlock in a warp or wave front
+  T return_val;
+  int done = 0;
+  unsigned int mask = __activemask();
+  unsigned int active = __ballot_sync(mask, 1);
+  unsigned int done_active = 0;
+  while (active != done_active) {
+    if (!done) {
+      if (lock_address_cuda((void*)dest, scope)) {
+        device_atomic_thread_fence(MemoryOrderAcquire(), scope);
+        return_val = *dest;
+        *dest = op.apply(return_val, val);
+        device_atomic_thread_fence(MemoryOrderRelease(), scope);
+        unlock_address_cuda((void*)dest, scope);
+        done = 1;
+      }
+    }
+    done_active = __ballot_sync(mask, done);
+  }
+  return return_val;
+}
+
+template <class Oper,
+          class T,
+          class MemoryOrder,
+          class MemoryScope,
+          // equivalent to:
+          //   requires !atomic_always_lock_free(sizeof(T))
+          std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0>
+__device__ T device_atomic_oper_fetch(const Oper& op,
+                                      T* const dest,
+                                      dont_deduce_this_parameter_t<const T> val,
+                                      MemoryOrder /*order*/,
+                                      MemoryScope scope) {
+  // This is a way to avoid deadlock in a warp or wave front
+  T return_val;
+  int done = 0;
+  unsigned int mask = __activemask();
+  unsigned int active = __ballot_sync(mask, 1);
+  unsigned int done_active = 0;
+  while (active != done_active) {
+    if (!done) {
+      if (lock_address_cuda((void*)dest, scope)) {
+        device_atomic_thread_fence(MemoryOrderAcquire(), scope);
+        return_val = op.apply(*dest, val);
+        *dest = return_val;
+        device_atomic_thread_fence(MemoryOrderRelease(), scope);
+        unlock_address_cuda((void*)dest, scope);
+        done = 1;
+      }
+    }
+    done_active = __ballot_sync(mask, done);
+  }
+  return return_val;
+}
+
+}  // namespace Impl
+}  // namespace desul
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_HIP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_HIP.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..2a50509550aa4b7728bda525c5dd49adf969a6b6
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_HIP.hpp
@@ -0,0 +1,88 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_LOCK_BASED_FETCH_OP_HIP_HPP_
+#define DESUL_ATOMICS_LOCK_BASED_FETCH_OP_HIP_HPP_
+
+#include <desul/atomics/Common.hpp>
+#include <desul/atomics/Lock_Array_HIP.hpp>
+#include <desul/atomics/Thread_Fence_HIP.hpp>
+#include <type_traits>
+
+namespace desul {
+namespace Impl {
+
+template <class Oper,
+          class T,
+          class MemoryOrder,
+          class MemoryScope,
+          // equivalent to:
+          //   requires !atomic_always_lock_free(sizeof(T))
+          std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0>
+__device__ T device_atomic_fetch_oper(const Oper& op,
+                                      T* const dest,
+                                      dont_deduce_this_parameter_t<const T> val,
+                                      MemoryOrder /*order*/,
+                                      MemoryScope scope) {
+  // This is a way to avoid deadlock in a warp or wave front
+  T return_val;
+  int done = 0;
+  unsigned long long int active = __ballot(1);
+  unsigned long long int done_active = 0;
+  while (active != done_active) {
+    if (!done) {
+      if (lock_address_hip((void*)dest, scope)) {
+        device_atomic_thread_fence(MemoryOrderAcquire(), scope);
+        return_val = *dest;
+        *dest = op.apply(return_val, val);
+        device_atomic_thread_fence(MemoryOrderRelease(), scope);
+        unlock_address_hip((void*)dest, scope);
+        done = 1;
+      }
+    }
+    done_active = __ballot(done);
+  }
+  return return_val;
+}
+
+template <class Oper,
+          class T,
+          class MemoryOrder,
+          class MemoryScope,
+          // equivalent to:
+          //   requires !atomic_always_lock_free(sizeof(T))
+          std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0>
+__device__ T device_atomic_oper_fetch(const Oper& op,
+                                      T* const dest,
+                                      dont_deduce_this_parameter_t<const T> val,
+                                      MemoryOrder /*order*/,
+                                      MemoryScope scope) {
+  // This is a way to avoid deadlock in a warp or wave front
+  T return_val;
+  int done = 0;
+  unsigned long long int active = __ballot(1);
+  unsigned long long int done_active = 0;
+  while (active != done_active) {
+    if (!done) {
+      if (lock_address_hip((void*)dest, scope)) {
+        device_atomic_thread_fence(MemoryOrderAcquire(), scope);
+        return_val = op.apply(*dest, val);
+        *dest = return_val;
+        device_atomic_thread_fence(MemoryOrderRelease(), scope);
+        unlock_address_hip((void*)dest, scope);
+        done = 1;
+      }
+    }
+    done_active = __ballot(done);
+  }
+  return return_val;
+}
+}  // namespace Impl
+}  // namespace desul
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_Host.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_Host.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..c0b0a49024c2560f2acfd2ce6d2760bab69f9a77
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_Host.hpp
@@ -0,0 +1,71 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_LOCK_BASED_FETCH_OP_HOST_HPP_
+#define DESUL_ATOMICS_LOCK_BASED_FETCH_OP_HOST_HPP_
+
+#include <desul/atomics/Common.hpp>
+#include <desul/atomics/Lock_Array.hpp>
+#include <desul/atomics/Thread_Fence.hpp>
+#include <type_traits>
+
+namespace desul {
+namespace Impl {
+
+template <class Oper,
+          class T,
+          class MemoryOrder,
+          class MemoryScope,
+          // equivalent to:
+          //   requires !atomic_always_lock_free(sizeof(T))
+          std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0>
+inline T host_atomic_fetch_oper(const Oper& op,
+                                T* const dest,
+                                dont_deduce_this_parameter_t<const T> val,
+                                MemoryOrder /*order*/,
+                                MemoryScope scope) {
+  // Acquire a lock for the address
+  while (!lock_address((void*)dest, scope)) {
+  }
+
+  host_atomic_thread_fence(MemoryOrderAcquire(), scope);
+  T return_val = *dest;
+  *dest = op.apply(return_val, val);
+  host_atomic_thread_fence(MemoryOrderRelease(), scope);
+  unlock_address((void*)dest, scope);
+  return return_val;
+}
+
+template <class Oper,
+          class T,
+          class MemoryOrder,
+          class MemoryScope,
+          // equivalent to:
+          //   requires !atomic_always_lock_free(sizeof(T))
+          std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0>
+inline T host_atomic_oper_fetch(const Oper& op,
+                                T* const dest,
+                                dont_deduce_this_parameter_t<const T> val,
+                                MemoryOrder /*order*/,
+                                MemoryScope scope) {
+  // Acquire a lock for the address
+  while (!lock_address((void*)dest, scope)) {
+  }
+
+  host_atomic_thread_fence(MemoryOrderAcquire(), scope);
+  T return_val = op.apply(*dest, val);
+  *dest = return_val;
+  host_atomic_thread_fence(MemoryOrderRelease(), scope);
+  unlock_address((void*)dest, scope);
+  return return_val;
+}
+
+}  // namespace Impl
+}  // namespace desul
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_Unimplemented.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_Unimplemented.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..b9f9fac5359ea9b2dce5cfaa1dbd81beb6f11352
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_Unimplemented.hpp
@@ -0,0 +1,55 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_LOCK_BASED_FETCH_OP_UNIMPLEMENTED_HPP_
+#define DESUL_ATOMICS_LOCK_BASED_FETCH_OP_UNIMPLEMENTED_HPP_
+
+#include <cassert>
+#include <desul/atomics/Common.hpp>
+#include <type_traits>
+
+namespace desul {
+namespace Impl {
+
+template <class Oper,
+          class T,
+          class MemoryOrder,
+          class MemoryScope,
+          // equivalent to:
+          //   requires !atomic_always_lock_free(sizeof(T))
+          std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0>
+DESUL_INLINE_FUNCTION T
+device_atomic_fetch_oper(const Oper& /*op*/,
+                         T* const /*dest*/,
+                         dont_deduce_this_parameter_t<const T> val,
+                         MemoryOrder /*order*/,
+                         MemoryScope /*scope*/) {
+  assert(false);
+  return val;  // FIXME not implemented
+}
+
+template <class Oper,
+          class T,
+          class MemoryOrder,
+          class MemoryScope,
+          // equivalent to:
+          //   requires !atomic_always_lock_free(sizeof(T))
+          std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0>
+DESUL_INLINE_FUNCTION T
+device_atomic_oper_fetch(const Oper& /*op*/,
+                         T* const /*dest*/,
+                         dont_deduce_this_parameter_t<const T> val,
+                         MemoryOrder /*order*/,
+                         MemoryScope /*scope*/) {
+  assert(false);
+  return val;  // FIXME not implemented
+}
+}  // namespace Impl
+}  // namespace desul
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Free_Fetch_Op.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Free_Fetch_Op.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..266642704410f7360bb5dc7e4c34990b75c4e8b4
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Free_Fetch_Op.hpp
@@ -0,0 +1,99 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_LOCK_FREE_FETCH_OP_HPP_
+#define DESUL_ATOMICS_LOCK_FREE_FETCH_OP_HPP_
+
+#include <desul/atomics/Common.hpp>
+#include <desul/atomics/Compare_Exchange.hpp>
+#include <type_traits>
+
+#if defined(__GNUC__) && (!defined(__clang__))
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstrict-aliasing"
+#endif
+
+namespace desul {
+namespace Impl {
+
+#define DESUL_IMPL_ATOMIC_FETCH_OPER(ANNOTATION, HOST_OR_DEVICE)                     \
+  template <class Oper,                                                              \
+            class T,                                                                 \
+            class MemoryOrder,                                                       \
+            class MemoryScope,                                                       \
+            std::enable_if_t<atomic_always_lock_free(sizeof(T)), int> = 0>           \
+  ANNOTATION T HOST_OR_DEVICE##_atomic_fetch_oper(                                   \
+      const Oper& op,                                                                \
+      T* const dest,                                                                 \
+      dont_deduce_this_parameter_t<const T> val,                                     \
+      MemoryOrder order,                                                             \
+      MemoryScope scope) {                                                           \
+    using cas_t = atomic_compare_exchange_t<T>;                                      \
+    cas_t oldval = reinterpret_cast<cas_t&>(*dest);                                  \
+    cas_t assume = oldval;                                                           \
+                                                                                     \
+    do {                                                                             \
+      if (check_early_exit(op, reinterpret_cast<T&>(oldval), val))                   \
+        return reinterpret_cast<T&>(oldval);                                         \
+      assume = oldval;                                                               \
+      T newval = op.apply(reinterpret_cast<T&>(assume), val);                        \
+      oldval =                                                                       \
+          HOST_OR_DEVICE##_atomic_compare_exchange(reinterpret_cast<cas_t*>(dest),   \
+                                                   assume,                           \
+                                                   reinterpret_cast<cas_t&>(newval), \
+                                                   order,                            \
+                                                   scope);                           \
+    } while (assume != oldval);                                                      \
+                                                                                     \
+    return reinterpret_cast<T&>(oldval);                                             \
+  }                                                                                  \
+                                                                                     \
+  template <class Oper,                                                              \
+            class T,                                                                 \
+            class MemoryOrder,                                                       \
+            class MemoryScope,                                                       \
+            std::enable_if_t<atomic_always_lock_free(sizeof(T)), int> = 0>           \
+  ANNOTATION T HOST_OR_DEVICE##_atomic_oper_fetch(                                   \
+      const Oper& op,                                                                \
+      T* const dest,                                                                 \
+      dont_deduce_this_parameter_t<const T> val,                                     \
+      MemoryOrder order,                                                             \
+      MemoryScope scope) {                                                           \
+    using cas_t = atomic_compare_exchange_t<T>;                                      \
+    cas_t oldval = reinterpret_cast<cas_t&>(*dest);                                  \
+    T newval = val;                                                                  \
+    cas_t assume = oldval;                                                           \
+    do {                                                                             \
+      if (check_early_exit(op, reinterpret_cast<T&>(oldval), val))                   \
+        return reinterpret_cast<T&>(oldval);                                         \
+      assume = oldval;                                                               \
+      newval = op.apply(reinterpret_cast<T&>(assume), val);                          \
+      oldval =                                                                       \
+          HOST_OR_DEVICE##_atomic_compare_exchange(reinterpret_cast<cas_t*>(dest),   \
+                                                   assume,                           \
+                                                   reinterpret_cast<cas_t&>(newval), \
+                                                   order,                            \
+                                                   scope);                           \
+    } while (assume != oldval);                                                      \
+                                                                                     \
+    return newval;                                                                   \
+  }
+
+DESUL_IMPL_ATOMIC_FETCH_OPER(DESUL_IMPL_HOST_FUNCTION, host)
+DESUL_IMPL_ATOMIC_FETCH_OPER(DESUL_IMPL_DEVICE_FUNCTION, device)
+
+#undef DESUL_IMPL_ATOMIC_FETCH_OPER
+
+}  // namespace Impl
+}  // namespace desul
+
+#if defined(__GNUC__) && (!defined(__clang__))
+#pragma GCC diagnostic pop
+#endif
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Macros.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Macros.hpp
index 0890b2dbc5af20f3d3f111ee3846d8117ce05c5b..992fb9fa66bf32a863e8ac4fbd4aaf690d13e69d 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/Macros.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Macros.hpp
@@ -9,43 +9,39 @@ SPDX-License-Identifier: (BSD-3-Clause)
 #ifndef DESUL_ATOMICS_MACROS_HPP_
 #define DESUL_ATOMICS_MACROS_HPP_
 
+#include <desul/atomics/Config.hpp>
+
 // Macros
 
-#if (!defined(__CUDA_ARCH__) || !defined(__NVCC__)) &&                       \
-    (!defined(__HIP_DEVICE_COMPILE) || !defined(__HIP_PLATFORM_HCC__)) &&    \
-    !defined(__SYCL_DEVICE_ONLY__) && !defined(DESUL_HAVE_OPENMP_ATOMICS) && \
-    !defined(DESUL_HAVE_SERIAL_ATOMICS)
-#define DESUL_IMPL_HAVE_GCC_OR_MSVC_ATOMICS
+#if defined(DESUL_ATOMICS_ENABLE_CUDA) && defined(__CUDACC__)
+#define DESUL_HAVE_CUDA_ATOMICS
 #endif
 
-// ONLY use GNUC atomics if not compiling for the device
-// and we didn't explicitly say to use OPENMP or SERIAL atomics
-#if defined(__GNUC__) && defined(DESUL_IMPL_HAVE_GCC_OR_MSVC_ATOMICS)
-#define DESUL_HAVE_GCC_ATOMICS
+#if defined(DESUL_ATOMICS_ENABLE_HIP) && defined(__HIPCC__)
+#define DESUL_HAVE_HIP_ATOMICS
 #endif
 
-// Equivalent to above: if we are compiling for the device we
-// need to use CUDA/HIP/SYCL atomics instead of MSVC atomics
-#if defined(_MSC_VER) && defined(DESUL_IMPL_HAVE_GCC_OR_MSVC_ATOMICS)
-#define DESUL_HAVE_MSVC_ATOMICS
+#if defined(DESUL_ATOMICS_ENABLE_SYCL) && defined(SYCL_LANGUAGE_VERSION)
+#define DESUL_HAVE_SYCL_ATOMICS
 #endif
 
-#undef DESUL_IMPL_HAVE_GCC_OR_MSVC_ATOMICS
-
-#ifdef __CUDACC__
-#define DESUL_HAVE_CUDA_ATOMICS
+#if defined(DESUL_ATOMICS_ENABLE_OPENMP)
+#define DESUL_HAVE_OPENMP_ATOMICS
 #endif
 
-#ifdef __HIPCC__
-#define DESUL_HAVE_HIP_ATOMICS
+// ONLY use GNUC atomics if not explicitly say to use OpenMP atomics
+#if !defined(DESUL_HAVE_OPENMP_ATOMICS) && defined(__GNUC__)
+#define DESUL_HAVE_GCC_ATOMICS
 #endif
 
-#ifdef __SYCL_DEVICE_ONLY__
-#define DESUL_HAVE_SYCL_ATOMICS
+// Equivalent to above for MSVC atomics
+#if !defined(DESUL_HAVE_OPENMP_ATOMICS) && defined(_MSC_VER)
+#define DESUL_HAVE_MSVC_ATOMICS
 #endif
 
-#if defined(__CUDA_ARCH__) || defined(__HIP_DEVICE_COMPILE__) || \
-    defined(__SYCL_DEVICE_ONLY__)
+#if (defined(DESUL_ATOMICS_ENABLE_CUDA) && defined(__CUDA_ARCH__)) ||         \
+    (defined(DESUL_ATOMICS_ENABLE_HIP) && defined(__HIP_DEVICE_COMPILE__)) || \
+    (defined(DESUL_ATOMICS_ENABLE_SYCL) && defined(__SYCL_DEVICE_ONLY__))
 #define DESUL_HAVE_GPU_LIKE_PROGRESS
 #endif
 
@@ -53,14 +49,76 @@ SPDX-License-Identifier: (BSD-3-Clause)
 #define DESUL_FORCEINLINE_FUNCTION inline __host__ __device__
 #define DESUL_INLINE_FUNCTION inline __host__ __device__
 #define DESUL_FUNCTION __host__ __device__
+#define DESUL_IMPL_HOST_FUNCTION __host__
+#define DESUL_IMPL_DEVICE_FUNCTION __device__
 #else
 #define DESUL_FORCEINLINE_FUNCTION inline
 #define DESUL_INLINE_FUNCTION inline
 #define DESUL_FUNCTION
+#define DESUL_IMPL_HOST_FUNCTION
+#define DESUL_IMPL_DEVICE_FUNCTION
 #endif
 
 #if !defined(DESUL_HAVE_GPU_LIKE_PROGRESS)
 #define DESUL_HAVE_FORWARD_PROGRESS
 #endif
 
+#define DESUL_IMPL_STRIP_PARENS(X) DESUL_IMPL_ESC(DESUL_IMPL_ISH X)
+#define DESUL_IMPL_ISH(...) DESUL_IMPL_ISH __VA_ARGS__
+#define DESUL_IMPL_ESC(...) DESUL_IMPL_ESC_(__VA_ARGS__)
+#define DESUL_IMPL_ESC_(...) DESUL_IMPL_VAN_##__VA_ARGS__
+#define DESUL_IMPL_VAN_DESUL_IMPL_ISH
+
+#if (defined(DESUL_ATOMICS_ENABLE_CUDA) && defined(__CUDACC__)) && defined(__NVCOMPILER)
+#include <nv/target>
+#define DESUL_IF_ON_DEVICE(CODE) NV_IF_TARGET(NV_IS_DEVICE, CODE)
+#define DESUL_IF_ON_HOST(CODE) NV_IF_TARGET(NV_IS_HOST, CODE)
+#endif
+
+// FIXME OpenMP Offload differentiate between device and host, but do we need this?
+#if defined(DESUL_HAVE_OPENMP_ATOMICS)
+#if 0
+// Base function.
+static constexpr bool desul_impl_omp_on_host() { return true; }
+
+#pragma omp begin declare variant match(device = {kind(host)})
+static constexpr bool desul_impl_omp_on_host() { return true; }
+#pragma omp end declare variant
+
+#pragma omp begin declare variant match(device = {kind(nohost)})
+static constexpr bool desul_impl_omp_on_host() { return false; }
+#pragma omp end declare variant
+
+#define DESUL_IF_ON_DEVICE(CODE)             \
+  if constexpr (!desul_impl_omp_on_host()) { \
+    DESUL_IMPL_STRIP_PARENS(CODE)            \
+  }
+#define DESUL_IF_ON_HOST(CODE)              \
+  if constexpr (desul_impl_omp_on_host()) { \
+    DESUL_IMPL_STRIP_PARENS(CODE)           \
+  }
+#else
+#define DESUL_IF_ON_DEVICE(CODE) \
+  {}
+#define DESUL_IF_ON_HOST(CODE) \
+  { DESUL_IMPL_STRIP_PARENS(CODE) }
+#endif
+#endif
+
+#if !defined(DESUL_IF_ON_HOST) && !defined(DESUL_IF_ON_DEVICE)
+#if (defined(DESUL_ATOMICS_ENABLE_CUDA) && defined(__CUDA_ARCH__)) ||         \
+    (defined(DESUL_ATOMICS_ENABLE_HIP) && defined(__HIP_DEVICE_COMPILE__)) || \
+    (defined(DESUL_ATOMICS_ENABLE_SYCL) && defined(__SYCL_DEVICE_ONLY__))
+#define DESUL_IF_ON_DEVICE(CODE) \
+  { DESUL_IMPL_STRIP_PARENS(CODE) }
+#define DESUL_IF_ON_HOST(CODE) \
+  {}
+#else
+#define DESUL_IF_ON_DEVICE(CODE) \
+  {}
+#define DESUL_IF_ON_HOST(CODE) \
+  { DESUL_IMPL_STRIP_PARENS(CODE) }
+#endif
+#endif
+
 #endif  // DESUL_ATOMICS_MACROS_HPP_
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/OpenMP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/OpenMP.hpp
deleted file mode 100644
index bc6fb26c2fc9ee1ec7d9f4deb6c4592a81c19fc9..0000000000000000000000000000000000000000
--- a/packages/kokkos/tpls/desul/include/desul/atomics/OpenMP.hpp
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
-Copyright (c) 2019, Lawrence Livermore National Security, LLC
-and DESUL project contributors. See the COPYRIGHT file for details.
-Source: https://github.com/desul/desul
-
-SPDX-License-Identifier: (BSD-3-Clause)
-*/
-#ifndef DESUL_ATOMICS_OPENMP_HPP_
-#define DESUL_ATOMICS_OPENMP_HPP_
-
-#ifdef DESUL_HAVE_OPENMP_ATOMICS
-
-#include <desul/atomics/openmp/OpenMP_40.hpp>
-#endif
-#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Operator_Function_Objects.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Operator_Function_Objects.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..be90cdbbd86ffc42a674eacc5f1cea70dc42c8cf
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Operator_Function_Objects.hpp
@@ -0,0 +1,175 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_OPERATOR_FUNCTION_OBJECTS_HPP_
+#define DESUL_ATOMICS_OPERATOR_FUNCTION_OBJECTS_HPP_
+
+#include <desul/atomics/Macros.hpp>
+#include <type_traits>
+
+// Function objects that represent common arithmetic and logical
+// Combination operands to be used in a compare-and-exchange based atomic operation
+namespace desul {
+namespace Impl {
+
+template <class Scalar1, class Scalar2>
+struct max_operator {
+  DESUL_FORCEINLINE_FUNCTION
+  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) {
+    return (val1 > val2 ? val1 : val2);
+  }
+  DESUL_FORCEINLINE_FUNCTION
+  static constexpr bool check_early_exit(Scalar1 const& val1, Scalar2 const& val2) {
+    return val1 > val2;
+  }
+};
+
+template <class Scalar1, class Scalar2>
+struct min_operator {
+  DESUL_FORCEINLINE_FUNCTION
+  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) {
+    return (val1 < val2 ? val1 : val2);
+  }
+  DESUL_FORCEINLINE_FUNCTION
+  static constexpr bool check_early_exit(Scalar1 const& val1, Scalar2 const& val2) {
+    return val1 < val2;
+  }
+};
+
+template <class Op, class Scalar1, class Scalar2, class = bool>
+struct may_exit_early : std::false_type {};
+
+// This exit early optimization causes weird compiler errors with MSVC 2019
+#ifndef DESUL_HAVE_MSVC_ATOMICS
+template <class Op, class Scalar1, class Scalar2>
+struct may_exit_early<Op,
+                      Scalar1,
+                      Scalar2,
+                      decltype(Op::check_early_exit(std::declval<Scalar1 const&>(),
+                                                    std::declval<Scalar2 const&>()))>
+    : std::true_type {};
+#endif
+
+template <class Op, class Scalar1, class Scalar2>
+constexpr DESUL_FUNCTION
+    std::enable_if_t<may_exit_early<Op, Scalar1, Scalar2>::value, bool>
+    check_early_exit(Op const&, Scalar1 const& val1, Scalar2 const& val2) {
+  return Op::check_early_exit(val1, val2);
+}
+
+template <class Op, class Scalar1, class Scalar2>
+constexpr DESUL_FUNCTION
+    std::enable_if_t<!may_exit_early<Op, Scalar1, Scalar2>::value, bool>
+    check_early_exit(Op const&, Scalar1 const&, Scalar2 const&) {
+  return false;
+}
+
+template <class Scalar1, class Scalar2>
+struct add_operator {
+  DESUL_FORCEINLINE_FUNCTION
+  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 + val2; }
+};
+
+template <class Scalar1, class Scalar2>
+struct sub_operator {
+  DESUL_FORCEINLINE_FUNCTION
+  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 - val2; }
+};
+
+template <class Scalar1, class Scalar2>
+struct mul_operator {
+  DESUL_FORCEINLINE_FUNCTION
+  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 * val2; }
+};
+
+template <class Scalar1, class Scalar2>
+struct div_operator {
+  DESUL_FORCEINLINE_FUNCTION
+  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 / val2; }
+};
+
+template <class Scalar1, class Scalar2>
+struct mod_operator {
+  DESUL_FORCEINLINE_FUNCTION
+  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 % val2; }
+};
+
+template <class Scalar1, class Scalar2>
+struct and_operator {
+  DESUL_FORCEINLINE_FUNCTION
+  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 & val2; }
+};
+
+template <class Scalar1, class Scalar2>
+struct or_operator {
+  DESUL_FORCEINLINE_FUNCTION
+  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 | val2; }
+};
+
+template <class Scalar1, class Scalar2>
+struct xor_operator {
+  DESUL_FORCEINLINE_FUNCTION
+  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 ^ val2; }
+};
+
+template <class Scalar1, class Scalar2>
+struct nand_operator {
+  DESUL_FORCEINLINE_FUNCTION
+  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) {
+    return ~(val1 & val2);
+  }
+};
+
+template <class Scalar1, class Scalar2>
+struct lshift_operator {
+  DESUL_FORCEINLINE_FUNCTION
+  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) {
+    return val1 << val2;
+  }
+};
+
+template <class Scalar1, class Scalar2>
+struct rshift_operator {
+  DESUL_FORCEINLINE_FUNCTION
+  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) {
+    return val1 >> val2;
+  }
+};
+
+template <class Scalar1, class Scalar2>
+struct inc_mod_operator {
+  DESUL_FORCEINLINE_FUNCTION
+  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) {
+    return ((val1 >= val2) ? Scalar1(0) : val1 + Scalar1(1));
+  }
+};
+
+template <class Scalar1, class Scalar2>
+struct dec_mod_operator {
+  DESUL_FORCEINLINE_FUNCTION
+  static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) {
+    return (((val1 == Scalar1(0)) | (val1 > val2)) ? val2 : (val1 - Scalar1(1)));
+  }
+};
+
+template <class Scalar1, class Scalar2>
+struct store_operator {
+  DESUL_FORCEINLINE_FUNCTION
+  static Scalar1 apply(const Scalar1&, const Scalar2& val2) { return val2; }
+};
+
+template <class Scalar1, class Scalar2>
+struct load_operator {
+  DESUL_FORCEINLINE_FUNCTION
+  static Scalar1 apply(const Scalar1& val1, const Scalar2&) { return val1; }
+};
+
+}  // namespace Impl
+}  // namespace desul
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..24078aae07fe90196a77cba4e3114fe086dbf049
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence.hpp
@@ -0,0 +1,35 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_THREAD_FENCE_HPP_
+#define DESUL_ATOMICS_THREAD_FENCE_HPP_
+
+#include <desul/atomics/Macros.hpp>
+
+#ifdef DESUL_HAVE_GCC_ATOMICS
+#include <desul/atomics/Thread_Fence_GCC.hpp>
+#endif
+#ifdef DESUL_HAVE_MSVC_ATOMICS
+#include <desul/atomics/Thread_Fence_MSVC.hpp>
+#endif
+#ifdef DESUL_HAVE_CUDA_ATOMICS
+#include <desul/atomics/Thread_Fence_CUDA.hpp>
+#endif
+#ifdef DESUL_HAVE_HIP_ATOMICS
+#include <desul/atomics/Thread_Fence_HIP.hpp>
+#endif
+#ifdef DESUL_HAVE_OPENMP_ATOMICS
+#include <desul/atomics/Thread_Fence_OpenMP.hpp>
+#endif
+#ifdef DESUL_HAVE_SYCL_ATOMICS
+#include <desul/atomics/Thread_Fence_SYCL.hpp>
+#endif
+
+#include <desul/atomics/Thread_Fence_ScopeCaller.hpp>
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_CUDA.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_CUDA.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..ad2c043ed10d4dd8b77773f9ceed2093561cc766
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_CUDA.hpp
@@ -0,0 +1,37 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_THREAD_FENCE_CUDA_HPP_
+#define DESUL_ATOMICS_THREAD_FENCE_CUDA_HPP_
+
+#include <desul/atomics/Common.hpp>
+
+namespace desul {
+namespace Impl {
+
+// clang-format off
+inline __device__ void device_atomic_thread_fence(MemoryOrderRelease, MemoryScopeDevice) { __threadfence();        }
+inline __device__ void device_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeDevice) { __threadfence();        }
+inline __device__ void device_atomic_thread_fence(MemoryOrderAcqRel , MemoryScopeDevice) { __threadfence();        }
+inline __device__ void device_atomic_thread_fence(MemoryOrderSeqCst , MemoryScopeDevice) { __threadfence();        }
+inline __device__ void device_atomic_thread_fence(MemoryOrderRelease, MemoryScopeCore  ) { __threadfence_block();  }
+inline __device__ void device_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeCore  ) { __threadfence_block();  }
+inline __device__ void device_atomic_thread_fence(MemoryOrderAcqRel , MemoryScopeCore  ) { __threadfence_block();  }
+inline __device__ void device_atomic_thread_fence(MemoryOrderSeqCst , MemoryScopeCore  ) { __threadfence_block();  }
+#ifndef DESUL_CUDA_ARCH_IS_PRE_PASCAL
+inline __device__ void device_atomic_thread_fence(MemoryOrderRelease, MemoryScopeNode  ) { __threadfence_system(); }
+inline __device__ void device_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeNode  ) { __threadfence_system(); }
+inline __device__ void device_atomic_thread_fence(MemoryOrderAcqRel , MemoryScopeNode  ) { __threadfence_system(); }
+inline __device__ void device_atomic_thread_fence(MemoryOrderSeqCst , MemoryScopeNode  ) { __threadfence_system(); }
+#endif
+// clang-format on
+
+}  // namespace Impl
+}  // namespace desul
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_GCC.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_GCC.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..4839cbd0fedeb372f8038eb99886ba17a3c18c57
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_GCC.hpp
@@ -0,0 +1,25 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_THREAD_FENCE_GCC_HPP_
+#define DESUL_ATOMICS_THREAD_FENCE_GCC_HPP_
+
+#include <desul/atomics/Adapt_GCC.hpp>
+
+namespace desul {
+namespace Impl {
+
+template <class MemoryOrder, class MemoryScope>
+void host_atomic_thread_fence(MemoryOrder, MemoryScope) {
+  __atomic_thread_fence(GCCMemoryOrder<MemoryOrder>::value);
+}
+
+}  // namespace Impl
+}  // namespace desul
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_HIP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_HIP.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..67fc7ffd2c90f4cb42c284a23f703e44dba9b2fd
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_HIP.hpp
@@ -0,0 +1,35 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_THREAD_FENCE_HIP_HPP_
+#define DESUL_ATOMICS_THREAD_FENCE_HIP_HPP_
+
+#include <desul/atomics/Common.hpp>
+
+namespace desul {
+namespace Impl {
+
+// clang-format off
+inline __device__ void device_atomic_thread_fence(MemoryOrderRelease, MemoryScopeDevice) { __threadfence();        }
+inline __device__ void device_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeDevice) { __threadfence();        }
+inline __device__ void device_atomic_thread_fence(MemoryOrderAcqRel , MemoryScopeDevice) { __threadfence();        }
+inline __device__ void device_atomic_thread_fence(MemoryOrderSeqCst , MemoryScopeDevice) { __threadfence();        }
+inline __device__ void device_atomic_thread_fence(MemoryOrderRelease, MemoryScopeCore  ) { __threadfence_block();  }
+inline __device__ void device_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeCore  ) { __threadfence_block();  }
+inline __device__ void device_atomic_thread_fence(MemoryOrderAcqRel , MemoryScopeCore  ) { __threadfence_block();  }
+inline __device__ void device_atomic_thread_fence(MemoryOrderSeqCst , MemoryScopeCore  ) { __threadfence_block();  }
+inline __device__ void device_atomic_thread_fence(MemoryOrderRelease, MemoryScopeNode  ) { __threadfence_system(); }
+inline __device__ void device_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeNode  ) { __threadfence_system(); }
+inline __device__ void device_atomic_thread_fence(MemoryOrderAcqRel , MemoryScopeNode  ) { __threadfence_system(); }
+inline __device__ void device_atomic_thread_fence(MemoryOrderSeqCst , MemoryScopeNode  ) { __threadfence_system(); }
+// clang-format on
+
+}  // namespace Impl
+}  // namespace desul
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_MSVC.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_MSVC.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..d5919f85001ac3c435ff82de07ead266cd024f87
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_MSVC.hpp
@@ -0,0 +1,27 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_THREAD_FENCE_MSVC_HPP_
+#define DESUL_ATOMICS_THREAD_FENCE_MSVC_HPP_
+
+#include <atomic>
+#include <desul/atomics/Adapt_CXX.hpp>
+#include <desul/atomics/Common.hpp>
+
+namespace desul {
+namespace Impl {
+
+template <class MemoryOrder, class MemoryScope>
+void host_atomic_thread_fence(MemoryOrder, MemoryScope) {
+  std::atomic_thread_fence(Impl::CXXMemoryOrder<MemoryOrder>::value);
+}
+
+}  // namespace Impl
+}  // namespace desul
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_OpenMP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_OpenMP.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..72fc7a5e7c61a64d9ff6be22e41081eedaa32c30
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_OpenMP.hpp
@@ -0,0 +1,79 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_THREAD_FENCE_OPENMP_HPP_
+#define DESUL_ATOMICS_THREAD_FENCE_OPENMP_HPP_
+
+#include <omp.h>
+
+#include <desul/atomics/Common.hpp>
+
+namespace desul {
+namespace Impl {
+
+#if _OPENMP > 201800
+
+// There is no seq_cst flush in OpenMP, isn't it the same anyway for fence?
+inline void host_atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeCore) {
+#pragma omp flush acq_rel
+}
+inline void host_atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeCore) {
+#pragma omp flush acq_rel
+}
+inline void host_atomic_thread_fence(MemoryOrderRelease, MemoryScopeCore) {
+#pragma omp flush release
+}
+inline void host_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeCore) {
+#pragma omp flush acquire
+}
+inline void host_atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeDevice) {
+#pragma omp flush acq_rel
+}
+inline void host_atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeDevice) {
+#pragma omp flush acq_rel
+}
+inline void host_atomic_thread_fence(MemoryOrderRelease, MemoryScopeDevice) {
+#pragma omp flush release
+}
+inline void host_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeDevice) {
+#pragma omp flush acquire
+}
+
+#else
+
+inline void host_atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeCore) {
+#pragma omp flush
+}
+inline void host_atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeCore) {
+#pragma omp flush
+}
+inline void host_atomic_thread_fence(MemoryOrderRelease, MemoryScopeCore) {
+#pragma omp flush
+}
+inline void host_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeCore) {
+#pragma omp flush
+}
+inline void host_atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeDevice) {
+#pragma omp flush
+}
+inline void host_atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeDevice) {
+#pragma omp flush
+}
+inline void host_atomic_thread_fence(MemoryOrderRelease, MemoryScopeDevice) {
+#pragma omp flush
+}
+inline void host_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeDevice) {
+#pragma omp flush
+}
+
+#endif
+
+}  // namespace Impl
+}  // namespace desul
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_SYCL.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_SYCL.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..769e92abfebbe00089eb5104b7065cd922132b87
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_SYCL.hpp
@@ -0,0 +1,35 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_THREAD_FENCE_SYCL_HPP_
+#define DESUL_ATOMICS_THREAD_FENCE_SYCL_HPP_
+
+#include <desul/atomics/Adapt_SYCL.hpp>
+#include <desul/atomics/Common.hpp>
+
+// FIXME_SYCL SYCL2020 dictates that <sycl/sycl.hpp> is the header to include
+// but icpx 2022.1.0 and earlier versions only provide <CL/sycl.hpp>
+#if __has_include(<sycl/sycl.hpp>)
+#include <sycl/sycl.hpp>
+#else
+#include <CL/sycl.hpp>
+#endif
+
+namespace desul {
+namespace Impl {
+
+template <class MemoryOrder, class MemoryScope>
+void device_atomic_thread_fence(MemoryOrder, MemoryScope) {
+  sycl::atomic_fence(SYCLMemoryOrder<MemoryOrder, /*extended namespace*/ false>::value,
+                     SYCLMemoryScope<MemoryScope, /*extended namespace*/ false>::value);
+}
+
+}  // namespace Impl
+}  // namespace desul
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_ScopeCaller.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_ScopeCaller.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..3f58bf5b2e9ab69a504ac66266854b453a3bc6ac
--- /dev/null
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_ScopeCaller.hpp
@@ -0,0 +1,26 @@
+/*
+Copyright (c) 2019, Lawrence Livermore National Security, LLC
+and DESUL project contributors. See the COPYRIGHT file for details.
+Source: https://github.com/desul/desul
+
+SPDX-License-Identifier: (BSD-3-Clause)
+*/
+
+#ifndef DESUL_ATOMICS_THREAD_FENCE_SCOPECALLER_HPP_
+#define DESUL_ATOMICS_THREAD_FENCE_SCOPECALLER_HPP_
+
+#include <desul/atomics/Common.hpp>
+
+namespace desul {
+
+// clang-format off
+DESUL_INLINE_FUNCTION void atomic_thread_fence(MemoryOrderSeqCst , MemoryScopeCaller) {}
+DESUL_INLINE_FUNCTION void atomic_thread_fence(MemoryOrderAcqRel , MemoryScopeCaller) {}
+DESUL_INLINE_FUNCTION void atomic_thread_fence(MemoryOrderRelease, MemoryScopeCaller) {}
+DESUL_INLINE_FUNCTION void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeCaller) {}
+DESUL_INLINE_FUNCTION void atomic_thread_fence(MemoryOrderRelaxed, MemoryScopeCaller) {}
+// clang-format on
+
+}  // namespace desul
+
+#endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/CUDA_asm.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/CUDA_asm.hpp
index 461d3e0928a19840973d1c971ccd100968193a42..96e0dfa269b363afc53beab3a1dc1776a57a0a2f 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/CUDA_asm.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/CUDA_asm.hpp
@@ -1,18 +1,17 @@
-#include<limits>
+#include <limits>
 namespace desul {
-#if defined(__CUDA_ARCH__)  || (defined(__clang__) && !defined(__NVCC__))
+namespace Impl {
 // Choose the variant of atomics we are using later
-#if !defined(DESUL_IMPL_ATOMIC_CUDA_PTX_GENERIC) && \
-    !defined(DESUL_IMPL_ATOMIC_CUDA_PTX_PREDICATE) && \
-    !defined(DESUL_IMPL_ATOMIC_CUDA_PTX_ISGLOBAL) && \
-    !defined(DESUL_IMPL_ATOMIC_CUDA_PTX_FORCEGLOBAL)
-#if (__CUDACC_VER_MAJOR__ > 11) || ((__CUDACC_VER_MAJOR__==11) && (__CUDACC_VER_MINOR__>1))
+#if !defined(DESUL_IMPL_ATOMIC_CUDA_PTX_PREDICATE) && \
+    !defined(DESUL_IMPL_ATOMIC_CUDA_PTX_ISGLOBAL)
+#if (__CUDACC_VER_MAJOR__ > 11) || \
+    ((__CUDACC_VER_MAJOR__ == 11) && (__CUDACC_VER_MINOR__ > 1))
 #define DESUL_IMPL_ATOMIC_CUDA_PTX_ISGLOBAL
 #else
 #define DESUL_IMPL_ATOMIC_CUDA_PTX_PREDICATE
 #endif
 #endif
-#include<desul/atomics/cuda/cuda_cc7_asm.inc>
+#include <desul/atomics/cuda/cuda_cc7_asm.inc>
 
-#endif
-}
+}  // namespace Impl
+}  // namespace desul
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/CUDA_asm_exchange.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/CUDA_asm_exchange.hpp
index 0ab95e6a00a4e67ffad0232f8652e8a0c9d4f6e6..8841c07dbfe2fe04fe4fde11cb4ab7dc52305998 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/CUDA_asm_exchange.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/CUDA_asm_exchange.hpp
@@ -1,8 +1,6 @@
-#include<limits>
+#include <limits>
 namespace desul {
-#if defined(__CUDA_ARCH__)  || (defined(__clang__) && !defined(__NVCC__))
-
-#include<desul/atomics/cuda/cuda_cc7_asm_exchange.inc>
-
-#endif
+namespace Impl {
+#include <desul/atomics/cuda/cuda_cc7_asm_exchange.inc>
 }
+}  // namespace desul
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc
index 6de590a952fa38f60c58a34c9499a420502ae381..47de0e0866f925352ab5c1ca81db441530012aaa 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc
@@ -1,7 +1,3 @@
-#ifdef DESUL_IMPL_ATOMIC_CUDA_PTX_GENERIC
-#include "cuda_cc7_asm_atomic_fetch_op.inc_generic"
-#endif
-
 #ifdef DESUL_IMPL_ATOMIC_CUDA_PTX_ISGLOBAL
 #include "cuda_cc7_asm_atomic_fetch_op.inc_isglobal"
 #endif
@@ -10,9 +6,3 @@
 #include "cuda_cc7_asm_atomic_fetch_op.inc_predicate"
 #endif
 
-// This version is not generally safe
-// Only here for performance comparison purposes
-#ifdef DESUL_IMPL_ATOMIC_CUDA_PTX_FORCEGLOBAL
-#include "cuda_cc7_asm_atomic_fetch_op.inc_forceglobal"
-#endif
-
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_isglobal b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_isglobal
index 3d077ae637ad9960ef687fff2456181033bf8d73..ef5798f21138e936cd63d8593fc9c245f1d75d92 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_isglobal
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_isglobal
@@ -6,7 +6,7 @@
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_AND() \
 template<class ctype> \
-inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_fetch_and(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type device_atomic_fetch_and(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   uint32_t asm_value = reinterpret_cast<uint32_t&>(value); \
   uint32_t asm_result = 0u; \
   if(__isGlobal(dest)) { \
@@ -17,7 +17,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_
   return reinterpret_cast<ctype&>(asm_result); \
 } \
 template<class ctype> \
-inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_fetch_and(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type device_atomic_fetch_and(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   uint64_t asm_value = reinterpret_cast<uint64_t&>(value); \
   uint64_t asm_result = 0u; \
   if(__isGlobal(dest)) { \
@@ -30,7 +30,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_OR() \
 template<class ctype> \
-inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_fetch_or(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type device_atomic_fetch_or(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   uint32_t asm_value = reinterpret_cast<uint32_t&>(value); \
   uint32_t asm_result = 0u; \
   if(__isGlobal(dest)) { \
@@ -41,7 +41,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_
   return reinterpret_cast<ctype&>(asm_result); \
 } \
 template<class ctype> \
-inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_fetch_or(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type device_atomic_fetch_or(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   uint64_t asm_value = reinterpret_cast<uint64_t&>(value); \
   uint64_t asm_result = 0u; \
   if(__isGlobal(dest)) { \
@@ -54,7 +54,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_XOR() \
 template<class ctype> \
-inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_fetch_xor(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type device_atomic_fetch_xor(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   uint32_t asm_value = reinterpret_cast<uint32_t&>(value); \
   uint32_t asm_result = 0u; \
   if(__isGlobal(dest)) { \
@@ -65,7 +65,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_
   return reinterpret_cast<ctype&>(asm_result); \
 } \
 template<class ctype> \
-inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_fetch_xor(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type device_atomic_fetch_xor(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   uint64_t asm_value = reinterpret_cast<uint64_t&>(value); \
   uint64_t asm_result = 0u; \
   if(__isGlobal(dest)) { \
@@ -78,7 +78,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_
 
 // Fetch atomics
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_ADD(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \
-inline __device__ ctype atomic_fetch_add(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ ctype device_atomic_fetch_add(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   ctype result=0; \
   if(__isGlobal(dest)) { \
   asm volatile("atom.add.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_ctype " %0,[%1],%2;" : reg_ret_ctype(result) : "l"(dest),reg_ctype(value) : "memory"); \
@@ -89,7 +89,7 @@ inline __device__ ctype atomic_fetch_add(ctype* dest, ctype value, __DESUL_IMPL_
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_SUB(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \
-inline __device__ ctype atomic_fetch_sub(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ ctype device_atomic_fetch_sub(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   ctype result=0; \
   ctype neg_value = -value; \
   if(__isGlobal(dest)) { \
@@ -101,7 +101,7 @@ inline __device__ ctype atomic_fetch_sub(ctype* dest, ctype value, __DESUL_IMPL_
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_MIN(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \
-inline __device__ ctype atomic_fetch_min(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ ctype device_atomic_fetch_min(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   ctype result=0; \
   if(__isGlobal(dest)) { \
   asm volatile("atom.min.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_ctype " %0,[%1],%2;" : reg_ret_ctype(result) : "l"(dest),reg_ctype(value) : "memory"); \
@@ -112,7 +112,7 @@ inline __device__ ctype atomic_fetch_min(ctype* dest, ctype value, __DESUL_IMPL_
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_MAX(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \
-inline __device__ ctype atomic_fetch_max(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ ctype device_atomic_fetch_max(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   ctype result=0; \
   if(__isGlobal(dest)) { \
   asm volatile("atom.max.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_ctype " %0,[%1],%2;" : reg_ret_ctype(result) : "l"(dest),reg_ctype(value) : "memory"); \
@@ -123,7 +123,7 @@ inline __device__ ctype atomic_fetch_max(ctype* dest, ctype value, __DESUL_IMPL_
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_INC(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \
-inline __device__ ctype atomic_fetch_inc(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ ctype device_atomic_fetch_inc(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   ctype result = 0; \
   ctype limit = desul::Impl::numeric_limits_max<ctype>::value; \
   if(__isGlobal(dest)) { \
@@ -133,7 +133,7 @@ inline __device__ ctype atomic_fetch_inc(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMO
   } \
   return result; \
 } \
-inline __device__ ctype atomic_fetch_inc_mod(ctype* dest, ctype limit, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ ctype device_atomic_fetch_inc_mod(ctype* dest, ctype limit, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   ctype result = 0; \
   if(__isGlobal(dest)) { \
   asm volatile("atom.inc.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_ctype " %0,[%1],%2;" : reg_ret_ctype(result) : "l"(dest),reg_ctype(limit) : "memory"); \
@@ -144,7 +144,7 @@ inline __device__ ctype atomic_fetch_inc_mod(ctype* dest, ctype limit, __DESUL_I
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_DEC(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \
-inline __device__ ctype atomic_fetch_dec(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ ctype device_atomic_fetch_dec(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   ctype result = 0; \
   ctype limit = desul::Impl::numeric_limits_max<ctype>::value; \
   if(__isGlobal(dest)) { \
@@ -154,7 +154,7 @@ inline __device__ ctype atomic_fetch_dec(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMO
   } \
   return result; \
 } \
-inline __device__ ctype atomic_fetch_dec_mod(ctype* dest, ctype limit, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ ctype device_atomic_fetch_dec_mod(ctype* dest, ctype limit, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   ctype result = 0; \
   if(__isGlobal(dest)) { \
   asm volatile("atom.dec.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_ctype " %0,[%1],%2;" : reg_ret_ctype(result) : "l"(dest),reg_ctype(limit) : "memory"); \
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_predicate b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_predicate
index 4039448c6bb63038b65b58bd819c9adf0a75a8a8..c80efc5e7cf043d06a7f82fc3643f3566c5bd6e6 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_predicate
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_predicate
@@ -6,7 +6,7 @@
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_AND() \
 template<class ctype> \
-inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_fetch_and(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type device_atomic_fetch_and(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   uint32_t asm_value = reinterpret_cast<uint32_t&>(value); \
   uint32_t asm_result = 0u; \
   asm volatile( \
@@ -20,7 +20,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_
   return reinterpret_cast<ctype&>(asm_result); \
 } \
 template<class ctype> \
-inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_fetch_and(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type device_atomic_fetch_and(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   uint64_t asm_value = reinterpret_cast<uint64_t&>(value); \
   uint64_t asm_result = 0u; \
   asm volatile( \
@@ -36,7 +36,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_OR() \
 template<class ctype> \
-inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_fetch_or(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type device_atomic_fetch_or(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   uint32_t asm_value = reinterpret_cast<uint32_t&>(value); \
   uint32_t asm_result = 0u; \
   asm volatile( \
@@ -50,7 +50,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_
   return reinterpret_cast<ctype&>(asm_result); \
 } \
 template<class ctype> \
-inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_fetch_or(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type device_atomic_fetch_or(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   uint64_t asm_value = reinterpret_cast<uint64_t&>(value); \
   uint64_t asm_result = 0u; \
   asm volatile( \
@@ -66,7 +66,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_XOR() \
 template<class ctype> \
-inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_fetch_xor(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type device_atomic_fetch_xor(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   uint32_t asm_value = reinterpret_cast<uint32_t&>(value); \
   uint32_t asm_result = 0u; \
   asm volatile( \
@@ -80,7 +80,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_
   return reinterpret_cast<ctype&>(asm_result); \
 } \
 template<class ctype> \
-inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_fetch_xor(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type device_atomic_fetch_xor(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   uint64_t asm_value = reinterpret_cast<uint64_t&>(value); \
   uint64_t asm_result = 0u; \
   asm volatile( \
@@ -96,7 +96,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_
 
 // Fetch atomics
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_ADD(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \
-inline __device__ ctype atomic_fetch_add(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ ctype device_atomic_fetch_add(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   ctype result=0; \
   asm volatile( \
           "{\n\t" \
@@ -110,7 +110,7 @@ inline __device__ ctype atomic_fetch_add(ctype* dest, ctype value, __DESUL_IMPL_
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_SUB(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \
-inline __device__ ctype atomic_fetch_sub(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ ctype device_atomic_fetch_sub(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   ctype result=0; \
   ctype neg_value = -value; \
   asm volatile( \
@@ -125,7 +125,7 @@ inline __device__ ctype atomic_fetch_sub(ctype* dest, ctype value, __DESUL_IMPL_
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_MIN(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \
-inline __device__ ctype atomic_fetch_min(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ ctype device_atomic_fetch_min(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   ctype result=0; \
   asm volatile( \
           "{\n\t" \
@@ -139,7 +139,7 @@ inline __device__ ctype atomic_fetch_min(ctype* dest, ctype value, __DESUL_IMPL_
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_MAX(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \
-inline __device__ ctype atomic_fetch_max(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ ctype device_atomic_fetch_max(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   ctype result=0; \
   asm volatile( \
           "{\n\t" \
@@ -153,7 +153,7 @@ inline __device__ ctype atomic_fetch_max(ctype* dest, ctype value, __DESUL_IMPL_
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_INC(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \
-inline __device__ ctype atomic_fetch_inc(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ ctype device_atomic_fetch_inc(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   ctype result = 0; \
   ctype limit = desul::Impl::numeric_limits_max<ctype>::value; \
   asm volatile( \
@@ -166,7 +166,7 @@ inline __device__ ctype atomic_fetch_inc(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMO
     : reg_ret_ctype(result) : "l"(dest),reg_ctype(limit) : "memory"); \
   return result; \
 } \
-inline __device__ ctype atomic_fetch_inc_mod(ctype* dest, ctype limit, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ ctype device_atomic_fetch_inc_mod(ctype* dest, ctype limit, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   ctype result = 0; \
   asm volatile( \
           "{\n\t" \
@@ -180,7 +180,7 @@ inline __device__ ctype atomic_fetch_inc_mod(ctype* dest, ctype limit, __DESUL_I
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_DEC(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \
-inline __device__ ctype atomic_fetch_dec(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ ctype device_atomic_fetch_dec(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   ctype result = 0; \
   ctype limit = desul::Impl::numeric_limits_max<ctype>::value; \
   asm volatile( \
@@ -193,7 +193,7 @@ inline __device__ ctype atomic_fetch_dec(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMO
     : reg_ret_ctype(result) : "l"(dest),reg_ctype(limit) : "memory"); \
   return result; \
 } \
-inline __device__ ctype atomic_fetch_dec_mod(ctype* dest, ctype limit, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ ctype device_atomic_fetch_dec_mod(ctype* dest, ctype limit, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   ctype result = 0; \
   asm volatile( \
           "{\n\t" \
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc
index ca02410515db3491c002b569f01ee150d1c0c683..7d2651d857c7c5b19313cb42a9d59f10cb109d2d 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc
@@ -1,7 +1,3 @@
-#ifdef DESUL_IMPL_ATOMIC_CUDA_PTX_GENERIC
-#include "cuda_cc7_asm_atomic_op.inc_generic"
-#endif
-
 #ifdef DESUL_IMPL_ATOMIC_CUDA_PTX_ISGLOBAL
 #include "cuda_cc7_asm_atomic_op.inc_isglobal"
 #endif
@@ -10,9 +6,3 @@
 #include "cuda_cc7_asm_atomic_op.inc_predicate"
 #endif
 
-// This version is not generally safe
-// Only here for performance comparison purposes
-#ifdef DESUL_IMPL_ATOMIC_CUDA_PTX_FORCEGLOBAL
-#include "cuda_cc7_asm_atomic_op.inc_forceglobal"
-#endif
-
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_isglobal b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_isglobal
index ba8937883423e62b9461b6d764d24022531db719..7bc6d4d9d19d76636988368f9153d83e2930531d 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_isglobal
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_isglobal
@@ -4,7 +4,7 @@
 
 // Non Returning Atomic Operations
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_ADD(type,asm_type,reg_type) \
-inline __device__ void atomic_add(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ void device_atomic_add(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   if(__isGlobal(dest)) { \
   asm volatile("red.add.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_type " [%0],%1;" :: "l"(dest),reg_type(value) : "memory"); \
   } else { \
@@ -13,7 +13,7 @@ inline __device__ void atomic_add(type* dest, type value, __DESUL_IMPL_CUDA_ASM_
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_SUB(type,asm_type,reg_type) \
-inline __device__ void atomic_sub(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ void device_atomic_sub(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   type neg_value = -value; \
   if(__isGlobal(dest)) { \
   asm volatile("red.add.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_type " [%0],%1;" :: "l"(dest),reg_type(neg_value) : "memory"); \
@@ -23,7 +23,7 @@ inline __device__ void atomic_sub(type* dest, type value, __DESUL_IMPL_CUDA_ASM_
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_MIN(type,asm_type,reg_type) \
-inline __device__ void atomic_min(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ void device_atomic_min(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   if(__isGlobal(dest)) { \
   asm volatile("red.min.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_type " [%0],%1;" :: "l"(dest),reg_type(value) : "memory"); \
   } else { \
@@ -32,7 +32,7 @@ inline __device__ void atomic_min(type* dest, type value, __DESUL_IMPL_CUDA_ASM_
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_MAX(type,asm_type,reg_type) \
-inline __device__ void atomic_max(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ void device_atomic_max(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   if(__isGlobal(dest)) { \
   asm volatile("red.max.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_type " [%0],%1;" :: "l"(dest),reg_type(value) : "memory"); \
   } else { \
@@ -41,7 +41,7 @@ inline __device__ void atomic_max(type* dest, type value, __DESUL_IMPL_CUDA_ASM_
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_INC(type,asm_type,reg_type) \
-inline __device__ void atomic_inc(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ void device_atomic_inc(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   type limit = desul::Impl::numeric_limits_max<type>::value; \
   if(__isGlobal(dest)) { \
   asm volatile("red.inc.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_type " [%0],%1;" :: "l"(dest),reg_type(limit) : "memory"); \
@@ -51,7 +51,7 @@ inline __device__ void atomic_inc(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_DEC(type,asm_type,reg_type) \
-inline __device__ void atomic_dec(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ void device_atomic_dec(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   type limit = desul::Impl::numeric_limits_max<type>::value; \
   if(__isGlobal(dest)) { \
   asm volatile("red.dec.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_type " [%0],%1;" :: "l"(dest),reg_type(limit) : "memory"); \
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_predicate b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_predicate
index 46e0ccf5e747e151039f68e17a72c82a05fc14fc..4ae8e46266e0f4b72a384db76b7f258314bc2838 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_predicate
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_predicate
@@ -4,7 +4,7 @@
 
 // Non Returning Atomic Operations
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_ADD(type,asm_type,reg_type) \
-inline __device__ void atomic_add(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ void device_atomic_add(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   asm volatile( \
           "{\n\t" \
           ".reg .pred p;\n\t" \
@@ -16,7 +16,7 @@ inline __device__ void atomic_add(type* dest, type value, __DESUL_IMPL_CUDA_ASM_
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_SUB(type,asm_type,reg_type) \
-inline __device__ void atomic_sub(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ void device_atomic_sub(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   type neg_value = -value; \
   asm volatile( \
           "{\n\t" \
@@ -29,7 +29,7 @@ inline __device__ void atomic_sub(type* dest, type value, __DESUL_IMPL_CUDA_ASM_
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_MIN(type,asm_type,reg_type) \
-inline __device__ void atomic_min(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ void device_atomic_min(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   asm volatile( \
           "{\n\t" \
           ".reg .pred p;\n\t" \
@@ -41,7 +41,7 @@ inline __device__ void atomic_min(type* dest, type value, __DESUL_IMPL_CUDA_ASM_
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_MAX(type,asm_type,reg_type) \
-inline __device__ void atomic_max(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ void device_atomic_max(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   asm volatile( \
           "{\n\t" \
           ".reg .pred p;\n\t" \
@@ -53,7 +53,7 @@ inline __device__ void atomic_max(type* dest, type value, __DESUL_IMPL_CUDA_ASM_
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_INC(type,asm_type,reg_type) \
-inline __device__ void atomic_inc(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ void device_atomic_inc(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   type limit = desul::Impl::numeric_limits_max<type>::value; \
   asm volatile( \
           "{\n\t" \
@@ -66,7 +66,7 @@ inline __device__ void atomic_inc(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER
 }
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_DEC(type,asm_type,reg_type) \
-inline __device__ void atomic_dec(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ void device_atomic_dec(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   type limit = desul::Impl::numeric_limits_max<type>::value; \
   asm volatile( \
           "{\n\t" \
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_exchange_op.inc b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_exchange_op.inc
index 51d992087e35f8842fbc143f8e903273499d4507..eccafde74b494ad7f0b9023137cd0ce1ef231588 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_exchange_op.inc
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_exchange_op.inc
@@ -1,14 +1,14 @@
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_EXCHANGE() \
 template<class ctype> \
-inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_exchange(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ typename ::std::enable_if<sizeof(ctype)==4, ctype>::type device_atomic_exchange(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   uint32_t asm_value = reinterpret_cast<uint32_t&>(value); \
   uint32_t asm_result = 0u; \
   asm volatile("atom.exch" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM ".b32" " %0,[%1],%2;" : "=r"(asm_result) : "l"(dest),"r"(asm_value) : "memory"); \
   return reinterpret_cast<ctype&>(asm_result); \
 } \
 template<class ctype> \
-inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_exchange(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ typename ::std::enable_if<sizeof(ctype)==8, ctype>::type device_atomic_exchange(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   uint64_t asm_value = reinterpret_cast<uint64_t&>(value); \
   uint64_t asm_result = 0u; \
   asm volatile("atom.exch" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM ".b64" " %0,[%1],%2;" : "=l"(asm_result) : "l"(dest),"l"(asm_value) : "memory"); \
@@ -17,7 +17,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_
 
 #define __DESUL_IMPL_CUDA_ASM_ATOMIC_COMPARE_EXCHANGE() \
 template<class ctype> \
-inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_compare_exchange(ctype* dest, ctype compare, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ typename ::std::enable_if<sizeof(ctype)==4, ctype>::type device_atomic_compare_exchange(ctype* dest, ctype compare, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   uint32_t asm_value = reinterpret_cast<uint32_t&>(value); \
   uint32_t asm_compare = reinterpret_cast<uint32_t&>(compare); \
   uint32_t asm_result = 0u; \
@@ -25,7 +25,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_
   return reinterpret_cast<ctype&>(asm_result); \
 } \
 template<class ctype> \
-inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_compare_exchange(ctype* dest, ctype compare, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
+inline __device__ typename ::std::enable_if<sizeof(ctype)==8, ctype>::type device_atomic_compare_exchange(ctype* dest, ctype compare, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \
   uint64_t asm_value = reinterpret_cast<uint64_t&>(value); \
   uint64_t asm_compare = reinterpret_cast<uint64_t&>(compare); \
   uint64_t asm_result = 0u; \
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/openmp/OpenMP_40.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/openmp/OpenMP_40.hpp
index f4f1bbd96ee6b73d5ec15372256bb4177c033234..bc9ef5b696a6eca92acc206b3dfd2987696d426c 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/openmp/OpenMP_40.hpp
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/openmp/OpenMP_40.hpp
@@ -1,4 +1,4 @@
-/* 
+/*
 Copyright (c) 2019, Lawrence Livermore National Security, LLC
 and DESUL project contributors. See the COPYRIGHT file for details.
 Source: https://github.com/desul/desul
@@ -8,65 +8,64 @@ SPDX-License-Identifier: (BSD-3-Clause)
 
 #ifndef DESUL_ATOMICS_OPENMP40_HPP_
 #define DESUL_ATOMICS_OPENMP40_HPP_
-#include<type_traits>
+
+#include <type_traits>
 
 namespace desul {
 namespace Impl {
-  template<class MEMORY_ORDER_TMP, class MEMORY_SCOPE_TMP>
-  void openmp_maybe_call_pre_capture_flush(MEMORY_ORDER_TMP, MEMORY_SCOPE_TMP) {}
-  template<class MEMORY_SCOPE_TMP>
-  void openmp_maybe_call_pre_capture_flush(MemoryOrderAcquire, MEMORY_SCOPE_TMP) {
-    atomic_thread_fence(MemoryOrderAcquire(), MEMORY_SCOPE_TMP());
-  }
-  template<class MEMORY_SCOPE_TMP>
-  void openmp_maybe_call_pre_capture_flush(MemoryOrderAcqRel, MEMORY_SCOPE_TMP) {
-    atomic_thread_fence(MemoryOrderAcqRel(), MEMORY_SCOPE_TMP());
-  }
-  template<class MEMORY_SCOPE_TMP>
-  void openmp_maybe_call_pre_capture_flush(MemoryOrderSeqCst, MEMORY_SCOPE_TMP) {
-    atomic_thread_fence(MemoryOrderSeqCst(), MEMORY_SCOPE_TMP());
-  }
-
-  template<class MEMORY_ORDER_TMP, class MEMORY_SCOPE_TMP>
-  void openmp_maybe_call_post_capture_flush(MEMORY_ORDER_TMP, MEMORY_SCOPE_TMP) {}
-  template<class MEMORY_SCOPE_TMP>
-  void openmp_maybe_call_post_capture_flush(MemoryOrderRelease, MEMORY_SCOPE_TMP) {
-    atomic_thread_fence(MemoryOrderRelease(), MEMORY_SCOPE_TMP());
-  }
-  template<class MEMORY_SCOPE_TMP>
-  void openmp_maybe_call_post_capture_flush(MemoryOrderAcqRel, MEMORY_SCOPE_TMP) {
-    atomic_thread_fence(MemoryOrderAcqRel(), MEMORY_SCOPE_TMP());
-  }
-  template<class MEMORY_SCOPE_TMP>
-  void openmp_maybe_call_post_capture_flush(MemoryOrderSeqCst, MEMORY_SCOPE_TMP) {
-    atomic_thread_fence(MemoryOrderSeqCst(), MEMORY_SCOPE_TMP());
-  }
+template <class MEMORY_ORDER_TMP, class MEMORY_SCOPE_TMP>
+void openmp_maybe_call_pre_capture_flush(MEMORY_ORDER_TMP, MEMORY_SCOPE_TMP) {}
+template <class MEMORY_SCOPE_TMP>
+void openmp_maybe_call_pre_capture_flush(MemoryOrderAcquire, MEMORY_SCOPE_TMP) {
+  atomic_thread_fence(MemoryOrderAcquire(), MEMORY_SCOPE_TMP());
+}
+template <class MEMORY_SCOPE_TMP>
+void openmp_maybe_call_pre_capture_flush(MemoryOrderAcqRel, MEMORY_SCOPE_TMP) {
+  atomic_thread_fence(MemoryOrderAcqRel(), MEMORY_SCOPE_TMP());
+}
+template <class MEMORY_SCOPE_TMP>
+void openmp_maybe_call_pre_capture_flush(MemoryOrderSeqCst, MEMORY_SCOPE_TMP) {
+  atomic_thread_fence(MemoryOrderSeqCst(), MEMORY_SCOPE_TMP());
+}
 
-  template<class T>
-  struct is_openmp_atomic_type_t {
-    static constexpr bool value = std::is_arithmetic<T>::value;
-  };
-  template<class T>
-  constexpr bool is_openmp_atomic_type_v = is_openmp_atomic_type_t<T>::value;
+template <class MEMORY_ORDER_TMP, class MEMORY_SCOPE_TMP>
+void openmp_maybe_call_post_capture_flush(MEMORY_ORDER_TMP, MEMORY_SCOPE_TMP) {}
+template <class MEMORY_SCOPE_TMP>
+void openmp_maybe_call_post_capture_flush(MemoryOrderRelease, MEMORY_SCOPE_TMP) {
+  atomic_thread_fence(MemoryOrderRelease(), MEMORY_SCOPE_TMP());
+}
+template <class MEMORY_SCOPE_TMP>
+void openmp_maybe_call_post_capture_flush(MemoryOrderAcqRel, MEMORY_SCOPE_TMP) {
+  atomic_thread_fence(MemoryOrderAcqRel(), MEMORY_SCOPE_TMP());
 }
+template <class MEMORY_SCOPE_TMP>
+void openmp_maybe_call_post_capture_flush(MemoryOrderSeqCst, MEMORY_SCOPE_TMP) {
+  atomic_thread_fence(MemoryOrderSeqCst(), MEMORY_SCOPE_TMP());
 }
 
+template <class T>
+constexpr bool is_openmp_atomic_type_v = std::is_arithmetic<T>::value;
+}  // namespace Impl
+}  // namespace desul
+
 namespace desul {
+namespace impl {
 // Can't use a macro approach to get all definitions since the ops include #pragma omp
 // So gonna use multiple inclusion of the same code snippet here.
 
-// Can't do Node level atomics this way with OpenMP Target, but we could 
-// have a define which says whether or not Device level IS node level (e.g. for pure CPU node)
+// Can't do Node level atomics this way with OpenMP Target, but we could
+// have a define which says whether or not Device level IS node level (e.g. for pure CPU
+// node)
 
 #define MEMORY_ORDER MemoryOrderRelaxed
 // #define MEMORY_SCOPE MemoryScopeNode
 // #include<desul/atomics/openmp/OpenMP_40_op.inc>
 // #undef MEMORY_SCOPE
 #define MEMORY_SCOPE MemoryScopeDevice
-#include<desul/atomics/openmp/OpenMP_40_op.inc>
+#include <desul/atomics/openmp/OpenMP_40_op.inc>
 #undef MEMORY_SCOPE
 #define MEMORY_SCOPE MemoryScopeCore
-#include<desul/atomics/openmp/OpenMP_40_op.inc>
+#include <desul/atomics/openmp/OpenMP_40_op.inc>
 #undef MEMORY_SCOPE
 #undef MEMORY_ORDER
 
@@ -75,10 +74,10 @@ namespace desul {
 // #include<desul/atomics/openmp/OpenMP_40_op.inc>
 // #undef MEMORY_SCOPE
 #define MEMORY_SCOPE MemoryScopeDevice
-#include<desul/atomics/openmp/OpenMP_40_op.inc>
+#include <desul/atomics/openmp/OpenMP_40_op.inc>
 #undef MEMORY_SCOPE
 #define MEMORY_SCOPE MemoryScopeCore
-#include<desul/atomics/openmp/OpenMP_40_op.inc>
+#include <desul/atomics/openmp/OpenMP_40_op.inc>
 #undef MEMORY_SCOPE
 #undef MEMORY_ORDER
 
@@ -87,11 +86,12 @@ namespace desul {
 // #include<desul/atomics/openmp/OpenMP_40_op.inc>
 // #undef MEMORY_SCOPE
 #define MEMORY_SCOPE MemoryScopeDevice
-#include<desul/atomics/openmp/OpenMP_40_op.inc>
+#include <desul/atomics/openmp/OpenMP_40_op.inc>
 #undef MEMORY_SCOPE
 #define MEMORY_SCOPE MemoryScopeCore
-#include<desul/atomics/openmp/OpenMP_40_op.inc>
+#include <desul/atomics/openmp/OpenMP_40_op.inc>
 #undef MEMORY_SCOPE
 #undef MEMORY_ORDER
+}  // namespace impl
 }  // namespace desul
 #endif
diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/openmp/OpenMP_40_op.inc b/packages/kokkos/tpls/desul/include/desul/atomics/openmp/OpenMP_40_op.inc
index a65f2a457dff8b2ec6e186411359e73b729fb5e1..7a65edda3932d1e190e6a949b11e517b906243b5 100644
--- a/packages/kokkos/tpls/desul/include/desul/atomics/openmp/OpenMP_40_op.inc
+++ b/packages/kokkos/tpls/desul/include/desul/atomics/openmp/OpenMP_40_op.inc
@@ -1,6 +1,6 @@
 
   template <typename T>                                                           
-  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_fetch_add(  
+  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_fetch_add(  
       T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       
     T tmp;                                                                        
     Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE());
@@ -10,7 +10,7 @@
     return tmp;                                                                   
   }                                                                               
   template <typename T>                                                           
-  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_fetch_sub(  
+  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_fetch_sub(  
       T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       
     T tmp;                                                                        
     Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE());    
@@ -20,7 +20,7 @@
     return tmp;                                                                   
   }                                                                               
   template <typename T>                                                           
-  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_fetch_and(  
+  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_fetch_and(  
       T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       
     T tmp;                                                                        
     Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE());   
@@ -30,7 +30,7 @@
     return tmp;                                                                   
   }                                                                               
   template <typename T>                                                           
-  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_fetch_or(   
+  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_fetch_or(   
       T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       
     T tmp;                                                                        
     Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE());    
@@ -40,7 +40,7 @@
     return tmp;                                                                   
   }                                                                               
   template <typename T>                                                           
-  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_fetch_xor(  
+  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_fetch_xor(  
       T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       
     T tmp;                                                                        
     Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE());    
@@ -50,7 +50,7 @@
     return tmp;                                                                   
   }                                                                               
   template <typename T>                                                           
-  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_add_fetch(  
+  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_add_fetch(  
       T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       
     T tmp;                                                                        
     Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE());    
@@ -60,7 +60,7 @@
     return tmp;                                                                   
   }                                                                               
   template <typename T>                                                           
-  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_sub_fetch(  
+  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_sub_fetch(  
       T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       
     T tmp;                                                                        
     Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE());    
@@ -70,7 +70,7 @@
     return tmp;                                                                   
   }                                                                               
   template <typename T>                                                           
-  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_and_fetch(  
+  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_and_fetch(  
       T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       
     T tmp;                                                                        
     Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE());    
@@ -80,7 +80,7 @@
     return tmp;                                                                   
   }                                                                               
   template <typename T>                                                           
-  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_or_fetch(   
+  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_or_fetch(   
       T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       
     T tmp;                                                                        
     Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE());    
@@ -90,7 +90,7 @@
     return tmp;                                                                   
   }                                                                               
   template <typename T>                                                           
-  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_xor_fetch(  
+  std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_xor_fetch(  
       T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) {                       
     T tmp;                                                                        
     Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE());    
diff --git a/packages/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp b/packages/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp
index cb8482c5da8b83bb1fc6323dea09fffce86d115b..19944b378e2c47090dbe3ce28913017a3f308933 100644
--- a/packages/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp
+++ b/packages/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp
@@ -70,7 +70,7 @@ void init_lock_arrays_cuda() {
                              "init_lock_arrays_cuda: cudaMalloc host locks");
 
   auto error_sync1 = cudaDeviceSynchronize();
-  DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE();
+  copy_cuda_lock_arrays_to_device();
   check_error_and_throw_cuda(error_sync1, "init_lock_arrays_cuda: post mallocs");
   init_lock_arrays_cuda_kernel<<<(CUDA_SPACE_ATOMIC_MASK + 1 + 255) / 256, 256>>>();
   auto error_sync2 = cudaDeviceSynchronize();
@@ -85,7 +85,7 @@ void finalize_lock_arrays_cuda() {
   CUDA_SPACE_ATOMIC_LOCKS_DEVICE_h = nullptr;
   CUDA_SPACE_ATOMIC_LOCKS_NODE_h = nullptr;
 #ifdef __CUDACC_RDC__
-  DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE();
+  copy_cuda_lock_arrays_to_device();
 #endif
 }
 
diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/compressed_pair.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/compressed_pair.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..163ec5fa56a418b6e7d7f94ffd74780e9e038805
--- /dev/null
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/compressed_pair.hpp
@@ -0,0 +1,225 @@
+/*
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
+//
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
+// the U.S. Government retains certain rights in this software.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the Corporation nor the names of the
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// 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 Christian R. Trott (crtrott@sandia.gov)
+//
+// ************************************************************************
+//@HEADER
+*/
+
+#pragma once
+
+#include "macros.hpp"
+#include "trait_backports.hpp"
+
+#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+#  include "no_unique_address.hpp"
+#endif
+
+namespace std {
+namespace experimental {
+namespace detail {
+
+// For no unique address emulation, this is the case taken when neither are empty.
+// For real `[[no_unique_address]]`, this case is always taken.
+template <class _T, class _U, class _Enable = void> struct __compressed_pair {
+  _MDSPAN_NO_UNIQUE_ADDRESS _T __t_val;
+  _MDSPAN_NO_UNIQUE_ADDRESS _U __u_val;
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T &__first() noexcept { return __t_val; }
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _T const &__first() const noexcept {
+    return __t_val;
+  }
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _U &__second() noexcept { return __u_val; }
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _U const &__second() const noexcept {
+    return __u_val;
+  }
+
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __compressed_pair() noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __compressed_pair(__compressed_pair const &) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __compressed_pair(__compressed_pair &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair &
+  operator=(__compressed_pair const &) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair &
+  operator=(__compressed_pair &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  ~__compressed_pair() noexcept = default;
+  template <class _TLike, class _ULike>
+  MDSPAN_INLINE_FUNCTION constexpr __compressed_pair(_TLike &&__t, _ULike &&__u)
+      : __t_val((_TLike &&) __t), __u_val((_ULike &&) __u) {}
+};
+
+#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+
+// First empty.
+template <class _T, class _U>
+struct __compressed_pair<
+    _T, _U,
+    enable_if_t<_MDSPAN_TRAIT(is_empty, _T) && !_MDSPAN_TRAIT(is_empty, _U)>>
+    : private _T {
+  _U __u_val;
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T &__first() noexcept {
+    return *static_cast<_T *>(this);
+  }
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _T const &__first() const noexcept {
+    return *static_cast<_T const *>(this);
+  }
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _U &__second() noexcept { return __u_val; }
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _U const &__second() const noexcept {
+    return __u_val;
+  }
+
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __compressed_pair() noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __compressed_pair(__compressed_pair const &) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __compressed_pair(__compressed_pair &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair &
+  operator=(__compressed_pair const &) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair &
+  operator=(__compressed_pair &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  ~__compressed_pair() noexcept = default;
+  template <class _TLike, class _ULike>
+  MDSPAN_INLINE_FUNCTION constexpr __compressed_pair(_TLike &&__t, _ULike &&__u)
+      : _T((_TLike &&) __t), __u_val((_ULike &&) __u) {}
+};
+
+// Second empty.
+template <class _T, class _U>
+struct __compressed_pair<
+    _T, _U,
+    enable_if_t<!_MDSPAN_TRAIT(is_empty, _T) && _MDSPAN_TRAIT(is_empty, _U)>>
+    : private _U {
+  _T __t_val;
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T &__first() noexcept { return __t_val; }
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _T const &__first() const noexcept {
+    return __t_val;
+  }
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _U &__second() noexcept {
+    return *static_cast<_U *>(this);
+  }
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _U const &__second() const noexcept {
+    return *static_cast<_U const *>(this);
+  }
+
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __compressed_pair() noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __compressed_pair(__compressed_pair const &) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __compressed_pair(__compressed_pair &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair &
+  operator=(__compressed_pair const &) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair &
+  operator=(__compressed_pair &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  ~__compressed_pair() noexcept = default;
+
+  template <class _TLike, class _ULike>
+  MDSPAN_INLINE_FUNCTION constexpr __compressed_pair(_TLike &&__t, _ULike &&__u)
+      : _U((_ULike &&) __u), __t_val((_TLike &&) __t) {}
+};
+
+// Both empty.
+template <class _T, class _U>
+struct __compressed_pair<
+    _T, _U,
+    enable_if_t<_MDSPAN_TRAIT(is_empty, _T) && _MDSPAN_TRAIT(is_empty, _U)>>
+    // We need to use the __no_unique_address_emulation wrapper here to avoid
+    // base class ambiguities.
+#ifdef _MDSPAN_COMPILER_MSVC
+// MSVC doesn't allow you to access public static member functions of a type
+// when you *happen* to privately inherit from that type.
+    : protected __no_unique_address_emulation<_T, 0>,
+      protected __no_unique_address_emulation<_U, 1>
+#else
+    : private __no_unique_address_emulation<_T, 0>,
+      private __no_unique_address_emulation<_U, 1>
+#endif
+{
+  using __first_base_t = __no_unique_address_emulation<_T, 0>;
+  using __second_base_t = __no_unique_address_emulation<_U, 1>;
+
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T &__first() noexcept {
+    return this->__first_base_t::__ref();
+  }
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _T const &__first() const noexcept {
+    return this->__first_base_t::__ref();
+  }
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _U &__second() noexcept {
+    return this->__second_base_t::__ref();
+  }
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _U const &__second() const noexcept {
+    return this->__second_base_t::__ref();
+  }
+
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __compressed_pair() noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __compressed_pair(__compressed_pair const &) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __compressed_pair(__compressed_pair &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair &
+  operator=(__compressed_pair const &) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair &
+  operator=(__compressed_pair &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  ~__compressed_pair() noexcept = default;
+  template <class _TLike, class _ULike>
+  MDSPAN_INLINE_FUNCTION constexpr __compressed_pair(_TLike &&__t, _ULike &&__u) noexcept
+    : __first_base_t(_T((_TLike &&) __t)),
+      __second_base_t(_U((_ULike &&) __u))
+  { }
+};
+
+#endif // !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+
+} // end namespace detail
+} // end namespace experimental
+} // end namespace std
diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/config.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/config.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..63cb63b9e903f05f439eecf5c89eb18b9a0a9983
--- /dev/null
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/config.hpp
@@ -0,0 +1,302 @@
+/*
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
+//
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
+// the U.S. Government retains certain rights in this software.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the Corporation nor the names of the
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// 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 Christian R. Trott (crtrott@sandia.gov)
+//
+// ************************************************************************
+//@HEADER
+*/
+
+#pragma once
+
+#ifndef __has_include
+#  define __has_include(x) 0
+#endif
+
+#if __has_include(<version>)
+#  include <version>
+#else
+#  include <type_traits>
+#  include <utility>
+#endif
+
+#ifdef _MSVC_LANG
+#define _MDSPAN_CPLUSPLUS _MSVC_LANG
+#else
+#define _MDSPAN_CPLUSPLUS __cplusplus
+#endif
+
+#define MDSPAN_CXX_STD_14 201402L
+#define MDSPAN_CXX_STD_17 201703L
+#define MDSPAN_CXX_STD_20 202002L
+
+#define MDSPAN_HAS_CXX_14 (_MDSPAN_CPLUSPLUS >= MDSPAN_CXX_STD_14)
+#define MDSPAN_HAS_CXX_17 (_MDSPAN_CPLUSPLUS >= MDSPAN_CXX_STD_17)
+#define MDSPAN_HAS_CXX_20 (_MDSPAN_CPLUSPLUS >= MDSPAN_CXX_STD_20)
+
+static_assert(_MDSPAN_CPLUSPLUS >= MDSPAN_CXX_STD_14, "mdspan requires C++14 or later.");
+
+#ifndef _MDSPAN_COMPILER_CLANG
+#  if defined(__clang__)
+#    define _MDSPAN_COMPILER_CLANG __clang__
+#  endif
+#endif
+
+#if !defined(_MDSPAN_COMPILER_MSVC) && !defined(_MDSPAN_COMPILER_MSVC_CLANG)
+#  if defined(_MSC_VER)
+#    if !defined(_MDSPAN_COMPILER_CLANG)
+#      define _MDSPAN_COMPILER_MSVC _MSC_VER
+#    else
+#      define _MDSPAN_COMPILER_MSVC_CLANG _MSC_VER
+#    endif
+#  endif
+#endif
+
+#ifndef _MDSPAN_COMPILER_INTEL
+#  ifdef __INTEL_COMPILER
+#    define _MDSPAN_COMPILER_INTEL __INTEL_COMPILER
+#  endif
+#endif
+
+#ifndef _MDSPAN_COMPILER_APPLECLANG
+#  ifdef __apple_build_version__
+#    define _MDSPAN_COMPILER_APPLECLANG __apple_build_version__
+#  endif
+#endif
+
+#ifndef _MDSPAN_HAS_CUDA
+#  if defined(__CUDACC__)
+#    define _MDSPAN_HAS_CUDA __CUDACC__
+#  endif
+#endif
+
+#ifndef _MDSPAN_HAS_HIP
+#  if defined(__HIPCC__)
+#    define _MDSPAN_HAS_HIP __HIPCC__
+#  endif
+#endif
+
+#ifndef __has_cpp_attribute
+#  define __has_cpp_attribute(x) 0
+#endif
+
+#ifndef _MDSPAN_PRESERVE_STANDARD_LAYOUT
+// Preserve standard layout by default, but we're not removing the old version
+// that turns this off until we're sure this doesn't have an unreasonable cost
+// to the compiler or optimizer.
+#  define _MDSPAN_PRESERVE_STANDARD_LAYOUT 1
+#endif
+
+#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+#  if ((__has_cpp_attribute(no_unique_address) >= 201803L) && \
+       (!defined(__NVCC__) || MDSPAN_HAS_CXX_20) && \
+       (!defined(_MDSPAN_COMPILER_MSVC) || MDSPAN_HAS_CXX_20))
+#    define _MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS 1
+#    define _MDSPAN_NO_UNIQUE_ADDRESS [[no_unique_address]]
+#  else
+#    define _MDSPAN_NO_UNIQUE_ADDRESS
+#  endif
+#endif
+
+// NVCC older than 11.6 chokes on the no-unique-address-emulation
+// so just pretend to use it (to avoid the full blown EBO workaround
+// which NVCC also doesn't like ...), and leave the macro empty
+#ifndef _MDSPAN_NO_UNIQUE_ADDRESS
+#  if defined(__NVCC__)
+#    define _MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS 1
+#    define _MDSPAN_USE_FAKE_ATTRIBUTE_NO_UNIQUE_ADDRESS
+#  endif
+#  define _MDSPAN_NO_UNIQUE_ADDRESS
+#endif
+
+#ifndef _MDSPAN_USE_CONCEPTS
+#  if defined(__cpp_concepts) && __cpp_concepts >= 201507L
+#    define _MDSPAN_USE_CONCEPTS 1
+#  endif
+#endif
+
+#ifndef _MDSPAN_USE_FOLD_EXPRESSIONS
+#  if (defined(__cpp_fold_expressions) && __cpp_fold_expressions >= 201603L) \
+          || (!defined(__cpp_fold_expressions) && MDSPAN_HAS_CXX_17)
+#    define _MDSPAN_USE_FOLD_EXPRESSIONS 1
+#  endif
+#endif
+
+#ifndef _MDSPAN_USE_INLINE_VARIABLES
+#  if defined(__cpp_inline_variables) && __cpp_inline_variables >= 201606L \
+         || (!defined(__cpp_inline_variables) && MDSPAN_HAS_CXX_17)
+#    define _MDSPAN_USE_INLINE_VARIABLES 1
+#  endif
+#endif
+
+#ifndef _MDSPAN_NEEDS_TRAIT_VARIABLE_TEMPLATE_BACKPORTS
+#  if (!(defined(__cpp_lib_type_trait_variable_templates) && __cpp_lib_type_trait_variable_templates >= 201510L) \
+          || !MDSPAN_HAS_CXX_17)
+#    if !(defined(_MDSPAN_COMPILER_APPLECLANG) && MDSPAN_HAS_CXX_17)
+#      define _MDSPAN_NEEDS_TRAIT_VARIABLE_TEMPLATE_BACKPORTS 1
+#    endif
+#  endif
+#endif
+
+#ifndef _MDSPAN_USE_VARIABLE_TEMPLATES
+#  if (defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304 && MDSPAN_HAS_CXX_17) \
+        || (!defined(__cpp_variable_templates) && MDSPAN_HAS_CXX_17)
+#    define _MDSPAN_USE_VARIABLE_TEMPLATES 1
+#  endif
+#endif // _MDSPAN_USE_VARIABLE_TEMPLATES
+
+#ifndef _MDSPAN_USE_CONSTEXPR_14
+#  if (defined(__cpp_constexpr) && __cpp_constexpr >= 201304) \
+        || (!defined(__cpp_constexpr) && MDSPAN_HAS_CXX_14) \
+        && (!(defined(__INTEL_COMPILER) && __INTEL_COMPILER <= 1700))
+#    define _MDSPAN_USE_CONSTEXPR_14 1
+#  endif
+#endif
+
+#ifndef _MDSPAN_USE_INTEGER_SEQUENCE
+#  if defined(_MDSPAN_COMPILER_MSVC)
+#    if (defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304)
+#      define _MDSPAN_USE_INTEGER_SEQUENCE 1
+#    endif
+#  endif
+#endif
+#ifndef _MDSPAN_USE_INTEGER_SEQUENCE
+#  if (defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304) \
+        || (!defined(__cpp_lib_integer_sequence) && MDSPAN_HAS_CXX_14) \
+        /* as far as I can tell, libc++ seems to think this is a C++11 feature... */ \
+        || (defined(__GLIBCXX__) && __GLIBCXX__ > 20150422 && __GNUC__ < 5 && !defined(__INTEL_CXX11_MODE__))
+     // several compilers lie about integer_sequence working properly unless the C++14 standard is used
+#    define _MDSPAN_USE_INTEGER_SEQUENCE 1
+#  elif defined(_MDSPAN_COMPILER_APPLECLANG) && MDSPAN_HAS_CXX_14
+     // appleclang seems to be missing the __cpp_lib_... macros, but doesn't seem to lie about C++14 making
+     // integer_sequence work
+#    define _MDSPAN_USE_INTEGER_SEQUENCE 1
+#  endif
+#endif
+
+#ifndef _MDSPAN_USE_RETURN_TYPE_DEDUCTION
+#  if (defined(__cpp_return_type_deduction) && __cpp_return_type_deduction >= 201304) \
+          || (!defined(__cpp_return_type_deduction) && MDSPAN_HAS_CXX_14)
+#    define _MDSPAN_USE_RETURN_TYPE_DEDUCTION 1
+#  endif
+#endif
+
+#ifndef _MDSPAN_USE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION
+// GCC 10's CTAD seems sufficiently broken to prevent its use.
+#  if (defined(_MDSPAN_COMPILER_CLANG) || !defined(__GNUC__) || __GNUC__ >= 11) \
+      && ((defined(__cpp_deduction_guides) && __cpp_deduction_guides >= 201703) \
+         || (!defined(__cpp_deduction_guides) && MDSPAN_HAS_CXX_17))
+#    define _MDSPAN_USE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION 1
+#  endif
+#endif
+
+#ifndef _MDSPAN_USE_ALIAS_TEMPLATE_ARGUMENT_DEDUCTION
+// GCC 10's CTAD seems sufficiently broken to prevent its use.
+#  if (defined(_MDSPAN_COMPILER_CLANG) || !defined(__GNUC__) || __GNUC__ >= 11) \
+      && ((defined(__cpp_deduction_guides) && __cpp_deduction_guides >= 201907) \
+          || (!defined(__cpp_deduction_guides) && MDSPAN_HAS_CXX_20))
+#    define _MDSPAN_USE_ALIAS_TEMPLATE_ARGUMENT_DEDUCTION 1
+#  endif
+#endif
+
+#ifndef _MDSPAN_USE_STANDARD_TRAIT_ALIASES
+#  if (defined(__cpp_lib_transformation_trait_aliases) && __cpp_lib_transformation_trait_aliases >= 201304) \
+          || (!defined(__cpp_lib_transformation_trait_aliases) && MDSPAN_HAS_CXX_14)
+#    define _MDSPAN_USE_STANDARD_TRAIT_ALIASES 1
+#  elif defined(_MDSPAN_COMPILER_APPLECLANG) && MDSPAN_HAS_CXX_14
+     // appleclang seems to be missing the __cpp_lib_... macros, but doesn't seem to lie about C++14
+#    define _MDSPAN_USE_STANDARD_TRAIT_ALIASES 1
+#  endif
+#endif
+
+#ifndef _MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND
+#  ifdef __GNUC__
+#    if __GNUC__ < 9
+#      define _MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND 1
+#    endif
+#  endif
+#endif
+
+#ifndef MDSPAN_CONDITIONAL_EXPLICIT
+#  if MDSPAN_HAS_CXX_20 && !defined(_MDSPAN_COMPILER_MSVC)
+#    define MDSPAN_CONDITIONAL_EXPLICIT(COND) explicit(COND)
+#  else
+#    define MDSPAN_CONDITIONAL_EXPLICIT(COND)
+#  endif
+#endif
+
+#ifndef MDSPAN_USE_BRACKET_OPERATOR
+#  if defined(__cpp_multidimensional_subscript)
+#    define MDSPAN_USE_BRACKET_OPERATOR 1
+#  else
+#    define MDSPAN_USE_BRACKET_OPERATOR 0
+#  endif
+#endif
+
+#ifndef MDSPAN_USE_PAREN_OPERATOR
+#  if !MDSPAN_USE_BRACKET_OPERATOR
+#    define MDSPAN_USE_PAREN_OPERATOR 1
+#  else
+#    define MDSPAN_USE_PAREN_OPERATOR 0
+#  endif
+#endif
+
+#if MDSPAN_USE_BRACKET_OPERATOR
+#  define __MDSPAN_OP(mds,...) mds[__VA_ARGS__]
+// Corentins demo compiler for subscript chokes on empty [] call,
+// though I believe the proposal supports it?
+#ifdef MDSPAN_NO_EMPTY_BRACKET_OPERATOR
+#  define __MDSPAN_OP0(mds) mds.accessor().access(mds.data_handle(),0)
+#else
+#  define __MDSPAN_OP0(mds) mds[]
+#endif
+#  define __MDSPAN_OP1(mds, a) mds[a]
+#  define __MDSPAN_OP2(mds, a, b) mds[a,b]
+#  define __MDSPAN_OP3(mds, a, b, c) mds[a,b,c]
+#  define __MDSPAN_OP4(mds, a, b, c, d) mds[a,b,c,d]
+#  define __MDSPAN_OP5(mds, a, b, c, d, e) mds[a,b,c,d,e]
+#  define __MDSPAN_OP6(mds, a, b, c, d, e, f) mds[a,b,c,d,e,f]
+#else
+#  define __MDSPAN_OP(mds,...) mds(__VA_ARGS__)
+#  define __MDSPAN_OP0(mds) mds()
+#  define __MDSPAN_OP1(mds, a) mds(a)
+#  define __MDSPAN_OP2(mds, a, b) mds(a,b)
+#  define __MDSPAN_OP3(mds, a, b, c) mds(a,b,c)
+#  define __MDSPAN_OP4(mds, a, b, c, d) mds(a,b,c,d)
+#  define __MDSPAN_OP5(mds, a, b, c, d, e) mds(a,b,c,d,e)
+#  define __MDSPAN_OP6(mds, a, b, c, d, e, f) mds(a,b,c,d,e,f)
+#endif
diff --git a/packages/kokkos/core/src/Kokkos_HIP.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/default_accessor.hpp
similarity index 55%
rename from packages/kokkos/core/src/Kokkos_HIP.hpp
rename to packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/default_accessor.hpp
index c387b5945d77aff8922e49d1d8c9f369deac8667..d26a7e6dad270b0ebadea63b1323f55ec850e855 100644
--- a/packages/kokkos/core/src/Kokkos_HIP.hpp
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/default_accessor.hpp
@@ -2,11 +2,10 @@
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
-//               Solutions of Sandia, LLC (NTESS).
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
 //
-// Under the terms of Contract DE-NA0003525 with NTESS,
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
 // the U.S. Government retains certain rights in this software.
 //
 // Redistribution and use in source and binary forms, with or without
@@ -24,10 +23,10 @@
 // contributors may be used to endorse or promote products derived from
 // this software without specific prior written permission.
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -42,36 +41,46 @@
 //@HEADER
 */
 
-#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
-#include <Kokkos_Macros.hpp>
-#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3
-static_assert(false,
-              "Including non-public Kokkos header files is not allowed.");
-#else
-KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.")
-#endif
-#endif
-#ifndef KOKKOS_HIP_HPP
-#define KOKKOS_HIP_HPP
+#pragma once
 
-#include <Kokkos_Core_fwd.hpp>
+#include "macros.hpp"
 
-#if defined(KOKKOS_ENABLE_HIP)
+#include <cstddef> // size_t
 
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
+namespace std {
+namespace experimental {
 
-#include <Kokkos_HIP_Space.hpp>
-#include <Kokkos_Parallel.hpp>
+template <class ElementType>
+struct default_accessor {
 
-#include <HIP/Kokkos_HIP_Half_Impl_Type.hpp>
-#include <HIP/Kokkos_HIP_Half_Conversion.hpp>
-#include <HIP/Kokkos_HIP_Instance.hpp>
-#include <HIP/Kokkos_HIP_MDRangePolicy.hpp>
-#include <HIP/Kokkos_HIP_Parallel_Range.hpp>
-#include <HIP/Kokkos_HIP_Parallel_MDRange.hpp>
-#include <HIP/Kokkos_HIP_Parallel_Team.hpp>
-#include <HIP/Kokkos_HIP_UniqueToken.hpp>
+  using offset_policy = default_accessor;
+  using element_type = ElementType;
+  using reference = ElementType&;
+  using data_handle_type = ElementType*;
 
-#endif
-#endif
+  MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr default_accessor() noexcept = default;
+
+  MDSPAN_TEMPLATE_REQUIRES(
+    class OtherElementType,
+    /* requires */ (
+      _MDSPAN_TRAIT(is_convertible, OtherElementType(*)[], element_type(*)[])
+    )
+  )
+  MDSPAN_INLINE_FUNCTION
+  constexpr default_accessor(default_accessor<OtherElementType>) noexcept {}
+
+  MDSPAN_INLINE_FUNCTION
+  constexpr data_handle_type
+  offset(data_handle_type p, size_t i) const noexcept {
+    return p + i;
+  }
+
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr reference access(data_handle_type p, size_t i) const noexcept {
+    return p[i];
+  }
+
+};
+
+} // end namespace experimental
+} // end namespace std
diff --git a/packages/kokkos/core/src/impl/Kokkos_PhysicalLayout.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/dynamic_extent.hpp
similarity index 57%
rename from packages/kokkos/core/src/impl/Kokkos_PhysicalLayout.hpp
rename to packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/dynamic_extent.hpp
index bc0a7df3e03969a37f70c71ce5497fd0f864fb2d..206540292d7e783be48ac46502d070013bac6880 100644
--- a/packages/kokkos/core/src/impl/Kokkos_PhysicalLayout.hpp
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/dynamic_extent.hpp
@@ -2,11 +2,10 @@
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
-//               Solutions of Sandia, LLC (NTESS).
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
 //
-// Under the terms of Contract DE-NA0003525 with NTESS,
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
 // the U.S. Government retains certain rights in this software.
 //
 // Redistribution and use in source and binary forms, with or without
@@ -24,10 +23,10 @@
 // contributors may be used to endorse or promote products derived from
 // this software without specific prior written permission.
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -42,36 +41,33 @@
 //@HEADER
 */
 
-#ifndef KOKKOS_PHYSICAL_LAYOUT_HPP
-#define KOKKOS_PHYSICAL_LAYOUT_HPP
+#pragma once
 
-#include <Kokkos_View.hpp>
+#include "macros.hpp"
 
-namespace Kokkos {
-namespace Impl {
+#include <cstddef>  // size_t
+#include <limits>   // numeric_limits
 
-struct PhysicalLayout {
-  enum LayoutType { Left, Right, Scalar, Error };
-  LayoutType layout_type;
-  int rank;
-  long long int stride[9];  // distance between two neighboring elements in a
-                            // given dimension
+namespace std {
+namespace experimental {
 
-  template <class T, class L, class D, class M>
-  PhysicalLayout(const View<T, L, D, M>& view)
-      : layout_type(
-            is_same<typename View<T, L, D, M>::array_layout, LayoutLeft>::value
-                ? Left
-                : (is_same<typename View<T, L, D, M>::array_layout,
-                           LayoutRight>::value
-                       ? Right
-                       : Error)),
-        rank(view.Rank) {
-    for (int i = 0; i < 9; i++) stride[i] = 0;
-    view.stride(stride);
-  }
-};
+_MDSPAN_INLINE_VARIABLE constexpr auto dynamic_extent = std::numeric_limits<size_t>::max();
 
-}  // namespace Impl
-}  // namespace Kokkos
-#endif
+namespace detail {
+
+template <class>
+constexpr auto __make_dynamic_extent() {
+  return dynamic_extent;
+}
+
+template <size_t>
+constexpr auto __make_dynamic_extent_integral() {
+  return dynamic_extent;
+}
+
+} // end namespace detail
+
+} // end namespace experimental
+} // namespace std
+
+//==============================================================================================================
diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/extents.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/extents.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..ce562ed7e2f16b6a7fa6b860d2a94129fe39c0e8
--- /dev/null
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/extents.hpp
@@ -0,0 +1,543 @@
+/*
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
+//
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
+// the U.S. Government retains certain rights in this software.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the Corporation nor the names of the
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// 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 Christian R. Trott (crtrott@sandia.gov)
+//
+// ************************************************************************
+//@HEADER
+*/
+
+#pragma once
+
+#include "macros.hpp"
+#include "static_array.hpp"
+#include "standard_layout_static_array.hpp"
+#include "trait_backports.hpp" // integer_sequence, etc.
+
+#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+#  include "no_unique_address.hpp"
+#endif
+
+#include <array>
+#include <cstddef>
+
+namespace std {
+namespace experimental {
+
+namespace detail {
+
+template<size_t ... Extents>
+struct _count_dynamic_extents;
+
+template<size_t E, size_t ... Extents>
+struct _count_dynamic_extents<E,Extents...> {
+  static constexpr size_t val = (E==dynamic_extent?1:0) + _count_dynamic_extents<Extents...>::val;
+};
+
+template<>
+struct _count_dynamic_extents<> {
+  static constexpr size_t val = 0;
+};
+
+template <size_t... Extents, size_t... OtherExtents>
+static constexpr std::false_type _check_compatible_extents(
+  std::false_type, std::integer_sequence<size_t, Extents...>, std::integer_sequence<size_t, OtherExtents...>
+) noexcept { return { }; }
+
+template <size_t... Extents, size_t... OtherExtents>
+static std::integral_constant<
+  bool,
+  _MDSPAN_FOLD_AND(
+    (
+      Extents == dynamic_extent
+        || OtherExtents == dynamic_extent
+        || Extents == OtherExtents
+    ) /* && ... */
+  )
+>
+_check_compatible_extents(
+  std::true_type, std::integer_sequence<size_t, Extents...>, std::integer_sequence<size_t, OtherExtents...>
+) noexcept { return { }; }
+
+struct __extents_tag { };
+
+} // end namespace detail
+
+template <class ThisIndexType, size_t... Extents>
+class extents
+#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+  : private detail::__no_unique_address_emulation<
+      detail::__partially_static_sizes_tagged<detail::__extents_tag, ThisIndexType , size_t, Extents...>>
+#endif
+{
+public:
+
+  using rank_type = size_t;
+  using index_type = ThisIndexType;
+  using size_type = make_unsigned_t<index_type>;
+
+// internal typedefs which for technical reasons are public
+  using __storage_t = detail::__partially_static_sizes_tagged<detail::__extents_tag, index_type, size_t, Extents...>;
+
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+  _MDSPAN_NO_UNIQUE_ADDRESS __storage_t __storage_;
+#else
+  using __base_t = detail::__no_unique_address_emulation<__storage_t>;
+#endif
+
+// private members dealing with the way we internally store dynamic extents
+ private:
+
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14
+  __storage_t& __storage() noexcept {
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+    return __storage_;
+#else
+    return this->__base_t::__ref();
+#endif
+  }
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr __storage_t const& __storage() const noexcept {
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+    return __storage_;
+#else
+    return this->__base_t::__ref();
+#endif
+  }
+
+  template <size_t... Idxs>
+  MDSPAN_FORCE_INLINE_FUNCTION
+  static constexpr
+  std::size_t _static_extent_impl(size_t n, std::integer_sequence<size_t, Idxs...>) noexcept {
+    return _MDSPAN_FOLD_PLUS_RIGHT(((Idxs == n) ? Extents : 0), /* + ... + */ 0);
+  }
+
+  template <class, size_t...>
+  friend class extents;
+
+  template <class OtherIndexType, size_t... OtherExtents, size_t... Idxs>
+  MDSPAN_INLINE_FUNCTION
+  constexpr bool _eq_impl(std::experimental::extents<OtherIndexType, OtherExtents...>, false_type, index_sequence<Idxs...>) const noexcept { return false; }
+  template <class OtherIndexType, size_t... OtherExtents, size_t... Idxs>
+  MDSPAN_INLINE_FUNCTION
+  constexpr bool _eq_impl(
+    std::experimental::extents<OtherIndexType, OtherExtents...> other,
+    true_type, index_sequence<Idxs...>
+  ) const noexcept {
+    return _MDSPAN_FOLD_AND(
+      (__storage().template __get_n<Idxs>() == other.__storage().template __get_n<Idxs>()) /* && ... */
+    );
+  }
+
+  template <class OtherIndexType, size_t... OtherExtents, size_t... Idxs>
+  MDSPAN_INLINE_FUNCTION
+  constexpr bool _not_eq_impl(std::experimental::extents<OtherIndexType, OtherExtents...>, false_type, index_sequence<Idxs...>) const noexcept { return true; }
+  template <class OtherIndexType, size_t... OtherExtents, size_t... Idxs>
+  MDSPAN_INLINE_FUNCTION
+  constexpr bool _not_eq_impl(
+    std::experimental::extents<OtherIndexType, OtherExtents...> other,
+    true_type, index_sequence<Idxs...>
+  ) const noexcept {
+    return _MDSPAN_FOLD_OR(
+      (__storage().template __get_n<Idxs>() != other.__storage().template __get_n<Idxs>()) /* || ... */
+    );
+  }
+
+#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+  MDSPAN_INLINE_FUNCTION constexpr explicit
+  extents(__base_t&& __b) noexcept
+    : __base_t(::std::move(__b))
+  { }
+#endif
+
+
+// public interface:
+public:
+  /* Defined above for use in the private code
+  using rank_type = size_t;
+  using index_type = ThisIndexType;
+  */
+
+  MDSPAN_INLINE_FUNCTION
+  static constexpr rank_type rank() noexcept { return sizeof...(Extents); }
+  MDSPAN_INLINE_FUNCTION
+  static constexpr rank_type rank_dynamic() noexcept { return _MDSPAN_FOLD_PLUS_RIGHT((rank_type(Extents == dynamic_extent)), /* + ... + */ 0); }
+
+  //--------------------------------------------------------------------------------
+  // Constructors, Destructors, and Assignment
+
+  // Default constructor
+  MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr extents() noexcept = default;
+
+  // Converting constructor
+  MDSPAN_TEMPLATE_REQUIRES(
+    class OtherIndexType, size_t... OtherExtents,
+    /* requires */ (
+      /* multi-stage check to protect from invalid pack expansion when sizes don't match? */
+      decltype(detail::_check_compatible_extents(
+        std::integral_constant<bool, sizeof...(Extents) == sizeof...(OtherExtents)>{},
+        std::integer_sequence<size_t, Extents...>{},
+        std::integer_sequence<size_t, OtherExtents...>{}
+      ))::value
+    )
+  )
+  MDSPAN_INLINE_FUNCTION
+  MDSPAN_CONDITIONAL_EXPLICIT(
+    (((Extents != dynamic_extent) && (OtherExtents == dynamic_extent)) || ...) ||
+    (std::numeric_limits<index_type>::max() < std::numeric_limits<OtherIndexType>::max()))
+  constexpr extents(const extents<OtherIndexType, OtherExtents...>& __other)
+    noexcept
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+    : __storage_{
+#else
+    : __base_t(__base_t{__storage_t{
+#endif
+        __other.__storage().__enable_psa_conversion()
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      }
+#else
+      }})
+#endif
+  {
+    /* TODO: precondition check
+     * other.extent(r) equals Er for each r for which Er is a static extent, and
+     * either
+     *   - sizeof...(OtherExtents) is zero, or
+     *   - other.extent(r) is a representable value of type index_type for all rank index r of other
+     */
+  }
+
+#ifdef __NVCC__
+    MDSPAN_TEMPLATE_REQUIRES(
+    class... Integral,
+    /* requires */ (
+      // TODO: check whether the other version works with newest NVCC, doesn't with 11.4
+      // NVCC seems to pick up rank_dynamic from the wrong extents type???
+      _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, Integral, index_type) /* && ... */) &&
+      _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_nothrow_constructible, index_type, Integral) /* && ... */) &&
+      // NVCC chokes on the fold thingy here so wrote the workaround
+      ((sizeof...(Integral) == detail::_count_dynamic_extents<Extents...>::val) ||
+       (sizeof...(Integral) == sizeof...(Extents)))
+      )
+    )
+#else
+    MDSPAN_TEMPLATE_REQUIRES(
+    class... Integral,
+    /* requires */ (
+       _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, Integral, index_type) /* && ... */) &&
+       _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_nothrow_constructible, index_type, Integral) /* && ... */) &&
+       ((sizeof...(Integral) == rank_dynamic()) || (sizeof...(Integral) == rank()))
+      )
+    )
+#endif
+  MDSPAN_INLINE_FUNCTION
+  explicit constexpr extents(Integral... exts) noexcept
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+    : __storage_{
+#else
+    : __base_t(__base_t{typename __base_t::__stored_type{
+#endif
+      std::conditional_t<sizeof...(Integral)==rank_dynamic(),
+        detail::__construct_psa_from_dynamic_exts_values_tag_t,
+        detail::__construct_psa_from_all_exts_values_tag_t>(),
+        static_cast<index_type>(exts)...
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      }
+#else
+      }})
+#endif
+  {
+    /* TODO: precondition check
+     * If sizeof...(IndexTypes) != rank_dynamic() is true, exts_arr[r] equals Er for each r for which Er is a static extent, and
+     * either
+     *   - sizeof...(exts) == 0 is true, or
+     *   - each element of exts is nonnegative and is a representable value of type index_type.
+     */
+  }
+
+    // TODO: check whether this works with newest NVCC, doesn't with 11.4
+#ifdef __NVCC__
+  // NVCC seems to pick up rank_dynamic from the wrong extents type???
+  // NVCC chokes on the fold thingy here so wrote the workaround
+  MDSPAN_TEMPLATE_REQUIRES(
+    class IndexType, size_t N,
+    /* requires */ (
+      _MDSPAN_TRAIT(is_convertible, IndexType, index_type) &&
+      _MDSPAN_TRAIT(is_nothrow_constructible, index_type, IndexType) &&
+      ((N == detail::_count_dynamic_extents<Extents...>::val) ||
+       (N == sizeof...(Extents)))
+    )
+  )
+#else
+    MDSPAN_TEMPLATE_REQUIRES(
+        class IndexType, size_t N,
+        /* requires */ (
+          _MDSPAN_TRAIT(is_convertible, IndexType, index_type) &&
+          _MDSPAN_TRAIT(is_nothrow_constructible, index_type, IndexType) &&
+          (N == rank() || N == rank_dynamic())
+    )
+  )
+#endif
+  MDSPAN_CONDITIONAL_EXPLICIT(N != rank_dynamic())
+  MDSPAN_INLINE_FUNCTION
+  constexpr
+  extents(std::array<IndexType, N> const& exts) noexcept
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+    : __storage_{
+#else
+    : __base_t(__base_t{typename __base_t::__stored_type{
+#endif
+      std::conditional_t<N==rank_dynamic(),
+        detail::__construct_psa_from_dynamic_exts_array_tag_t<0>,
+        detail::__construct_psa_from_all_exts_array_tag_t>(),
+      std::array<IndexType,N>{exts}
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      }
+#else
+      }})
+#endif
+  {
+    /* TODO: precondition check
+     * If N != rank_dynamic() is true, exts[r] equals Er for each r for which Er is a static extent, and
+     * either
+     *   - N is zero, or
+     *   - exts[r] is nonnegative and is a representable value of type index_type for all rank index r
+     */
+  }
+
+#ifdef __cpp_lib_span
+  // TODO: check whether the below works with newest NVCC, doesn't with 11.4
+#ifdef __NVCC__
+  // NVCC seems to pick up rank_dynamic from the wrong extents type???
+  // NVCC chokes on the fold thingy here so wrote the workaround
+  MDSPAN_TEMPLATE_REQUIRES(
+    class IndexType, size_t N,
+    /* requires */ (
+      _MDSPAN_TRAIT(is_convertible, IndexType, index_type) &&
+      _MDSPAN_TRAIT(is_nothrow_constructible, index_type, IndexType) &&
+      ((N == detail::_count_dynamic_extents<Extents...>::val) ||
+       (N == sizeof...(Extents)))
+    )
+  )
+#else
+    MDSPAN_TEMPLATE_REQUIRES(
+        class IndexType, size_t N,
+        /* requires */ (
+          _MDSPAN_TRAIT(is_convertible, IndexType, index_type) &&
+          _MDSPAN_TRAIT(is_nothrow_constructible, index_type, IndexType) &&
+          (N == rank() || N == rank_dynamic())
+    )
+  )
+#endif
+  MDSPAN_CONDITIONAL_EXPLICIT(N != rank_dynamic())
+  MDSPAN_INLINE_FUNCTION
+  constexpr
+  extents(std::span<IndexType, N> exts) noexcept
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+    : __storage_{
+#else
+    : __base_t(__base_t{typename __base_t::__stored_type{
+#endif
+      std::conditional_t<N==rank_dynamic(),
+        detail::__construct_psa_from_dynamic_exts_array_tag_t<0>,
+        detail::__construct_psa_from_all_exts_array_tag_t>(),
+      exts
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      }
+#else
+      }})
+#endif
+  {
+    /* TODO: precondition check
+     * If N != rank_dynamic() is true, exts[r] equals Er for each r for which Er is a static extent, and
+     * either
+     *   - N is zero, or
+     *   - exts[r] is nonnegative and is a representable value of type index_type for all rank index r
+     */
+  }
+#endif
+
+  // Need this constructor for some submdspan implementation stuff
+  // for the layout_stride case where I use an extents object for strides
+  MDSPAN_INLINE_FUNCTION
+  constexpr explicit
+  extents(__storage_t const& sto ) noexcept
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+    : __storage_{
+#else
+    : __base_t(__base_t{
+#endif
+        sto
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      }
+#else
+      })
+#endif
+  { }
+
+  //--------------------------------------------------------------------------------
+
+  MDSPAN_INLINE_FUNCTION
+  static constexpr
+  size_t static_extent(size_t n) noexcept {
+    // Can't do assert here since that breaks true constexpr ness
+    // assert(n<rank());
+    return _static_extent_impl(n, std::make_integer_sequence<size_t, sizeof...(Extents)>{});
+  }
+
+  MDSPAN_INLINE_FUNCTION
+  constexpr
+  index_type extent(size_t n) const noexcept {
+    // Can't do assert here since that breaks true constexpr ness
+    // assert(n<rank());
+    return __storage().__get(n);
+  }
+
+  //--------------------------------------------------------------------------------
+
+  template<class OtherIndexType, size_t... RHS>
+  MDSPAN_INLINE_FUNCTION
+  friend constexpr bool operator==(extents const& lhs, extents<OtherIndexType, RHS...> const& rhs) noexcept {
+    return lhs._eq_impl(
+      rhs, std::integral_constant<bool, (sizeof...(RHS) == rank())>{},
+      make_index_sequence<sizeof...(RHS)>{}
+    );
+  }
+
+#if !(MDSPAN_HAS_CXX_20)
+  template<class OtherIndexType, size_t... RHS>
+  MDSPAN_INLINE_FUNCTION
+  friend constexpr bool operator!=(extents const& lhs, extents<OtherIndexType, RHS...> const& rhs) noexcept {
+    return lhs._not_eq_impl(
+      rhs, std::integral_constant<bool, (sizeof...(RHS) == rank())>{},
+      make_index_sequence<sizeof...(RHS)>{}
+    );
+  }
+#endif
+
+  // End of public interface
+
+public:  // (but not really)
+
+  MDSPAN_INLINE_FUNCTION static constexpr
+  extents __make_extents_impl(detail::__partially_static_sizes<index_type, size_t,Extents...>&& __bs) noexcept {
+    // This effectively amounts to a sideways cast that can be done in a constexpr
+    // context, but we have to do it to handle the case where the extents and the
+    // strides could accidentally end up with the same types in their hierarchies
+    // somehow (which would cause layout_stride::mapping to not be standard_layout)
+    return extents(
+#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      __base_t{
+#endif
+        ::std::move(__bs.template __with_tag<detail::__extents_tag>())
+#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      }
+#endif
+    );
+  }
+
+  template <size_t N>
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr
+  index_type __extent() const noexcept {
+    return __storage().template __get_n<N>();
+  }
+
+  template <size_t N, size_t Default=dynamic_extent>
+  MDSPAN_INLINE_FUNCTION
+  static constexpr
+  index_type __static_extent() noexcept {
+    return __storage_t::template __get_static_n<N, Default>();
+  }
+
+};
+
+namespace detail {
+
+template <class IndexType, size_t Rank, class Extents = ::std::experimental::extents<IndexType>>
+struct __make_dextents;
+
+template <class IndexType, size_t Rank, size_t... ExtentsPack>
+struct __make_dextents<IndexType, Rank, ::std::experimental::extents<IndexType, ExtentsPack...>> {
+  using type = typename __make_dextents<IndexType, Rank - 1,
+    ::std::experimental::extents<IndexType, ::std::experimental::dynamic_extent, ExtentsPack...>>::type;
+};
+
+template <class IndexType, size_t... ExtentsPack>
+struct __make_dextents<IndexType, 0, ::std::experimental::extents<IndexType, ExtentsPack...>> {
+  using type = ::std::experimental::extents<IndexType, ExtentsPack...>;
+};
+
+} // end namespace detail
+
+template <class IndexType, size_t Rank>
+using dextents = typename detail::__make_dextents<IndexType, Rank>::type;
+
+#if defined(_MDSPAN_USE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION)
+template <class... IndexTypes>
+extents(IndexTypes...)
+  -> extents<size_t, detail::__make_dynamic_extent<IndexTypes>()...>;
+#endif
+
+namespace detail {
+
+template <class T>
+struct __is_extents : ::std::false_type {};
+
+template <class IndexType, size_t... ExtentsPack>
+struct __is_extents<::std::experimental::extents<IndexType, ExtentsPack...>> : ::std::true_type {};
+
+template <class T>
+static constexpr bool __is_extents_v = __is_extents<T>::value;
+
+
+template <typename Extents>
+struct __extents_to_partially_static_sizes;
+
+template <class IndexType, size_t... ExtentsPack>
+struct __extents_to_partially_static_sizes<::std::experimental::extents<IndexType, ExtentsPack...>> {
+  using type = detail::__partially_static_sizes<
+          typename ::std::experimental::extents<IndexType, ExtentsPack...>::index_type, size_t, 
+          ExtentsPack...>;
+};
+
+template <typename Extents>
+using __extents_to_partially_static_sizes_t = typename __extents_to_partially_static_sizes<Extents>::type;
+
+} // end namespace detail
+} // end namespace experimental
+} // end namespace std
diff --git a/packages/kokkos/core/src/impl/Kokkos_Timer.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/full_extent_t.hpp
similarity index 64%
rename from packages/kokkos/core/src/impl/Kokkos_Timer.hpp
rename to packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/full_extent_t.hpp
index 6edf571d7892e4260fc7d617a1a86a63d265baa2..e5ede0f9d594be0433e94b97cb716dcbb7779614 100644
--- a/packages/kokkos/core/src/impl/Kokkos_Timer.hpp
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/full_extent_t.hpp
@@ -2,11 +2,10 @@
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
-//               Solutions of Sandia, LLC (NTESS).
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
 //
-// Under the terms of Contract DE-NA0003525 with NTESS,
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
 // the U.S. Government retains certain rights in this software.
 //
 // Redistribution and use in source and binary forms, with or without
@@ -24,10 +23,10 @@
 // contributors may be used to endorse or promote products derived from
 // this software without specific prior written permission.
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -42,28 +41,16 @@
 //@HEADER
 */
 
-#ifndef KOKKOS_IMPLWALLTIME_HPP
-#define KOKKOS_IMPLWALLTIME_HPP
+#pragma once
 
-#include <Kokkos_Macros.hpp>
+#include "macros.hpp"
 
-KOKKOS_IMPL_WARNING("This file is deprecated. Use <Kokkos_Timer.hpp> instead.")
+namespace std {
+namespace experimental {
 
-#include <Kokkos_Timer.hpp>
+struct full_extent_t { explicit full_extent_t() = default; };
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
-namespace Kokkos {
-namespace Impl {
+_MDSPAN_INLINE_VARIABLE constexpr auto full_extent = full_extent_t{ };
 
-/** \brief  Time since construction
- *   Timer promoted from Impl to Kokkos ns
- *   This file included for backwards compatibility
- */
-using Timer KOKKOS_DEPRECATED_WITH_COMMENT("Use Kokkos::Timer instead!") =
-    Kokkos::Timer;
-
-}  // namespace Impl
-}  // namespace Kokkos
-#endif
-
-#endif /* #ifndef KOKKOS_IMPLWALLTIME_HPP */
+} // end namespace experimental
+} // namespace std
diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/layout_left.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/layout_left.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..8cd2e14fb8d7039727ee7a1f87e5a29cdd875136
--- /dev/null
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/layout_left.hpp
@@ -0,0 +1,240 @@
+/*
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
+//
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
+// the U.S. Government retains certain rights in this software.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the Corporation nor the names of the
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// 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 Christian R. Trott (crtrott@sandia.gov)
+//
+// ************************************************************************
+//@HEADER
+*/
+
+#pragma once
+
+#include "macros.hpp"
+#include "trait_backports.hpp"
+#include "extents.hpp"
+
+namespace std {
+namespace experimental {
+
+//==============================================================================
+
+template <class Extents>
+class layout_left::mapping {
+  public:
+    using extents_type = Extents;
+    using index_type = typename extents_type::index_type;
+    using size_type = typename extents_type::size_type;
+    using rank_type = typename extents_type::rank_type;
+    using layout_type = layout_left;
+  private:
+
+    static_assert(detail::__is_extents_v<extents_type>, "std::experimental::layout_left::mapping must be instantiated with a specialization of std::experimental::extents.");
+
+    template <class>
+    friend class mapping;
+
+    // i0+(i1 + E(1)*(i2 + E(2)*i3))
+    template <size_t r, size_t Rank>
+    struct __rank_count {};
+
+    template <size_t r, size_t Rank, class I, class... Indices>
+    constexpr index_type __compute_offset(
+      __rank_count<r,Rank>, const I& i, Indices... idx) const {
+      return __compute_offset(__rank_count<r+1,Rank>(), idx...) *
+                 __extents.template __extent<r>() + i;
+    }
+
+    template<class I>
+    constexpr index_type __compute_offset(
+      __rank_count<extents_type::rank()-1,extents_type::rank()>, const I& i) const {
+      return i;
+    }
+
+    constexpr index_type __compute_offset(__rank_count<0,0>) const { return 0; }
+
+  public:
+
+    //--------------------------------------------------------------------------------
+
+    MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping() noexcept = default;
+    MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping(mapping const&) noexcept = default;
+
+    constexpr mapping(extents_type const& __exts) noexcept
+      :__extents(__exts)
+    { }
+
+    MDSPAN_TEMPLATE_REQUIRES(
+      class OtherExtents,
+      /* requires */ (
+        _MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents)
+      )
+    )
+    MDSPAN_CONDITIONAL_EXPLICIT((!is_convertible<OtherExtents, extents_type>::value)) // needs two () due to comma
+    MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14
+    mapping(mapping<OtherExtents> const& other) noexcept // NOLINT(google-explicit-constructor)
+      :__extents(other.extents())
+    {
+       /*
+        * TODO: check precondition
+        * other.required_span_size() is a representable value of type index_type
+        */
+    }
+
+    MDSPAN_TEMPLATE_REQUIRES(
+      class OtherExtents,
+      /* requires */ (
+        _MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents) &&
+        (extents_type::rank() <= 1)
+      )
+    )
+    MDSPAN_CONDITIONAL_EXPLICIT((!is_convertible<OtherExtents, extents_type>::value)) // needs two () due to comma
+    MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14
+    mapping(layout_right::mapping<OtherExtents> const& other) noexcept // NOLINT(google-explicit-constructor)
+      :__extents(other.extents())
+    {
+       /*
+        * TODO: check precondition
+        * other.required_span_size() is a representable value of type index_type
+        */
+    }
+
+    MDSPAN_TEMPLATE_REQUIRES(
+      class OtherExtents,
+      /* requires */ (
+        _MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents)
+      )
+    )
+    MDSPAN_CONDITIONAL_EXPLICIT((extents_type::rank() > 0))
+    MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14
+    mapping(layout_stride::mapping<OtherExtents> const& other) // NOLINT(google-explicit-constructor)
+      :__extents(other.extents())
+    {
+       /*
+        * TODO: check precondition
+        * other.required_span_size() is a representable value of type index_type
+        */
+       #ifndef __CUDA_ARCH__
+       size_t stride = 1;
+       for(rank_type r=0; r<__extents.rank(); r++) {
+         if(stride != other.stride(r))
+           throw std::runtime_error("Assigning layout_stride to layout_left with invalid strides.");
+         stride *= __extents.extent(r);
+       }
+       #endif
+    }
+
+    MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED mapping& operator=(mapping const&) noexcept = default;
+
+    MDSPAN_INLINE_FUNCTION
+    constexpr const extents_type& extents() const noexcept {
+      return __extents;
+    }
+
+    MDSPAN_INLINE_FUNCTION
+    constexpr index_type required_span_size() const noexcept {
+      index_type value = 1;
+      for(rank_type r=0; r<extents_type::rank(); r++) value*=__extents.extent(r);
+      return value;
+    }
+
+    //--------------------------------------------------------------------------------
+
+    MDSPAN_TEMPLATE_REQUIRES(
+      class... Indices,
+      /* requires */ (
+        (sizeof...(Indices) == extents_type::rank()) &&
+        _MDSPAN_FOLD_AND(
+           (_MDSPAN_TRAIT(is_convertible, Indices, index_type) &&
+            _MDSPAN_TRAIT(is_nothrow_constructible, index_type, Indices))
+        )
+      )
+    )
+    constexpr index_type operator()(Indices... idxs) const noexcept {
+      return __compute_offset(__rank_count<0, extents_type::rank()>(), idxs...);
+    }
+
+
+
+    MDSPAN_INLINE_FUNCTION static constexpr bool is_always_unique() noexcept { return true; }
+    MDSPAN_INLINE_FUNCTION static constexpr bool is_always_exhaustive() noexcept { return true; }
+    MDSPAN_INLINE_FUNCTION static constexpr bool is_always_strided() noexcept { return true; }
+
+    MDSPAN_INLINE_FUNCTION constexpr bool is_unique() const noexcept { return true; }
+    MDSPAN_INLINE_FUNCTION constexpr bool is_exhaustive() const noexcept { return true; }
+    MDSPAN_INLINE_FUNCTION constexpr bool is_strided() const noexcept { return true; }
+
+    MDSPAN_INLINE_FUNCTION
+    constexpr index_type stride(rank_type i) const noexcept {
+      index_type value = 1;
+      for(rank_type r=0; r<i; r++) value*=__extents.extent(r);
+      return value;
+    }
+
+    template<class OtherExtents>
+    MDSPAN_INLINE_FUNCTION
+    friend constexpr bool operator==(mapping const& lhs, mapping<OtherExtents> const& rhs) noexcept {
+      return lhs.extents() == rhs.extents();
+    }
+
+    // In C++ 20 the not equal exists if equal is found
+#if MDSPAN_HAS_CXX_20
+    template<class OtherExtents>
+    MDSPAN_INLINE_FUNCTION
+    friend constexpr bool operator!=(mapping const& lhs, mapping<OtherExtents> const& rhs) noexcept {
+      return lhs.extents() != rhs.extents();
+    }
+#endif
+
+    // Not really public, but currently needed to implement fully constexpr useable submdspan:
+    template<size_t N, class SizeType, size_t ... E, size_t ... Idx>
+    constexpr index_type __get_stride(std::experimental::extents<SizeType, E...>,integer_sequence<size_t, Idx...>) const {
+      return _MDSPAN_FOLD_TIMES_RIGHT((Idx<N? __extents.template __extent<Idx>():1),1);
+    }
+    template<size_t N>
+    constexpr index_type __stride() const noexcept {
+      return __get_stride<N>(__extents, make_index_sequence<extents_type::rank()>());
+    }
+
+private:
+   _MDSPAN_NO_UNIQUE_ADDRESS extents_type __extents{};
+
+};
+
+
+} // end namespace experimental
+} // end namespace std
+
diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/layout_right.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/layout_right.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..118f3632c009d19eb0ef763329478c12a1444d8c
--- /dev/null
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/layout_right.hpp
@@ -0,0 +1,240 @@
+/*
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
+//
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
+// the U.S. Government retains certain rights in this software.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the Corporation nor the names of the
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// 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 Christian R. Trott (crtrott@sandia.gov)
+//
+// ************************************************************************
+//@HEADER
+*/
+
+#pragma once
+
+#include "macros.hpp"
+#include "trait_backports.hpp"
+#include "extents.hpp"
+#include <stdexcept>
+#include "layout_stride.hpp"
+
+namespace std {
+namespace experimental {
+
+//==============================================================================
+template <class Extents>
+class layout_right::mapping {
+  public:
+    using extents_type = Extents;
+    using index_type = typename extents_type::index_type;
+    using size_type = typename extents_type::size_type;
+    using rank_type = typename extents_type::rank_type;
+    using layout_type = layout_right;
+  private:
+
+    static_assert(detail::__is_extents_v<extents_type>, "std::experimental::layout_right::mapping must be instantiated with a specialization of std::experimental::extents.");
+
+    template <class>
+    friend class mapping;
+
+    // i0+(i1 + E(1)*(i2 + E(2)*i3))
+    template <size_t r, size_t Rank>
+    struct __rank_count {};
+
+    template <size_t r, size_t Rank, class I, class... Indices>
+    constexpr index_type __compute_offset(
+      index_type offset, __rank_count<r,Rank>, const I& i, Indices... idx) const {
+      return __compute_offset(offset * __extents.template __extent<r>() + i,__rank_count<r+1,Rank>(),  idx...);
+    }
+
+    template<class I, class ... Indices>
+    constexpr index_type __compute_offset(
+      __rank_count<0,extents_type::rank()>, const I& i, Indices... idx) const {
+      return __compute_offset(i,__rank_count<1,extents_type::rank()>(),idx...);
+    }
+
+    constexpr index_type __compute_offset(size_t offset, __rank_count<extents_type::rank(), extents_type::rank()>) const {
+      return static_cast<index_type>(offset);
+    }
+
+    constexpr index_type __compute_offset(__rank_count<0,0>) const { return 0; }
+
+  public:
+
+    //--------------------------------------------------------------------------------
+
+    MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping() noexcept = default;
+    MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping(mapping const&) noexcept = default;
+
+    constexpr mapping(extents_type const& __exts) noexcept
+      :__extents(__exts)
+    { }
+
+    MDSPAN_TEMPLATE_REQUIRES(
+      class OtherExtents,
+      /* requires */ (
+        _MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents)
+      )
+    )
+    MDSPAN_CONDITIONAL_EXPLICIT((!is_convertible<OtherExtents, extents_type>::value)) // needs two () due to comma
+    MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14
+    mapping(mapping<OtherExtents> const& other) noexcept // NOLINT(google-explicit-constructor)
+      :__extents(other.extents())
+    {
+       /*
+        * TODO: check precondition
+        * other.required_span_size() is a representable value of type index_type
+        */
+    }
+
+    MDSPAN_TEMPLATE_REQUIRES(
+      class OtherExtents,
+      /* requires */ (
+        _MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents) &&
+        (extents_type::rank() <= 1)
+      )
+    )
+    MDSPAN_CONDITIONAL_EXPLICIT((!is_convertible<OtherExtents, extents_type>::value)) // needs two () due to comma
+    MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14
+    mapping(layout_left::mapping<OtherExtents> const& other) noexcept // NOLINT(google-explicit-constructor)
+      :__extents(other.extents())
+    {
+       /*
+        * TODO: check precondition
+        * other.required_span_size() is a representable value of type index_type
+        */
+    }
+
+    MDSPAN_TEMPLATE_REQUIRES(
+      class OtherExtents,
+      /* requires */ (
+        _MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents)
+      )
+    )
+    MDSPAN_CONDITIONAL_EXPLICIT((extents_type::rank() > 0))
+    MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14
+    mapping(layout_stride::mapping<OtherExtents> const& other) // NOLINT(google-explicit-constructor)
+      :__extents(other.extents())
+    {
+       /*
+        * TODO: check precondition
+        * other.required_span_size() is a representable value of type index_type
+        */
+       #ifndef __CUDA_ARCH__
+       size_t stride = 1;
+       for(rank_type r=__extents.rank(); r>0; r--) {
+         if(stride != other.stride(r-1))
+           throw std::runtime_error("Assigning layout_stride to layout_right with invalid strides.");
+         stride *= __extents.extent(r-1);
+       }
+       #endif
+    }
+
+    MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED mapping& operator=(mapping const&) noexcept = default;
+
+    MDSPAN_INLINE_FUNCTION
+    constexpr const extents_type& extents() const noexcept {
+      return __extents;
+    }
+
+    MDSPAN_INLINE_FUNCTION
+    constexpr index_type required_span_size() const noexcept {
+      index_type value = 1;
+      for(rank_type r=0; r != extents_type::rank(); ++r) value*=__extents.extent(r);
+      return value;
+    }
+
+    //--------------------------------------------------------------------------------
+
+    MDSPAN_TEMPLATE_REQUIRES(
+      class... Indices,
+      /* requires */ (
+        (sizeof...(Indices) == extents_type::rank()) &&
+        _MDSPAN_FOLD_AND(
+           (_MDSPAN_TRAIT(is_convertible, Indices, index_type) &&
+            _MDSPAN_TRAIT(is_nothrow_constructible, index_type, Indices))
+        )
+      )
+    )
+    constexpr index_type operator()(Indices... idxs) const noexcept {
+      return __compute_offset(__rank_count<0, extents_type::rank()>(), idxs...);
+    }
+
+    MDSPAN_INLINE_FUNCTION static constexpr bool is_always_unique() noexcept { return true; }
+    MDSPAN_INLINE_FUNCTION static constexpr bool is_always_exhaustive() noexcept { return true; }
+    MDSPAN_INLINE_FUNCTION static constexpr bool is_always_strided() noexcept { return true; }
+    MDSPAN_INLINE_FUNCTION constexpr bool is_unique() const noexcept { return true; }
+    MDSPAN_INLINE_FUNCTION constexpr bool is_exhaustive() const noexcept { return true; }
+    MDSPAN_INLINE_FUNCTION constexpr bool is_strided() const noexcept { return true; }
+
+    MDSPAN_INLINE_FUNCTION
+    constexpr index_type stride(rank_type i) const noexcept {
+      index_type value = 1;
+      for(rank_type r=extents_type::rank()-1; r>i; r--) value*=__extents.extent(r);
+      return value;
+    }
+
+    template<class OtherExtents>
+    MDSPAN_INLINE_FUNCTION
+    friend constexpr bool operator==(mapping const& lhs, mapping<OtherExtents> const& rhs) noexcept {
+      return lhs.extents() == rhs.extents();
+    }
+
+    // In C++ 20 the not equal exists if equal is found
+#if MDSPAN_HAS_CXX_20
+    template<class OtherExtents>
+    MDSPAN_INLINE_FUNCTION
+    friend constexpr bool operator!=(mapping const& lhs, mapping<OtherExtents> const& rhs) noexcept {
+      return lhs.extents() != rhs.extents();
+    }
+#endif
+
+    // Not really public, but currently needed to implement fully constexpr useable submdspan:
+    template<size_t N, class SizeType, size_t ... E, size_t ... Idx>
+    constexpr index_type __get_stride(std::experimental::extents<SizeType, E...>,integer_sequence<size_t, Idx...>) const {
+      return _MDSPAN_FOLD_TIMES_RIGHT((Idx>N? __extents.template __extent<Idx>():1),1);
+    }
+    template<size_t N>
+    constexpr index_type __stride() const noexcept {
+      return __get_stride<N>(__extents, make_index_sequence<extents_type::rank()>());
+    }
+
+private:
+   _MDSPAN_NO_UNIQUE_ADDRESS extents_type __extents{};
+
+};
+
+} // end namespace experimental
+} // end namespace std
+
diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/layout_stride.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/layout_stride.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..c04c0c45aee8433f1a734be4fcc5215e414101ea
--- /dev/null
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/layout_stride.hpp
@@ -0,0 +1,553 @@
+/*
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
+//
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
+// the U.S. Government retains certain rights in this software.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the Corporation nor the names of the
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// 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 Christian R. Trott (crtrott@sandia.gov)
+//
+// ************************************************************************
+//@HEADER
+*/
+
+#pragma once
+
+#include "macros.hpp"
+#include "static_array.hpp"
+#include "extents.hpp"
+#include "trait_backports.hpp"
+#include "compressed_pair.hpp"
+
+#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+#  include "no_unique_address.hpp"
+#endif
+
+#include <algorithm>
+#include <numeric>
+#include <array>
+#if  _MDSPAN_USE_CONCEPTS && MDSPAN_HAS_CXX_20
+#include<concepts>
+#endif
+
+namespace std {
+namespace experimental {
+
+struct layout_left {
+  template<class Extents>
+    class mapping;
+};
+struct layout_right {
+  template<class Extents>
+    class mapping;
+};
+
+namespace detail {
+  template<class Layout, class Mapping>
+  constexpr bool __is_mapping_of =
+    is_same<typename Layout::template mapping<typename Mapping::extents_type>, Mapping>::value;
+
+#if  _MDSPAN_USE_CONCEPTS && MDSPAN_HAS_CXX_20
+  template<class M>
+  concept __layout_mapping_alike = requires {
+    requires __is_extents<typename M::extents_type>::value;
+    { M::is_always_strided() } -> same_as<bool>;
+    { M::is_always_exhaustive() } -> same_as<bool>;
+    { M::is_always_unique() } -> same_as<bool>;
+    bool_constant<M::is_always_strided()>::value;
+    bool_constant<M::is_always_exhaustive()>::value;
+    bool_constant<M::is_always_unique()>::value;
+  };
+#endif
+} // namespace detail
+
+struct layout_stride {
+  template <class Extents>
+  class mapping
+#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+    : private detail::__no_unique_address_emulation<
+        detail::__compressed_pair<
+          Extents,
+          std::array<typename Extents::index_type, Extents::rank()>
+        >
+      >
+#endif
+  {
+  public:
+    using extents_type = Extents;
+    using index_type = typename extents_type::index_type;
+    using size_type = typename extents_type::size_type;
+    using rank_type = typename extents_type::rank_type;
+    using layout_type = layout_stride;
+
+    // This could be a `requires`, but I think it's better and clearer as a `static_assert`.
+    static_assert(detail::__is_extents_v<Extents>, "std::experimental::layout_stride::mapping must be instantiated with a specialization of std::experimental::extents.");
+
+
+  private:
+
+    //----------------------------------------------------------------------------
+
+    using __strides_storage_t = array<index_type, extents_type::rank()>;//::std::experimental::dextents<index_type, extents_type::rank()>;
+    using __member_pair_t = detail::__compressed_pair<extents_type, __strides_storage_t>;
+
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+    _MDSPAN_NO_UNIQUE_ADDRESS __member_pair_t __members;
+#else
+    using __base_t = detail::__no_unique_address_emulation<__member_pair_t>;
+#endif
+
+    MDSPAN_FORCE_INLINE_FUNCTION constexpr __strides_storage_t const&
+    __strides_storage() const noexcept {
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      return __members.__second();
+#else
+      return this->__base_t::__ref().__second();
+#endif
+    }
+    MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 __strides_storage_t&
+    __strides_storage() noexcept {
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      return __members.__second();
+#else
+      return this->__base_t::__ref().__second();
+#endif
+    }
+
+    //----------------------------------------------------------------------------
+
+    template <class>
+    friend class mapping;
+
+    //----------------------------------------------------------------------------
+
+    // Workaround for non-deducibility of the index sequence template parameter if it's given at the top level
+    template <class>
+    struct __deduction_workaround;
+
+    template <size_t... Idxs>
+    struct __deduction_workaround<index_sequence<Idxs...>>
+    {
+      template <class OtherExtents>
+      MDSPAN_INLINE_FUNCTION
+      static constexpr bool _eq_impl(mapping const& self, mapping<OtherExtents> const& other) noexcept {
+        return _MDSPAN_FOLD_AND((self.stride(Idxs) == other.stride(Idxs)) /* && ... */);
+      }
+      template <class OtherExtents>
+      MDSPAN_INLINE_FUNCTION
+      static constexpr bool _not_eq_impl(mapping const& self, mapping<OtherExtents> const& other) noexcept {
+        return _MDSPAN_FOLD_OR((self.stride(Idxs) != other.stride(Idxs)) /* || ... */);
+      }
+
+      template <class... Integral>
+      MDSPAN_FORCE_INLINE_FUNCTION
+      static constexpr size_t _call_op_impl(mapping const& self, Integral... idxs) noexcept {
+        return _MDSPAN_FOLD_PLUS_RIGHT((idxs * self.stride(Idxs)), /* + ... + */ 0);
+      }
+
+      MDSPAN_INLINE_FUNCTION
+      static constexpr size_t _req_span_size_impl(mapping const& self) noexcept {
+        // assumes no negative strides; not sure if I'm allowed to assume that or not
+        return __impl::_call_op_impl(self, (self.extents().template __extent<Idxs>() - 1)...) + 1;
+      }
+
+      template<class OtherMapping>
+      MDSPAN_INLINE_FUNCTION
+      static constexpr const __strides_storage_t fill_strides(const OtherMapping& map) {
+        return __strides_storage_t{static_cast<index_type>(map.stride(Idxs))...};
+      }
+
+      MDSPAN_INLINE_FUNCTION
+      static constexpr const __strides_storage_t& fill_strides(const __strides_storage_t& s) {
+        return s;
+      }
+
+      template<class IntegralType>
+      MDSPAN_INLINE_FUNCTION
+      static constexpr const __strides_storage_t fill_strides(const array<IntegralType,extents_type::rank()>& s) {
+        return __strides_storage_t{static_cast<index_type>(s[Idxs])...};
+      }
+
+      MDSPAN_INLINE_FUNCTION
+      static constexpr const __strides_storage_t fill_strides(
+        detail::__extents_to_partially_static_sizes_t<
+          ::std::experimental::dextents<index_type, extents_type::rank()>>&& s) {
+        return __strides_storage_t{static_cast<index_type>(s.template __get_n<Idxs>())...};
+      }
+
+      template<size_t K>
+      MDSPAN_INLINE_FUNCTION
+      static constexpr size_t __return_zero() { return 0; }
+
+      template<class Mapping>
+      MDSPAN_INLINE_FUNCTION
+      static constexpr typename Mapping::index_type
+        __OFFSET(const Mapping& m) { return m(__return_zero<Idxs>()...); }
+    };
+
+    // Can't use defaulted parameter in the __deduction_workaround template because of a bug in MSVC warning C4348.
+    using __impl = __deduction_workaround<make_index_sequence<Extents::rank()>>;
+
+
+    //----------------------------------------------------------------------------
+
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+    MDSPAN_INLINE_FUNCTION constexpr explicit
+    mapping(__member_pair_t&& __m) : __members(::std::move(__m)) {}
+#else
+    MDSPAN_INLINE_FUNCTION constexpr explicit
+    mapping(__base_t&& __b) : __base_t(::std::move(__b)) {}
+#endif
+
+  public: // but not really
+    MDSPAN_INLINE_FUNCTION
+    static constexpr mapping
+    __make_mapping(
+      detail::__extents_to_partially_static_sizes_t<Extents>&& __exts,
+      detail::__extents_to_partially_static_sizes_t<
+        ::std::experimental::dextents<index_type, Extents::rank()>>&& __strs
+    ) noexcept {
+      // call the private constructor we created for this purpose
+      return mapping(
+#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+        __base_t{
+#endif
+          __member_pair_t(
+            extents_type::__make_extents_impl(::std::move(__exts)),
+            __strides_storage_t{__impl::fill_strides(::std::move(__strs))}
+          )
+#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+        }
+#endif
+      );
+    }
+    //----------------------------------------------------------------------------
+
+
+  public:
+
+    //--------------------------------------------------------------------------------
+
+    MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping() noexcept = default;
+    MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping(mapping const&) noexcept = default;
+
+    MDSPAN_TEMPLATE_REQUIRES(
+      class IntegralTypes,
+      /* requires */ (
+        // MSVC 19.32 does not like using index_type here, requires the typename Extents::index_type
+        // error C2641: cannot deduce template arguments for 'std::experimental::layout_stride::mapping'
+        _MDSPAN_TRAIT(is_convertible, const remove_const_t<IntegralTypes>&, typename Extents::index_type) &&
+        _MDSPAN_TRAIT(is_nothrow_constructible, typename Extents::index_type, const remove_const_t<IntegralTypes>&)
+      )
+    )
+    MDSPAN_INLINE_FUNCTION
+    constexpr
+    mapping(
+      extents_type const& e,
+      array<IntegralTypes, extents_type::rank()> const& s
+    ) noexcept
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      : __members{
+#else
+      : __base_t(__base_t{__member_pair_t(
+#endif
+          e, __strides_storage_t(__impl::fill_strides(s))
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+        }
+#else
+        )})
+#endif
+    {
+      /*
+       * TODO: check preconditions
+       * - s[i] > 0 is true for all i in the range [0, rank_ ).
+       * - REQUIRED-SPAN-SIZE(e, s) is a representable value of type index_type ([basic.fundamental]).
+       * - If rank_ is greater than 0, then there exists a permutation P of the integers in the
+       *   range [0, rank_), such that s[ pi ] >= s[ pi − 1 ] * e.extent( pi − 1 ) is true for
+       *   all i in the range [1, rank_ ), where pi is the ith element of P.
+       */
+    }
+
+#ifdef __cpp_lib_span
+    MDSPAN_TEMPLATE_REQUIRES(
+      class IntegralTypes,
+      /* requires */ (
+        // MSVC 19.32 does not like using index_type here, requires the typename Extents::index_type
+        // error C2641: cannot deduce template arguments for 'std::experimental::layout_stride::mapping'
+        _MDSPAN_TRAIT(is_convertible, const remove_const_t<IntegralTypes>&, typename Extents::index_type) &&
+        _MDSPAN_TRAIT(is_nothrow_constructible, typename Extents::index_type, const remove_const_t<IntegralTypes>&)
+      )
+    )
+    MDSPAN_INLINE_FUNCTION
+    constexpr
+    mapping(
+      extents_type const& e,
+      span<IntegralTypes, extents_type::rank()> const& s
+    ) noexcept
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      : __members{
+#else
+      : __base_t(__base_t{__member_pair_t(
+#endif
+          e, __strides_storage_t(__impl::fill_strides(s))
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+        }
+#else
+        )})
+#endif
+    {
+      /*
+       * TODO: check preconditions
+       * - s[i] > 0 is true for all i in the range [0, rank_ ).
+       * - REQUIRED-SPAN-SIZE(e, s) is a representable value of type index_type ([basic.fundamental]).
+       * - If rank_ is greater than 0, then there exists a permutation P of the integers in the
+       *   range [0, rank_), such that s[ pi ] >= s[ pi − 1 ] * e.extent( pi − 1 ) is true for
+       *   all i in the range [1, rank_ ), where pi is the ith element of P.
+       */
+    }
+#endif // __cpp_lib_span
+
+#if !(_MDSPAN_USE_CONCEPTS && MDSPAN_HAS_CXX_20)
+    MDSPAN_TEMPLATE_REQUIRES(
+      class StridedLayoutMapping,
+      /* requires */ (
+        _MDSPAN_TRAIT(is_constructible, extents_type, typename StridedLayoutMapping::extents_type) &&
+        detail::__is_mapping_of<typename StridedLayoutMapping::layout_type, StridedLayoutMapping> &&
+        StridedLayoutMapping::is_always_unique() &&
+        StridedLayoutMapping::is_always_strided()
+      )
+    )
+#else
+    template<class StridedLayoutMapping>
+    requires(
+         detail::__layout_mapping_alike<StridedLayoutMapping> &&
+         _MDSPAN_TRAIT(is_constructible, extents_type, typename StridedLayoutMapping::extents_type) &&
+         StridedLayoutMapping::is_always_unique() &&
+         StridedLayoutMapping::is_always_strided()
+    )
+#endif
+    MDSPAN_CONDITIONAL_EXPLICIT(
+      (!is_convertible<typename StridedLayoutMapping::extents_type, extents_type>::value) &&
+      (detail::__is_mapping_of<layout_left, StridedLayoutMapping> ||
+       detail::__is_mapping_of<layout_right, StridedLayoutMapping> ||
+       detail::__is_mapping_of<layout_stride, StridedLayoutMapping>)
+    ) // needs two () due to comma
+    MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14
+    mapping(StridedLayoutMapping const& other) noexcept // NOLINT(google-explicit-constructor)
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      : __members{
+#else
+      : __base_t(__base_t{__member_pair_t(
+#endif
+          other.extents(), __strides_storage_t(__impl::fill_strides(other))
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+        }
+#else
+        )})
+#endif
+    {
+      /*
+       * TODO: check preconditions
+       * - other.stride(i) > 0 is true for all i in the range [0, rank_ ).
+       * - other.required_span_size() is a representable value of type index_type ([basic.fundamental]).
+       * - OFFSET(other) == 0
+       */
+    }
+
+    //--------------------------------------------------------------------------------
+
+    MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED
+    mapping& operator=(mapping const&) noexcept = default;
+
+    MDSPAN_INLINE_FUNCTION constexpr const extents_type& extents() const noexcept {
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      return __members.__first();
+#else
+      return this->__base_t::__ref().__first();
+#endif
+    };
+
+    MDSPAN_INLINE_FUNCTION
+    constexpr array< index_type, extents_type::rank() > strides() const noexcept {
+      return __strides_storage();
+    }
+
+    MDSPAN_INLINE_FUNCTION
+    constexpr index_type required_span_size() const noexcept {
+      index_type span_size = 1;
+      for(unsigned r = 0; r < extents_type::rank(); r++) {
+        // Return early if any of the extents are zero
+        if(extents().extent(r)==0) return 0;
+        span_size = std::max(span_size, static_cast<index_type>(extents().extent(r) * __strides_storage()[r]));
+      }
+      return span_size;
+    }
+
+
+    MDSPAN_TEMPLATE_REQUIRES(
+      class... Indices,
+      /* requires */ (
+        sizeof...(Indices) == Extents::rank() &&
+        _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, Indices, index_type) /*&& ...*/ ) &&
+        _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_nothrow_constructible, index_type, Indices) /*&& ...*/)
+      )
+    )
+    MDSPAN_FORCE_INLINE_FUNCTION
+    constexpr size_t operator()(Indices... idxs) const noexcept {
+      return __impl::_call_op_impl(*this, static_cast<index_type>(idxs)...);
+    }
+
+    MDSPAN_INLINE_FUNCTION static constexpr bool is_always_unique() noexcept { return true; }
+    MDSPAN_INLINE_FUNCTION static constexpr bool is_always_exhaustive() noexcept {
+      return false;
+    }
+    MDSPAN_INLINE_FUNCTION static constexpr bool is_always_strided() noexcept { return true; }
+
+    MDSPAN_INLINE_FUNCTION static constexpr bool is_unique() noexcept { return true; }
+    MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 bool is_exhaustive() const noexcept {
+// TODO @testing test layout_stride is_exhaustive()
+// FIXME CUDA
+#ifdef __CUDA_ARCH__
+      return false;
+#else
+      auto rem = array<size_t, Extents::rank()>{ };
+      std::iota(rem.begin(), rem.end(), size_t(0));
+      auto next_idx_iter = std::find_if(
+        rem.begin(), rem.end(),
+        [&](size_t i) { return this->stride(i) == 1;  }
+      );
+      if(next_idx_iter != rem.end()) {
+        size_t prev_stride_times_prev_extent =
+          this->extents().extent(*next_idx_iter) * this->stride(*next_idx_iter);
+        // "remove" the index
+        constexpr auto removed_index_sentinel = static_cast<size_t>(-1);
+        *next_idx_iter = removed_index_sentinel;
+        size_t found_count = 1;
+        while (found_count != Extents::rank()) {
+          next_idx_iter = std::find_if(
+            rem.begin(), rem.end(),
+            [&](size_t i) {
+              return i != removed_index_sentinel
+                && static_cast<size_t>(this->extents().extent(i)) == prev_stride_times_prev_extent;
+            }
+          );
+          if (next_idx_iter != rem.end()) {
+            // "remove" the index
+            *next_idx_iter = removed_index_sentinel;
+            ++found_count;
+            prev_stride_times_prev_extent = stride(*next_idx_iter) * this->extents().extent(*next_idx_iter);
+          } else { break; }
+        }
+        return found_count == Extents::rank();
+      }
+      return false;
+#endif
+    }
+    MDSPAN_INLINE_FUNCTION static constexpr bool is_strided() noexcept { return true; }
+
+
+    MDSPAN_INLINE_FUNCTION
+    constexpr index_type stride(rank_type r) const noexcept {
+      return __strides_storage()[r];
+    }
+
+#if !(_MDSPAN_USE_CONCEPTS && MDSPAN_HAS_CXX_20)
+    MDSPAN_TEMPLATE_REQUIRES(
+      class StridedLayoutMapping,
+      /* requires */ (
+        detail::__is_mapping_of<typename StridedLayoutMapping::layout_type, StridedLayoutMapping> &&
+        (extents_type::rank() == StridedLayoutMapping::extents_type::rank()) &&
+        StridedLayoutMapping::is_always_strided()
+      )
+    )
+#else
+    template<class StridedLayoutMapping>
+    requires(
+         detail::__layout_mapping_alike<StridedLayoutMapping> &&
+         (extents_type::rank() == StridedLayoutMapping::extents_type::rank()) &&
+         StridedLayoutMapping::is_always_strided()
+    )
+#endif
+    MDSPAN_INLINE_FUNCTION
+    friend constexpr bool operator==(const mapping& x, const StridedLayoutMapping& y) noexcept {
+      bool strides_match = true;
+      for(rank_type r = 0; r < extents_type::rank(); r++)
+        strides_match = strides_match && (x.stride(r) == y.stride(r));
+      return (x.extents() == y.extents()) &&
+             (__impl::__OFFSET(y)== static_cast<typename StridedLayoutMapping::index_type>(0)) &&
+             strides_match;
+    }
+
+    // This one is not technically part of the proposal. Just here to make implementation a bit more optimal hopefully
+    MDSPAN_TEMPLATE_REQUIRES(
+      class OtherExtents,
+      /* requires */ (
+        (extents_type::rank() == OtherExtents::rank())
+      )
+    )
+    MDSPAN_INLINE_FUNCTION
+    friend constexpr bool operator==(mapping const& lhs, mapping<OtherExtents> const& rhs) noexcept {
+      return __impl::_eq_impl(lhs, rhs);
+    }
+
+#if !MDSPAN_HAS_CXX_20
+    MDSPAN_TEMPLATE_REQUIRES(
+      class StridedLayoutMapping,
+      /* requires */ (
+        detail::__is_mapping_of<typename StridedLayoutMapping::layout_type, StridedLayoutMapping> &&
+        (extents_type::rank() == StridedLayoutMapping::extents_type::rank()) &&
+        StridedLayoutMapping::is_always_strided()
+      )
+    )
+    MDSPAN_INLINE_FUNCTION
+    friend constexpr bool operator!=(const mapping& x, const StridedLayoutMapping& y) noexcept {
+      return not (x == y);
+    }
+
+    MDSPAN_TEMPLATE_REQUIRES(
+      class OtherExtents,
+      /* requires */ (
+        (extents_type::rank() == OtherExtents::rank())
+      )
+    )
+    MDSPAN_INLINE_FUNCTION
+    friend constexpr bool operator!=(mapping const& lhs, mapping<OtherExtents> const& rhs) noexcept {
+      return __impl::_not_eq_impl(lhs, rhs);
+    }
+#endif
+
+  };
+};
+
+} // end namespace experimental
+} // end namespace std
diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/macros.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/macros.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..848dcf91a74a0859de18debae545b59333840428
--- /dev/null
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/macros.hpp
@@ -0,0 +1,647 @@
+/*
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
+//
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
+// the U.S. Government retains certain rights in this software.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the Corporation nor the names of the
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// 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 Christian R. Trott (crtrott@sandia.gov)
+//
+// ************************************************************************
+//@HEADER
+*/
+
+
+#pragma once
+
+#include "config.hpp"
+
+#include <type_traits> // std::is_void
+
+#ifndef _MDSPAN_HOST_DEVICE
+#  if defined(_MDSPAN_HAS_CUDA) || defined(_MDSPAN_HAS_HIP)
+#    define _MDSPAN_HOST_DEVICE __host__ __device__
+#  else
+#    define _MDSPAN_HOST_DEVICE
+#  endif
+#endif
+
+#ifndef MDSPAN_FORCE_INLINE_FUNCTION
+#  ifdef _MDSPAN_COMPILER_MSVC // Microsoft compilers
+#    define MDSPAN_FORCE_INLINE_FUNCTION __forceinline _MDSPAN_HOST_DEVICE
+#  else
+#    define MDSPAN_FORCE_INLINE_FUNCTION __attribute__((always_inline)) _MDSPAN_HOST_DEVICE
+#  endif
+#endif
+
+#ifndef MDSPAN_INLINE_FUNCTION
+#  define MDSPAN_INLINE_FUNCTION inline _MDSPAN_HOST_DEVICE
+#endif
+
+// In CUDA defaulted functions do not need host device markup
+#ifndef MDSPAN_INLINE_FUNCTION_DEFAULTED
+#  define MDSPAN_INLINE_FUNCTION_DEFAULTED
+#endif
+
+//==============================================================================
+// <editor-fold desc="Preprocessor helpers"> {{{1
+
+#define MDSPAN_PP_COUNT(...) \
+  _MDSPAN_PP_INTERNAL_EXPAND_ARGS_PRIVATE( \
+    _MDSPAN_PP_INTERNAL_ARGS_AUGMENTER(__VA_ARGS__) \
+  )
+
+#define _MDSPAN_PP_INTERNAL_ARGS_AUGMENTER(...) unused, __VA_ARGS__
+#define _MDSPAN_PP_INTERNAL_EXPAND(x) x
+#define _MDSPAN_PP_INTERNAL_EXPAND_ARGS_PRIVATE(...) \
+  _MDSPAN_PP_INTERNAL_EXPAND( \
+    _MDSPAN_PP_INTERNAL_COUNT_PRIVATE( \
+      __VA_ARGS__, 69, 68, 67, 66, 65, 64, 63, 62, 61, \
+      60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49,  \
+      48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37,  \
+      36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25,  \
+      24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13,  \
+      12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 \
+    ) \
+  )
+# define _MDSPAN_PP_INTERNAL_COUNT_PRIVATE( \
+         _1_, _2_, _3_, _4_, _5_, _6_, _7_, _8_, _9_, \
+    _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, \
+    _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, \
+    _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, \
+    _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, \
+    _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, \
+    _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, \
+    _70, count, ...) count \
+    /**/
+
+#define MDSPAN_PP_STRINGIFY_IMPL(x) #x
+#define MDSPAN_PP_STRINGIFY(x) MDSPAN_PP_STRINGIFY_IMPL(x)
+
+#define MDSPAN_PP_CAT_IMPL(x, y) x ## y
+#define MDSPAN_PP_CAT(x, y) MDSPAN_PP_CAT_IMPL(x, y)
+
+#define MDSPAN_PP_EVAL(X, ...) X(__VA_ARGS__)
+
+#define MDSPAN_PP_REMOVE_PARENS_IMPL(...) __VA_ARGS__
+#define MDSPAN_PP_REMOVE_PARENS(...) MDSPAN_PP_REMOVE_PARENS_IMPL __VA_ARGS__
+
+// </editor-fold> end Preprocessor helpers }}}1
+//==============================================================================
+
+//==============================================================================
+// <editor-fold desc="Concept emulation"> {{{1
+
+// These compatibility macros don't help with partial ordering, but they should do the trick
+// for what we need to do with concepts in mdspan
+#ifdef _MDSPAN_USE_CONCEPTS
+#  define MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) > requires REQ
+#  define MDSPAN_FUNCTION_REQUIRES(PAREN_PREQUALS, FNAME, PAREN_PARAMS, QUALS, REQ) \
+     MDSPAN_PP_REMOVE_PARENS(PAREN_PREQUALS) FNAME PAREN_PARAMS QUALS requires REQ \
+     /**/
+#else
+#  define MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) , typename ::std::enable_if<(REQ), int>::type = 0>
+#  define MDSPAN_FUNCTION_REQUIRES(PAREN_PREQUALS, FNAME, PAREN_PARAMS, QUALS, REQ) \
+     MDSPAN_TEMPLATE_REQUIRES( \
+       class __function_requires_ignored=void, \
+       (std::is_void<__function_requires_ignored>::value && REQ) \
+     ) MDSPAN_PP_REMOVE_PARENS(PAREN_PREQUALS) FNAME PAREN_PARAMS QUALS \
+     /**/
+#endif
+
+
+#if defined(_MDSPAN_COMPILER_MSVC)
+#  define MDSPAN_TEMPLATE_REQUIRES(...) \
+      MDSPAN_PP_CAT( \
+        MDSPAN_PP_CAT(MDSPAN_TEMPLATE_REQUIRES_, MDSPAN_PP_COUNT(__VA_ARGS__))\
+        (__VA_ARGS__), \
+      ) \
+    /**/
+#else
+#  define MDSPAN_TEMPLATE_REQUIRES(...) \
+    MDSPAN_PP_EVAL( \
+        MDSPAN_PP_CAT(MDSPAN_TEMPLATE_REQUIRES_, MDSPAN_PP_COUNT(__VA_ARGS__)), \
+        __VA_ARGS__ \
+    ) \
+    /**/
+#endif
+
+#define MDSPAN_TEMPLATE_REQUIRES_2(TP1, REQ) \
+  template<TP1 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+#define MDSPAN_TEMPLATE_REQUIRES_3(TP1, TP2, REQ) \
+  template<TP1, TP2 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+#define MDSPAN_TEMPLATE_REQUIRES_4(TP1, TP2, TP3, REQ) \
+  template<TP1, TP2, TP3 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+#define MDSPAN_TEMPLATE_REQUIRES_5(TP1, TP2, TP3, TP4, REQ) \
+  template<TP1, TP2, TP3, TP4 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+#define MDSPAN_TEMPLATE_REQUIRES_6(TP1, TP2, TP3, TP4, TP5, REQ) \
+  template<TP1, TP2, TP3, TP4, TP5 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+#define MDSPAN_TEMPLATE_REQUIRES_7(TP1, TP2, TP3, TP4, TP5, TP6, REQ) \
+  template<TP1, TP2, TP3, TP4, TP5, TP6 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+#define MDSPAN_TEMPLATE_REQUIRES_8(TP1, TP2, TP3, TP4, TP5, TP6, TP7, REQ) \
+  template<TP1, TP2, TP3, TP4, TP5, TP6, TP7 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+#define MDSPAN_TEMPLATE_REQUIRES_9(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, REQ) \
+  template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+#define MDSPAN_TEMPLATE_REQUIRES_10(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, REQ) \
+  template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+#define MDSPAN_TEMPLATE_REQUIRES_11(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, REQ) \
+  template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+#define MDSPAN_TEMPLATE_REQUIRES_12(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, REQ) \
+  template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+#define MDSPAN_TEMPLATE_REQUIRES_13(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, REQ) \
+  template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+#define MDSPAN_TEMPLATE_REQUIRES_14(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, REQ) \
+  template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+#define MDSPAN_TEMPLATE_REQUIRES_15(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, REQ) \
+  template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+#define MDSPAN_TEMPLATE_REQUIRES_16(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, REQ) \
+  template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+#define MDSPAN_TEMPLATE_REQUIRES_17(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, TP16, REQ) \
+  template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, TP16 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+#define MDSPAN_TEMPLATE_REQUIRES_18(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, TP16, TP17, REQ) \
+  template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, TP16, TP17 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+#define MDSPAN_TEMPLATE_REQUIRES_19(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, TP16, TP17, TP18, REQ) \
+  template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, TP16, TP17, TP18 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+#define MDSPAN_TEMPLATE_REQUIRES_20(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, TP16, TP17, TP18, TP19, REQ) \
+  template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, TP16, TP17, TP18, TP19 \
+    MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \
+    /**/
+
+#define MDSPAN_INSTANTIATE_ONLY_IF_USED \
+  MDSPAN_TEMPLATE_REQUIRES( \
+    class __instantiate_only_if_used_tparam=void, \
+    ( _MDSPAN_TRAIT(std::is_void, __instantiate_only_if_used_tparam) ) \
+  ) \
+  /**/
+
+// </editor-fold> end Concept emulation }}}1
+//==============================================================================
+
+//==============================================================================
+// <editor-fold desc="inline variables"> {{{1
+
+#ifdef _MDSPAN_USE_INLINE_VARIABLES
+#  define _MDSPAN_INLINE_VARIABLE inline
+#else
+#  define _MDSPAN_INLINE_VARIABLE
+#endif
+
+// </editor-fold> end inline variables }}}1
+//==============================================================================
+
+//==============================================================================
+// <editor-fold desc="Return type deduction"> {{{1
+
+#if _MDSPAN_USE_RETURN_TYPE_DEDUCTION
+#  define _MDSPAN_DEDUCE_RETURN_TYPE_SINGLE_LINE(SIGNATURE, BODY) \
+    auto MDSPAN_PP_REMOVE_PARENS(SIGNATURE) { return MDSPAN_PP_REMOVE_PARENS(BODY); }
+#  define _MDSPAN_DEDUCE_DECLTYPE_AUTO_RETURN_TYPE_SINGLE_LINE(SIGNATURE, BODY) \
+    decltype(auto) MDSPAN_PP_REMOVE_PARENS(SIGNATURE) { return MDSPAN_PP_REMOVE_PARENS(BODY); }
+#else
+#  define _MDSPAN_DEDUCE_RETURN_TYPE_SINGLE_LINE(SIGNATURE, BODY) \
+    auto MDSPAN_PP_REMOVE_PARENS(SIGNATURE) \
+      -> std::remove_cv_t<std::remove_reference_t<decltype(BODY)>> \
+    { return MDSPAN_PP_REMOVE_PARENS(BODY); }
+#  define _MDSPAN_DEDUCE_DECLTYPE_AUTO_RETURN_TYPE_SINGLE_LINE(SIGNATURE, BODY) \
+    auto MDSPAN_PP_REMOVE_PARENS(SIGNATURE) \
+      -> decltype(BODY) \
+    { return MDSPAN_PP_REMOVE_PARENS(BODY); }
+
+#endif
+
+// </editor-fold> end Return type deduction }}}1
+//==============================================================================
+
+//==============================================================================
+// <editor-fold desc="fold expressions"> {{{1
+
+struct __mdspan_enable_fold_comma { };
+
+#ifdef _MDSPAN_USE_FOLD_EXPRESSIONS
+#  define _MDSPAN_FOLD_AND(...) ((__VA_ARGS__) && ...)
+#  define _MDSPAN_FOLD_AND_TEMPLATE(...) ((__VA_ARGS__) && ...)
+#  define _MDSPAN_FOLD_OR(...) ((__VA_ARGS__) || ...)
+#  define _MDSPAN_FOLD_ASSIGN_LEFT(INIT, ...) (INIT = ... = (__VA_ARGS__))
+#  define _MDSPAN_FOLD_ASSIGN_RIGHT(PACK, ...) (PACK = ... = (__VA_ARGS__))
+#  define _MDSPAN_FOLD_TIMES_RIGHT(PACK, ...) (PACK * ... * (__VA_ARGS__))
+#  define _MDSPAN_FOLD_PLUS_RIGHT(PACK, ...) (PACK + ... + (__VA_ARGS__))
+#  define _MDSPAN_FOLD_COMMA(...) ((__VA_ARGS__), ...)
+#else
+
+namespace std {
+
+namespace __fold_compatibility_impl {
+
+// We could probably be more clever here, but at the (small) risk of losing some compiler understanding.  For the
+// few operations we need, it's not worth generalizing over the operation
+
+#if _MDSPAN_USE_RETURN_TYPE_DEDUCTION
+
+MDSPAN_FORCE_INLINE_FUNCTION
+constexpr decltype(auto) __fold_right_and_impl() {
+  return true;
+}
+
+template <class Arg, class... Args>
+MDSPAN_FORCE_INLINE_FUNCTION
+constexpr decltype(auto) __fold_right_and_impl(Arg&& arg, Args&&... args) {
+  return ((Arg&&)arg) && __fold_compatibility_impl::__fold_right_and_impl((Args&&)args...);
+}
+
+MDSPAN_FORCE_INLINE_FUNCTION
+constexpr decltype(auto) __fold_right_or_impl() {
+  return false;
+}
+
+template <class Arg, class... Args>
+MDSPAN_FORCE_INLINE_FUNCTION
+constexpr auto __fold_right_or_impl(Arg&& arg, Args&&... args) {
+  return ((Arg&&)arg) || __fold_compatibility_impl::__fold_right_or_impl((Args&&)args...);
+}
+
+template <class Arg1>
+MDSPAN_FORCE_INLINE_FUNCTION
+constexpr auto __fold_left_assign_impl(Arg1&& arg1) {
+  return (Arg1&&)arg1;
+}
+
+template <class Arg1, class Arg2, class... Args>
+MDSPAN_FORCE_INLINE_FUNCTION
+constexpr auto __fold_left_assign_impl(Arg1&& arg1, Arg2&& arg2, Args&&... args) {
+  return __fold_compatibility_impl::__fold_left_assign_impl((((Arg1&&)arg1) = ((Arg2&&)arg2)), (Args&&)args...);
+}
+
+template <class Arg1>
+MDSPAN_FORCE_INLINE_FUNCTION
+constexpr auto __fold_right_assign_impl(Arg1&& arg1) {
+  return (Arg1&&)arg1;
+}
+
+template <class Arg1, class Arg2, class... Args>
+MDSPAN_FORCE_INLINE_FUNCTION
+constexpr auto __fold_right_assign_impl(Arg1&& arg1, Arg2&& arg2,  Args&&... args) {
+  return ((Arg1&&)arg1) = __fold_compatibility_impl::__fold_right_assign_impl((Arg2&&)arg2, (Args&&)args...);
+}
+
+template <class Arg1>
+MDSPAN_FORCE_INLINE_FUNCTION
+constexpr auto __fold_right_plus_impl(Arg1&& arg1) {
+  return (Arg1&&)arg1;
+}
+
+template <class Arg1, class Arg2, class... Args>
+MDSPAN_FORCE_INLINE_FUNCTION
+constexpr auto __fold_right_plus_impl(Arg1&& arg1, Arg2&& arg2, Args&&... args) {
+  return ((Arg1&&)arg1) + __fold_compatibility_impl::__fold_right_plus_impl((Arg2&&)arg2, (Args&&)args...);
+}
+
+template <class Arg1>
+MDSPAN_FORCE_INLINE_FUNCTION
+constexpr auto __fold_right_times_impl(Arg1&& arg1) {
+  return (Arg1&&)arg1;
+}
+
+template <class Arg1, class Arg2, class... Args>
+MDSPAN_FORCE_INLINE_FUNCTION
+constexpr auto __fold_right_times_impl(Arg1&& arg1, Arg2&& arg2, Args&&... args) {
+  return ((Arg1&&)arg1) * __fold_compatibility_impl::__fold_right_times_impl((Arg2&&)arg2, (Args&&)args...);
+}
+
+#else
+
+//------------------------------------------------------------------------------
+// <editor-fold desc="right and"> {{{2
+
+template <class... Args>
+struct __fold_right_and_impl_;
+template <>
+struct __fold_right_and_impl_<> {
+  using __rv = bool;
+  MDSPAN_FORCE_INLINE_FUNCTION
+  static constexpr __rv
+  __impl() noexcept {
+    return true;
+  }
+};
+template <class Arg, class... Args>
+struct __fold_right_and_impl_<Arg, Args...> {
+  using __next_t = __fold_right_and_impl_<Args...>;
+  using __rv = decltype(std::declval<Arg>() && std::declval<typename __next_t::__rv>());
+  MDSPAN_FORCE_INLINE_FUNCTION
+  static constexpr __rv
+  __impl(Arg&& arg, Args&&... args) noexcept {
+    return ((Arg&&)arg) && __next_t::__impl((Args&&)args...);
+  }
+};
+
+template <class... Args>
+MDSPAN_FORCE_INLINE_FUNCTION
+constexpr typename __fold_right_and_impl_<Args...>::__rv
+__fold_right_and_impl(Args&&... args) {
+  return __fold_right_and_impl_<Args...>::__impl((Args&&)args...);
+}
+
+// </editor-fold> end right and }}}2
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+// <editor-fold desc="right or"> {{{2
+
+template <class... Args>
+struct __fold_right_or_impl_;
+template <>
+struct __fold_right_or_impl_<> {
+  using __rv = bool;
+  MDSPAN_FORCE_INLINE_FUNCTION
+  static constexpr __rv
+  __impl() noexcept {
+    return false;
+  }
+};
+template <class Arg, class... Args>
+struct __fold_right_or_impl_<Arg, Args...> {
+  using __next_t = __fold_right_or_impl_<Args...>;
+  using __rv = decltype(std::declval<Arg>() || std::declval<typename __next_t::__rv>());
+  MDSPAN_FORCE_INLINE_FUNCTION
+  static constexpr __rv
+  __impl(Arg&& arg, Args&&... args) noexcept {
+    return ((Arg&&)arg) || __next_t::__impl((Args&&)args...);
+  }
+};
+
+template <class... Args>
+MDSPAN_FORCE_INLINE_FUNCTION
+constexpr typename __fold_right_or_impl_<Args...>::__rv
+__fold_right_or_impl(Args&&... args) {
+  return __fold_right_or_impl_<Args...>::__impl((Args&&)args...);
+}
+
+// </editor-fold> end right or }}}2
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+// <editor-fold desc="right plus"> {{{2
+
+template <class... Args>
+struct __fold_right_plus_impl_;
+template <class Arg>
+struct __fold_right_plus_impl_<Arg> {
+  using __rv = Arg&&;
+  MDSPAN_FORCE_INLINE_FUNCTION
+  static constexpr __rv
+  __impl(Arg&& arg) noexcept {
+    return (Arg&&)arg;
+  }
+};
+template <class Arg1, class Arg2, class... Args>
+struct __fold_right_plus_impl_<Arg1, Arg2, Args...> {
+  using __next_t = __fold_right_plus_impl_<Arg2, Args...>;
+  using __rv = decltype(std::declval<Arg1>() + std::declval<typename __next_t::__rv>());
+  MDSPAN_FORCE_INLINE_FUNCTION
+  static constexpr __rv
+  __impl(Arg1&& arg, Arg2&& arg2, Args&&... args) noexcept {
+    return ((Arg1&&)arg) + __next_t::__impl((Arg2&&)arg2, (Args&&)args...);
+  }
+};
+
+template <class... Args>
+MDSPAN_FORCE_INLINE_FUNCTION
+constexpr typename __fold_right_plus_impl_<Args...>::__rv
+__fold_right_plus_impl(Args&&... args) {
+  return __fold_right_plus_impl_<Args...>::__impl((Args&&)args...);
+}
+
+// </editor-fold> end right plus }}}2
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+// <editor-fold desc="right times"> {{{2
+
+template <class... Args>
+struct __fold_right_times_impl_;
+template <class Arg>
+struct __fold_right_times_impl_<Arg> {
+  using __rv = Arg&&;
+  MDSPAN_FORCE_INLINE_FUNCTION
+  static constexpr __rv
+  __impl(Arg&& arg) noexcept {
+    return (Arg&&)arg;
+  }
+};
+template <class Arg1, class Arg2, class... Args>
+struct __fold_right_times_impl_<Arg1, Arg2, Args...> {
+  using __next_t = __fold_right_times_impl_<Arg2, Args...>;
+  using __rv = decltype(std::declval<Arg1>() * std::declval<typename __next_t::__rv>());
+  MDSPAN_FORCE_INLINE_FUNCTION
+  static constexpr __rv
+  __impl(Arg1&& arg, Arg2&& arg2, Args&&... args) noexcept {
+    return ((Arg1&&)arg) * __next_t::__impl((Arg2&&)arg2, (Args&&)args...);
+  }
+};
+
+template <class... Args>
+MDSPAN_FORCE_INLINE_FUNCTION
+constexpr typename __fold_right_times_impl_<Args...>::__rv
+__fold_right_times_impl(Args&&... args) {
+  return __fold_right_times_impl_<Args...>::__impl((Args&&)args...);
+}
+
+// </editor-fold> end right times }}}2
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+// <editor-fold desc="right assign"> {{{2
+
+template <class... Args>
+struct __fold_right_assign_impl_;
+template <class Arg>
+struct __fold_right_assign_impl_<Arg> {
+  using __rv = Arg&&;
+  MDSPAN_FORCE_INLINE_FUNCTION
+  static constexpr __rv
+  __impl(Arg&& arg) noexcept {
+    return (Arg&&)arg;
+  }
+};
+template <class Arg1, class Arg2, class... Args>
+struct __fold_right_assign_impl_<Arg1, Arg2, Args...> {
+  using __next_t = __fold_right_assign_impl_<Arg2, Args...>;
+  using __rv = decltype(std::declval<Arg1>() = std::declval<typename __next_t::__rv>());
+  MDSPAN_FORCE_INLINE_FUNCTION
+  static constexpr __rv
+  __impl(Arg1&& arg, Arg2&& arg2, Args&&... args) noexcept {
+    return ((Arg1&&)arg) = __next_t::__impl((Arg2&&)arg2, (Args&&)args...);
+  }
+};
+
+template <class... Args>
+MDSPAN_FORCE_INLINE_FUNCTION
+constexpr typename __fold_right_assign_impl_<Args...>::__rv
+__fold_right_assign_impl(Args&&... args) {
+  return __fold_right_assign_impl_<Args...>::__impl((Args&&)args...);
+}
+
+// </editor-fold> end right assign }}}2
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+// <editor-fold desc="left assign"> {{{2
+
+template <class... Args>
+struct __fold_left_assign_impl_;
+template <class Arg>
+struct __fold_left_assign_impl_<Arg> {
+  using __rv = Arg&&;
+  MDSPAN_FORCE_INLINE_FUNCTION
+  static constexpr __rv
+  __impl(Arg&& arg) noexcept {
+    return (Arg&&)arg;
+  }
+};
+template <class Arg1, class Arg2, class... Args>
+struct __fold_left_assign_impl_<Arg1, Arg2, Args...> {
+  using __assign_result_t = decltype(std::declval<Arg1>() = std::declval<Arg2>());
+  using __next_t = __fold_left_assign_impl_<__assign_result_t, Args...>;
+  using __rv = typename __next_t::__rv;
+  MDSPAN_FORCE_INLINE_FUNCTION
+  static constexpr __rv
+  __impl(Arg1&& arg, Arg2&& arg2, Args&&... args) noexcept {
+    return __next_t::__impl(((Arg1&&)arg) = (Arg2&&)arg2, (Args&&)args...);
+  }
+};
+
+template <class... Args>
+MDSPAN_FORCE_INLINE_FUNCTION
+constexpr typename __fold_left_assign_impl_<Args...>::__rv
+__fold_left_assign_impl(Args&&... args) {
+  return __fold_left_assign_impl_<Args...>::__impl((Args&&)args...);
+}
+
+// </editor-fold> end left assign }}}2
+//------------------------------------------------------------------------------
+
+#endif
+
+
+template <class... Args>
+constexpr __mdspan_enable_fold_comma __fold_comma_impl(Args&&... args) noexcept { return { }; }
+
+template <bool... Bs>
+struct __bools;
+
+} // __fold_compatibility_impl
+
+} // end namespace std
+
+#  define _MDSPAN_FOLD_AND(...) std::__fold_compatibility_impl::__fold_right_and_impl((__VA_ARGS__)...)
+#  define _MDSPAN_FOLD_OR(...) std::__fold_compatibility_impl::__fold_right_or_impl((__VA_ARGS__)...)
+#  define _MDSPAN_FOLD_ASSIGN_LEFT(INIT, ...) std::__fold_compatibility_impl::__fold_left_assign_impl(INIT, (__VA_ARGS__)...)
+#  define _MDSPAN_FOLD_ASSIGN_RIGHT(PACK, ...) std::__fold_compatibility_impl::__fold_right_assign_impl((PACK)..., __VA_ARGS__)
+#  define _MDSPAN_FOLD_TIMES_RIGHT(PACK, ...) std::__fold_compatibility_impl::__fold_right_times_impl((PACK)..., __VA_ARGS__)
+#  define _MDSPAN_FOLD_PLUS_RIGHT(PACK, ...) std::__fold_compatibility_impl::__fold_right_plus_impl((PACK)..., __VA_ARGS__)
+#  define _MDSPAN_FOLD_COMMA(...) std::__fold_compatibility_impl::__fold_comma_impl((__VA_ARGS__)...)
+
+#  define _MDSPAN_FOLD_AND_TEMPLATE(...) \
+  _MDSPAN_TRAIT(std::is_same, __fold_compatibility_impl::__bools<(__VA_ARGS__)..., true>, __fold_compatibility_impl::__bools<true, (__VA_ARGS__)...>)
+
+#endif
+
+// </editor-fold> end fold expressions }}}1
+//==============================================================================
+
+//==============================================================================
+// <editor-fold desc="Variable template compatibility"> {{{1
+
+#if _MDSPAN_USE_VARIABLE_TEMPLATES
+#  define _MDSPAN_TRAIT(TRAIT, ...) TRAIT##_v<__VA_ARGS__>
+#else
+#  define _MDSPAN_TRAIT(TRAIT, ...) TRAIT<__VA_ARGS__>::value
+#endif
+
+// </editor-fold> end Variable template compatibility }}}1
+//==============================================================================
+
+//==============================================================================
+// <editor-fold desc="Pre-C++14 constexpr"> {{{1
+
+#if _MDSPAN_USE_CONSTEXPR_14
+#  define _MDSPAN_CONSTEXPR_14 constexpr
+// Workaround for a bug (I think?) in EDG frontends
+#  ifdef __EDG__
+#    define _MDSPAN_CONSTEXPR_14_DEFAULTED
+#  else
+#    define _MDSPAN_CONSTEXPR_14_DEFAULTED constexpr
+#  endif
+#else
+#  define _MDSPAN_CONSTEXPR_14
+#  define _MDSPAN_CONSTEXPR_14_DEFAULTED
+#endif
+
+// </editor-fold> end Pre-C++14 constexpr }}}1
+//==============================================================================
diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/maybe_static_value.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/maybe_static_value.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..7abb1d5d65f7ee73d1cb949d0b7c0ce3665603c7
--- /dev/null
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/maybe_static_value.hpp
@@ -0,0 +1,152 @@
+/*
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
+//
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
+// the U.S. Government retains certain rights in this software.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the Corporation nor the names of the
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// 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 Christian R. Trott (crtrott@sandia.gov)
+//
+// ************************************************************************
+//@HEADER
+*/
+
+#include "macros.hpp"
+
+#include "dynamic_extent.hpp"
+
+#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+#  include "no_unique_address.hpp"
+#endif
+
+// This is only needed for the non-standard-layout version of partially
+// static array.
+// Needs to be after the includes above to work with the single header generator
+#if !_MDSPAN_PRESERVE_STANDARD_LAYOUT
+namespace std {
+namespace experimental {
+
+//==============================================================================
+
+namespace detail {
+
+// static case
+template <class _dynamic_t, class static_t, _static_t __v,
+          _static_t __is_dynamic_sentinal = dynamic_extent,
+          size_t __array_entry_index = 0>
+struct __maybe_static_value {
+  static constexpr _static_t __static_value = __v;
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _dynamic_t __value() const noexcept {
+    return static_cast<_dynamic_t>(__v);
+  }
+  template <class _U>
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14
+  __mdspan_enable_fold_comma
+  __set_value(_U&& /*__rhs*/) noexcept {
+    // Should we assert that the value matches the static value here?
+    return {};
+  }
+
+  //--------------------------------------------------------------------------
+
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __maybe_static_value() noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __maybe_static_value(__maybe_static_value const&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __maybe_static_value(__maybe_static_value&&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __maybe_static_value& operator=(__maybe_static_value const&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __maybe_static_value& operator=(__maybe_static_value&&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  ~__maybe_static_value() noexcept = default;
+
+  MDSPAN_INLINE_FUNCTION
+  constexpr explicit __maybe_static_value(_dynamic_t const&) noexcept {
+    // Should we assert that the value matches the static value here?
+  }
+
+  //--------------------------------------------------------------------------
+
+};
+
+// dynamic case
+template <class _dynamic_t, class _static_t, _static_t __is_dynamic_sentinal, size_t __array_entry_index>
+struct __maybe_static_value<_dynamic_t, _static_t, __is_dynamic_sentinal, __is_dynamic_sentinal,
+                            __array_entry_index>
+#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+    : __no_unique_address_emulation<_T>
+#endif
+{
+  static constexpr _static_t __static_value = __is_dynamic_sentinal;
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+  _MDSPAN_NO_UNIQUE_ADDRESS _dynamic_t __v = {};
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _dynamic_t __value() const noexcept {
+    return __v;
+  }
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _dynamic_t &__ref() noexcept {
+    return __v;
+  }
+  template <class _U>
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14
+  __mdspan_enable_fold_comma
+  __set_value(_U&& __rhs) noexcept {
+    __v = (_U &&)rhs;
+    return {};
+  }
+#else
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _dynamic_t __value() const noexcept {
+    return this->__no_unique_address_emulation<_dynamic_t>::__ref();
+  }
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _dynamic_t &__ref() noexcept {
+    return this->__no_unique_address_emulation<_dynamic_t>::__ref();
+  }
+  template <class _U>
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14
+  __mdspan_enable_fold_comma
+  __set_value(_U&& __rhs) noexcept {
+    this->__no_unique_address_emulation<_dynamic_t>::__ref() = (_U &&)__rhs;
+    return {};
+  }
+#endif
+};
+
+} // namespace detail
+
+//==============================================================================
+
+} // end namespace experimental
+} // end namespace std
+
+#endif // !_MDSPAN_PRESERVE_STANDARD_LAYOUT
diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/mdspan.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/mdspan.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..374444c0535038f37dce9f829243bc0e6ac78bf6
--- /dev/null
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/mdspan.hpp
@@ -0,0 +1,444 @@
+/*
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
+//
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
+// the U.S. Government retains certain rights in this software.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the Corporation nor the names of the
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// 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 Christian R. Trott (crtrott@sandia.gov)
+//
+// ************************************************************************
+//@HEADER
+*/
+
+
+#pragma once
+
+#include "default_accessor.hpp"
+#include "layout_right.hpp"
+#include "extents.hpp"
+#include "trait_backports.hpp"
+#include "compressed_pair.hpp"
+
+namespace std {
+namespace experimental {
+
+template <
+  class ElementType,
+  class Extents,
+  class LayoutPolicy = layout_right,
+  class AccessorPolicy = default_accessor<ElementType>
+>
+class mdspan
+{
+private:
+  static_assert(detail::__is_extents_v<Extents>, "std::experimental::mdspan's Extents template parameter must be a specialization of std::experimental::extents.");
+
+  // Workaround for non-deducibility of the index sequence template parameter if it's given at the top level
+  template <class>
+  struct __deduction_workaround;
+
+  template <size_t... Idxs>
+  struct __deduction_workaround<index_sequence<Idxs...>>
+  {
+    MDSPAN_FORCE_INLINE_FUNCTION static constexpr
+    size_t __size(mdspan const& __self) noexcept {
+      return _MDSPAN_FOLD_TIMES_RIGHT((__self.__mapping_ref().extents().template __extent<Idxs>()), /* * ... * */ size_t(1));
+    }
+    MDSPAN_FORCE_INLINE_FUNCTION static constexpr
+    bool __empty(mdspan const& __self) noexcept {
+      return (__self.rank()>0) && _MDSPAN_FOLD_OR((__self.__mapping_ref().extents().template __extent<Idxs>()==index_type(0)));
+    }
+    template <class ReferenceType, class SizeType, size_t N>
+    MDSPAN_FORCE_INLINE_FUNCTION static constexpr
+    ReferenceType __callop(mdspan const& __self, const array<SizeType, N>& indices) noexcept {
+      return __self.__accessor_ref().access(__self.__ptr_ref(), __self.__mapping_ref()(indices[Idxs]...));
+    }
+  };
+
+public:
+
+  //--------------------------------------------------------------------------------
+  // Domain and codomain types
+
+  using extents_type = Extents;
+  using layout_type = LayoutPolicy;
+  using accessor_type = AccessorPolicy;
+  using mapping_type = typename layout_type::template mapping<extents_type>;
+  using element_type = ElementType;
+  using value_type = remove_cv_t<element_type>;
+  using index_type = typename extents_type::index_type;
+  using size_type = typename extents_type::size_type;
+  using rank_type = typename extents_type::rank_type;
+  using data_handle_type = typename accessor_type::data_handle_type;
+  using reference = typename accessor_type::reference;
+
+  MDSPAN_INLINE_FUNCTION static constexpr size_t rank() noexcept { return extents_type::rank(); }
+  MDSPAN_INLINE_FUNCTION static constexpr size_t rank_dynamic() noexcept { return extents_type::rank_dynamic(); }
+  MDSPAN_INLINE_FUNCTION static constexpr size_t static_extent(size_t r) noexcept { return extents_type::static_extent(r); }
+  MDSPAN_INLINE_FUNCTION constexpr index_type extent(size_t r) const noexcept { return __mapping_ref().extents().extent(r); };
+
+private:
+
+  // Can't use defaulted parameter in the __deduction_workaround template because of a bug in MSVC warning C4348.
+  using __impl = __deduction_workaround<make_index_sequence<extents_type::rank()>>;
+
+  using __map_acc_pair_t = detail::__compressed_pair<mapping_type, accessor_type>;
+
+public:
+
+  //--------------------------------------------------------------------------------
+  // [mdspan.basic.cons], mdspan constructors, assignment, and destructor
+
+#if !MDSPAN_HAS_CXX_20
+  MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mdspan() = default;
+#else
+  MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mdspan()
+    requires(
+       (rank_dynamic() > 0) &&
+       _MDSPAN_TRAIT(is_default_constructible, data_handle_type) &&
+       _MDSPAN_TRAIT(is_default_constructible, mapping_type) &&
+       _MDSPAN_TRAIT(is_default_constructible, accessor_type)
+     ) = default;
+#endif
+  MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mdspan(const mdspan&) = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mdspan(mdspan&&) = default;
+
+  MDSPAN_TEMPLATE_REQUIRES(
+    class... SizeTypes,
+    /* requires */ (
+      _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) &&
+      _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_nothrow_constructible, index_type, SizeTypes) /* && ... */) &&
+      ((sizeof...(SizeTypes) == rank()) || (sizeof...(SizeTypes) == rank_dynamic())) &&
+      _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type) &&
+      _MDSPAN_TRAIT(is_default_constructible, accessor_type)
+    )
+  )
+  MDSPAN_INLINE_FUNCTION
+  explicit constexpr mdspan(data_handle_type p, SizeTypes... dynamic_extents)
+    // TODO @proposal-bug shouldn't I be allowed to do `move(p)` here?
+    : __members(std::move(p), __map_acc_pair_t(mapping_type(extents_type(static_cast<index_type>(std::move(dynamic_extents))...)), accessor_type()))
+  { }
+
+  MDSPAN_TEMPLATE_REQUIRES(
+    class SizeType, size_t N,
+    /* requires */ (
+      _MDSPAN_TRAIT(is_convertible, SizeType, index_type) &&
+      _MDSPAN_TRAIT(is_nothrow_constructible, index_type, SizeType) &&
+      ((N == rank()) || (N == rank_dynamic())) &&
+      _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type) &&
+      _MDSPAN_TRAIT(is_default_constructible, accessor_type)
+    )
+  )
+  MDSPAN_CONDITIONAL_EXPLICIT(N != rank_dynamic())
+  MDSPAN_INLINE_FUNCTION
+  constexpr mdspan(data_handle_type p, const array<SizeType, N>& dynamic_extents)
+    : __members(std::move(p), __map_acc_pair_t(mapping_type(extents_type(dynamic_extents)), accessor_type()))
+  { }
+
+#ifdef __cpp_lib_span
+  MDSPAN_TEMPLATE_REQUIRES(
+    class SizeType, size_t N,
+    /* requires */ (
+      _MDSPAN_TRAIT(is_convertible, SizeType, index_type) &&
+      _MDSPAN_TRAIT(is_nothrow_constructible, index_type, SizeType) &&
+      ((N == rank()) || (N == rank_dynamic())) &&
+      _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type) &&
+      _MDSPAN_TRAIT(is_default_constructible, accessor_type)
+    )
+  )
+  MDSPAN_CONDITIONAL_EXPLICIT(N != rank_dynamic())
+  MDSPAN_INLINE_FUNCTION
+  constexpr mdspan(data_handle_type p, span<SizeType, N> dynamic_extents)
+    : __members(std::move(p), __map_acc_pair_t(mapping_type(extents_type(as_const(dynamic_extents))), accessor_type()))
+  { }
+#endif
+
+  MDSPAN_FUNCTION_REQUIRES(
+    (MDSPAN_INLINE_FUNCTION constexpr),
+    mdspan, (data_handle_type p, const extents_type& exts), ,
+    /* requires */ (_MDSPAN_TRAIT(is_default_constructible, accessor_type) &&
+                    _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type))
+  ) : __members(std::move(p), __map_acc_pair_t(mapping_type(exts), accessor_type()))
+  { }
+
+  MDSPAN_FUNCTION_REQUIRES(
+    (MDSPAN_INLINE_FUNCTION constexpr),
+    mdspan, (data_handle_type p, const mapping_type& m), ,
+    /* requires */ (_MDSPAN_TRAIT(is_default_constructible, accessor_type))
+  ) : __members(std::move(p), __map_acc_pair_t(m, accessor_type()))
+  { }
+
+  MDSPAN_INLINE_FUNCTION
+  constexpr mdspan(data_handle_type p, const mapping_type& m, const accessor_type& a)
+    : __members(std::move(p), __map_acc_pair_t(m, a))
+  { }
+
+  MDSPAN_TEMPLATE_REQUIRES(
+    class OtherElementType, class OtherExtents, class OtherLayoutPolicy, class OtherAccessor,
+    /* requires */ (
+      _MDSPAN_TRAIT(is_constructible, mapping_type, typename OtherLayoutPolicy::template mapping<OtherExtents>) &&
+      _MDSPAN_TRAIT(is_constructible, accessor_type, OtherAccessor)
+    )
+  )
+  MDSPAN_INLINE_FUNCTION
+  constexpr mdspan(const mdspan<OtherElementType, OtherExtents, OtherLayoutPolicy, OtherAccessor>& other)
+    : __members(other.__ptr_ref(), __map_acc_pair_t(other.__mapping_ref(), other.__accessor_ref()))
+  {
+      static_assert(_MDSPAN_TRAIT(is_constructible, data_handle_type, typename OtherAccessor::data_handle_type),"Incompatible data_handle_type for mdspan construction");
+      static_assert(_MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents),"Incompatible extents for mdspan construction");
+      /*
+       * TODO: Check precondition
+       * For each rank index r of extents_type, static_extent(r) == dynamic_extent || static_extent(r) == other.extent(r) is true.
+       */
+  }
+
+  /* Might need this on NVIDIA?
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  ~mdspan() = default;
+  */
+
+  MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED mdspan& operator=(const mdspan&) = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED mdspan& operator=(mdspan&&) = default;
+
+
+  //--------------------------------------------------------------------------------
+  // [mdspan.basic.mapping], mdspan mapping domain multidimensional index to access codomain element
+
+  #if MDSPAN_USE_BRACKET_OPERATOR
+  MDSPAN_TEMPLATE_REQUIRES(
+    class... SizeTypes,
+    /* requires */ (
+      _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) &&
+      _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_nothrow_constructible, index_type, SizeTypes) /* && ... */) &&
+      (rank() == sizeof...(SizeTypes))
+    )
+  )
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr reference operator[](SizeTypes... indices) const
+  {
+    return __accessor_ref().access(__ptr_ref(), __mapping_ref()(index_type(indices)...));
+  }
+  #endif
+
+  MDSPAN_TEMPLATE_REQUIRES(
+    class SizeType,
+    /* requires */ (
+      _MDSPAN_TRAIT(is_convertible, SizeType, index_type) &&
+      _MDSPAN_TRAIT(is_nothrow_constructible, index_type, SizeType)
+    )
+  )
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr reference operator[](const array<SizeType, rank()>& indices) const
+  {
+    return __impl::template __callop<reference>(*this, indices);
+  }
+
+  #ifdef __cpp_lib_span
+  MDSPAN_TEMPLATE_REQUIRES(
+    class SizeType,
+    /* requires */ (
+      _MDSPAN_TRAIT(is_convertible, SizeType, index_type) &&
+      _MDSPAN_TRAIT(is_nothrow_constructible, index_type, SizeType)
+    )
+  )
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr reference operator[](span<SizeType, rank()> indices) const
+  {
+    return __impl::template __callop<reference>(*this, indices);
+  }
+  #endif // __cpp_lib_span
+
+  #if !MDSPAN_USE_BRACKET_OPERATOR
+  MDSPAN_TEMPLATE_REQUIRES(
+    class Index,
+    /* requires */ (
+      _MDSPAN_TRAIT(is_convertible, Index, index_type) &&
+      _MDSPAN_TRAIT(is_nothrow_constructible, index_type, Index) &&
+      extents_type::rank() == 1
+    )
+  )
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr reference operator[](Index idx) const
+  {
+    return __accessor_ref().access(__ptr_ref(), __mapping_ref()(index_type(idx)));
+  }
+  #endif
+
+  #if MDSPAN_USE_PAREN_OPERATOR
+  MDSPAN_TEMPLATE_REQUIRES(
+    class... SizeTypes,
+    /* requires */ (
+      _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) &&
+      _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_nothrow_constructible, index_type, SizeTypes) /* && ... */) &&
+      extents_type::rank() == sizeof...(SizeTypes)
+    )
+  )
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr reference operator()(SizeTypes... indices) const
+  {
+    return __accessor_ref().access(__ptr_ref(), __mapping_ref()(indices...));
+  }
+
+  MDSPAN_TEMPLATE_REQUIRES(
+    class SizeType,
+    /* requires */ (
+      _MDSPAN_TRAIT(is_convertible, SizeType, index_type) &&
+      _MDSPAN_TRAIT(is_nothrow_constructible, index_type, SizeType)
+    )
+  )
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr reference operator()(const array<SizeType, rank()>& indices) const
+  {
+    return __impl::template __callop<reference>(*this, indices);
+  }
+
+  #ifdef __cpp_lib_span
+  MDSPAN_TEMPLATE_REQUIRES(
+    class SizeType,
+    /* requires */ (
+      _MDSPAN_TRAIT(is_convertible, SizeType, index_type) &&
+      _MDSPAN_TRAIT(is_nothrow_constructible, index_type, SizeType)
+    )
+  )
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr reference operator()(span<SizeType, rank()> indices) const
+  {
+    return __impl::template __callop<reference>(*this, indices);
+  }
+  #endif // __cpp_lib_span
+  #endif // MDSPAN_USE_PAREN_OPERATOR
+
+  MDSPAN_INLINE_FUNCTION constexpr size_t size() const noexcept {
+    return __impl::__size(*this);
+  };
+
+  MDSPAN_INLINE_FUNCTION constexpr bool empty() const noexcept {
+    return __impl::__empty(*this);
+  };
+
+  MDSPAN_INLINE_FUNCTION
+  friend constexpr void swap(mdspan& x, mdspan& y) noexcept {
+    swap(x.__ptr_ref(), y.__ptr_ref());
+    swap(x.__mapping_ref(), y.__mapping_ref());
+    swap(x.__accessor_ref(), y.__accessor_ref());
+  }
+
+  //--------------------------------------------------------------------------------
+  // [mdspan.basic.domobs], mdspan observers of the domain multidimensional index space
+
+
+  MDSPAN_INLINE_FUNCTION constexpr const extents_type& extents() const noexcept { return __mapping_ref().extents(); };
+  MDSPAN_INLINE_FUNCTION constexpr const data_handle_type& data_handle() const noexcept { return __ptr_ref(); };
+  MDSPAN_INLINE_FUNCTION constexpr const mapping_type& mapping() const noexcept { return __mapping_ref(); };
+  MDSPAN_INLINE_FUNCTION constexpr const accessor_type& accessor() const noexcept { return __accessor_ref(); };
+
+  //--------------------------------------------------------------------------------
+  // [mdspan.basic.obs], mdspan observers of the mapping
+
+  MDSPAN_INLINE_FUNCTION static constexpr bool is_always_unique() noexcept { return mapping_type::is_always_unique(); };
+  MDSPAN_INLINE_FUNCTION static constexpr bool is_always_exhaustive() noexcept { return mapping_type::is_always_exhaustive(); };
+  MDSPAN_INLINE_FUNCTION static constexpr bool is_always_strided() noexcept { return mapping_type::is_always_strided(); };
+
+  MDSPAN_INLINE_FUNCTION constexpr bool is_unique() const noexcept { return __mapping_ref().is_unique(); };
+  MDSPAN_INLINE_FUNCTION constexpr bool is_exhaustive() const noexcept { return __mapping_ref().is_exhaustive(); };
+  MDSPAN_INLINE_FUNCTION constexpr bool is_strided() const noexcept { return __mapping_ref().is_strided(); };
+  MDSPAN_INLINE_FUNCTION constexpr index_type stride(size_t r) const { return __mapping_ref().stride(r); };
+
+private:
+
+  detail::__compressed_pair<data_handle_type, __map_acc_pair_t> __members{};
+
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 data_handle_type& __ptr_ref() noexcept { return __members.__first(); }
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr data_handle_type const& __ptr_ref() const noexcept { return __members.__first(); }
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 mapping_type& __mapping_ref() noexcept { return __members.__second().__first(); }
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr mapping_type const& __mapping_ref() const noexcept { return __members.__second().__first(); }
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 accessor_type& __accessor_ref() noexcept { return __members.__second().__second(); }
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr accessor_type const& __accessor_ref() const noexcept { return __members.__second().__second(); }
+
+  template <class, class, class, class>
+  friend class mdspan;
+
+};
+
+#if defined(_MDSPAN_USE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION)
+MDSPAN_TEMPLATE_REQUIRES(
+  class ElementType, class... SizeTypes,
+  /* requires */ _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_integral, SizeTypes) /* && ... */) &&
+  (sizeof...(SizeTypes) > 0)
+)
+explicit mdspan(ElementType*, SizeTypes...)
+  -> mdspan<ElementType, ::std::experimental::dextents<size_t, sizeof...(SizeTypes)>>;
+
+MDSPAN_TEMPLATE_REQUIRES(
+  class Pointer,
+  (_MDSPAN_TRAIT(is_pointer, std::remove_reference_t<Pointer>))
+)
+mdspan(Pointer&&) -> mdspan<std::remove_pointer_t<std::remove_reference_t<Pointer>>, extents<size_t>>;
+
+MDSPAN_TEMPLATE_REQUIRES(
+  class CArray,
+  (_MDSPAN_TRAIT(is_array, CArray) && (rank_v<CArray> == 1))
+)
+mdspan(CArray&) -> mdspan<std::remove_all_extents_t<CArray>, extents<size_t, ::std::extent_v<CArray,0>>>;
+
+template <class ElementType, class SizeType, size_t N>
+mdspan(ElementType*, const ::std::array<SizeType, N>&)
+  -> mdspan<ElementType, ::std::experimental::dextents<size_t, N>>;
+
+#ifdef __cpp_lib_span
+template <class ElementType, class SizeType, size_t N>
+mdspan(ElementType*, ::std::span<SizeType, N>)
+  -> mdspan<ElementType, ::std::experimental::dextents<size_t, N>>;
+#endif
+
+// This one is necessary because all the constructors take `data_handle_type`s, not
+// `ElementType*`s, and `data_handle_type` is taken from `accessor_type::data_handle_type`, which
+// seems to throw off automatic deduction guides.
+template <class ElementType, class SizeType, size_t... ExtentsPack>
+mdspan(ElementType*, const extents<SizeType, ExtentsPack...>&)
+  -> mdspan<ElementType, ::std::experimental::extents<SizeType, ExtentsPack...>>;
+
+template <class ElementType, class MappingType>
+mdspan(ElementType*, const MappingType&)
+  -> mdspan<ElementType, typename MappingType::extents_type, typename MappingType::layout_type>;
+
+template <class MappingType, class AccessorType>
+mdspan(const typename AccessorType::data_handle_type, const MappingType&, const AccessorType&)
+  -> mdspan<typename AccessorType::element_type, typename MappingType::extents_type, typename MappingType::layout_type, AccessorType>;
+#endif
+
+
+
+} // end namespace experimental
+} // end namespace std
diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/no_unique_address.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/no_unique_address.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..904dd40a7590155e745c2549381e59f63c63a8af
--- /dev/null
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/no_unique_address.hpp
@@ -0,0 +1,127 @@
+/*
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
+//
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
+// the U.S. Government retains certain rights in this software.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the Corporation nor the names of the
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// 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 Christian R. Trott (crtrott@sandia.gov)
+//
+// ************************************************************************
+//@HEADER
+*/
+
+#pragma once
+
+#include "macros.hpp"
+#include "trait_backports.hpp"
+
+namespace std {
+namespace experimental {
+namespace detail {
+
+//==============================================================================
+
+template <class _T, size_t _Disambiguator = 0, class _Enable = void>
+struct __no_unique_address_emulation {
+  using __stored_type = _T;
+  _T __v;
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _T const &__ref() const noexcept {
+    return __v;
+  }
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T &__ref() noexcept {
+    return __v;
+  }
+};
+
+// Empty case
+// This doesn't work if _T is final, of course, but we're not using anything
+// like that currently. That kind of thing could be added pretty easily though
+template <class _T, size_t _Disambiguator>
+struct __no_unique_address_emulation<
+    _T, _Disambiguator,
+    enable_if_t<_MDSPAN_TRAIT(is_empty, _T) &&
+                // If the type isn't trivially destructible, its destructor
+                // won't be called at the right time, so don't use this
+                // specialization
+                _MDSPAN_TRAIT(is_trivially_destructible, _T)>> : 
+#ifdef _MDSPAN_COMPILER_MSVC
+    // MSVC doesn't allow you to access public static member functions of a type
+    // when you *happen* to privately inherit from that type.
+    protected
+#else
+    // But we still want this to be private if possible so that we don't accidentally 
+    // access members of _T directly rather than calling __ref() first, which wouldn't
+    // work if _T happens to be stateful and thus we're using the unspecialized definition
+    // of __no_unique_address_emulation above.
+    private
+#endif
+    _T {
+  using __stored_type = _T;
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _T const &__ref() const noexcept {
+    return *static_cast<_T const *>(this);
+  }
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T &__ref() noexcept {
+    return *static_cast<_T *>(this);
+  }
+
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __no_unique_address_emulation() noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __no_unique_address_emulation(
+      __no_unique_address_emulation const &) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __no_unique_address_emulation(
+      __no_unique_address_emulation &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __no_unique_address_emulation &
+  operator=(__no_unique_address_emulation const &) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __no_unique_address_emulation &
+  operator=(__no_unique_address_emulation &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  ~__no_unique_address_emulation() noexcept = default;
+
+  // Explicitly make this not a reference so that the copy or move
+  // constructor still gets called.
+  MDSPAN_INLINE_FUNCTION
+  explicit constexpr __no_unique_address_emulation(_T const& __v) noexcept : _T(__v) {}
+  MDSPAN_INLINE_FUNCTION
+  explicit constexpr __no_unique_address_emulation(_T&& __v) noexcept : _T(::std::move(__v)) {}
+};
+
+//==============================================================================
+
+} // end namespace detail
+} // end namespace experimental
+} // end namespace std
diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/standard_layout_static_array.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/standard_layout_static_array.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..1c543b08051b57ba45fb1e8abe71e7875db366b1
--- /dev/null
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/standard_layout_static_array.hpp
@@ -0,0 +1,685 @@
+/*
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
+//
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
+// the U.S. Government retains certain rights in this software.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the Corporation nor the names of the
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// 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 Christian R. Trott (crtrott@sandia.gov)
+//
+// ************************************************************************
+//@HEADER
+*/
+
+#pragma once
+
+#include "macros.hpp"
+#include "dynamic_extent.hpp"
+#include "trait_backports.hpp" // enable_if
+#include "compressed_pair.hpp"
+
+#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+#  include "no_unique_address.hpp"
+#endif
+
+#include <array>
+#ifdef __cpp_lib_span
+#include <span>
+#endif
+#include <utility> // integer_sequence
+#include <cstddef>
+
+namespace std {
+namespace experimental {
+namespace detail {
+
+//==============================================================================
+
+_MDSPAN_INLINE_VARIABLE constexpr struct
+    __construct_psa_from_dynamic_exts_values_tag_t {
+} __construct_psa_from_dynamic_exts_values_tag = {};
+
+_MDSPAN_INLINE_VARIABLE constexpr struct
+    __construct_psa_from_all_exts_values_tag_t {
+} __construct_psa_from_all_exts_values_tag = {};
+
+struct __construct_psa_from_all_exts_array_tag_t {};
+template <size_t _N = 0> struct __construct_psa_from_dynamic_exts_array_tag_t {};
+
+//==============================================================================
+
+template <size_t _I, class _T> using __repeated_with_idxs = _T;
+
+//==============================================================================
+
+#if _MDSPAN_PRESERVE_STANDARD_LAYOUT
+
+/**
+ *  PSA = "partially static array"
+ *
+ * @tparam _T
+ * @tparam _ValsSeq
+ * @tparam __sentinal
+ */
+template <class _Tag, class _T, class _static_t, class _ValsSeq, _static_t __sentinal = static_cast<_static_t>(dynamic_extent),
+          class _IdxsSeq = make_index_sequence<_ValsSeq::size()>>
+struct __standard_layout_psa;
+
+//==============================================================================
+// Static case
+template <class _Tag, class _T, class _static_t, _static_t __value, _static_t... __values_or_sentinals,
+          _static_t __sentinal, size_t _Idx, size_t... _Idxs>
+struct __standard_layout_psa<
+    _Tag, _T, _static_t, integer_sequence<_static_t, __value, __values_or_sentinals...>,
+    __sentinal, integer_sequence<size_t, _Idx, _Idxs...>>
+#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+    : private __no_unique_address_emulation<__standard_layout_psa<
+          _Tag, _T, _static_t, integer_sequence<_static_t, __values_or_sentinals...>, __sentinal,
+          integer_sequence<size_t, _Idxs...>>>
+#endif
+{
+
+  //--------------------------------------------------------------------------
+
+  using __next_t =
+      __standard_layout_psa<_Tag, _T, _static_t,
+                            integer_sequence<_static_t, __values_or_sentinals...>,
+                            __sentinal, integer_sequence<size_t, _Idxs...>>;
+
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+  _MDSPAN_NO_UNIQUE_ADDRESS __next_t __next_;
+#else
+  using __base_t = __no_unique_address_emulation<__next_t>;
+#endif
+
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 __next_t &__next() noexcept {
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+    return __next_;
+#else
+    return this->__base_t::__ref();
+#endif
+  }
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr __next_t const &__next() const noexcept {
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+    return __next_;
+#else
+    return this->__base_t::__ref();
+#endif
+  }
+
+  static constexpr auto __size = sizeof...(_Idxs) + 1;
+  static constexpr auto __size_dynamic = __next_t::__size_dynamic;
+
+  //--------------------------------------------------------------------------
+
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __standard_layout_psa() noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __standard_layout_psa(__standard_layout_psa const &) noexcept =
+      default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __standard_layout_psa(__standard_layout_psa &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __standard_layout_psa &
+  operator=(__standard_layout_psa const &) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __standard_layout_psa &
+  operator=(__standard_layout_psa &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  ~__standard_layout_psa() noexcept = default;
+
+  //--------------------------------------------------------------------------
+
+  MDSPAN_INLINE_FUNCTION
+  constexpr __standard_layout_psa(
+      __construct_psa_from_all_exts_values_tag_t, _T const & /*__val*/,
+      __repeated_with_idxs<_Idxs, _T> const &... __vals) noexcept
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      : __next_{
+#else
+      : __base_t(__base_t{__next_t(
+#endif
+          __construct_psa_from_all_exts_values_tag, __vals...
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+        }
+#else
+        )})
+#endif
+  { }
+
+  template <class... _Ts>
+  MDSPAN_INLINE_FUNCTION constexpr __standard_layout_psa(
+      __construct_psa_from_dynamic_exts_values_tag_t,
+      _Ts const &... __vals) noexcept
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      : __next_{
+#else
+      : __base_t(__base_t{__next_t(
+#endif
+          __construct_psa_from_dynamic_exts_values_tag, __vals...
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+        }
+#else
+        )})
+#endif
+  { }
+
+  template <class _U, size_t _N>
+  MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa(
+      array<_U, _N> const &__vals) noexcept
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      : __next_{
+#else
+      : __base_t(__base_t{__next_t(
+#endif
+          __vals
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+        }
+#else
+        )})
+#endif
+  { }
+
+  template <class _U, size_t _NStatic>
+  MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa(
+      __construct_psa_from_all_exts_array_tag_t const & __tag,
+      array<_U, _NStatic> const &__vals) noexcept
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      : __next_{
+#else
+      : __base_t(__base_t{__next_t(
+#endif
+          __tag, __vals
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+        }
+#else
+        )})
+#endif
+  { }
+
+  template <class _U, size_t _IDynamic, size_t _NDynamic>
+  MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa(
+      __construct_psa_from_dynamic_exts_array_tag_t<_IDynamic> __tag,
+      array<_U, _NDynamic> const &__vals) noexcept
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      : __next_{
+#else
+      : __base_t(__base_t{__next_t(
+#endif
+          __tag, __vals
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+        }
+#else
+        )})
+#endif
+  { }
+
+#ifdef __cpp_lib_span
+  template <class _U, size_t _N>
+  MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa(
+      span<_U, _N> const &__vals) noexcept
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      : __next_{
+#else
+      : __base_t(__base_t{__next_t(
+#endif
+          __vals
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+        }
+#else
+        )})
+#endif
+  { }
+
+  template <class _U, size_t _NStatic>
+  MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa(
+      __construct_psa_from_all_exts_array_tag_t const & __tag,
+      span<_U, _NStatic> const &__vals) noexcept
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      : __next_{
+#else
+      : __base_t(__base_t{__next_t(
+#endif
+          __tag, __vals
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+        }
+#else
+        )})
+#endif
+  { }
+
+  template <class _U, size_t _IDynamic, size_t _NDynamic>
+  MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa(
+      __construct_psa_from_dynamic_exts_array_tag_t<_IDynamic> __tag,
+      span<_U, _NDynamic> const &__vals) noexcept
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      : __next_{
+#else
+      : __base_t(__base_t{__next_t(
+#endif
+          __tag, __vals
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+        }
+#else
+        )})
+#endif
+  { }
+#endif
+
+  template <class _UTag, class _U, class _static_U, class _UValsSeq, _static_U __u_sentinal,
+            class _IdxsSeq>
+  MDSPAN_INLINE_FUNCTION constexpr __standard_layout_psa(
+      __standard_layout_psa<_UTag, _U, _static_U, _UValsSeq, __u_sentinal, _IdxsSeq> const
+          &__rhs) noexcept
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+      : __next_{
+#else
+      : __base_t(__base_t{__next_t(
+#endif
+          __rhs.__next()
+#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
+        }
+#else
+        )})
+#endif
+  { }
+
+  //--------------------------------------------------------------------------
+
+  // See https://godbolt.org/z/_KSDNX for a summary-by-example of why this is
+  // necessary. We're using inheritance here instead of an alias template
+  // because we have to deduce __values_or_sentinals in several places, and
+  // alias templates don't permit that in this context.
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr __standard_layout_psa const &__enable_psa_conversion() const
+      noexcept {
+    return *this;
+  }
+
+  template <size_t _I, enable_if_t<_I != _Idx, int> = 0>
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _T __get_n() const noexcept {
+    return __next().template __get_n<_I>();
+  }
+  template <size_t _I, enable_if_t<_I == _Idx, int> = 1>
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _T __get_n() const noexcept {
+    return __value;
+  }
+  template <size_t _I, enable_if_t<_I != _Idx, int> = 0>
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 void
+  __set_n(_T const &__rhs) noexcept {
+    __next().__set_value(__rhs);
+  }
+  template <size_t _I, enable_if_t<_I == _Idx, int> = 1>
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 void
+  __set_n(_T const &) noexcept {
+    // Don't assert here because that would break constexpr. This better
+    // not change anything, though
+  }
+  template <size_t _I, enable_if_t<_I == _Idx, _static_t> = __sentinal>
+  MDSPAN_FORCE_INLINE_FUNCTION static constexpr _static_t __get_static_n() noexcept {
+    return __value;
+  }
+  template <size_t _I, enable_if_t<_I != _Idx, _static_t> __default = __sentinal>
+  MDSPAN_FORCE_INLINE_FUNCTION static constexpr _static_t __get_static_n() noexcept {
+    return __next_t::template __get_static_n<_I, __default>();
+  }
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _T __get(size_t __n) const noexcept {
+    return __value * (_T(_Idx == __n)) + __next().__get(__n);
+  }
+
+  //--------------------------------------------------------------------------
+};
+
+//==============================================================================
+
+// Dynamic case, __next_t may or may not be empty
+template <class _Tag, class _T, class _static_t, _static_t __sentinal, _static_t... __values_or_sentinals,
+          size_t _Idx, size_t... _Idxs>
+struct __standard_layout_psa<
+    _Tag, _T, _static_t, integer_sequence<_static_t, __sentinal, __values_or_sentinals...>,
+    __sentinal, integer_sequence<size_t, _Idx, _Idxs...>> {
+  //--------------------------------------------------------------------------
+
+  using __next_t =
+      __standard_layout_psa<_Tag, _T, _static_t,
+                            integer_sequence<_static_t, __values_or_sentinals...>,
+                            __sentinal, integer_sequence<size_t, _Idxs...>>;
+
+  using __value_pair_t = __compressed_pair<_T, __next_t>;
+  __value_pair_t __value_pair;
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 __next_t &__next() noexcept {
+    return __value_pair.__second();
+  }
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr __next_t const &__next() const noexcept {
+    return __value_pair.__second();
+  }
+
+  static constexpr auto __size = sizeof...(_Idxs) + 1;
+  static constexpr auto __size_dynamic = 1 + __next_t::__size_dynamic;
+
+  //--------------------------------------------------------------------------
+
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __standard_layout_psa() noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __standard_layout_psa(__standard_layout_psa const &) noexcept =
+      default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __standard_layout_psa(__standard_layout_psa &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __standard_layout_psa &
+  operator=(__standard_layout_psa const &) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __standard_layout_psa &
+  operator=(__standard_layout_psa &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  ~__standard_layout_psa() noexcept = default;
+
+  //--------------------------------------------------------------------------
+
+  MDSPAN_INLINE_FUNCTION
+  constexpr __standard_layout_psa(
+      __construct_psa_from_all_exts_values_tag_t, _T const &__val,
+      __repeated_with_idxs<_Idxs, _T> const &... __vals) noexcept
+      : __value_pair(__val,
+                     __next_t(__construct_psa_from_all_exts_values_tag,
+                              __vals...)) {}
+
+  template <class... _Ts>
+  MDSPAN_INLINE_FUNCTION constexpr __standard_layout_psa(
+      __construct_psa_from_dynamic_exts_values_tag_t, _T const &__val,
+      _Ts const &... __vals) noexcept
+      : __value_pair(__val,
+                     __next_t(__construct_psa_from_dynamic_exts_values_tag,
+                              __vals...)) {}
+
+  template <class _U, size_t _N>
+  MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa(
+      array<_U, _N> const &__vals) noexcept
+      : __value_pair(::std::get<_Idx>(__vals), __vals) {}
+
+  template <class _U, size_t _NStatic>
+  MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa(
+      __construct_psa_from_all_exts_array_tag_t __tag,
+      array<_U, _NStatic> const &__vals) noexcept
+      : __value_pair(
+            ::std::get<_Idx>(__vals),
+            __next_t(__tag,
+                     __vals)) {}
+
+  template <class _U, size_t _IDynamic, size_t _NDynamic>
+  MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa(
+      __construct_psa_from_dynamic_exts_array_tag_t<_IDynamic>,
+      array<_U, _NDynamic> const &__vals) noexcept
+      : __value_pair(
+            ::std::get<_IDynamic>(__vals),
+            __next_t(__construct_psa_from_dynamic_exts_array_tag_t<_IDynamic + 1>{},
+                     __vals)) {}
+
+#ifdef __cpp_lib_span
+  template <class _U, size_t _N>
+  MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa(
+      span<_U, _N> const &__vals) noexcept
+      : __value_pair(__vals[_Idx], __vals) {}
+
+  template <class _U, size_t _NStatic>
+  MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa(
+      __construct_psa_from_all_exts_array_tag_t __tag,
+      span<_U, _NStatic> const &__vals) noexcept
+      : __value_pair(
+            __vals[_Idx],
+            __next_t(__tag,
+                     __vals)) {}
+
+  template <class _U, size_t _IDynamic, size_t _NDynamic>
+  MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa(
+      __construct_psa_from_dynamic_exts_array_tag_t<_IDynamic>,
+      span<_U, _NDynamic> const &__vals) noexcept
+      : __value_pair(
+            __vals[_IDynamic],
+            __next_t(__construct_psa_from_dynamic_exts_array_tag_t<_IDynamic + 1>{},
+                     __vals)) {}
+#endif
+
+  template <class _UTag, class _U, class _static_U, class _UValsSeq, _static_U __u_sentinal,
+            class _UIdxsSeq>
+  MDSPAN_INLINE_FUNCTION constexpr __standard_layout_psa(
+      __standard_layout_psa<_UTag, _U, _static_U, _UValsSeq, __u_sentinal, _UIdxsSeq> const
+          &__rhs) noexcept
+      : __value_pair(__rhs.template __get_n<_Idx>(), __rhs.__next()) {}
+
+  //--------------------------------------------------------------------------
+
+  // See comment in the previous partial specialization for why this is
+  // necessary.  Or just trust me that it's messy.
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr __standard_layout_psa const &__enable_psa_conversion() const
+      noexcept {
+    return *this;
+  }
+
+  template <size_t _I, enable_if_t<_I != _Idx, int> = 0>
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _T __get_n() const noexcept {
+    return __next().template __get_n<_I>();
+  }
+  template <size_t _I, enable_if_t<_I == _Idx, int> = 1>
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _T __get_n() const noexcept {
+    return __value_pair.__first();
+  }
+  template <size_t _I, enable_if_t<_I != _Idx, int> = 0>
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 void
+  __set_n(_T const &__rhs) noexcept {
+    __next().__set_value(__rhs);
+  }
+  template <size_t _I, enable_if_t<_I == _Idx, int> = 1>
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 void
+  __set_n(_T const &__rhs) noexcept {
+    __value_pair.__first() = __rhs;
+  }
+  template <size_t _I, enable_if_t<_I == _Idx, _static_t> __default = __sentinal>
+  MDSPAN_FORCE_INLINE_FUNCTION static constexpr _static_t __get_static_n() noexcept {
+    return __default;
+  }
+  template <size_t _I, enable_if_t<_I != _Idx, _static_t> __default = __sentinal>
+  MDSPAN_FORCE_INLINE_FUNCTION static constexpr _static_t __get_static_n() noexcept {
+    return __next_t::template __get_static_n<_I, __default>();
+  }
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _T __get(size_t __n) const noexcept {
+    return __value_pair.__first() * (_T(_Idx == __n)) + __next().__get(__n);
+  }
+
+  //--------------------------------------------------------------------------
+};
+
+// empty/terminal case
+template <class _Tag, class _T, class _static_t, _static_t __sentinal>
+struct __standard_layout_psa<_Tag, _T, _static_t, integer_sequence<_static_t>, __sentinal,
+                             integer_sequence<size_t>> {
+  //--------------------------------------------------------------------------
+
+  static constexpr auto __size = 0;
+  static constexpr auto __size_dynamic = 0;
+
+  //--------------------------------------------------------------------------
+
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __standard_layout_psa() noexcept
+#if defined(__clang__) || defined(_MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND)
+  // As far as I can tell, there appears to be a bug in clang that's causing
+  // this to be non-constexpr when it's defaulted.
+  { }
+#else
+   = default;
+#endif
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __standard_layout_psa(__standard_layout_psa const &) noexcept =
+      default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __standard_layout_psa(__standard_layout_psa &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __standard_layout_psa &
+  operator=(__standard_layout_psa const &) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __standard_layout_psa &
+  operator=(__standard_layout_psa &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  ~__standard_layout_psa() noexcept = default;
+
+  MDSPAN_INLINE_FUNCTION
+  constexpr __standard_layout_psa(
+      __construct_psa_from_all_exts_values_tag_t) noexcept {}
+
+  template <class... _Ts>
+  MDSPAN_INLINE_FUNCTION constexpr __standard_layout_psa(
+      __construct_psa_from_dynamic_exts_values_tag_t) noexcept {}
+
+  template <class _U, size_t _N>
+  MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa(
+      array<_U, _N> const &) noexcept {}
+
+  template <class _U, size_t _NStatic>
+  MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa(
+      __construct_psa_from_all_exts_array_tag_t,
+      array<_U, _NStatic> const &) noexcept {}
+
+  template <class _U, size_t _IDynamic, size_t _NDynamic>
+  MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa(
+      __construct_psa_from_dynamic_exts_array_tag_t<_IDynamic>,
+      array<_U, _NDynamic> const &) noexcept {}
+
+#ifdef __cpp_lib_span
+  template <class _U, size_t _N>
+  MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa(
+      span<_U, _N> const &) noexcept {}
+
+  template <class _U, size_t _NStatic>
+  MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa(
+      __construct_psa_from_all_exts_array_tag_t,
+      span<_U, _NStatic> const &) noexcept {}
+
+  template <class _U, size_t _IDynamic, size_t _NDynamic>
+  MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa(
+      __construct_psa_from_dynamic_exts_array_tag_t<_IDynamic>,
+      span<_U, _NDynamic> const &) noexcept {}
+#endif
+
+  template <class _UTag, class _U, class _static_U, class _UValsSeq, _static_U __u_sentinal,
+            class _UIdxsSeq>
+  MDSPAN_INLINE_FUNCTION constexpr __standard_layout_psa(
+      __standard_layout_psa<_UTag, _U, _static_U, _UValsSeq, __u_sentinal, _UIdxsSeq> const&) noexcept {}
+
+  // See comment in the previous partial specialization for why this is
+  // necessary.  Or just trust me that it's messy.
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr __standard_layout_psa const &__enable_psa_conversion() const
+      noexcept {
+    return *this;
+  }
+
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _T __get(size_t /*n*/) const noexcept {
+    return 0;
+  }
+};
+
+// Same thing, but with a disambiguator so that same-base issues doesn't cause
+// a loss of standard-layout-ness.
+template <class _Tag, class T, class _static_t, _static_t... __values_or_sentinals>
+struct __partially_static_sizes_tagged
+    : __standard_layout_psa<
+          _Tag, T, _static_t,
+          integer_sequence<_static_t, __values_or_sentinals...>> {
+  using __tag_t = _Tag;
+  using __psa_impl_t = __standard_layout_psa<
+      _Tag, T, _static_t, integer_sequence<_static_t, __values_or_sentinals...>>;
+  using __psa_impl_t::__psa_impl_t;
+#ifdef _MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND
+  MDSPAN_INLINE_FUNCTION
+#endif
+  constexpr __partially_static_sizes_tagged() noexcept
+#ifdef _MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND
+    : __psa_impl_t() { }
+#else
+    = default;
+#endif
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __partially_static_sizes_tagged(
+      __partially_static_sizes_tagged const &) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __partially_static_sizes_tagged(
+      __partially_static_sizes_tagged &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __partially_static_sizes_tagged &
+  operator=(__partially_static_sizes_tagged const &) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __partially_static_sizes_tagged &
+  operator=(__partially_static_sizes_tagged &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  ~__partially_static_sizes_tagged() noexcept = default;
+
+  template <class _UTag>
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr explicit __partially_static_sizes_tagged(
+    __partially_static_sizes_tagged<_UTag, T, _static_t, __values_or_sentinals...> const& __vals
+  ) noexcept : __psa_impl_t(__vals.__enable_psa_conversion()) { }
+};
+
+struct __no_tag {};
+template <class T, class _static_t, _static_t... __values_or_sentinals>
+struct __partially_static_sizes
+    : __partially_static_sizes_tagged<__no_tag, T, _static_t, __values_or_sentinals...> {
+private:
+  using __base_t =
+      __partially_static_sizes_tagged<__no_tag, T, _static_t, __values_or_sentinals...>;
+  template <class _UTag>
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr __partially_static_sizes(
+    __partially_static_sizes_tagged<_UTag, T, _static_t, __values_or_sentinals...>&& __vals
+  ) noexcept : __base_t(::std::move(__vals)) { }
+public:
+  using __base_t::__base_t;
+
+#ifdef _MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND
+  MDSPAN_INLINE_FUNCTION
+  constexpr __partially_static_sizes() noexcept : __base_t() { }
+#endif
+  template <class _UTag>
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr __partially_static_sizes_tagged<
+      _UTag, T, _static_t, __values_or_sentinals...>
+  __with_tag() const noexcept {
+    return __partially_static_sizes_tagged<_UTag, T, _static_t, __values_or_sentinals...>(*this);
+  }
+};
+
+#endif // _MDSPAN_PRESERVE_STATIC_LAYOUT
+
+} // end namespace detail
+} // end namespace experimental
+} // end namespace std
diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/static_array.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/static_array.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..548bd8c8a75074e39d93f2a2ad38bbc1509198a6
--- /dev/null
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/static_array.hpp
@@ -0,0 +1,286 @@
+/*
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
+//
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
+// the U.S. Government retains certain rights in this software.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the Corporation nor the names of the
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// 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 Christian R. Trott (crtrott@sandia.gov)
+//
+// ************************************************************************
+//@HEADER
+*/
+
+#pragma once
+
+#include "macros.hpp"
+
+#include "dynamic_extent.hpp"
+#include "trait_backports.hpp"
+#include "maybe_static_value.hpp"
+#include "standard_layout_static_array.hpp"
+#include "type_list.hpp"
+
+// Needs to be after the includes above to work with the single header generator
+#if !_MDSPAN_PRESERVE_STANDARD_LAYOUT
+#include <cstddef> // size_t
+#include <utility> // integer_sequence
+#include <array>
+
+namespace std {
+namespace experimental {
+namespace detail {
+
+//==============================================================================
+
+template <class _T, _T _Val, bool _Mask> struct __mask_element {};
+
+template <class _T, _T... _Result>
+struct __mask_sequence_assign_op {
+  template <_T _V>
+  __mask_sequence_assign_op<_T, _Result..., _V>
+  operator=(__mask_element<_T, _V, true>&&);
+  template <_T _V>
+  __mask_sequence_assign_op<_T, _Result...>
+  operator=(__mask_element<_T, _V, false>&&);
+  using __result = integer_sequence<_T, _Result...>;
+};
+
+template <class _Seq, class _Mask>
+struct __mask_sequence;
+
+template <class _T, _T... _Vals, bool... _Masks>
+struct __mask_sequence<integer_sequence<_T, _Vals...>, integer_sequence<bool, _Masks...>>
+{
+  using type = typename decltype(
+    _MDSPAN_FOLD_ASSIGN_LEFT(
+      __mask_sequence_assign_op<_T>{}, /* = ... = */ __mask_element<_T, _Vals, _Masks>{}
+    )
+  )::__result;
+};
+
+//==============================================================================
+
+template <class _T, class _static_t, class _Vals, _static_t __sentinal,
+          class _Idxs, class _IdxsDynamic, class _IdxsDynamicIdxs>
+class __partially_static_array_impl;
+
+template <
+  class _T, class _static_t,
+  _static_t... __values_or_sentinals, _static_t __sentinal,
+  size_t... _Idxs,
+  size_t... _IdxsDynamic,
+  size_t... _IdxsDynamicIdxs
+>
+class __partially_static_array_impl<
+  _T,
+  _static_t,
+  integer_sequence<_static_t, __values_or_sentinals...>,
+  __sentinal,
+  integer_sequence<size_t, _Idxs...>,
+  integer_sequence<size_t, _IdxsDynamic...>,
+  integer_sequence<size_t, _IdxsDynamicIdxs...>
+>
+    : private __maybe_static_value<_T, _static_t, __values_or_sentinals, __sentinal,
+                                   _Idxs>... {
+private:
+
+  template <size_t _N>
+  using __base_n = typename __type_at<_N,
+    __type_list<__maybe_static_value<_T, _static_t, __values_or_sentinals, __sentinal, _Idxs>...>
+  >::type;
+
+public:
+
+  static constexpr auto __size = sizeof...(_Idxs);
+  static constexpr auto __size_dynamic =
+    _MDSPAN_FOLD_PLUS_RIGHT(static_cast<int>((__values_or_sentinals == __sentinal)), /* + ... + */ 0);
+
+  //--------------------------------------------------------------------------
+
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __partially_static_array_impl() = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __partially_static_array_impl(
+      __partially_static_array_impl const &) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  constexpr __partially_static_array_impl(
+      __partially_static_array_impl &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __partially_static_array_impl &
+  operator=(__partially_static_array_impl const &) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  _MDSPAN_CONSTEXPR_14_DEFAULTED __partially_static_array_impl &
+  operator=(__partially_static_array_impl &&) noexcept = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  ~__partially_static_array_impl() noexcept = default;
+
+  MDSPAN_INLINE_FUNCTION
+  constexpr __partially_static_array_impl(
+      __construct_psa_from_all_exts_values_tag_t,
+      __repeated_with_idxs<_Idxs, _T> const &... __vals) noexcept
+      : __base_n<_Idxs>(__base_n<_Idxs>{{__vals}})... {}
+
+  MDSPAN_INLINE_FUNCTION
+  constexpr __partially_static_array_impl(
+      __construct_psa_from_dynamic_exts_values_tag_t,
+      __repeated_with_idxs<_IdxsDynamicIdxs, _T> const &... __vals) noexcept
+      : __base_n<_IdxsDynamic>(__base_n<_IdxsDynamic>{{__vals}})... {}
+
+  MDSPAN_INLINE_FUNCTION constexpr explicit __partially_static_array_impl(
+    array<_T, sizeof...(_Idxs)> const& __vals) noexcept
+    : __partially_static_array_impl(
+        __construct_psa_from_all_exts_values_tag,
+        ::std::get<_Idxs>(__vals)...) {}
+
+  // clang-format off
+  MDSPAN_FUNCTION_REQUIRES(
+    (MDSPAN_INLINE_FUNCTION constexpr explicit),
+    __partially_static_array_impl,
+    (array<_T, __size_dynamic> const &__vals), noexcept,
+    /* requires */
+      (sizeof...(_Idxs) != __size_dynamic)
+  ): __partially_static_array_impl(
+       __construct_psa_from_dynamic_exts_values_tag,
+       ::std::get<_IdxsDynamicIdxs>(__vals)...) {}
+  // clang-format on
+
+  template <class _U, class _static_u, class _UValsSeq, _static_u __u_sentinal, class _UIdxsSeq,
+            class _UIdxsDynamicSeq, class _UIdxsDynamicIdxsSeq>
+  MDSPAN_INLINE_FUNCTION constexpr __partially_static_array_impl(
+    __partially_static_array_impl<
+      _U, _static_u, _UValsSeq, __u_sentinal, _UIdxsSeq,
+     _UIdxsDynamicSeq, _UIdxsDynamicIdxsSeq> const &__rhs) noexcept
+    : __partially_static_array_impl(
+        __construct_psa_from_all_exts_values_tag,
+        __rhs.template __get_n<_Idxs>()...) {}
+
+  //--------------------------------------------------------------------------
+
+  // See comment in the previous partial specialization for why this is
+  // necessary.  Or just trust me that it's messy.
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr __partially_static_array_impl const &__enable_psa_conversion() const
+  noexcept {
+      return *this;
+  }
+
+  template <size_t _I>
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _T __get_n() const noexcept {
+    return static_cast<__base_n<_I> const*>(this)->__value();
+  }
+
+  template <class _U, size_t _I>
+  MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 void __set_n(_U&& __rhs) noexcept {
+    static_cast<__base_n<_I>*>(this)->__set_value((_U&&)__rhs);
+  }
+
+  template <size_t _I, _static_t __default = __sentinal>
+  MDSPAN_FORCE_INLINE_FUNCTION static constexpr _static_t
+  __get_static_n() noexcept {
+    return __base_n<_I>::__static_value == __sentinal ?
+      __default : __base_n<_I>::__static_value;
+  }
+
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr _T
+  __get(size_t __n) const noexcept {
+    return _MDSPAN_FOLD_PLUS_RIGHT(
+      (_T(_Idxs == __n) * __get_n<_Idxs>()), /* + ... + */ _T(0)
+    );
+  }
+
+};
+
+//==============================================================================
+
+template <class _T, class _static_t, class _ValSeq, _static_t __sentinal, class _Idxs = make_index_sequence<_ValSeq::size()>>
+struct __partially_static_array_impl_maker;
+
+template <
+  class _T, class _static_t,  _static_t... _Vals, _static_t __sentinal, size_t... _Idxs
+>
+struct __partially_static_array_impl_maker<
+  _T, _static_t, integer_sequence<_static_t, _Vals...>, __sentinal, integer_sequence<size_t, _Idxs...>
+>
+{
+  using __dynamic_idxs = typename __mask_sequence<
+    integer_sequence<size_t, _Idxs...>,
+    integer_sequence<bool, (_Vals == __sentinal)...>
+  >::type;
+  using __impl_base =
+    __partially_static_array_impl<_T, _static_t,
+      integer_sequence<_static_t, _Vals...>,
+      __sentinal, integer_sequence<size_t, _Idxs...>,
+      __dynamic_idxs,
+      make_index_sequence<__dynamic_idxs::size()>
+    >;
+};
+
+template <class _T, class _static_t, class _ValsSeq, _static_t __sentinal = dynamic_extent>
+class __partially_static_array_with_sentinal
+  : public __partially_static_array_impl_maker<_T, _static_t, _ValsSeq, __sentinal>::__impl_base
+{
+private:
+  using __base_t = typename __partially_static_array_impl_maker<_T, _static_t, _ValsSeq, __sentinal>::__impl_base;
+public:
+  using __base_t::__base_t;
+};
+
+//==============================================================================
+
+template <class T, class _static_t, _static_t... __values_or_sentinals>
+struct __partially_static_sizes :
+  __partially_static_array_with_sentinal<
+    T, _static_t, ::std::integer_sequence<_static_t, __values_or_sentinals...>>
+{
+private:
+  using __base_t = __partially_static_array_with_sentinal<
+    T, _static_t, ::std::integer_sequence<_static_t, __values_or_sentinals...>>;
+public:
+  using __base_t::__base_t;
+  template <class _UTag>
+  MDSPAN_FORCE_INLINE_FUNCTION constexpr __partially_static_sizes<T, _static_t, __values_or_sentinals...>
+  __with_tag() const noexcept {
+    return *this;
+  }
+};
+
+// Tags are needed for the standard layout version, but not here
+template <class T, class _static_t, _static_t... __values_or_sentinals>
+using __partially_static_sizes_tagged = __partially_static_sizes<T, _static_t, __values_or_sentinals...>;
+
+} // end namespace detail
+} // end namespace experimental
+} // end namespace std
+
+#endif // !_MDSPAN_PRESERVE_STANDARD_LAYOUT
diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/submdspan.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/submdspan.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..dde1ab15bf39f8190a326a9dadc4acfe968db0dc
--- /dev/null
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/submdspan.hpp
@@ -0,0 +1,586 @@
+/*
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
+//
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
+// the U.S. Government retains certain rights in this software.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the Corporation nor the names of the
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// 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 Christian R. Trott (crtrott@sandia.gov)
+//
+// ************************************************************************
+//@HEADER
+*/
+
+
+#pragma once
+
+#include "mdspan.hpp"
+#include "full_extent_t.hpp"
+#include "dynamic_extent.hpp"
+#include "layout_left.hpp"
+#include "layout_right.hpp"
+#include "layout_stride.hpp"
+#include "macros.hpp"
+#include "trait_backports.hpp"
+
+#include <tuple> // std::apply
+#include <utility> // std::pair
+
+namespace std {
+namespace experimental {
+
+namespace detail {
+
+template <size_t OldExtent, size_t OldStaticStride, class T>
+struct __slice_wrap {
+  T slice;
+  size_t old_extent;
+  size_t old_stride;
+};
+
+//--------------------------------------------------------------------------------
+
+template <size_t OldExtent, size_t OldStaticStride>
+MDSPAN_INLINE_FUNCTION constexpr
+__slice_wrap<OldExtent, OldStaticStride, size_t>
+__wrap_slice(size_t val, size_t ext, size_t stride) { return { val, ext, stride }; }
+
+template <size_t OldExtent, size_t OldStaticStride, class IntegerType, IntegerType Value0>
+MDSPAN_INLINE_FUNCTION constexpr
+__slice_wrap<OldExtent, OldStaticStride, std::integral_constant<IntegerType, Value0>>
+__wrap_slice(size_t val, size_t ext, std::integral_constant<IntegerType, Value0> stride)
+{
+#if MDSPAN_HAS_CXX_17
+  if constexpr (std::is_signed_v<IntegerType>) {
+    static_assert(Value0 >= IntegerType(0), "Invalid slice specifier");
+  }
+#endif // MDSPAN_HAS_CXX_17
+
+  return { val, ext, stride };
+}
+
+template <size_t OldExtent, size_t OldStaticStride>
+MDSPAN_INLINE_FUNCTION constexpr
+__slice_wrap<OldExtent, OldStaticStride, full_extent_t>
+__wrap_slice(full_extent_t val, size_t ext, size_t stride) { return { val, ext, stride }; }
+
+// TODO generalize this to anything that works with std::get<0> and std::get<1>
+template <size_t OldExtent, size_t OldStaticStride>
+MDSPAN_INLINE_FUNCTION constexpr
+__slice_wrap<OldExtent, OldStaticStride, std::tuple<size_t, size_t>>
+__wrap_slice(std::tuple<size_t, size_t> const& val, size_t ext, size_t stride)
+{
+  return { val, ext, stride };
+}
+
+template <size_t OldExtent, size_t OldStaticStride,
+	  class IntegerType0, IntegerType0 Value0,
+	  class IntegerType1, IntegerType1 Value1>
+MDSPAN_INLINE_FUNCTION constexpr
+  __slice_wrap<OldExtent, OldStaticStride,
+               std::tuple<std::integral_constant<IntegerType0, Value0>,
+                          std::integral_constant<IntegerType1, Value1>>>
+__wrap_slice(std::tuple<std::integral_constant<IntegerType0, Value0>, std::integral_constant<IntegerType1, Value1>> const& val, size_t ext, size_t stride)
+{
+  static_assert(Value1 >= Value0, "Invalid slice tuple");
+  return { val, ext, stride };
+}
+
+//--------------------------------------------------------------------------------
+
+
+// a layout right remains a layout right if it is indexed by 0 or more scalars,
+// then optionally a pair and finally 0 or more all
+template <
+  // what we encountered until now preserves the layout right
+  bool result=true,
+  // we only encountered 0 or more scalars, no pair or all
+  bool encountered_only_scalar=true
+>
+struct preserve_layout_right_analysis : integral_constant<bool, result> {
+  using layout_type_if_preserved = layout_right;
+  using encounter_pair = preserve_layout_right_analysis<
+    // if we encounter a pair, the layout remains a layout right only if it was one before
+    // and that only scalars were encountered until now
+    result && encountered_only_scalar,
+    // if we encounter a pair, we didn't encounter scalars only
+    false
+  >;
+  using encounter_all = preserve_layout_right_analysis<
+    // if we encounter a all, the layout remains a layout right if it was one before
+    result,
+    // if we encounter a all, we didn't encounter scalars only
+    false
+  >;
+  using encounter_scalar = preserve_layout_right_analysis<
+    // if we encounter a scalar, the layout remains a layout right only if it was one before
+    // and that only scalars were encountered until now
+    result && encountered_only_scalar,
+    // if we encounter a scalar, the fact that we encountered scalars only doesn't change
+    encountered_only_scalar
+  >;
+};
+
+// a layout left remains a layout left if it is indexed by 0 or more all,
+// then optionally a pair and finally 0 or more scalars
+template <
+  bool result=true,
+  bool encountered_only_all=true
+>
+struct preserve_layout_left_analysis : integral_constant<bool, result> {
+  using layout_type_if_preserved = layout_left;
+  using encounter_pair = preserve_layout_left_analysis<
+    // if we encounter a pair, the layout remains a layout left only if it was one before
+    // and that only all were encountered until now
+    result && encountered_only_all,
+    // if we encounter a pair, we didn't encounter all only
+    false
+  >;
+  using encounter_all = preserve_layout_left_analysis<
+    // if we encounter a all, the layout remains a layout left only if it was one before
+    // and that only all were encountered until now
+    result && encountered_only_all,
+    // if we encounter a all, the fact that we encountered scalars all doesn't change
+    encountered_only_all
+  >;
+  using encounter_scalar = preserve_layout_left_analysis<
+    // if we encounter a scalar, the layout remains a layout left if it was one before
+    result,
+    // if we encounter a scalar, we didn't encounter scalars only
+    false
+  >;
+};
+
+struct ignore_layout_preservation : std::integral_constant<bool, false> {
+  using layout_type_if_preserved = void;
+  using encounter_pair = ignore_layout_preservation;
+  using encounter_all = ignore_layout_preservation;
+  using encounter_scalar = ignore_layout_preservation;
+};
+
+template <class Layout>
+struct preserve_layout_analysis
+  : ignore_layout_preservation { };
+template <>
+struct preserve_layout_analysis<layout_right>
+  : preserve_layout_right_analysis<> { };
+template <>
+struct preserve_layout_analysis<layout_left>
+  : preserve_layout_left_analysis<> { };
+
+//--------------------------------------------------------------------------------
+
+template <
+  class _IndexT,
+  class _PreserveLayoutAnalysis,
+  class _OffsetsArray=__partially_static_sizes<_IndexT, size_t>,
+  class _ExtsArray=__partially_static_sizes<_IndexT, size_t>,
+  class _StridesArray=__partially_static_sizes<_IndexT, size_t>,
+  class = make_index_sequence<_OffsetsArray::__size>,
+  class = make_index_sequence<_ExtsArray::__size>,
+  class = make_index_sequence<_StridesArray::__size>
+>
+struct __assign_op_slice_handler;
+
+/* clang-format: off */
+template <
+  class _IndexT,
+  class _PreserveLayoutAnalysis,
+  size_t... _Offsets,
+  size_t... _Exts,
+  size_t... _Strides,
+  size_t... _OffsetIdxs,
+  size_t... _ExtIdxs,
+  size_t... _StrideIdxs>
+struct __assign_op_slice_handler<
+  _IndexT,
+  _PreserveLayoutAnalysis,
+  __partially_static_sizes<_IndexT, size_t, _Offsets...>,
+  __partially_static_sizes<_IndexT, size_t, _Exts...>,
+  __partially_static_sizes<_IndexT, size_t, _Strides...>,
+  integer_sequence<size_t, _OffsetIdxs...>,
+  integer_sequence<size_t, _ExtIdxs...>,
+  integer_sequence<size_t, _StrideIdxs...>>
+{
+  // TODO remove this for better compiler performance
+  static_assert(
+    _MDSPAN_FOLD_AND((_Strides == dynamic_extent || _Strides > 0) /* && ... */),
+    " "
+  );
+  static_assert(
+    _MDSPAN_FOLD_AND((_Offsets == dynamic_extent || _Offsets >= 0) /* && ... */),
+    " "
+  );
+
+  using __offsets_storage_t = __partially_static_sizes<_IndexT, size_t, _Offsets...>;
+  using __extents_storage_t = __partially_static_sizes<_IndexT, size_t, _Exts...>;
+  using __strides_storage_t = __partially_static_sizes<_IndexT, size_t, _Strides...>;
+  __offsets_storage_t __offsets;
+  __extents_storage_t __exts;
+  __strides_storage_t __strides;
+
+#ifdef __INTEL_COMPILER
+#if __INTEL_COMPILER <= 1800
+  MDSPAN_INLINE_FUNCTION constexpr __assign_op_slice_handler(__assign_op_slice_handler&& __other) noexcept
+    : __offsets(::std::move(__other.__offsets)), __exts(::std::move(__other.__exts)), __strides(::std::move(__other.__strides))
+  { }
+  MDSPAN_INLINE_FUNCTION constexpr __assign_op_slice_handler(
+    __offsets_storage_t&& __o,
+    __extents_storage_t&& __e,
+    __strides_storage_t&& __s
+  ) noexcept
+    : __offsets(::std::move(__o)), __exts(::std::move(__e)), __strides(::std::move(__s))
+  { }
+#endif
+#endif
+
+// Don't define this unless we need it; they have a cost to compile
+#ifndef _MDSPAN_USE_RETURN_TYPE_DEDUCTION
+  using __extents_type = ::std::experimental::extents<_IndexT, _Exts...>;
+#endif
+
+  // For size_t slice, skip the extent and stride, but add an offset corresponding to the value
+  template <size_t _OldStaticExtent, size_t _OldStaticStride>
+  MDSPAN_FORCE_INLINE_FUNCTION // NOLINT (misc-unconventional-assign-operator)
+  _MDSPAN_CONSTEXPR_14 auto
+  operator=(__slice_wrap<_OldStaticExtent, _OldStaticStride, size_t>&& __slice) noexcept
+    -> __assign_op_slice_handler<
+         _IndexT,
+         typename _PreserveLayoutAnalysis::encounter_scalar,
+         __partially_static_sizes<_IndexT, size_t, _Offsets..., dynamic_extent>,
+         __partially_static_sizes<_IndexT, size_t, _Exts...>,
+         __partially_static_sizes<_IndexT, size_t, _Strides...>/* intentional space here to work around ICC bug*/> {
+    return {
+      __partially_static_sizes<_IndexT, size_t, _Offsets..., dynamic_extent>(
+        __construct_psa_from_all_exts_values_tag,
+        __offsets.template __get_n<_OffsetIdxs>()..., __slice.slice),
+      ::std::move(__exts),
+      ::std::move(__strides)
+    };
+  }
+
+  // Treat integral_constant slice like size_t slice, but with a compile-time offset.
+  // The result's extents_type can't take advantage of that,
+  // but it might help for specialized layouts.
+  template <size_t _OldStaticExtent, size_t _OldStaticStride, class IntegerType, IntegerType Value0>
+  MDSPAN_FORCE_INLINE_FUNCTION // NOLINT (misc-unconventional-assign-operator)
+  _MDSPAN_CONSTEXPR_14 auto
+  operator=(__slice_wrap<_OldStaticExtent, _OldStaticStride, std::integral_constant<IntegerType, Value0>>&&) noexcept
+    -> __assign_op_slice_handler<
+         _IndexT,
+         typename _PreserveLayoutAnalysis::encounter_scalar,
+         __partially_static_sizes<_IndexT, size_t, _Offsets..., Value0>,
+         __partially_static_sizes<_IndexT, size_t, _Exts...>,
+         __partially_static_sizes<_IndexT, size_t, _Strides...>/* intentional space here to work around ICC bug*/> {
+#if MDSPAN_HAS_CXX_17
+    if constexpr (std::is_signed_v<IntegerType>) {
+      static_assert(Value0 >= IntegerType(0), "Invalid slice specifier");
+    }
+#endif // MDSPAN_HAS_CXX_17
+    return {
+      __partially_static_sizes<_IndexT, size_t, _Offsets..., Value0>(
+        __construct_psa_from_all_exts_values_tag,
+        __offsets.template __get_n<_OffsetIdxs>()..., size_t(Value0)),
+      ::std::move(__exts),
+      ::std::move(__strides)
+    };
+  }
+
+  // For a std::full_extent, offset 0 and old extent
+  template <size_t _OldStaticExtent, size_t _OldStaticStride>
+  MDSPAN_FORCE_INLINE_FUNCTION // NOLINT (misc-unconventional-assign-operator)
+  _MDSPAN_CONSTEXPR_14 auto
+  operator=(__slice_wrap<_OldStaticExtent, _OldStaticStride, full_extent_t>&& __slice) noexcept
+    -> __assign_op_slice_handler<
+         _IndexT,
+         typename _PreserveLayoutAnalysis::encounter_all,
+         __partially_static_sizes<_IndexT, size_t, _Offsets..., 0>,
+         __partially_static_sizes<_IndexT, size_t, _Exts..., _OldStaticExtent>,
+         __partially_static_sizes<_IndexT, size_t, _Strides..., _OldStaticStride>/* intentional space here to work around ICC bug*/> {
+    return {
+      __partially_static_sizes<_IndexT, size_t, _Offsets..., 0>(
+        __construct_psa_from_all_exts_values_tag,
+        __offsets.template __get_n<_OffsetIdxs>()..., size_t(0)),
+      __partially_static_sizes<_IndexT, size_t, _Exts..., _OldStaticExtent>(
+        __construct_psa_from_all_exts_values_tag,
+        __exts.template __get_n<_ExtIdxs>()..., __slice.old_extent),
+      __partially_static_sizes<_IndexT, size_t, _Strides..., _OldStaticStride>(
+        __construct_psa_from_all_exts_values_tag,
+        __strides.template __get_n<_StrideIdxs>()..., __slice.old_stride)
+    };
+  }
+
+  // For a std::tuple, add an offset and add a new dynamic extent (strides still preserved)
+  template <size_t _OldStaticExtent, size_t _OldStaticStride>
+  MDSPAN_FORCE_INLINE_FUNCTION // NOLINT (misc-unconventional-assign-operator)
+  _MDSPAN_CONSTEXPR_14 auto
+  operator=(__slice_wrap<_OldStaticExtent, _OldStaticStride, tuple<size_t, size_t>>&& __slice) noexcept
+    -> __assign_op_slice_handler<
+         _IndexT,
+         typename _PreserveLayoutAnalysis::encounter_pair,
+         __partially_static_sizes<_IndexT, size_t, _Offsets..., dynamic_extent>,
+         __partially_static_sizes<_IndexT, size_t, _Exts..., dynamic_extent>,
+         __partially_static_sizes<_IndexT, size_t, _Strides..., _OldStaticStride>/* intentional space here to work around ICC bug*/> {
+    return {
+      __partially_static_sizes<_IndexT, size_t, _Offsets..., dynamic_extent>(
+        __construct_psa_from_all_exts_values_tag,
+        __offsets.template __get_n<_OffsetIdxs>()..., ::std::get<0>(__slice.slice)),
+      __partially_static_sizes<_IndexT, size_t, _Exts..., dynamic_extent>(
+        __construct_psa_from_all_exts_values_tag,
+        __exts.template __get_n<_ExtIdxs>()..., ::std::get<1>(__slice.slice) - ::std::get<0>(__slice.slice)),
+      __partially_static_sizes<_IndexT, size_t, _Strides..., _OldStaticStride>(
+        __construct_psa_from_all_exts_values_tag,
+        __strides.template __get_n<_StrideIdxs>()..., __slice.old_stride)
+    };
+  }
+
+  // For a std::tuple of two std::integral_constant, do something like
+  // we did above for a tuple of two size_t, but make sure the
+  // result's extents type make the values compile-time constants.
+  template <size_t _OldStaticExtent, size_t _OldStaticStride,
+	    class IntegerType0, IntegerType0 Value0,
+	    class IntegerType1, IntegerType1 Value1>
+  MDSPAN_FORCE_INLINE_FUNCTION // NOLINT (misc-unconventional-assign-operator)
+  _MDSPAN_CONSTEXPR_14 auto
+  operator=(__slice_wrap<_OldStaticExtent, _OldStaticStride, tuple<std::integral_constant<IntegerType0, Value0>, std::integral_constant<IntegerType1, Value1>>>&& __slice) noexcept
+    -> __assign_op_slice_handler<
+         _IndexT,
+         typename _PreserveLayoutAnalysis::encounter_pair,
+         __partially_static_sizes<_IndexT, size_t, _Offsets..., size_t(Value0)>,
+         __partially_static_sizes<_IndexT, size_t, _Exts..., size_t(Value1 - Value0)>,
+         __partially_static_sizes<_IndexT, size_t, _Strides..., _OldStaticStride>/* intentional space here to work around ICC bug*/> {
+    static_assert(Value1 >= Value0, "Invalid slice specifier");
+    return {
+      // We're still turning the template parameters Value0 and Value1
+      // into (constexpr) run-time values here.
+      __partially_static_sizes<_IndexT, size_t, _Offsets..., size_t(Value0) > (
+        __construct_psa_from_all_exts_values_tag,
+        __offsets.template __get_n<_OffsetIdxs>()..., Value0),
+      __partially_static_sizes<_IndexT, size_t, _Exts..., size_t(Value1 - Value0) > (
+        __construct_psa_from_all_exts_values_tag,
+        __exts.template __get_n<_ExtIdxs>()..., Value1 - Value0),
+      __partially_static_sizes<_IndexT, size_t, _Strides..., _OldStaticStride>(
+        __construct_psa_from_all_exts_values_tag,
+        __strides.template __get_n<_StrideIdxs>()..., __slice.old_stride)
+    };
+  }
+
+   // TODO defer instantiation of this?
+  using layout_type = typename conditional<
+    _PreserveLayoutAnalysis::value,
+    typename _PreserveLayoutAnalysis::layout_type_if_preserved,
+    layout_stride
+  >::type;
+
+  // TODO noexcept specification
+  template <class NewLayout>
+  MDSPAN_INLINE_FUNCTION
+  _MDSPAN_DEDUCE_RETURN_TYPE_SINGLE_LINE(
+    (
+      _MDSPAN_CONSTEXPR_14 /* auto */
+      _make_layout_mapping_impl(NewLayout) noexcept
+    ),
+    (
+      /* not layout stride, so don't pass dynamic_strides */
+      /* return */ typename NewLayout::template mapping<::std::experimental::extents<_IndexT, _Exts...>>(
+        experimental::extents<_IndexT, _Exts...>::__make_extents_impl(::std::move(__exts))
+      ) /* ; */
+    )
+  )
+
+  MDSPAN_INLINE_FUNCTION
+  _MDSPAN_DEDUCE_RETURN_TYPE_SINGLE_LINE(
+    (
+      _MDSPAN_CONSTEXPR_14 /* auto */
+      _make_layout_mapping_impl(layout_stride) noexcept
+    ),
+    (
+      /* return */ layout_stride::template mapping<::std::experimental::extents<_IndexT, _Exts...>>
+        ::__make_mapping(::std::move(__exts), ::std::move(__strides)) /* ; */
+    )
+  )
+
+  template <class OldLayoutMapping> // mostly for deferred instantiation, but maybe we'll use this in the future
+  MDSPAN_INLINE_FUNCTION
+  _MDSPAN_DEDUCE_RETURN_TYPE_SINGLE_LINE(
+    (
+      _MDSPAN_CONSTEXPR_14 /* auto */
+      make_layout_mapping(OldLayoutMapping const&) noexcept
+    ),
+    (
+      /* return */ this->_make_layout_mapping_impl(layout_type{}) /* ; */
+    )
+  )
+};
+
+//==============================================================================
+
+#if _MDSPAN_USE_RETURN_TYPE_DEDUCTION
+// Forking this because the C++11 version will be *completely* unreadable
+template <class ET, class ST, size_t... Exts, class LP, class AP, class... SliceSpecs, size_t... Idxs>
+MDSPAN_INLINE_FUNCTION
+constexpr auto _submdspan_impl(
+  integer_sequence<size_t, Idxs...>,
+  mdspan<ET, std::experimental::extents<ST, Exts...>, LP, AP> const& src,
+  SliceSpecs&&... slices
+) noexcept
+{
+  using _IndexT = ST;
+  auto _handled =
+    _MDSPAN_FOLD_ASSIGN_LEFT(
+      (
+        detail::__assign_op_slice_handler<
+          _IndexT,
+          detail::preserve_layout_analysis<LP>
+        >{
+          __partially_static_sizes<_IndexT, size_t>{},
+          __partially_static_sizes<_IndexT, size_t>{},
+          __partially_static_sizes<_IndexT, size_t>{}
+        }
+      ),
+        /* = ... = */
+      detail::__wrap_slice<
+        Exts, dynamic_extent
+      >(
+        slices, src.extents().template __extent<Idxs>(),
+        src.mapping().stride(Idxs)
+      )
+    );
+
+  size_t offset_size = src.mapping()(_handled.__offsets.template __get_n<Idxs>()...);
+  auto offset_ptr = src.accessor().offset(src.data_handle(), offset_size);
+  auto map = _handled.make_layout_mapping(src.mapping());
+  auto acc_pol = typename AP::offset_policy(src.accessor());
+  return mdspan<
+    ET, remove_const_t<remove_reference_t<decltype(map.extents())>>,
+        typename decltype(_handled)::layout_type, remove_const_t<remove_reference_t<decltype(acc_pol)>>
+  >(
+    std::move(offset_ptr), std::move(map), std::move(acc_pol)
+  );
+}
+#else
+
+template <class ET, class AP, class Src, class Handled, size_t... Idxs>
+auto _submdspan_impl_helper(Src&& src, Handled&& h, std::integer_sequence<size_t, Idxs...>)
+  -> mdspan<
+       ET, typename Handled::__extents_type, typename Handled::layout_type, typename AP::offset_policy
+     >
+{
+  return {
+    src.accessor().offset(src.data_handle(), src.mapping()(h.__offsets.template __get_n<Idxs>()...)),
+    h.make_layout_mapping(src.mapping()),
+    typename AP::offset_policy(src.accessor())
+  };
+}
+
+template <class ET, class ST, size_t... Exts, class LP, class AP, class... SliceSpecs, size_t... Idxs>
+MDSPAN_INLINE_FUNCTION
+_MDSPAN_DEDUCE_RETURN_TYPE_SINGLE_LINE(
+  (
+    constexpr /* auto */ _submdspan_impl(
+      std::integer_sequence<size_t, Idxs...> seq,
+      mdspan<ET, std::experimental::extents<ST, Exts...>, LP, AP> const& src,
+      SliceSpecs&&... slices
+    ) noexcept
+  ),
+  (
+    /* return */ _submdspan_impl_helper<ET, AP>(
+      src,
+      _MDSPAN_FOLD_ASSIGN_LEFT(
+        (
+          detail::__assign_op_slice_handler<
+            size_t,
+            detail::preserve_layout_analysis<LP>
+          >{
+            __partially_static_sizes<ST, size_t>{},
+            __partially_static_sizes<ST, size_t>{},
+            __partially_static_sizes<ST, size_t>{}
+          }
+        ),
+        /* = ... = */
+        detail::__wrap_slice<
+          Exts, dynamic_extent
+        >(
+          slices, src.extents().template __extent<Idxs>(), src.mapping().stride(Idxs)
+        )
+      ),
+      seq
+    ) /* ; */
+  )
+)
+
+#endif
+
+template <class T> struct _is_layout_stride : std::false_type { };
+template<>
+struct _is_layout_stride<
+  layout_stride
+> : std::true_type
+{ };
+
+} // namespace detail
+
+//==============================================================================
+
+MDSPAN_TEMPLATE_REQUIRES(
+  class ET, class EXT, class LP, class AP, class... SliceSpecs,
+  /* requires */ (
+    (
+      _MDSPAN_TRAIT(is_same, LP, layout_left)
+        || _MDSPAN_TRAIT(is_same, LP, layout_right)
+        || detail::_is_layout_stride<LP>::value
+    ) &&
+    _MDSPAN_FOLD_AND((
+      _MDSPAN_TRAIT(is_convertible, SliceSpecs, size_t)
+        || _MDSPAN_TRAIT(is_convertible, SliceSpecs, tuple<size_t, size_t>)
+        || _MDSPAN_TRAIT(is_convertible, SliceSpecs, full_extent_t)
+    ) /* && ... */) &&
+    sizeof...(SliceSpecs) == EXT::rank()
+  )
+)
+MDSPAN_INLINE_FUNCTION
+_MDSPAN_DEDUCE_RETURN_TYPE_SINGLE_LINE(
+  (
+    constexpr submdspan(
+      mdspan<ET, EXT, LP, AP> const& src, SliceSpecs... slices
+    ) noexcept
+  ),
+  (
+    /* return */
+      detail::_submdspan_impl(std::make_index_sequence<sizeof...(SliceSpecs)>{}, src, slices...) /*;*/
+  )
+)
+/* clang-format: on */
+
+} // end namespace experimental
+} // namespace std
diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/trait_backports.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/trait_backports.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..a94e1a1e031d8248965493c95eba798123aad3e0
--- /dev/null
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/trait_backports.hpp
@@ -0,0 +1,160 @@
+/*
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
+//
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
+// the U.S. Government retains certain rights in this software.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the Corporation nor the names of the
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// 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 Christian R. Trott (crtrott@sandia.gov)
+//
+// ************************************************************************
+//@HEADER
+*/
+
+#ifndef MDSPAN_INCLUDE_EXPERIMENTAL_BITS_TRAIT_BACKPORTS_HPP_
+#define MDSPAN_INCLUDE_EXPERIMENTAL_BITS_TRAIT_BACKPORTS_HPP_
+
+#include "macros.hpp"
+#include "config.hpp"
+
+#include <type_traits>
+#include <utility> // integer_sequence
+
+//==============================================================================
+// <editor-fold desc="Variable template trait backports (e.g., is_void_v)"> {{{1
+
+#ifdef _MDSPAN_NEEDS_TRAIT_VARIABLE_TEMPLATE_BACKPORTS
+
+#if _MDSPAN_USE_VARIABLE_TEMPLATES
+namespace std {
+
+#define _MDSPAN_BACKPORT_TRAIT(TRAIT) \
+  template <class... Args> _MDSPAN_INLINE_VARIABLE constexpr auto TRAIT##_v = TRAIT<Args...>::value;
+
+_MDSPAN_BACKPORT_TRAIT(is_assignable)
+_MDSPAN_BACKPORT_TRAIT(is_constructible)
+_MDSPAN_BACKPORT_TRAIT(is_convertible)
+_MDSPAN_BACKPORT_TRAIT(is_default_constructible)
+_MDSPAN_BACKPORT_TRAIT(is_trivially_destructible)
+_MDSPAN_BACKPORT_TRAIT(is_same)
+_MDSPAN_BACKPORT_TRAIT(is_empty)
+_MDSPAN_BACKPORT_TRAIT(is_void)
+
+#undef _MDSPAN_BACKPORT_TRAIT
+
+} // end namespace std
+
+#endif // _MDSPAN_USE_VARIABLE_TEMPLATES
+
+#endif // _MDSPAN_NEEDS_TRAIT_VARIABLE_TEMPLATE_BACKPORTS
+
+// </editor-fold> end Variable template trait backports (e.g., is_void_v) }}}1
+//==============================================================================
+
+//==============================================================================
+// <editor-fold desc="integer sequence (ugh...)"> {{{1
+
+#if !defined(_MDSPAN_USE_INTEGER_SEQUENCE) || !_MDSPAN_USE_INTEGER_SEQUENCE
+
+namespace std {
+
+template <class T, T... Vals>
+struct integer_sequence {
+  static constexpr std::size_t size() noexcept { return sizeof...(Vals); }
+  using value_type = T;
+};
+
+template <std::size_t... Vals>
+using index_sequence = std::integer_sequence<std::size_t, Vals...>;
+
+namespace __detail {
+
+template <class T, T N, T I, class Result>
+struct __make_int_seq_impl;
+
+template <class T, T N, T... Vals>
+struct __make_int_seq_impl<T, N, N, integer_sequence<T, Vals...>>
+{
+  using type = integer_sequence<T, Vals...>;
+};
+
+template <class T, T N, T I, T... Vals>
+struct __make_int_seq_impl<
+  T, N, I, integer_sequence<T, Vals...>
+> : __make_int_seq_impl<T, N, I+1, integer_sequence<T, Vals..., I>>
+{ };
+
+} // end namespace __detail
+
+template <class T, T N>
+using make_integer_sequence = typename __detail::__make_int_seq_impl<T, N, 0, integer_sequence<T>>::type;
+
+template <std::size_t N>
+using make_index_sequence = typename __detail::__make_int_seq_impl<size_t, N, 0, integer_sequence<size_t>>::type;
+
+template <class... T>
+using index_sequence_for = make_index_sequence<sizeof...(T)>;
+
+} // end namespace std
+
+#endif
+
+// </editor-fold> end integer sequence (ugh...) }}}1
+//==============================================================================
+
+//==============================================================================
+// <editor-fold desc="standard trait aliases"> {{{1
+
+#if !defined(_MDSPAN_USE_STANDARD_TRAIT_ALIASES) || !_MDSPAN_USE_STANDARD_TRAIT_ALIASES
+
+namespace std {
+
+#define _MDSPAN_BACKPORT_TRAIT_ALIAS(TRAIT) \
+  template <class... Args> using TRAIT##_t = typename TRAIT<Args...>::type;
+
+_MDSPAN_BACKPORT_TRAIT_ALIAS(remove_cv)
+_MDSPAN_BACKPORT_TRAIT_ALIAS(remove_reference)
+
+template <bool _B, class _T=void>
+using enable_if_t = typename enable_if<_B, _T>::type;
+
+#undef _MDSPAN_BACKPORT_TRAIT_ALIAS
+
+} // end namespace std
+
+#endif
+
+// </editor-fold> end standard trait aliases }}}1
+//==============================================================================
+
+#endif //MDSPAN_INCLUDE_EXPERIMENTAL_BITS_TRAIT_BACKPORTS_HPP_
diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/type_list.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/type_list.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..7de72e65374cb7efda519bd0cfc8e9c99cebad62
--- /dev/null
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/type_list.hpp
@@ -0,0 +1,117 @@
+/*
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
+//
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
+// the U.S. Government retains certain rights in this software.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the Corporation nor the names of the
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// 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 Christian R. Trott (crtrott@sandia.gov)
+//
+// ************************************************************************
+//@HEADER
+*/
+
+#include "macros.hpp"
+
+#include "trait_backports.hpp" // make_index_sequence
+
+namespace std {
+namespace experimental {
+
+//==============================================================================
+
+namespace detail {
+
+template <class... _Ts> struct __type_list { static constexpr auto __size = sizeof...(_Ts); };
+
+// Implementation of type_list at() that's heavily optimized for small typelists
+template <size_t, class> struct __type_at;
+template <size_t, class _Seq, class=make_index_sequence<_Seq::__size>> struct __type_at_large_impl;
+
+template <size_t _I, size_t _Idx, class _T>
+struct __type_at_entry { };
+
+template <class _Result>
+struct __type_at_assign_op_ignore_rest {
+  template <class _T>
+  __type_at_assign_op_ignore_rest<_Result> operator=(_T&&);
+  using type = _Result;
+};
+
+struct __type_at_assign_op_impl {
+  template <size_t _I, size_t _Idx, class _T>
+  __type_at_assign_op_impl operator=(__type_at_entry<_I, _Idx, _T>&&);
+  template <size_t _I, class _T>
+  __type_at_assign_op_ignore_rest<_T> operator=(__type_at_entry<_I, _I, _T>&&);
+};
+
+template <size_t _I, class... _Ts, size_t... _Idxs>
+struct __type_at_large_impl<_I, __type_list<_Ts...>, integer_sequence<size_t, _Idxs...>>
+  : decltype(
+      _MDSPAN_FOLD_ASSIGN_LEFT(__type_at_assign_op_impl{}, /* = ... = */ __type_at_entry<_I, _Idxs, _Ts>{})
+    )
+{ };
+
+template <size_t _I, class... _Ts>
+struct __type_at<_I, __type_list<_Ts...>>
+    : __type_at_large_impl<_I, __type_list<_Ts...>>
+{ };
+
+template <class _T0, class... _Ts>
+struct __type_at<0, __type_list<_T0, _Ts...>> {
+  using type = _T0;
+};
+
+template <class _T0, class _T1, class... _Ts>
+struct __type_at<1, __type_list<_T0, _T1, _Ts...>> {
+  using type = _T1;
+};
+
+template <class _T0, class _T1, class _T2, class... _Ts>
+struct __type_at<2, __type_list<_T0, _T1, _T2, _Ts...>> {
+  using type = _T2;
+};
+
+template <class _T0, class _T1, class _T2, class _T3, class... _Ts>
+struct __type_at<3, __type_list<_T0, _T1, _T2, _T3, _Ts...>> {
+  using type = _T3;
+};
+
+
+} // namespace detail
+
+//==============================================================================
+
+} // end namespace experimental
+} // end namespace std
+
diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p1684_bits/mdarray.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p1684_bits/mdarray.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..b27a25c9fe4c407a1a7c0ce6750c8a2a4310c931
--- /dev/null
+++ b/packages/kokkos/tpls/mdspan/include/experimental/__p1684_bits/mdarray.hpp
@@ -0,0 +1,463 @@
+/*
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
+//
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
+// the U.S. Government retains certain rights in this software.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the Corporation nor the names of the
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// 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 Christian R. Trott (crtrott@sandia.gov)
+//
+// ************************************************************************
+//@HEADER
+*/
+
+
+#pragma once
+
+#include "../mdspan"
+#include <cassert>
+#include <vector>
+
+namespace std {
+namespace experimental {
+
+namespace {
+  template<class Extents>
+  struct size_of_extents;
+
+  template<class IndexType, size_t ... Extents>
+  struct size_of_extents<extents<IndexType, Extents...>> {
+    constexpr static size_t value() {
+      size_t size = 1;
+      for(size_t r=0; r<extents<IndexType, Extents...>::rank(); r++)
+        size *= extents<IndexType, Extents...>::static_extent(r);
+      return size;
+    }
+  };
+}
+
+namespace {
+  template<class C>
+  struct container_is_array : false_type {
+    template<class M>
+    static constexpr C construct(const M& m) { return C(m.required_span_size()); }
+  };
+  template<class T, size_t N>
+  struct container_is_array<array<T,N>> : true_type {
+    template<class M>
+    static constexpr array<T,N> construct(const M&) { return array<T,N>(); }
+  };
+}
+
+template <
+  class ElementType,
+  class Extents,
+  class LayoutPolicy = layout_right,
+  class Container = vector<ElementType>
+>
+class mdarray {
+private:
+  static_assert(detail::__is_extents_v<Extents>, "std::experimental::mdspan's Extents template parameter must be a specialization of std::experimental::extents.");
+
+
+public:
+
+  //--------------------------------------------------------------------------------
+  // Domain and codomain types
+
+  using extents_type = Extents;
+  using layout_type = LayoutPolicy;
+  using container_type = Container;
+  using mapping_type = typename layout_type::template mapping<extents_type>;
+  using element_type = ElementType;
+  using value_type = remove_cv_t<element_type>;
+  using index_type = typename Extents::index_type;
+  using pointer = typename container_type::pointer;
+  using reference = typename container_type::reference;
+  using const_pointer = typename container_type::const_pointer;
+  using const_reference = typename container_type::const_reference;
+
+public:
+
+  //--------------------------------------------------------------------------------
+  // [mdspan.basic.cons], mdspan constructors, assignment, and destructor
+
+#if !(MDSPAN_HAS_CXX_20)
+  MDSPAN_FUNCTION_REQUIRES(
+    (MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr),
+    mdarray, (), ,
+    /* requires */ (extents_type::rank_dynamic()!=0)) {}
+#else
+  MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mdarray() requires(extents_type::rank_dynamic()!=0) = default;
+#endif
+  MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mdarray(const mdarray&) = default;
+  MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mdarray(mdarray&&) = default;
+
+  // Constructors for container types constructible from a size
+  MDSPAN_TEMPLATE_REQUIRES(
+    class... SizeTypes,
+    /* requires */ (
+      _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) &&
+      _MDSPAN_TRAIT(is_constructible, extents_type, SizeTypes...) &&
+      _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type) &&
+      (_MDSPAN_TRAIT(is_constructible, container_type, size_t) ||
+       container_is_array<container_type>::value) &&
+      (extents_type::rank()>0 || extents_type::rank_dynamic()==0)
+    )
+  )
+  MDSPAN_INLINE_FUNCTION
+  explicit constexpr mdarray(SizeTypes... dynamic_extents)
+    : map_(extents_type(dynamic_extents...)), ctr_(container_is_array<container_type>::construct(map_))
+  { }
+
+  MDSPAN_FUNCTION_REQUIRES(
+    (MDSPAN_INLINE_FUNCTION constexpr),
+    mdarray, (const extents_type& exts), ,
+    /* requires */ ((_MDSPAN_TRAIT(is_constructible, container_type, size_t) ||
+                     container_is_array<container_type>::value) &&
+                    _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type))
+  ) : map_(exts), ctr_(container_is_array<container_type>::construct(map_))
+  { }
+
+  MDSPAN_FUNCTION_REQUIRES(
+    (MDSPAN_INLINE_FUNCTION constexpr),
+    mdarray, (const mapping_type& m), ,
+    /* requires */ (_MDSPAN_TRAIT(is_constructible, container_type, size_t) ||
+                    container_is_array<container_type>::value)
+  ) : map_(m), ctr_(container_is_array<container_type>::construct(map_))
+  { }
+
+  // Constructors from container
+  MDSPAN_TEMPLATE_REQUIRES(
+    class... SizeTypes,
+    /* requires */ (
+      _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) &&
+      _MDSPAN_TRAIT(is_constructible, extents_type, SizeTypes...) &&
+      _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type)
+    )
+  )
+  MDSPAN_INLINE_FUNCTION
+  explicit constexpr mdarray(const container_type& ctr, SizeTypes... dynamic_extents)
+    : map_(extents_type(dynamic_extents...)), ctr_(ctr)
+  { assert(ctr.size() >= static_cast<size_t>(map_.required_span_size())); }
+
+
+  MDSPAN_FUNCTION_REQUIRES(
+    (MDSPAN_INLINE_FUNCTION constexpr),
+    mdarray, (const container_type& ctr, const extents_type& exts), ,
+    /* requires */ (_MDSPAN_TRAIT(is_constructible, mapping_type, extents_type))
+  ) : map_(exts), ctr_(ctr)
+  { assert(ctr.size() >= static_cast<size_t>(map_.required_span_size())); }
+
+  constexpr mdarray(const container_type& ctr, const mapping_type& m)
+    : map_(m), ctr_(ctr)
+  { assert(ctr.size() >= static_cast<size_t>(map_.required_span_size())); }
+
+
+  // Constructors from container
+  MDSPAN_TEMPLATE_REQUIRES(
+    class... SizeTypes,
+    /* requires */ (
+      _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) &&
+      _MDSPAN_TRAIT(is_constructible, extents_type, SizeTypes...) &&
+      _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type)
+    )
+  )
+  MDSPAN_INLINE_FUNCTION
+  explicit constexpr mdarray(container_type&& ctr, SizeTypes... dynamic_extents)
+    : map_(extents_type(dynamic_extents...)), ctr_(std::move(ctr))
+  { assert(ctr_.size() >= static_cast<size_t>(map_.required_span_size())); }
+
+
+  MDSPAN_FUNCTION_REQUIRES(
+    (MDSPAN_INLINE_FUNCTION constexpr),
+    mdarray, (container_type&& ctr, const extents_type& exts), ,
+    /* requires */ (_MDSPAN_TRAIT(is_constructible, mapping_type, extents_type))
+  ) : map_(exts), ctr_(std::move(ctr))
+  { assert(ctr_.size() >= static_cast<size_t>(map_.required_span_size())); }
+
+  constexpr mdarray(container_type&& ctr, const mapping_type& m)
+    : map_(m), ctr_(std::move(ctr))
+  { assert(ctr_.size() >= static_cast<size_t>(map_.required_span_size())); }
+
+
+
+  MDSPAN_TEMPLATE_REQUIRES(
+    class OtherElementType, class OtherExtents, class OtherLayoutPolicy, class OtherContainer,
+    /* requires */ (
+      _MDSPAN_TRAIT(is_constructible, mapping_type, typename OtherLayoutPolicy::template mapping<OtherExtents>) &&
+      _MDSPAN_TRAIT(is_constructible, container_type, OtherContainer)
+    )
+  )
+  MDSPAN_INLINE_FUNCTION
+  constexpr mdarray(const mdarray<OtherElementType, OtherExtents, OtherLayoutPolicy, OtherContainer>& other)
+    : map_(other.mapping()), ctr_(other.container())
+  {
+    static_assert(is_constructible<extents_type, OtherExtents>::value, "");
+  }
+
+  // Constructors for container types constructible from a size and allocator
+  MDSPAN_TEMPLATE_REQUIRES(
+    class Alloc,
+    /* requires */ (_MDSPAN_TRAIT(is_constructible, container_type, size_t, Alloc) &&
+                    _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type))
+  )
+  MDSPAN_INLINE_FUNCTION
+  constexpr mdarray(const extents_type& exts, const Alloc& a)
+    : map_(exts), ctr_(map_.required_span_size(), a)
+  { }
+
+  MDSPAN_TEMPLATE_REQUIRES(
+    class Alloc,
+    /* requires */ (_MDSPAN_TRAIT(is_constructible, container_type, size_t, Alloc))
+  )
+  MDSPAN_INLINE_FUNCTION
+  constexpr mdarray(const mapping_type& map, const Alloc& a)
+    : map_(map), ctr_(map_.required_span_size(), a)
+  { }
+
+  // Constructors for container types constructible from a container and allocator
+  MDSPAN_TEMPLATE_REQUIRES(
+    class Alloc,
+    /* requires */ (_MDSPAN_TRAIT(is_constructible, container_type, container_type, Alloc) &&
+                    _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type))
+  )
+  MDSPAN_INLINE_FUNCTION
+  constexpr mdarray(const container_type& ctr, const extents_type& exts, const Alloc& a)
+    : map_(exts), ctr_(ctr, a)
+  { assert(ctr_.size() >= static_cast<size_t>(map_.required_span_size())); }
+
+  MDSPAN_TEMPLATE_REQUIRES(
+    class Alloc,
+    /* requires */ (_MDSPAN_TRAIT(is_constructible, container_type, size_t, Alloc))
+  )
+  MDSPAN_INLINE_FUNCTION
+  constexpr mdarray(const container_type& ctr, const mapping_type& map, const Alloc& a)
+    : map_(map), ctr_(ctr, a)
+  { assert(ctr_.size() >= static_cast<size_t>(map_.required_span_size())); }
+
+  MDSPAN_TEMPLATE_REQUIRES(
+    class Alloc,
+    /* requires */ (_MDSPAN_TRAIT(is_constructible, container_type, container_type, Alloc) &&
+                    _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type))
+  )
+  MDSPAN_INLINE_FUNCTION
+  constexpr mdarray(container_type&& ctr, const extents_type& exts, const Alloc& a)
+    : map_(exts), ctr_(std::move(ctr), a)
+  { assert(ctr_.size() >= static_cast<size_t>(map_.required_span_size())); }
+
+  MDSPAN_TEMPLATE_REQUIRES(
+    class Alloc,
+    /* requires */ (_MDSPAN_TRAIT(is_constructible, container_type, size_t, Alloc))
+  )
+  MDSPAN_INLINE_FUNCTION
+  constexpr mdarray(container_type&& ctr, const mapping_type& map, const Alloc& a)
+    : map_(map), ctr_(std::move(ctr), a)
+  { assert(ctr_.size() >= map_.required_span_size()); }
+
+  MDSPAN_TEMPLATE_REQUIRES(
+    class OtherElementType, class OtherExtents, class OtherLayoutPolicy, class OtherContainer, class Alloc,
+    /* requires */ (
+      _MDSPAN_TRAIT(is_constructible, mapping_type, typename OtherLayoutPolicy::template mapping<OtherExtents>) &&
+      _MDSPAN_TRAIT(is_constructible, container_type, OtherContainer, Alloc)
+    )
+  )
+  MDSPAN_INLINE_FUNCTION
+  constexpr mdarray(const mdarray<OtherElementType, OtherExtents, OtherLayoutPolicy, OtherContainer>& other, const Alloc& a)
+    : map_(other.mapping()), ctr_(other.container(), a)
+  {
+    static_assert(is_constructible<extents_type, OtherExtents>::value, "");
+  }
+
+  MDSPAN_INLINE_FUNCTION_DEFAULTED
+  ~mdarray() = default;
+
+  //--------------------------------------------------------------------------------
+  // [mdspan.basic.mapping], mdspan mapping domain multidimensional index to access codomain element
+
+  #if MDSPAN_USE_BRACKET_OPERATOR
+  MDSPAN_TEMPLATE_REQUIRES(
+    class... SizeTypes,
+    /* requires */ (
+      _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) &&
+      extents_type::rank() == sizeof...(SizeTypes)
+    )
+  )
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr const_reference operator[](SizeTypes... indices) const noexcept
+  {
+    return ctr_[map_(index_type(indices)...)];
+  }
+
+  MDSPAN_TEMPLATE_REQUIRES(
+    class... SizeTypes,
+    /* requires */ (
+      _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) &&
+      extents_type::rank() == sizeof...(SizeTypes)
+    )
+  )
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr reference operator[](SizeTypes... indices) noexcept
+  {
+    return ctr_[map_(index_type(indices)...)];
+  }
+  #endif
+
+#if 0
+  MDSPAN_TEMPLATE_REQUIRES(
+    class SizeType, size_t N,
+    /* requires */ (
+      _MDSPAN_TRAIT(is_convertible, SizeType, index_type) &&
+      N == extents_type::rank()
+    )
+  )
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr const_reference operator[](const array<SizeType, N>& indices) const noexcept
+  {
+    return __impl::template __callop<reference>(*this, indices);
+  }
+
+  MDSPAN_TEMPLATE_REQUIRES(
+    class SizeType, size_t N,
+    /* requires */ (
+      _MDSPAN_TRAIT(is_convertible, SizeType, index_type) &&
+      N == extents_type::rank()
+    )
+  )
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr reference operator[](const array<SizeType, N>& indices) noexcept
+  {
+    return __impl::template __callop<reference>(*this, indices);
+  }
+#endif
+
+
+  #if MDSPAN_USE_PAREN_OPERATOR
+  MDSPAN_TEMPLATE_REQUIRES(
+    class... SizeTypes,
+    /* requires */ (
+      _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) &&
+      extents_type::rank() == sizeof...(SizeTypes)
+    )
+  )
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr const_reference operator()(SizeTypes... indices) const noexcept
+  {
+    return ctr_[map_(index_type(indices)...)];
+  }
+  MDSPAN_TEMPLATE_REQUIRES(
+    class... SizeTypes,
+    /* requires */ (
+      _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) &&
+      extents_type::rank() == sizeof...(SizeTypes)
+    )
+  )
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr reference operator()(SizeTypes... indices) noexcept
+  {
+    return ctr_[map_(index_type(indices)...)];
+  }
+
+#if 0
+  MDSPAN_TEMPLATE_REQUIRES(
+    class SizeType, size_t N,
+    /* requires */ (
+      _MDSPAN_TRAIT(is_convertible, SizeType, index_type) &&
+      N == extents_type::rank()
+    )
+  )
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr const_reference operator()(const array<SizeType, N>& indices) const noexcept
+  {
+    return __impl::template __callop<reference>(*this, indices);
+  }
+
+  MDSPAN_TEMPLATE_REQUIRES(
+    class SizeType, size_t N,
+    /* requires */ (
+      _MDSPAN_TRAIT(is_convertible, SizeType, index_type) &&
+      N == extents_type::rank()
+    )
+  )
+  MDSPAN_FORCE_INLINE_FUNCTION
+  constexpr reference operator()(const array<SizeType, N>& indices) noexcept
+  {
+    return __impl::template __callop<reference>(*this, indices);
+  }
+#endif
+  #endif
+
+  MDSPAN_INLINE_FUNCTION constexpr pointer data() noexcept { return ctr_.data(); };
+  MDSPAN_INLINE_FUNCTION constexpr const_pointer data() const noexcept { return ctr_.data(); };
+  MDSPAN_INLINE_FUNCTION constexpr container_type& container() noexcept { return ctr_; };
+  MDSPAN_INLINE_FUNCTION constexpr const container_type& container() const noexcept { return ctr_; };
+
+  //--------------------------------------------------------------------------------
+  // [mdspan.basic.domobs], mdspan observers of the domain multidimensional index space
+
+  MDSPAN_INLINE_FUNCTION static constexpr size_t rank() noexcept { return extents_type::rank(); }
+  MDSPAN_INLINE_FUNCTION static constexpr size_t rank_dynamic() noexcept { return extents_type::rank_dynamic(); }
+  MDSPAN_INLINE_FUNCTION static constexpr index_type static_extent(size_t r) noexcept { return extents_type::static_extent(r); }
+
+  MDSPAN_INLINE_FUNCTION constexpr extents_type extents() const noexcept { return map_.extents(); };
+  MDSPAN_INLINE_FUNCTION constexpr index_type extent(size_t r) const noexcept { return map_.extents().extent(r); };
+  MDSPAN_INLINE_FUNCTION constexpr index_type size() const noexcept {
+//    return __impl::__size(*this);
+    return ctr_.size();
+  };
+
+
+  //--------------------------------------------------------------------------------
+  // [mdspan.basic.obs], mdspan observers of the mapping
+
+  MDSPAN_INLINE_FUNCTION static constexpr bool is_always_unique() noexcept { return mapping_type::is_always_unique(); };
+  MDSPAN_INLINE_FUNCTION static constexpr bool is_always_exhaustive() noexcept { return mapping_type::is_always_exhaustive(); };
+  MDSPAN_INLINE_FUNCTION static constexpr bool is_always_strided() noexcept { return mapping_type::is_always_strided(); };
+
+  MDSPAN_INLINE_FUNCTION constexpr mapping_type mapping() const noexcept { return map_; };
+  MDSPAN_INLINE_FUNCTION constexpr bool is_unique() const noexcept { return map_.is_unique(); };
+  MDSPAN_INLINE_FUNCTION constexpr bool is_exhaustive() const noexcept { return map_.is_exhaustive(); };
+  MDSPAN_INLINE_FUNCTION constexpr bool is_strided() const noexcept { return map_.is_strided(); };
+  MDSPAN_INLINE_FUNCTION constexpr index_type stride(size_t r) const { return map_.stride(r); };
+
+private:
+  mapping_type map_;
+  container_type ctr_;
+
+  template <class, class, class, class>
+  friend class mdarray;
+};
+
+
+} // end namespace experimental
+} // end namespace std
diff --git a/packages/kokkos/core/src/Kokkos_TaskPolicy.hpp b/packages/kokkos/tpls/mdspan/include/experimental/mdarray
similarity index 76%
rename from packages/kokkos/core/src/Kokkos_TaskPolicy.hpp
rename to packages/kokkos/tpls/mdspan/include/experimental/mdarray
index 9751fab460d4495b1683a94fc0e9d7f879c9a412..fa710a59b66616665d94dd11bb7e83ce7bddfe0a 100644
--- a/packages/kokkos/core/src/Kokkos_TaskPolicy.hpp
+++ b/packages/kokkos/tpls/mdspan/include/experimental/mdarray
@@ -2,11 +2,10 @@
 //@HEADER
 // ************************************************************************
 //
-//                        Kokkos v. 3.0
-//       Copyright (2020) National Technology & Engineering
-//               Solutions of Sandia, LLC (NTESS).
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
 //
-// Under the terms of Contract DE-NA0003525 with NTESS,
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
 // the U.S. Government retains certain rights in this software.
 //
 // Redistribution and use in source and binary forms, with or without
@@ -24,10 +23,10 @@
 // contributors may be used to endorse or promote products derived from
 // this software without specific prior written permission.
 //
-// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -42,10 +41,8 @@
 //@HEADER
 */
 
-// For backward compatibility:
-#include <Kokkos_Macros.hpp>
+#pragma once
 
-KOKKOS_IMPL_WARNING(
-    "This file is deprecated. Use <Kokkos_TaskScheduler.hpp> instead.")
+#include "mdspan"
+#include "__p1684_bits/mdarray.hpp"
 
-#include <Kokkos_TaskScheduler.hpp>
diff --git a/packages/kokkos/tpls/mdspan/include/experimental/mdspan b/packages/kokkos/tpls/mdspan/include/experimental/mdspan
new file mode 100644
index 0000000000000000000000000000000000000000..ca6f6b8686cd19fa0142aa158cb55b204aef7760
--- /dev/null
+++ b/packages/kokkos/tpls/mdspan/include/experimental/mdspan
@@ -0,0 +1,56 @@
+/*
+//@HEADER
+// ************************************************************************
+//
+//                        Kokkos v. 2.0
+//              Copyright (2019) Sandia Corporation
+//
+// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
+// the U.S. Government retains certain rights in this software.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the Corporation nor the names of the
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// 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 Christian R. Trott (crtrott@sandia.gov)
+//
+// ************************************************************************
+//@HEADER
+*/
+
+#pragma once
+
+#include "__p0009_bits/default_accessor.hpp"
+#include "__p0009_bits/full_extent_t.hpp"
+#include "__p0009_bits/mdspan.hpp"
+#include "__p0009_bits/dynamic_extent.hpp"
+#include "__p0009_bits/extents.hpp"
+#include "__p0009_bits/layout_stride.hpp"
+#include "__p0009_bits/layout_left.hpp"
+#include "__p0009_bits/layout_right.hpp"
+#include "__p0009_bits/macros.hpp"
+#include "__p0009_bits/static_array.hpp"
+#include "__p0009_bits/submdspan.hpp"
diff --git a/src/utils/PugsUtils.cpp b/src/utils/PugsUtils.cpp
index 3677d5c8fded780fcb2a468809443e0e26131ccf..60380902556f88f774b698c4f7f196ea5192930e 100644
--- a/src/utils/PugsUtils.cpp
+++ b/src/utils/PugsUtils.cpp
@@ -140,11 +140,10 @@ initialize(int& argc, char* argv[])
 
   setDefaultOMPEnvironment();
   {
-    Kokkos::InitArguments args;
-    args.num_threads      = nb_threads;
-    args.num_numa         = -1;
-    args.device_id        = -1;
-    args.disable_warnings = true;
+    Kokkos::InitializationSettings args;
+    args.set_num_threads(nb_threads);
+    args.set_device_id(-1);
+    args.set_disable_warnings(true);
 
     Kokkos::initialize(args);
   }
diff --git a/src/utils/PugsUtils.hpp b/src/utils/PugsUtils.hpp
index 76d8ffd3feafd53d6fa2d5326fa18e8e65d95ca6..cf4c680099d8d115a090a9485a23afbb424ae25a 100644
--- a/src/utils/PugsUtils.hpp
+++ b/src/utils/PugsUtils.hpp
@@ -8,16 +8,16 @@
 
 template <typename FunctionType>
 PUGS_FORCEINLINE void
-parallel_for(size_t size, const FunctionType& lambda, const std::string& label = "")
+parallel_for(size_t size, const FunctionType& lambda)
 {
-  Kokkos::parallel_for(size, lambda, label);
+  Kokkos::parallel_for(size, lambda);
 }
 
 template <typename FunctorType, typename ReturnType>
 PUGS_FORCEINLINE void
-parallel_reduce(size_t size, const FunctorType& functor, ReturnType& value, const std::string& label = "")
+parallel_reduce(size_t size, const FunctorType& functor, ReturnType& value)
 {
-  Kokkos::parallel_reduce(label, size, functor, value);
+  Kokkos::parallel_reduce(size, functor, value);
 }
 
 void setDefaultOMPEnvironment();
diff --git a/tests/mpi_test_main.cpp b/tests/mpi_test_main.cpp
index eeaf00129829c33fd5e54cdcb44e09bb2419e91f..1692bd7aca6edafd683fe7351c104cea8283a81c 100644
--- a/tests/mpi_test_main.cpp
+++ b/tests/mpi_test_main.cpp
@@ -29,11 +29,10 @@ main(int argc, char* argv[])
   const int nb_threads     = std::max(nb_max_threads / parallel::Messenger::getInstance().size(), 1ul);
 
   {
-    Kokkos::InitArguments args;
-    args.num_threads      = nb_threads;
-    args.num_numa         = -1;
-    args.device_id        = -1;
-    args.disable_warnings = true;
+    Kokkos::InitializationSettings args;
+    args.set_num_threads(nb_threads);
+    args.set_device_id(-1);
+    args.set_disable_warnings(true);
 
     Kokkos::initialize(args);
   }
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index 0dcf46cfe0e22d9bce9572b27b072a4a58c16b98..0e334f92c8a73ca526e905c1c5d6e82236f2d1ea 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -24,11 +24,10 @@ main(int argc, char* argv[])
   const int nb_threads = std::max(std::thread::hardware_concurrency(), 1u);
 
   {
-    Kokkos::InitArguments args;
-    args.num_threads      = nb_threads;
-    args.num_numa         = -1;
-    args.device_id        = -1;
-    args.disable_warnings = true;
+    Kokkos::InitializationSettings args;
+    args.set_num_threads(nb_threads);
+    args.set_device_id(-1);
+    args.set_disable_warnings(true);
 
     Kokkos::initialize(args);
   }