Commit 1fffc621 authored by BRAMAS Berenger's avatar BRAMAS Berenger

Copy from old repository

parents
# Use an official Python runtime as a parent image
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get install -y wget
RUN apt-get install -y g++-7
RUN apt-get install -y cmake
RUN apt-get install -y git
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: true
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 0
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
PenaltyBreakBeforeFirstCallParameter: 140
PenaltyBreakComment: 140
PenaltyBreakFirstLessLess: 140
PenaltyBreakString: 140
PenaltyExcessCharacter: 10000
PointerAlignment: Left
ReflowComments: true
SortIncludes: false
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Never
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: true
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp17
TabWidth: 4
UseTab: Never
image: berenger/spetabaruci
spetabaru:
script:
- mkdir build
- cd build
- VERBOSE=1 CXX=g++-7 cmake ..
- make
- make test
spetabaru-debug:
script:
- mkdir build
- cd build
- VERBOSE=1 CXX=g++-7 cmake -DCMAKE_BUILD_TYPE=DEBUG ..
- make
- make test
###########################################################################
# SPETABARU - Berenger Bramas MPCDF - 2017
# Under MIT Licence, please you must read the LICENCE file.
###########################################################################
cmake_minimum_required (VERSION 2.8.3 FATAL_ERROR)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
#===========================================================================
# Project Declaration
#===========================================================================
project(SPETABARU CXX)
# check if compiling into source directories
string(COMPARE EQUAL "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" insource)
if(insource)
message(FATAL_ERROR "${PROJECT_NAME} requires an out of source build. Goto ./Build and tapes cmake ../")
endif(insource)
# Adds the CMAKE_DEPENDENT_OPTION command
INCLUDE(CMakeDependentOption)
# set(CMAKE_CXX_STANDARD 17)
# set(CMAKE_CXX_STANDARD_REQUIRED ON)
# set(CMAKE_CXX_EXTENSIONS OFF)
# need pthread
set(SPETABARU_LIBRARIES pthread)
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
# the RPATH to be used when installing
SET(CMAKE_INSTALL_RPATH "/home/bbramas/Downloads/gcc7/lib64/")
# don't add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# Release by default
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo" FORCE)
endif()
if($ENV{VERBOSE})
MESSAGE(STATUS "Main -- CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}")
endif()
# Test if SPETABARU is included as a subproject
if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
set(SPETABARU_AS_SUBPROJECT FALSE)
else()
set(SPETABARU_AS_SUBPROJECT TRUE)
endif()
if($ENV{VERBOSE})
MESSAGE(STATUS "Main -- SPETABARU_AS_SUBPROJECT ${SPETABARU_AS_SUBPROJECT}")
endif()
# Build only the lib if subproject
if(NOT DEFINED SPETABARU_JUST_LIB)
set(SPETABARU_JUST_LIB ${SPETABARU_AS_SUBPROJECT} CACHE BOOL
"Set to on to build the lib for external use (without test and extra flags)" FORCE)
endif()
if(NOT DEFINED SPETABARU_DO_INSTALL)
set(SPETABARU_DO_INSTALL OFF CACHE BOOL
"Set to on to install the headers file of SPETABARU" FORCE)
endif()
if($ENV{VERBOSE})
MESSAGE(STATUS "Main -- SPETABARU_JUST_LIB ${SPETABARU_JUST_LIB}")
MESSAGE(STATUS "Main -- SPETABARU_DO_INSTALL ${SPETABARU_DO_INSTALL}")
endif()
#===========================================================================
# Version Number
#===========================================================================
set(SPETABARU_MAJOR_VERSION 0)
set(SPETABARU_MINOR_VERSION 1)
set(SPETABARU_PATCH_VERSION 0)
set(SPETABARU_VERSION "${SPETABARU_MAJOR_VERSION}.${SPETABARU_MINOR_VERSION}.${SPETABARU_PATCH_VERSION}" )
#===========================================================================
# Options
#===========================================================================
# Extra-flags
SET( SPETABARU_EXTRA_CXX_FLAGS "-funroll-loops" CACHE STRING "These flags are used for all configurations" )
set(SPETABARU_CXX_FLAGS "-std=c++17 ${SPETABARU_CXX_FLAGS} ${SPETABARU_EXTRA_CXX_FLAGS}")
# Options
if(NOT SPETABARU_AS_SUBPROJECT)
SET( SPETABARU_EXTRA_CXX_FLAGS_RELEASE "-O3" CACHE STRING "These flags are added to the usual ones for RELEASE" )
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${SPETABARU_EXTRA_CXX_FLAGS_RELEASE}")
SET( SPETABARU_EXTRA_CXX_FLAGS_DEBUG "-O0" CACHE STRING "These flags are added to the usual ones for DEBUG" )
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${SPETABARU_EXTRA_CXX_FLAGS_DEBUG}")
set(SPETABARU_CXX_FLAGS "${SPETABARU_CXX_FLAGS} -fpic -Wextra -Wnon-virtual-dtor -Wshadow -Wpointer-arith -Wcast-qual -Wall -pedantic -Woverloaded-virtual -Wpointer-arith -Wcast-qual -Wno-error")
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
else()
set(SPETABARU_CXX_FLAGS "${SPETABARU_CXX_FLAGS} -Wconversion -Wno-sign-conversion")
endif()
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "ppc64le")
# Builting functions are not correctly making variables/parameters used
set(SPETABARU_CXX_FLAGS "${SPETABARU_CXX_FLAGS} -Wno-unused-but-set-variable -Wno-unused-but-set-parameter")
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(SPETABARU_CXX_FLAGS "${SPETABARU_CXX_FLAGS} -m64")
endif()
OPTION( SPETABARU_ATTACHE_SOURCE "Set to on to add -g flag" OFF )
if( SPETABARU_ATTACHE_SOURCE )
set(SPETABARU_CXX_FLAGS "${SPETABARU_CXX_FLAGS} -g")
endif(SPETABARU_ATTACHE_SOURCE)
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "icpc.*$")
else()
set(SPETABARU_CXX_FLAGS "${SPETABARU_CXX_FLAGS} -Wold-style-cast")
endif()
#===========================================================================
# Generate config
#===========================================================================
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Src/SPETABARUConfig.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/Src/SPETABARUConfig.h )
#===========================================================================
# Build lib
#===========================================================================
add_subdirectory(Src)
if(NOT SPETABARU_JUST_LIB)
#===========================================================================
# Build unit tests
#===========================================================================
enable_testing()
add_subdirectory(UTests)
add_subdirectory(UTests/ShouldNotCompile)
#===========================================================================
# Build examples
#===========================================================================
add_subdirectory(Examples)
endif()
#===========================================================================
# Export cmake info
#===========================================================================
configure_file(${SPETABARU_SOURCE_DIR}/CMakeModules/SpetabaruInfo.cmake.in
${SPETABARU_BINARY_DIR}/SpetabaruInfo.cmake
@ONLY IMMEDIATE
)
if(SPETABARU_DO_INSTALL)
install(FILES ${SPETABARU_BINARY_DIR}/SpetabaruInfo.cmake DESTINATION lib/ )
endif()
if(SPETABARU_AS_SUBPROJECT)
set(SPETABARU_CXX_FLAGS "${SPETABARU_CXX_FLAGS}" PARENT_SCOPE)
set(SPETABARU_BINARY_DIR "${SPETABARU_BINARY_DIR}" PARENT_SCOPE)
set(SPETABARU_SOURCE_DIR "${SPETABARU_SOURCE_DIR}" PARENT_SCOPE)
set(SPETABARU_INCLUDE_DIR "${SPETABARU_INCLUDE_DIR}" PARENT_SCOPE)
else()
# nothing - we are not used by another lib here
endif()
#!/usr/bin/env bash
#SBATCH -J spetabaru
#SBATCH -D ./
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
# for OpenMP:
#SBATCH --cpus-per-task=32
#SBATCH --time=00:20:00
#SBATCH -p short
#SBATCH --mail-type=ALL --mail-user=berenger.bramas@mpcdf.mpg.de
module load cmake
module load gcc/7.2
cd /u/bbramas/spetabaru/Build/test
outputdir="results"
cptres=0
while [ -d "$outputdir" ] ; do
cptres=$((cptres+1))
outputdir="results-"$cptres
done
mkdir "$outputdir"
for th in 1 5 10 ; do
for loops in 1 5 10 50 100 ; do
export NBTHREADS=$th
export NBLOOPS=$loops
outputdirrun="$outputdir/run-$NBTHREADS-$NBLOOPS"
mkdir "$outputdirrun"
./mc > "$outputdirrun/output.txt" 2>&1
mv /tmp/spec_without_collision* /tmp/nospec_without_collision.* "$outputdirrun"
done
done
#!/usr/bin/env bash
#SBATCH -J spetabaru
#SBATCH -D ./
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
# for OpenMP:
#SBATCH --cpus-per-task=32
#SBATCH --time=02:00:00
#SBATCH -p short
#SBATCH --mail-type=ALL --mail-user=berenger.bramas@mpcdf.mpg.de
module load cmake
module load gcc/7.2
cd /u/bbramas/spetabaru/Build/testremc
outputdir="results"
cptres=0
while [ -d "$outputdir" ] ; do
cptres=$((cptres+1))
outputdir="results-"$cptres
done
mkdir "$outputdir"
for loops in 5 10 50 100 ; do
th=1
export NBTHREADS=$th
export NBLOOPS=$loops
outputdirrun="$outputdir/run-$NBTHREADS-$NBLOOPS"
mkdir "$outputdirrun"
./remc > "$outputdirrun/output.txt" 2>&1
mv /tmp/remc* "$outputdirrun"
for th in 5 10 20 30 ; do
export NBTHREADS=$th
export NBLOOPS=$loops
outputdirrun="$outputdir/run-$NBTHREADS-$NBLOOPS"
mkdir "$outputdirrun"
./remcnoseq > "$outputdirrun/output.txt" 2>&1
mv /tmp/remc* "$outputdirrun"
done
done
###########################################################################
# SPETABARU - Berenger Bramas MPCDF - 2016
# Under MIT Licence, please you must read the LICENCE file.
###########################################################################
project(PATTERNS_SPETABARU CXX)
ADD_DEFINITIONS(${SPETABARU_CXX_FLAGS})
if(SPETABARU_BUILD_EXAMPLES)
if($ENV{VERBOSE})
MESSAGE(STATUS "Examples -- SPETABARU_CXX_FLAGS : ${SPETABARU_CXX_FLAGS}")
endif()
# Find all code files
file(
GLOB_RECURSE
source_tests_files
./*.cpp
)
# Adding the project sources dir as an include dir
INCLUDE_DIRECTORIES(
${SPETABARU_BINARY_DIR}/Src
${SPETABARU_SOURCE_DIR}/Src
)
# Add execs - 1 cpp = 1 exec
foreach(exec ${source_tests_files})
get_filename_component(
execname ${exec}
NAME_WE
)
if($ENV{VERBOSE})
MESSAGE(STATUS "Patterns -- Add ${execname}")
endif()
add_executable(
${execname}
${exec}
)
target_link_libraries(
${execname}
spetabaru
${SPETABARU_LIBRARIES}
)
endforeach(exec)
endif()
///////////////////////////////////////////////////////////////////////////
// Spetabaru - Berenger Bramas MPCDF - 2017
// Under MIT Licence, please you must read the LICENCE file.
///////////////////////////////////////////////////////////////////////////
#include <iostream>
#include "Utils/SpModes.hpp"
#include "Utils/SpUtils.hpp"
#include "Tasks/SpTask.hpp"
#include "Runtimes/SpRuntime.hpp"
#include "Utils/SpTimer.hpp"
int main(){
const int NumThreads = SpUtils::DefaultNumThreads();
SpRuntime runtime(NumThreads);
{
const int NbTasksToSubmit = 1000;
int initVal = 1;
SpTimer timer;
for(int idx = 0 ; idx < NbTasksToSubmit ; ++idx){
runtime.task(SpRead(initVal),
[](const int&){
usleep(1000);
});
}
timer.stop();
runtime.waitAllTasks();
std::cout << "Average time to insert a task with no pressure = " << timer.getElapsed()/double(NbTasksToSubmit) << "s" << std::endl;
}
{
const int NbTasksToSubmit = 1000;
int initVal = 1;
SpTimer timer;
for(int idx = 0 ; idx < NbTasksToSubmit ; ++idx){
runtime.task(SpRead(initVal),
[](const int&){
});
}
timer.stop();
runtime.waitAllTasks();
std::cout << "Average time to insert a task with pressure = " << timer.getElapsed()/double(NbTasksToSubmit) << "s" << std::endl;
}
{
static const int NbLoops = 100;
const int NbTasksToSubmit = runtime.getNbThreads();
int initVal = 1;
std::vector<SpAbstractTaskWithReturn<double>::SpTaskViewer> elapsed;
elapsed.reserve(NbTasksToSubmit*NbLoops);
for(int idxLoop = 0 ; idxLoop < NbLoops ; ++idxLoop){
for(int idx = 0 ; idx < NbTasksToSubmit ; ++idx){
SpTimer timerTask;
elapsed.emplace_back( runtime.task(SpRead(initVal),
[timerTask](const int&) mutable -> double {
timerTask.stop();
usleep(1000);
return timerTask.getElapsed();
}) );
}
runtime.waitAllTasks();
}
double averageToExecute = 0;
for(const SpAbstractTaskWithReturn<double>::SpTaskViewer& viewer : elapsed){
averageToExecute += viewer.getValue()/double(NbTasksToSubmit*NbLoops);
}
std::cout << "Average time for a task to be executed without pressure = " << averageToExecute << "s" << std::endl;
}
{
static const int NbLoops = 100;
const int NbTasksToSubmit = runtime.getNbThreads();
int initVal = 1;
std::vector<SpAbstractTaskWithReturn<double>::SpTaskViewer> elapsed;
elapsed.reserve(NbTasksToSubmit*NbLoops);
for(int idxLoop = 0 ; idxLoop < NbLoops ; ++idxLoop){
for(int idx = 0 ; idx < NbTasksToSubmit ; ++idx){
SpTimer timerTask;
elapsed.emplace_back( runtime.task(SpRead(initVal),
[timerTask](const int&) mutable -> double {
timerTask.stop();
return timerTask.getElapsed();
}) );
}
runtime.waitAllTasks();
}
double averageToExecute = 0;
for(const SpAbstractTaskWithReturn<double>::SpTaskViewer& viewer : elapsed){
averageToExecute += viewer.getValue()/double(NbTasksToSubmit*NbLoops);
}
std::cout << "Average time for a task to be executed with pressure = " << averageToExecute << "s" << std::endl;
}
runtime.stopAllThreads();
return 0;
}
///////////////////////////////////////////////////////////////////////////
// Spetabaru - Berenger Bramas MPCDF - 2017
// Under MIT Licence, please you must read the LICENCE file.
///////////////////////////////////////////////////////////////////////////
#include <iostream>
#include "Utils/SpModes.hpp"
#include "Utils/SpUtils.hpp"
#include "Tasks/SpTask.hpp"
#include "Runtimes/SpRuntime.hpp"
int main(){
const int NumThreads = SpUtils::DefaultNumThreads();
SpRuntime runtime(NumThreads);
int initVal = 1;
int writeVal = 0;
runtime.task(SpRead(initVal),
[&initVal](const int& /*initValParam*/){
});
runtime.task(SpRead(initVal), SpWrite(writeVal),
[](const int& /*initValParam*/, int& /*writeValParam*/){
});
runtime.task(SpRead(writeVal),
[&initVal](const int& /*writeValParam*/){
});
for(int idx = 0 ; idx < 5 ; ++idx){
runtime.task(SpWrite(initVal), SpWrite(writeVal),
[](int& /*initValParam*/, int& /*writeValParam*/){
});
runtime.task(SpRead(writeVal),
[&initVal](const int& /*writeValParam*/){
});
}
runtime.waitAllTasks();
runtime.stopAllThreads();
runtime.generateDot("/tmp/graph.dot");
return 0;
}
///////////////////////////////////////////////////////////////////////////
// Spetabaru - Berenger Bramas MPCDF - 2017
// Under MIT Licence, please you must read the LICENCE file.
///////////////////////////////////////////////////////////////////////////
#include <iostream>
#include "Utils/SpModes.hpp"
#include "Utils/SpUtils.hpp"
#include "Tasks/SpTask.hpp"
#include "Runtimes/SpRuntime.hpp"
int main(){
return 0;
}
///////////////////////////////////////////////////////////////////////////
// Spetabaru - Berenger Bramas MPCDF - 2017
// Under MIT Licence, please you must read the LICENCE file.
///////////////////////////////////////////////////////////////////////////
#include <iostream>
#include "Utils/SpModes.hpp"
#include "Utils/SpUtils.hpp"
#include "Tasks/SpTask.hpp"
#include "Runtimes/SpRuntime.hpp"
int main(){
const int NumThreads = SpUtils::DefaultNumThreads();
SpRuntime runtime(NumThreads);
int initVal = 1;
int writeVal = 0;
int baseTime = 10000;
runtime.task(SpRead(initVal),
[baseTime](const int&){
usleep(1*baseTime);
});
runtime.task(SpRead(initVal), SpWrite(writeVal),
[baseTime](const int&, int&){
usleep(3*baseTime);
});
runtime.task(SpRead(writeVal),
[baseTime](const int&){
usleep(5*baseTime);
});
for(int idx = 0 ; idx < 5 ; ++idx){
runtime.task(SpWrite(initVal), SpWrite(writeVal),
[baseTime](int&, int&){
usleep(10*baseTime);
});
runtime.task(SpRead(writeVal),
[baseTime](const int&){
usleep(1*baseTime);
});
runtime.task(SpWrite(initVal),
[baseTime](int&){
usleep(10*baseTime);
});
usleep(baseTime/10);
}
runtime.waitAllTasks();
runtime.stopAllThreads();
runtime.generateTrace("/tmp/trace.svg");
return 0;
}
###########################################################################
# SPETABARU - Berenger Bramas MPCDF - 2016
# Under MIT Licence, please you must read the LICENCE file.
###########################################################################
project(EXAMPLES_SPETABARU CXX)
OPTION( SPETABARU_BUILD_EXAMPLES "Set to ON to build examples" ON )
if($ENV{VERBOSE})
MESSAGE(STATUS "Examples -- SPETABARU_BUILD_EXAMPLES = ${SPETABARU_BUILD_EXAMPLES}")
endif()
if( SPETABARU_BUILD_EXAMPLES )
file(GLOB all_examples ./*)
foreach(example_name ${all_examples})
if(IS_DIRECTORY ${example_name})
if($ENV{VERBOSE})
message(STATUS "Examples -- ${example_name}" )
endif()
add_subdirectory(${example_name})
endif()
endforeach()
endif()
###########################################################################
# SPETABARU - Berenger Bramas MPCDF - 2016
# Under MIT Licence, please you must read the LICENCE file.
###########################################################################
project(PATTERNS_SPETABARU CXX)
ADD_DEFINITIONS(${SPETABARU_CXX_FLAGS})
if(SPETABARU_BUILD_EXAMPLES)
if($ENV{VERBOSE})
MESSAGE(STATUS "Examples -- SPETABARU_CXX_FLAGS : ${SPETABARU_CXX_FLAGS}")
endif()
# Find all code files
file(
GLOB_RECURSE
source_tests_files
./*.cpp
)