Commit 6f736e10 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Merge branch 'JK/execution' into 'develop'

Refactoring for execution policies

Closes #49, #46, and #11

See merge request !42
parents ccd42739 9723c16b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ stages:
    WITH_OPENMP: "no"
    WITH_CUDA: "no"
    WITH_CUDA_ARCH: "auto"
    WITH_MIC: "no"
    WITH_MPI: "no"
    # configurations
    WITH_TESTS: "no"
@@ -46,6 +45,8 @@ stages:
          fi
        - export CTEST_OUTPUT_ON_FAILURE=1
        - export CTEST_PARALLEL_LEVEL=4
        # enforce (more or less) warning-free builds
        - export CXXFLAGS="-Werror -Wno-error=deprecated -Wno-error=deprecated-declarations -Wno-error=uninitialized -Wno-error=vla"
        - mkdir -p "./builddir/$CI_JOB_NAME"
        - pushd "./builddir/$CI_JOB_NAME"
        - cmake ../..
@@ -56,7 +57,6 @@ stages:
                -DWITH_MPI=${WITH_MPI}
                -DWITH_CUDA=${WITH_CUDA}
                -DWITH_CUDA_ARCH=${WITH_CUDA_ARCH}
                -DWITH_MIC=${WITH_MIC}
                -DWITH_TESTS=${WITH_TESTS}
                -DWITH_DOC=${WITH_DOC}
                -DWITH_COVERAGE=${WITH_COVERAGE}
+1 −19
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@ set( tnlVersion "0.1" )

# declare all custom build options
option(OFFLINE_BUILD "Offline build (i.e. without downloading libraries such as pybind11)" OFF)
option(WITH_MIC "Build with MIC support" OFF)
option(WITH_CUDA "Build with CUDA support" ON)
set(WITH_CUDA_ARCH "auto" CACHE STRING "Build for these CUDA architectures")
option(WITH_OPENMP "Build with OpenMP support" ON)
@@ -83,7 +82,7 @@ set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( CMAKE_CXX_EXTENSIONS OFF )

# set Debug/Release options
set( CMAKE_CXX_FLAGS "-pthread -Wall -Wno-unused-local-typedefs -Wno-unused-variable -Wno-unknown-pragmas" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wall -Wno-unused-local-typedefs -Wno-unused-variable -Wno-unknown-pragmas" )
set( CMAKE_CXX_FLAGS_DEBUG "-g" )
set( CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -mtune=native -DNDEBUG" )
# pass -rdynamic only in Debug mode
@@ -120,22 +119,6 @@ if( NOT DEFINED ENV{CI_JOB_NAME} )
   endif()
endif()

if( CMAKE_CXX_COMPILER_ID STREQUAL "Intel" )
   set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_ICPC -wd2568 -wd2571 -wd2570")
   #####
   #  Check for MIC
   #
   if( ${WITH_MIC} )
      message( "Enabled MIC support." )
      set( MIC_CXX_FLAGS "-DHAVE_MIC")
      # build all tests with MIC support
      set( CXX_TESTS_FLAGS ${CXX_TESTS_FLAGS} -DHAVE_MIC )
      set( WITH_CUDA OFF CACHE BOOL "Build with CUDA support" )
   else()
      set( MIC_CXX_FLAGS "")
   endif()
endif()

# force colorized output in continuous integration
if( DEFINED ENV{CI_JOB_NAME} OR ${CMAKE_GENERATOR} STREQUAL "Ninja" )
   message(STATUS "Continuous integration or Ninja detected -- forcing compilers to produce colorized output.")
@@ -355,7 +338,6 @@ INCLUDE( CPack )
# Print custom build options
message( "-- Build options:" )
message( "   OFFLINE_BUILD = ${OFFLINE_BUILD}" )
message( "   WITH_MIC = ${WITH_MIC}" )
message( "   WITH_CUDA = ${WITH_CUDA}" )
message( "   WITH_CUDA_ARCH = ${WITH_CUDA_ARCH}" )
message( "   WITH_OPENMP = ${WITH_OPENMP}" )
+2 −2
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ int main()
    */
   File file;
   file.open( "file-example-cuda-test-file.tnl", std::ios_base::out | std::ios_base::trunc );
   file.save< double, double, Devices::Host >( doubleArray, size );
   file.save< double, double, Allocators::Host< double > >( doubleArray, size );
   file.close();

   /***
@@ -31,7 +31,7 @@ int main()
    * Read array from the file to device
    */
   file.open( "file-example-cuda-test-file.tnl", std::ios_base::in );
   file.load< double, double, Devices::Cuda >( deviceArray, size );
   file.load< double, double, Allocators::Cuda< double > >( deviceArray, size );
   file.close();

   /***
+3 −3
Original line number Diff line number Diff line
@@ -18,21 +18,21 @@ int main()
    */
   File file;
   file.open( "test-file.tnl", std::ios_base::out | std::ios_base::trunc );
   file.save< double, float, Devices::Host >( doubleArray, size );
   file.save< double, float >( doubleArray, size );
   file.close();

   /***
    * Load the array of floats from the file.
    */
   file.open( "test-file.tnl", std::ios_base::in );
   file.load< float, float, Devices::Host >( floatArray, size );
   file.load< float, float >( floatArray, size );
   file.close();

   /***
    * Load the array of floats from the file and convert them to integers.
    */
   file.open( "test-file.tnl", std::ios_base::in );
   file.load< int, float, Devices::Host >( intArray, size );
   file.load< int, float >( intArray, size );
   file.close();

   /***
+7 −20
Original line number Diff line number Diff line
#include <iostream>
#include <TNL/param-types.h>
#include <TNL/TypeInfo.h>
#include <TNL/Object.h>
#include <TNL/Devices/Host.h>
#include <TNL/Devices/Cuda.h>
@@ -13,24 +13,12 @@ class MyArray : public Object
{
   public:

      using HostType = MyArray< Value, Devices::Host >;
      
      static String getType()
      {
         return "MyArray< " + TNL::getType< Value >() + ", " + TNL::getType< Device >() + " >";
      }

      String getTypeVirtual() const
      {
         return getType();
      }

      static String getSerializationType()
      {
         return HostType::getType();
         return "MyArray< " + TNL::getType< Value >() + ", " + getType< Devices::Host >() + " >";
      }

      String getSerializationTypeVirtual() const
      virtual String getSerializationTypeVirtual() const override
      {
         return getSerializationType();
      }
@@ -47,11 +35,11 @@ int main()
   Object* cudaArrayPtr = &cudaArray;

   // Object types
   cout << "HostArray type is                  " << HostArray::getType() << endl;
   cout << "hostArrayPtr type is               " << hostArrayPtr->getTypeVirtual() << endl;
   cout << "HostArray type is                  " << getType< HostArray >() << endl;
   cout << "hostArrayPtr type is               " << getType( *hostArrayPtr ) << endl;

   cout << "CudaArray type is                  " << CudaArray::getType() << endl;
   cout << "cudaArrayPtr type is               " << cudaArrayPtr->getTypeVirtual() << endl;
   cout << "CudaArray type is                  " << getType< CudaArray >() << endl;
   cout << "cudaArrayPtr type is               " << getType( *cudaArrayPtr ) << endl;

   // Object serialization types
   cout << "HostArray serialization type is    " << HostArray::getSerializationType() << endl;
@@ -60,4 +48,3 @@ int main()
   cout << "CudaArray serialization type is    " << CudaArray::getSerializationType() << endl;
   cout << "cudaArrayPtr serialization type is " << cudaArrayPtr->getSerializationTypeVirtual() << endl;
}
Loading