Commit 660bfea5 authored by Jannick Wolters's avatar Jannick Wolters
Browse files

added blaze as backend. include typedef.h for readability

parent 81a5bd81
......@@ -10,3 +10,6 @@
[submodule "code/ext/Catch2"]
path = code/ext/Catch2
url = git://github.com/catchorg/Catch2.git
[submodule "code/ext/blaze"]
path = code/ext/blaze
url = https://bitbucket.org/blaze-lib/blaze.git
......@@ -25,6 +25,84 @@ include_directories( ${MPI_INCLUDE_PATH} )
find_package( LAPACK REQUIRED )
include_directories( ${LAPACK_INCLUDE_DIR} )
set( '-DBLAZE_USE_SHARED_MEMORY_PARALLELIZATION=OFF' )
set( '-DBLAZE_USE_VECTORIZATION=ON' )
set( '-DBLAZE_BLAS_MODE=ON' )
set( '-DBLAZE_DEFAULT_STORAGE_ORDER=blaze::rowMajor' )
message( "Automatic Cache Size Configuration" )
set(flag 1)
if (WIN32)
execute_process(COMMAND wmic cpu get L3CacheSize
OUTPUT_VARIABLE tmp
RESULT_VARIABLE flag
ERROR_QUIET)
if (flag)
execute_process(COMMAND wmic cpu get L2CacheSize
OUTPUT_VARIABLE tmp
RESULT_VARIABLE flag
ERROR_QUIET)
endif (flag)
if (flag)
execute_process(COMMAND wmic cpu get L1CacheSize
OUTPUT_VARIABLE tmp
RESULT_VARIABLE flag
ERROR_QUIET)
endif (flag)
endif (WIN32)
if (UNIX)
execute_process(COMMAND cat /sys/devices/system/cpu/cpu0/cache/index3/size
OUTPUT_VARIABLE tmp
RESULT_VARIABLE flag
ERROR_QUIET)
if (flag)
execute_process(COMMAND cat /sys/devices/system/cpu/cpu0/cache/index2/size
OUTPUT_VARIABLE tmp
RESULT_VARIABLE flag
ERROR_QUIET)
endif (flag)
if (flag)
execute_process(COMMAND cat /sys/devices/system/cpu/cpu0/cache/index1/size
OUTPUT_VARIABLE tmp
RESULT_VARIABLE flag
ERROR_QUIET)
endif (flag)
endif (UNIX)
if (APPLE)
execute_process(COMMAND sysctl -n hw.l3cachesize
OUTPUT_VARIABLE tmp
RESULT_VARIABLE flag
ERROR_QUIET)
if (flag)
execute_process(COMMAND sysctl -n hw.l2cachesize
OUTPUT_VARIABLE tmp
RESULT_VARIABLE flag
ERROR_QUIET)
endif (flag)
if (flag)
execute_process(COMMAND sysctl -n hw.l1icachesize
OUTPUT_VARIABLE tmp
RESULT_VARIABLE flag
ERROR_QUIET)
endif (flag)
if (flag EQUAL 0)
math(EXPR tmp ${tmp}/1024) # If successful convert to kibibytes to comply with rest
endif (flag EQUAL 0)
endif (APPLE)
if (flag)
message(WARNING "Cache size not found automatically. Using default value as cache size.")
set(tmp "3072")
endif (flag)
string( REGEX MATCH "([0-9][0-9]+)" tmp ${tmp} )
math( EXPR BLAZE_CACHE_SIZE ${tmp}*1024 )
set( '-DBLAZE_CACHE_SIZE="${BLAZE_CACHE_SIZE}UL"' )
message( "Configuring Cache Size: ${BLAZE_CACHE_SIZE}" )
include_directories( ${CMAKE_SOURCE_DIR}/ext/blaze )
find_package( VTK REQUIRED COMPONENTS vtkIOGeometry vtkFiltersCore )
include_directories( ${CMAKE_SOURCE_DIR}/ext/cpptoml/include )
......
#ifndef TYPEDEFS_H
#define TYPEDEFS_H
#include <vector>
#include <blaze/math/DynamicMatrix.h>
#include <blaze/math/DynamicVector.h>
typedef std::vector<std::vector<double>> Matrix;
typedef std::vector<double> Vector;
typedef blaze::DynamicMatrix<double> Matrix;
typedef std::vector<blaze::DynamicVector<double>> VecVec;
typedef std::vector<blaze::DynamicVector<unsigned>> VecVecU;
typedef blaze::DynamicVector<double> Vector;
typedef blaze::DynamicVector<unsigned> VectorU;
#endif // TYPEDEFS_H
#include <mpi.h>
#include "io.h"
#include "quadrature.h"
#include <mpi.h>
#include "typedef.h"
int main( int argc, char** argv ) {
......@@ -9,7 +11,17 @@ int main( int argc, char** argv ) {
Settings* settings = ReadInputFile( inputFile );
InitLogger( settings->GetLogDir(), spdlog::level::info, spdlog::level::info );
PrintLogHeader( settings->GetInputFile() );
// playground and demo
Quadrature* Q = Quadrature::CreateQuadrature( "montecarlo", 10 );
Q->PrintWeights();
auto log = spdlog::get( "event" );
log->info( "this is a print function to terminal and a logfile simultaneously" );
log->error( "also has {0} different log types", 4 );
Vector foo( 10, 1.0 ); // blaze vector (see typedef.h)
std::cout << foo << std::endl; // is printable
return EXIT_SUCCESS;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment