9 #include <Compadre_Config.h> 
   17 #ifdef COMPADRE_USE_MPI 
   21 #include <Kokkos_Timer.hpp> 
   22 #include <Kokkos_Core.hpp> 
   24 using namespace Compadre;
 
   29 int main (
int argc, 
char* args[]) {
 
   31 #ifdef COMPADRE_USE_MPI 
   33 MPI_Init(&argc, &args);
 
   40 bool all_passed = 
true;
 
   48         int arg3toi = atoi(args[2]);
 
   57         int arg2toi = atoi(args[1]);
 
   66     Kokkos::Profiling::pushRegion(
"Setup Data");
 
   69     Kokkos::View<int**, Kokkos::DefaultExecutionSpace> data_device(
"data", num_flags, num_cols);
 
   70     Kokkos::View<int**>::HostMirror data = Kokkos::create_mirror_view(data_device);
 
   73     Kokkos::View<int*, Kokkos::DefaultExecutionSpace> flags_device(
"flags", num_flags);
 
   74     Kokkos::View<int*>::HostMirror flags = Kokkos::create_mirror_view(flags_device);
 
   78     Kokkos::Profiling::popRegion();
 
   79     Kokkos::Profiling::pushRegion(
"Filter And Extract Data");
 
   83     for (
int i=0; i<num_flags; i++) {
 
   84         for (
int j=0; j<num_cols; j++) {
 
   93     Kokkos::deep_copy(data_device, data);
 
   96     int num_filtered_flags = 0; 
 
   97     for (
int i=0; i<num_flags; i++) {
 
  100             num_filtered_flags++;
 
  106     Kokkos::deep_copy(flags_device, flags);
 
  109     auto filtered_flags = filterViewByID<Kokkos::HostSpace>(flags_device, 1);
 
  110     auto extracted_data = Extract::extractViewByIndex<Kokkos::HostSpace>(data_device, filtered_flags);
 
  114     Kokkos::Profiling::popRegion();
 
  115     Kokkos::Profiling::pushRegion(
"Check Filtered And Extracted Data");
 
  119     if (filtered_flags.extent(0) != (size_t)num_filtered_flags) {
 
  121         std::cout << 
"Failed - number of filtered flags not matched!" << filtered_flags.extent(0) << 
" " << num_filtered_flags << std::endl;
 
  123     for (
size_t i=0; i<filtered_flags.extent(0); i++) {
 
  124         if (filtered_flags(i) % 2 != 0) {
 
  126             std::cout << 
"Failed - incorrect filtered flags " << filtered_flags(i) << std::endl;
 
  130     for (
size_t i=0; i<extracted_data.extent(0); i++) {
 
  131         for (
size_t j=0; j<extracted_data.extent(1); j++) {
 
  132             if (extracted_data(i, j) != 1) {
 
  134                 std::cout << 
"Failed - incorrect values in extracted view at index " << i << 
" " << j << 
" " << extracted_data(i, j) << std::endl;
 
  141     Kokkos::Profiling::popRegion();
 
  149 #ifdef COMPADRE_USE_MPI 
  155     fprintf(stdout, 
"Passed test \n");
 
  158     fprintf(stdout, 
"Failed test \n");
 
Class handling Kokkos command line arguments and returning parameters. 
 
int main(int argc, char *args[])
[Parse Command Line Arguments]