From 3d8f381baed0da0aa6c0797e824add81ed88d91f Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 11 Apr 2017 15:49:55 +0200 Subject: [PATCH] Initial commit --- CMakeLists.txt | 87 ++++ bin/unittests.sh | 108 ++++ iwir/coderepo/for1.properties | 7 + iwir/coderepo/for1/atomic1.properties | 17 + iwir/coderepo/for1/atomic1a.code | 23 + iwir/coderepo/for1/atomic1b.code | 23 + iwir/coderepo/for1/atomic1c.code | 23 + iwir/coderepo/for1/atomic1sim.code | 26 + iwir/coderepo/for1/atomic2.code | 79 +++ iwir/coderepo/for1/atomic2.properties | 8 + iwir/coderepo/for1/atomic2sim.code | 82 +++ iwir/coderepo/for1/wfInput.code | 2 + iwir/coderepo/for1/wfOutput.code | 39 ++ iwir/coderepo/foreach1.properties | 7 + iwir/coderepo/foreach1/atomic1.code | 42 ++ iwir/coderepo/foreach1/atomic1.properties | 4 + iwir/coderepo/foreach1/atomic2.code | 164 ++++++ iwir/coderepo/foreach1/atomic2.properties | 4 + iwir/coderepo/foreach1/wfInput.code | 19 + iwir/coderepo/foreach1/wfOutput.code | 60 +++ iwir/coderepo/if1.properties | 14 + iwir/coderepo/if1/atomic1.code | 3 + iwir/coderepo/if1/atomic1.properties | 4 + iwir/coderepo/if1/atomic2.code | 16 + iwir/coderepo/if1/atomic2.properties | 4 + iwir/coderepo/if1/atomic3.code | 16 + iwir/coderepo/if1/atomic3.properties | 4 + iwir/coderepo/if1/atomic4.code | 16 + iwir/coderepo/if1/atomic4.properties | 4 + iwir/coderepo/if1/atomic5.code | 47 ++ iwir/coderepo/if1/atomic5.properties | 4 + iwir/coderepo/if1/atomic6.code | 16 + iwir/coderepo/if1/atomic6.properties | 4 + iwir/coderepo/if1/atomic7.code | 16 + iwir/coderepo/if1/atomic7.properties | 4 + iwir/coderepo/if1/atomic8.code | 42 ++ iwir/coderepo/if1/atomic8.properties | 4 + iwir/coderepo/if1/includes.code | 2 + iwir/coderepo/if1/wfInput.code | 47 ++ iwir/coderepo/if1/wfOutput.code | 63 +++ iwir/coderepo/if2.properties | 8 + iwir/coderepo/if2/atomic1.code | 10 + iwir/coderepo/if2/atomic1.properties | 4 + iwir/coderepo/if2/atomic2.code | 9 + iwir/coderepo/if2/atomic2.properties | 4 + iwir/coderepo/if2/atomic3.code | 44 ++ iwir/coderepo/if2/atomic3.properties | 4 + iwir/coderepo/if2/wfInput.code | 12 + iwir/coderepo/if2/wfOutput.code | 8 + iwir/coderepo/pfor1.properties | 7 + iwir/coderepo/pfor1/atomic1.code | 21 + iwir/coderepo/pfor1/atomic1.properties | 4 + iwir/coderepo/pfor1/atomic2.code | 32 ++ iwir/coderepo/pfor1/atomic2.properties | 4 + iwir/coderepo/pfor1/wfInput.code | 2 + iwir/coderepo/pfor1/wfOutput.code | 31 ++ iwir/coderepo/pforeach1.properties | 7 + iwir/coderepo/pforeach1/atomic1.code | 21 + iwir/coderepo/pforeach1/atomic1.properties | 4 + iwir/coderepo/pforeach1/atomic2.code | 32 ++ iwir/coderepo/pforeach1/atomic2.properties | 4 + iwir/coderepo/pforeach1/wfInput.code | 9 + iwir/coderepo/pforeach1/wfOutput.code | 31 ++ iwir/coderepo/sparselu-wfr.properties | 8 + iwir/coderepo/sparselu/atomic1.code | 5 + iwir/coderepo/sparselu/atomic1.properties | 4 + iwir/coderepo/sparselu/atomic2.code | 17 + iwir/coderepo/sparselu/atomic2.properties | 4 + iwir/coderepo/sparselu/atomic3.code | 18 + iwir/coderepo/sparselu/atomic3.properties | 4 + iwir/coderepo/sparselu/atomic4.code | 22 + iwir/coderepo/sparselu/atomic4.properties | 4 + iwir/coderepo/sparselu/includes.code | 1 + iwir/coderepo/wavefront.properties | 7 + iwir/coderepo/wavefront/atomic1.code | 23 + iwir/coderepo/wavefront/atomic1.properties | 4 + iwir/coderepo/wavefront/includes.code | 2 + iwir/coderepo/wavefront/wfInput.code | 63 +++ iwir/coderepo/wavefront/wfOutput.code | 47 ++ iwir/coderepo/while1.properties | 7 + iwir/coderepo/while1/atomic1.code | 21 + iwir/coderepo/while1/atomic1.properties | 4 + iwir/coderepo/while1/atomic2.code | 28 ++ iwir/coderepo/while1/atomic2.properties | 4 + iwir/coderepo/while1/wfInput.code | 3 + iwir/coderepo/while1/wfOutput.code | 26 + iwir/for1.iwir | 95 ++++ iwir/foreach1.iwir | 127 +++++ iwir/if1.iwir | 227 +++++++++ iwir/if2.iwir | 84 ++++ iwir/pfor1.iwir | 65 +++ iwir/pforeach1.iwir | 64 +++ iwir/sparselu-wfr.iwir | 176 +++++++ iwir/wavefront.iwir | 87 ++++ iwir/while1.iwir | 81 +++ src/.directory | 4 + src/sparselu/app-desc.h | 53 ++ src/sparselu/bots.h | 113 +++++ src/sparselu/bots_common.cpp | 346 +++++++++++++ src/sparselu/bots_common.h | 56 +++ src/sparselu/bots_main.cpp | 559 +++++++++++++++++++++ src/sparselu/bots_main.h | 51 ++ src/sparselu/omp-tasks-app.h | 33 ++ src/sparselu/sparselu.h | 24 + src/sparselu/sparselu_funcs.cpp | 289 +++++++++++ src/wavefront/wavefront-omp.cpp | 81 +++ 106 files changed, 4407 insertions(+) create mode 100755 CMakeLists.txt create mode 100755 bin/unittests.sh create mode 100755 iwir/coderepo/for1.properties create mode 100755 iwir/coderepo/for1/atomic1.properties create mode 100755 iwir/coderepo/for1/atomic1a.code create mode 100755 iwir/coderepo/for1/atomic1b.code create mode 100755 iwir/coderepo/for1/atomic1c.code create mode 100755 iwir/coderepo/for1/atomic1sim.code create mode 100755 iwir/coderepo/for1/atomic2.code create mode 100755 iwir/coderepo/for1/atomic2.properties create mode 100755 iwir/coderepo/for1/atomic2sim.code create mode 100755 iwir/coderepo/for1/wfInput.code create mode 100755 iwir/coderepo/for1/wfOutput.code create mode 100755 iwir/coderepo/foreach1.properties create mode 100755 iwir/coderepo/foreach1/atomic1.code create mode 100755 iwir/coderepo/foreach1/atomic1.properties create mode 100755 iwir/coderepo/foreach1/atomic2.code create mode 100755 iwir/coderepo/foreach1/atomic2.properties create mode 100755 iwir/coderepo/foreach1/wfInput.code create mode 100755 iwir/coderepo/foreach1/wfOutput.code create mode 100755 iwir/coderepo/if1.properties create mode 100755 iwir/coderepo/if1/atomic1.code create mode 100755 iwir/coderepo/if1/atomic1.properties create mode 100755 iwir/coderepo/if1/atomic2.code create mode 100755 iwir/coderepo/if1/atomic2.properties create mode 100755 iwir/coderepo/if1/atomic3.code create mode 100755 iwir/coderepo/if1/atomic3.properties create mode 100755 iwir/coderepo/if1/atomic4.code create mode 100755 iwir/coderepo/if1/atomic4.properties create mode 100755 iwir/coderepo/if1/atomic5.code create mode 100755 iwir/coderepo/if1/atomic5.properties create mode 100755 iwir/coderepo/if1/atomic6.code create mode 100755 iwir/coderepo/if1/atomic6.properties create mode 100755 iwir/coderepo/if1/atomic7.code create mode 100755 iwir/coderepo/if1/atomic7.properties create mode 100755 iwir/coderepo/if1/atomic8.code create mode 100755 iwir/coderepo/if1/atomic8.properties create mode 100755 iwir/coderepo/if1/includes.code create mode 100755 iwir/coderepo/if1/wfInput.code create mode 100755 iwir/coderepo/if1/wfOutput.code create mode 100755 iwir/coderepo/if2.properties create mode 100755 iwir/coderepo/if2/atomic1.code create mode 100755 iwir/coderepo/if2/atomic1.properties create mode 100755 iwir/coderepo/if2/atomic2.code create mode 100755 iwir/coderepo/if2/atomic2.properties create mode 100755 iwir/coderepo/if2/atomic3.code create mode 100755 iwir/coderepo/if2/atomic3.properties create mode 100755 iwir/coderepo/if2/wfInput.code create mode 100755 iwir/coderepo/if2/wfOutput.code create mode 100755 iwir/coderepo/pfor1.properties create mode 100755 iwir/coderepo/pfor1/atomic1.code create mode 100755 iwir/coderepo/pfor1/atomic1.properties create mode 100755 iwir/coderepo/pfor1/atomic2.code create mode 100755 iwir/coderepo/pfor1/atomic2.properties create mode 100755 iwir/coderepo/pfor1/wfInput.code create mode 100755 iwir/coderepo/pfor1/wfOutput.code create mode 100755 iwir/coderepo/pforeach1.properties create mode 100755 iwir/coderepo/pforeach1/atomic1.code create mode 100755 iwir/coderepo/pforeach1/atomic1.properties create mode 100755 iwir/coderepo/pforeach1/atomic2.code create mode 100755 iwir/coderepo/pforeach1/atomic2.properties create mode 100755 iwir/coderepo/pforeach1/wfInput.code create mode 100755 iwir/coderepo/pforeach1/wfOutput.code create mode 100755 iwir/coderepo/sparselu-wfr.properties create mode 100755 iwir/coderepo/sparselu/atomic1.code create mode 100755 iwir/coderepo/sparselu/atomic1.properties create mode 100755 iwir/coderepo/sparselu/atomic2.code create mode 100755 iwir/coderepo/sparselu/atomic2.properties create mode 100755 iwir/coderepo/sparselu/atomic3.code create mode 100755 iwir/coderepo/sparselu/atomic3.properties create mode 100755 iwir/coderepo/sparselu/atomic4.code create mode 100755 iwir/coderepo/sparselu/atomic4.properties create mode 100755 iwir/coderepo/sparselu/includes.code create mode 100755 iwir/coderepo/wavefront.properties create mode 100755 iwir/coderepo/wavefront/atomic1.code create mode 100755 iwir/coderepo/wavefront/atomic1.properties create mode 100755 iwir/coderepo/wavefront/includes.code create mode 100755 iwir/coderepo/wavefront/wfInput.code create mode 100755 iwir/coderepo/wavefront/wfOutput.code create mode 100755 iwir/coderepo/while1.properties create mode 100755 iwir/coderepo/while1/atomic1.code create mode 100755 iwir/coderepo/while1/atomic1.properties create mode 100755 iwir/coderepo/while1/atomic2.code create mode 100755 iwir/coderepo/while1/atomic2.properties create mode 100755 iwir/coderepo/while1/wfInput.code create mode 100755 iwir/coderepo/while1/wfOutput.code create mode 100755 iwir/for1.iwir create mode 100755 iwir/foreach1.iwir create mode 100755 iwir/if1.iwir create mode 100755 iwir/if2.iwir create mode 100755 iwir/pfor1.iwir create mode 100755 iwir/pforeach1.iwir create mode 100755 iwir/sparselu-wfr.iwir create mode 100755 iwir/wavefront.iwir create mode 100755 iwir/while1.iwir create mode 100755 src/.directory create mode 100755 src/sparselu/app-desc.h create mode 100755 src/sparselu/bots.h create mode 100755 src/sparselu/bots_common.cpp create mode 100755 src/sparselu/bots_common.h create mode 100755 src/sparselu/bots_main.cpp create mode 100755 src/sparselu/bots_main.h create mode 100755 src/sparselu/omp-tasks-app.h create mode 100755 src/sparselu/sparselu.h create mode 100755 src/sparselu/sparselu_funcs.cpp create mode 100755 src/wavefront/wavefront-omp.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..720f30f --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,87 @@ +cmake_minimum_required(VERSION 2.8) +project(wfr-unittests C CXX) + +# Compiler flags +set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -DNDEBUG -Wall") +set(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -DNDEBUG -Wall") +set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall") +set(CMAKE_C_FLAGS_RELEASE "-O3 -Wall") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_DEBUG}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_DEBUG}") + +# Find WFR-libraries +if (NOT WFR_FOUND) + if (NOT WFR_DIR) + set(WFR_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../WFR-lib/dist") + endif() + find_package(WFR REQUIRED) +endif() + +# Find IWIR2WFR compiler +if (NOT IWIR2WFR_FOUND) + if (NOT IWIR2WFR_DIR) + set(IWIR2WFR_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../IWIR2WFRcompiler/dist") + endif() + find_package(IWIR2WFR REQUIRED) +endif() + +# Where to find IWIR file and activity implementation repository +set(IWIR_DIR "${CMAKE_CURRENT_SOURCE_DIR}/iwir") +set(REPO_DIR "${CMAKE_CURRENT_SOURCE_DIR}/iwir/coderepo") + +get_directory_property(hasParent PARENT_DIRECTORY) +# Where to install the output +if (NOT hasParent) + if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/dist") + endif() +endif() + +# Setup include dir +include_directories(${WFR_INCLUDE_DIR}) + +# Wavefront needs OpenMP +FIND_PACKAGE(OpenMP) +if(OPENMP_FOUND) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") +endif() + +# Enable C++11 support and ignore the Sparselu BOTS main +ADD_DEFINITIONS( -std=c++11 -DSPARSELU_SKIP_BOTS_MAIN ) + +# +# Convenience function for setting up individual unit-tests +# +function(add_wfr_utest utest_name add_inc) + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${utest_name}) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${utest_name}/${utest_name}.cpp ${CMAKE_CURRENT_BINARY_DIR}/${utest_name}/${utest_name}.h + COMMAND ${IWIR2WFR_EXE} -i ${IWIR_DIR}/${utest_name}.iwir -o ${CMAKE_CURRENT_BINARY_DIR}/${utest_name}/${utest_name} -skipmain -printir -repoconfig ${REPO_DIR}/${utest_name}.properties + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${utest_name} + ) + add_executable(${utest_name}.bin ${CMAKE_CURRENT_BINARY_DIR}/${utest_name}/${utest_name}.cpp ${ARGN}) + target_include_directories(${utest_name}.bin PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${utest_name} ${add_inc}) + target_link_libraries(${utest_name}.bin ${WFR_LIBRARIES}) + add_dependencies(${utest_name}.bin wfr_lib) # Otherwise we would have race conditions when compiling the parent project with -j + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${utest_name}/${utest_name}.cpp ${CMAKE_CURRENT_BINARY_DIR}/${utest_name}/${utest_name}.h DESTINATION ${CMAKE_INSTALL_PREFIX}/utests/${utest_name}) + install(TARGETS ${utest_name}.bin DESTINATION ${CMAKE_INSTALL_PREFIX}/utests/${utest_name}) +endfunction() + + +# +# Setup individual unit-tests +# +add_wfr_utest(for1 "") +add_wfr_utest(foreach1 "") +add_wfr_utest(if1 "") +add_wfr_utest(if2 "") +add_wfr_utest(pfor1 "") +add_wfr_utest(pforeach1 "") +add_wfr_utest(sparselu-wfr ${CMAKE_CURRENT_SOURCE_DIR}/src/sparselu ${CMAKE_CURRENT_SOURCE_DIR}/src/sparselu/sparselu_funcs.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/sparselu/bots_main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/sparselu/bots_common.cpp) +if(OPENMP_FOUND) + add_wfr_utest(wavefront "") +endif() +add_wfr_utest(while1 "") + +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bin/unittests.sh PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE DESTINATION ${CMAKE_INSTALL_PREFIX}/utests) + diff --git a/bin/unittests.sh b/bin/unittests.sh new file mode 100755 index 0000000..75967e1 --- /dev/null +++ b/bin/unittests.sh @@ -0,0 +1,108 @@ +#!/bin/bash + + +if [ "$1" != "" ]; then + BIN_BASE=$1 +else + BIN_BASE="." +fi + + +if [ "$2" != "" ]; then + LIBRARY_PATH=$2:$LD_LIBRARY_PATH +else + LIBRARY_PATH=../lib:$LD_LIBRARY_PATH +fi + + + +SUCCESS_COUNT=0 +FAILURE_COUNT=0 +TOTAL_COUNT=0 + +exec_test() { + TIMELIMIT="$1" + BINARY="$2" + + PROLOG="Running $BINARY" + echo "" + echo -n -e "$PROLOG" + + let TOTAL_COUNT=$TOTAL_COUNT+1 + OUTPUT=$(LD_LIBRARY_PATH=$LIBRARY_PATH timeout $TIMELIMIT ./$BINARY 1>/dev/null 2>&1) + CODE=$? + RESULT="" + REASON="" + + if [ $CODE -eq 0 ]; then + RESULT="\e[1m\e[32mOk" + let SUCCESS_COUNT=$SUCCESS_COUNT+1 + elif [ $CODE -eq 124 ]; then + RESULT="\e[1m\e[31mFailure" + REASON="Timeout" + let FAILURE_COUNT=$FAILURE_COUNT+1 + elif [ $CODE -eq 134 ]; then + RESULT="\e[1m\e[31mFailure" + REASON="Exception" + let FAILURE_COUNT=$FAILURE_COUNT+1 + else + RESULT="\e[1m\e[31mFailure" + REASON="Unknown" + let FAILURE_COUNT=$FAILURE_COUNT+1 + fi + + STATUSMSG=$RESULT + if [ -n "$REASON" ]; then + STATUSMSG="$STATUSMSG ($REASON)" + fi + STATUSMSG="$STATUSMSG\e[0m" + blanks=" " + echo -e "${blanks:0:${#width}-${#PROLOG}}$STATUSMSG" + + if [ -n "$OUTPUT" ]; then + echo -e "$OUTPUT" + fi +} + + +# Run unit tests +exec_test 10 "$BIN_BASE/for1/for1.bin --early-evaluation" +exec_test 10 "$BIN_BASE/for1/for1.bin --late-evaluation" +exec_test 10 "$BIN_BASE/foreach1/foreach1.bin --early-evaluation" +exec_test 10 "$BIN_BASE/foreach1/foreach1.bin --late-evaluation" +exec_test 10 "$BIN_BASE/pfor1/pfor1.bin --early-evaluation" +exec_test 10 "$BIN_BASE/pfor1/pfor1.bin --late-evaluation" +exec_test 10 "$BIN_BASE/pforeach1/pforeach1.bin --early-evaluation" +exec_test 10 "$BIN_BASE/pforeach1/pforeach1.bin --late-evaluation" +exec_test 10 "$BIN_BASE/while1/while1.bin --early-evaluation" +exec_test 10 "$BIN_BASE/while1/while1.bin --late-evaluation" +exec_test 10 "$BIN_BASE/if1/if1.bin --early-evaluation" +exec_test 10 "$BIN_BASE/if1/if1.bin --late-evaluation" +exec_test 10 "$BIN_BASE/if2/if2.bin --early-evaluation" +exec_test 10 "$BIN_BASE/if2/if2.bin --late-evaluation" +#exec_test 30 "$BIN_BASE/wavefront/wavefront.bin --early-evaluation" +#exec_test 30 "$BIN_BASE/wavefront/wavefront.bin --late-evaluation" +#exec_test 260 "$BIN_BASE/sparselu/sparselu-wfr.bin -c --early-evaluation" +#exec_test 260 "$BIN_BASE/sparselu/sparselu-wfr.bin -c --late-evaluation" +#exec_test 260 "$BIN_BASE/sparselu-wfr/sparselu-wfr.bin --early-evaluation" +#exec_test 260 "$BIN_BASE/sparselu-wfr/sparselu-wfr.bin --late-evaluation" + +# Clean up +rm -rf *.dot default.sqlite* + +# Display summary + +echo "" +echo -e "\e[1mTotal number of tests: $TOTAL_COUNT\e[0m" +echo -e "\e[1mNumber of successful tests: $SUCCESS_COUNT\e[0m" +echo -e "\e[1mNumber of failed tests: $FAILURE_COUNT\e[0m" +echo "" + +# Return value + +RETVAL=0 +if [ $FAILURE_COUNT -ne 0 ]; then + RETVAL=1 +fi + +exit $RETVAL diff --git a/iwir/coderepo/for1.properties b/iwir/coderepo/for1.properties new file mode 100755 index 0000000..d9227af --- /dev/null +++ b/iwir/coderepo/for1.properties @@ -0,0 +1,7 @@ + +wfinput=for1/wfInput.code +wfoutput=for1/wfOutput.code + +atomicTask.0=for1/atomic1.properties +atomicTask.1=for1/atomic2.properties + diff --git a/iwir/coderepo/for1/atomic1.properties b/iwir/coderepo/for1/atomic1.properties new file mode 100755 index 0000000..552fff3 --- /dev/null +++ b/iwir/coderepo/for1/atomic1.properties @@ -0,0 +1,17 @@ + +name=AtomicActivity1 +entries=4 +entry.0=atomic1a.code +entryname.0=atomic1a +entrytype.0=pthreads +entrymetadata.0={{\"key1\", \"value1\"}, {\"key2\", \"value2\"}} +entry.1=atomic1b.code +entryname.1=atomic1b +entrytype.1=openCL +entry.2=atomic1b.code +entryname.2=atomic1c +entrytype.2=cuda +entry.3=atomic1sim.code +entryname.3=atomic1sim +entrytype.3=pthreads +entrymetadata.3={{\"sim-mode\", \"1\"}} \ No newline at end of file diff --git a/iwir/coderepo/for1/atomic1a.code b/iwir/coderepo/for1/atomic1a.code new file mode 100755 index 0000000..6244fd2 --- /dev/null +++ b/iwir/coderepo/for1/atomic1a.code @@ -0,0 +1,23 @@ + auto myiter = WFR_SELF_GETITERATIONID(); + std::cout << "AtomicActivity1 [" << myiter << "]:" << std::endl + << "\titerCount: " << sin->iterCount.getValue() << std::endl + << "\ttaskIn1: " << sin->taskIn1.getValue() << std::endl + << "\tloopPortIn1: " << sin->loopPortIn1.getValue() << std::endl; + #include + if (myiter+1 != sin->taskIn1.getValue()) { + std::stringstream ss; + ss << "Test Failure: IterationID+1 [" << myiter+1 << "] does not match taskIn1 [" << sin->taskIn1.getValue()<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (myiter == 0 && sin->iterCount.getValue() != sin->loopPortIn1.getValue()) { + std::stringstream ss; + ss << "Test Failure: LoopPortIn1 [" << sin->loopPortIn1.getValue() << "] does not match iterCount [" << sin->iterCount.getValue()<< "] in 1st iteration."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (myiter > 0 && sin->loopPortIn1.getValue() != myiter) { + std::stringstream ss; + ss << "Test Failure: LoopPortIn1 [" << sin->loopPortIn1.getValue() << "] does not match iterationID- [" << myiter << "] in subsequent iterations."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + sout->taskOut1.setValue(sin->taskIn1.getValue()); + sout->isOK.setValue(true); \ No newline at end of file diff --git a/iwir/coderepo/for1/atomic1b.code b/iwir/coderepo/for1/atomic1b.code new file mode 100755 index 0000000..6244fd2 --- /dev/null +++ b/iwir/coderepo/for1/atomic1b.code @@ -0,0 +1,23 @@ + auto myiter = WFR_SELF_GETITERATIONID(); + std::cout << "AtomicActivity1 [" << myiter << "]:" << std::endl + << "\titerCount: " << sin->iterCount.getValue() << std::endl + << "\ttaskIn1: " << sin->taskIn1.getValue() << std::endl + << "\tloopPortIn1: " << sin->loopPortIn1.getValue() << std::endl; + #include + if (myiter+1 != sin->taskIn1.getValue()) { + std::stringstream ss; + ss << "Test Failure: IterationID+1 [" << myiter+1 << "] does not match taskIn1 [" << sin->taskIn1.getValue()<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (myiter == 0 && sin->iterCount.getValue() != sin->loopPortIn1.getValue()) { + std::stringstream ss; + ss << "Test Failure: LoopPortIn1 [" << sin->loopPortIn1.getValue() << "] does not match iterCount [" << sin->iterCount.getValue()<< "] in 1st iteration."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (myiter > 0 && sin->loopPortIn1.getValue() != myiter) { + std::stringstream ss; + ss << "Test Failure: LoopPortIn1 [" << sin->loopPortIn1.getValue() << "] does not match iterationID- [" << myiter << "] in subsequent iterations."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + sout->taskOut1.setValue(sin->taskIn1.getValue()); + sout->isOK.setValue(true); \ No newline at end of file diff --git a/iwir/coderepo/for1/atomic1c.code b/iwir/coderepo/for1/atomic1c.code new file mode 100755 index 0000000..6244fd2 --- /dev/null +++ b/iwir/coderepo/for1/atomic1c.code @@ -0,0 +1,23 @@ + auto myiter = WFR_SELF_GETITERATIONID(); + std::cout << "AtomicActivity1 [" << myiter << "]:" << std::endl + << "\titerCount: " << sin->iterCount.getValue() << std::endl + << "\ttaskIn1: " << sin->taskIn1.getValue() << std::endl + << "\tloopPortIn1: " << sin->loopPortIn1.getValue() << std::endl; + #include + if (myiter+1 != sin->taskIn1.getValue()) { + std::stringstream ss; + ss << "Test Failure: IterationID+1 [" << myiter+1 << "] does not match taskIn1 [" << sin->taskIn1.getValue()<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (myiter == 0 && sin->iterCount.getValue() != sin->loopPortIn1.getValue()) { + std::stringstream ss; + ss << "Test Failure: LoopPortIn1 [" << sin->loopPortIn1.getValue() << "] does not match iterCount [" << sin->iterCount.getValue()<< "] in 1st iteration."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (myiter > 0 && sin->loopPortIn1.getValue() != myiter) { + std::stringstream ss; + ss << "Test Failure: LoopPortIn1 [" << sin->loopPortIn1.getValue() << "] does not match iterationID- [" << myiter << "] in subsequent iterations."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + sout->taskOut1.setValue(sin->taskIn1.getValue()); + sout->isOK.setValue(true); \ No newline at end of file diff --git a/iwir/coderepo/for1/atomic1sim.code b/iwir/coderepo/for1/atomic1sim.code new file mode 100755 index 0000000..46be300 --- /dev/null +++ b/iwir/coderepo/for1/atomic1sim.code @@ -0,0 +1,26 @@ + auto myiter = WFR_SELF_GETITERATIONID(); + std::cout << "AtomicActivity1 [" << myiter << "]:" << std::endl + << "\titerCount: " << sin->iterCount.getValue() << std::endl + << "\ttaskIn1: " << sin->taskIn1.getValue() << std::endl + << "\tloopPortIn1: " << sin->loopPortIn1.getValue() << std::endl; + #include + if (myiter+1 != sin->taskIn1.getValue()) { + std::stringstream ss; + ss << "Test Failure: IterationID+1 [" << myiter+1 << "] does not match taskIn1 [" << sin->taskIn1.getValue()<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (myiter == 0 && sin->iterCount.getValue() != sin->loopPortIn1.getValue()) { + std::stringstream ss; + ss << "Test Failure: LoopPortIn1 [" << sin->loopPortIn1.getValue() << "] does not match iterCount [" << sin->iterCount.getValue()<< "] in 1st iteration."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (myiter > 0 && sin->loopPortIn1.getValue() != myiter) { + std::stringstream ss; + ss << "Test Failure: LoopPortIn1 [" << sin->loopPortIn1.getValue() << "] does not match iterationID- [" << myiter << "] in subsequent iterations."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + + EXECUTE_SIMULATION_MODE + + sout->taskOut1.setValue(sin->taskIn1.getValue()); + sout->isOK.setValue(true); \ No newline at end of file diff --git a/iwir/coderepo/for1/atomic2.code b/iwir/coderepo/for1/atomic2.code new file mode 100755 index 0000000..55ed7ac --- /dev/null +++ b/iwir/coderepo/for1/atomic2.code @@ -0,0 +1,79 @@ + std::cout << "AtomicActivity2:" << std::endl + << "\titerCount: " << sin->iterCount.getValue() << std::endl + << "\toutPortIn1: " << sin->outPortIn1.getValue() << std::endl + << "\toutPortIn2: " << sin->outPortIn2.getValue() << std::endl + << "\tloopPortIn1: " << sin->loopPortIn1.getValue() << std::endl; + if (sin->iterCount.getValue() <= 0) { + #include + std::stringstream ss; + ss << "Test Failure: iterCount [" << sin->iterCount.getValue() << "] is not greater than zero."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->iterCount.getValue() != sin->outPortIn1.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: outPortIn1 [" << sin->outPortIn1.getValue() << "] is not equal iterCount [" << (sin->iterCount.getValue()) << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->iterCount.getValue() != sin->outPortIn2.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: outPortIn2 [" << sin->outPortIn2.getValue() << "] is not equal iterCount [" << (sin->iterCount.getValue()) << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->iterCount.getValue() != sin->loopPortIn1.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: loopPortIn1 [" << sin->loopPortIn1.getValue() << "] is not equal iterCount [" << (sin->iterCount.getValue()) << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->unionPortIn1.getSize() != sin->iterCount.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: unionPortIn1 collection size [" << sin->unionPortIn1.getSize() << "] is not equal iterCount [" << sin->iterCount.getValue() << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + std::cout << "\tunionPortIn1: [ "; + bool isFirst = true; + for (wfr_id_t t = 0; t < sin->unionPortIn1.getSize(); t++) { + if (sin->unionPortIn1.getEntryValue(t) != t+1) { + #include + std::stringstream ss; + ss << "Test Failure: unionPortIn1 collection value index [" << t << "] does not have value [" << sin->unionPortIn1.getEntryValue(t)<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << sin->unionPortIn1.getEntryValue(t); + } + std::cout << " ]" << std::endl; + if (sin->isOkUnion1.getSize() != sin->iterCount.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: isOkUnion1 collection size [" << sin->isOkUnion1.getSize() << "] is not equal iterCount [" << sin->iterCount.getValue() << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + std::cout << "\tisOkUnion1: [ "; + isFirst = true; + for (wfr_id_t t = 0; t < sin->isOkUnion1.getSize(); t++) { + if (!sin->isOkUnion1.getEntryValue(t)) { + #include + std::stringstream ss; + ss << "Test Failure: isOkUnion1 collection value at index [" << t << "] is not true]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << sin->isOkUnion1.getEntryValue(t); + } + std::cout << " ]" << std::endl; + sout->outPortOut1.setValue(sin->outPortIn1.getValue()); + sout->loopPortOut1.setValue(sin->loopPortIn1.getValue()); + sout->unionPortOut1 = sin->unionPortIn1; + sout->isOK.setValue(true); \ No newline at end of file diff --git a/iwir/coderepo/for1/atomic2.properties b/iwir/coderepo/for1/atomic2.properties new file mode 100755 index 0000000..a4cb763 --- /dev/null +++ b/iwir/coderepo/for1/atomic2.properties @@ -0,0 +1,8 @@ + +name=AtomicActivity2 +entries=2 +entry.0=atomic2.code +entry.1=atomic2sim.code +entryname.1=atomic2sim +entrytype.1=pthreads +entrymetadata.1={{\"sim-mode\", \"1\"}} diff --git a/iwir/coderepo/for1/atomic2sim.code b/iwir/coderepo/for1/atomic2sim.code new file mode 100755 index 0000000..d84e9c5 --- /dev/null +++ b/iwir/coderepo/for1/atomic2sim.code @@ -0,0 +1,82 @@ + std::cout << "AtomicActivity2:" << std::endl + << "\titerCount: " << sin->iterCount.getValue() << std::endl + << "\toutPortIn1: " << sin->outPortIn1.getValue() << std::endl + << "\toutPortIn2: " << sin->outPortIn2.getValue() << std::endl + << "\tloopPortIn1: " << sin->loopPortIn1.getValue() << std::endl; + if (sin->iterCount.getValue() <= 0) { + #include + std::stringstream ss; + ss << "Test Failure: iterCount [" << sin->iterCount.getValue() << "] is not greater than zero."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->iterCount.getValue() != sin->outPortIn1.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: outPortIn1 [" << sin->outPortIn1.getValue() << "] is not equal iterCount [" << (sin->iterCount.getValue()) << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->iterCount.getValue() != sin->outPortIn2.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: outPortIn2 [" << sin->outPortIn2.getValue() << "] is not equal iterCount [" << (sin->iterCount.getValue()) << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->iterCount.getValue() != sin->loopPortIn1.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: loopPortIn1 [" << sin->loopPortIn1.getValue() << "] is not equal iterCount [" << (sin->iterCount.getValue()) << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->unionPortIn1.getSize() != sin->iterCount.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: unionPortIn1 collection size [" << sin->unionPortIn1.getSize() << "] is not equal iterCount [" << sin->iterCount.getValue() << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + std::cout << "\tunionPortIn1: [ "; + bool isFirst = true; + for (wfr_id_t t = 0; t < sin->unionPortIn1.getSize(); t++) { + if (sin->unionPortIn1.getEntryValue(t) != t+1) { + #include + std::stringstream ss; + ss << "Test Failure: unionPortIn1 collection value index [" << t << "] does not have value [" << sin->unionPortIn1.getEntryValue(t)<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << sin->unionPortIn1.getEntryValue(t); + } + std::cout << " ]" << std::endl; + if (sin->isOkUnion1.getSize() != sin->iterCount.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: isOkUnion1 collection size [" << sin->isOkUnion1.getSize() << "] is not equal iterCount [" << sin->iterCount.getValue() << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + std::cout << "\tisOkUnion1: [ "; + isFirst = true; + for (wfr_id_t t = 0; t < sin->isOkUnion1.getSize(); t++) { + if (!sin->isOkUnion1.getEntryValue(t)) { + #include + std::stringstream ss; + ss << "Test Failure: isOkUnion1 collection value at index [" << t << "] is not true]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << sin->isOkUnion1.getEntryValue(t); + } + std::cout << " ]" << std::endl; + + EXECUTE_SIMULATION_MODE + + sout->outPortOut1.setValue(sin->outPortIn1.getValue()); + sout->loopPortOut1.setValue(sin->loopPortIn1.getValue()); + sout->unionPortOut1 = sin->unionPortIn1; + sout->isOK.setValue(true); \ No newline at end of file diff --git a/iwir/coderepo/for1/wfInput.code b/iwir/coderepo/for1/wfInput.code new file mode 100755 index 0000000..c43b990 --- /dev/null +++ b/iwir/coderepo/for1/wfInput.code @@ -0,0 +1,2 @@ + wfInput.iterationCount.setValue(2); + \ No newline at end of file diff --git a/iwir/coderepo/for1/wfOutput.code b/iwir/coderepo/for1/wfOutput.code new file mode 100755 index 0000000..9120cd4 --- /dev/null +++ b/iwir/coderepo/for1/wfOutput.code @@ -0,0 +1,39 @@ + /*if (wfOutput.unionPortOut1.getSize() != wfInput.iterationCount.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: unionPortOut1 collection size [" << wfOutput.unionPortOut1.getSize() << "] is not equal iterCount [" << wfInput.iterationCount.getValue() << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (wfOutput.outPortOut1.getValue() != wfInput.iterationCount.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: outPortOut1 value [" << wfOutput.outPortOut1.getValue() << "] is not equal iterCount [" << wfInput.iterationCount.getValue() << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (wfOutput.loopPortOut1.getValue() != wfInput.iterationCount.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: loopPortOut1 value [" << wfOutput.loopPortOut1.getValue() << "] is not equal iterCount [" << wfInput.iterationCount.getValue() << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + }*/ + std::cout << "wfOutput:" << std::endl + << "\toutPortOut1: " << wfOutput.outPortOut1.getValue() << std::endl + << "\tloopPortOut1: " << wfOutput.loopPortOut1.getValue() << std::endl + << "\tisOK: " << wfOutput.isOK.getValue() << std::endl; + std::cout << "\tunionPortOut1: [ "; + bool isFirst = true; + for (wfr_id_t t = 0; t < wfOutput.unionPortOut1.getSize(); t++) { + if (wfOutput.unionPortOut1.getEntryValue(t) != t+1) { + #include + std::stringstream ss; + ss << "Test Failure: unionPortOut1 collection value index [" << t << "] does not have correct value [" << wfOutput.unionPortOut1.getEntryValue(t)<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << wfOutput.unionPortOut1.getEntryValue(t); + } + std::cout << " ]" << std::endl; \ No newline at end of file diff --git a/iwir/coderepo/foreach1.properties b/iwir/coderepo/foreach1.properties new file mode 100755 index 0000000..8fb722c --- /dev/null +++ b/iwir/coderepo/foreach1.properties @@ -0,0 +1,7 @@ + +wfinput=foreach1/wfInput.code +wfoutput=foreach1/wfOutput.code + +atomicTask.0=foreach1/atomic1.properties +atomicTask.1=foreach1/atomic2.properties + diff --git a/iwir/coderepo/foreach1/atomic1.code b/iwir/coderepo/foreach1/atomic1.code new file mode 100755 index 0000000..4315d78 --- /dev/null +++ b/iwir/coderepo/foreach1/atomic1.code @@ -0,0 +1,42 @@ + auto myiter = WFR_SELF_GETITERATIONID(); + std::cout << "AtomicActivity1 [" << myiter << "]:" << std::endl + << "\telements1Count: " << sin->elements1Count.getValue() << std::endl + << "\telement1in: " << sin->element1in.getValue() << std::endl + << "\tloopPort1: " << sin->loopPort1.getValue() << std::endl + << "\telements2Count: " << sin->elements2Count.getValue() << std::endl + << "\telement2in: " << sin->element2in.getValue() << std::endl + << "\tloopPort2: " << sin->loopPort2.getValue() << std::endl; + #include + if (myiter == 0 && sin->elements1Count.getValue() != sin->loopPort1.getValue()) { + std::stringstream ss; + ss << "Test Failure: loopPort1 value [" << sin->loopPort1.getValue() << "] is not equal telements1Count [" << sin->elements1Count.getValue() << "] during first iteration."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (myiter > 0 && myiter != sin->loopPort1.getValue()) { + std::stringstream ss; + ss << "Test Failure: loopPort1 value [" << sin->loopPort1.getValue() << "] is not equal myiter [" << myiter << "] during subsequent iteration."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (myiter == 0 && sin->elements2Count.getValue() != sin->loopPort2.getValue()) { + std::stringstream ss; + ss << "Test Failure: loopPort2 value [" << sin->loopPort2.getValue() << "] is not equal telements2Count [" << sin->elements2Count.getValue() << "] during first iteration."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (myiter > 0 && myiter != sin->loopPort2.getValue()) { + std::stringstream ss; + ss << "Test Failure: loopPort2 value [" << sin->loopPort2.getValue() << "] is not equal myiter [" << myiter << "] during subsequent iteration."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if ( myiter+1 != sin->element1in.getValue()) { + std::stringstream ss; + ss << "Test Failure: element1in value [" << sin->element1in.getValue() << "] is not equal myiter+1 [" << myiter+1 << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if ( myiter+1 != sin->element2in.getValue()) { + std::stringstream ss; + ss << "Test Failure: element2in value [" << sin->element2in.getValue() << "] is not equal myiter+1 [" << myiter+1 << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + sout->element1.setValue(sin->element1in.getValue()); + sout->element2.setValue(sin->element2in.getValue()); + sout->isOk.setValue(true); \ No newline at end of file diff --git a/iwir/coderepo/foreach1/atomic1.properties b/iwir/coderepo/foreach1/atomic1.properties new file mode 100755 index 0000000..f069424 --- /dev/null +++ b/iwir/coderepo/foreach1/atomic1.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity1 +entries=1 +entry.0=atomic1.code diff --git a/iwir/coderepo/foreach1/atomic2.code b/iwir/coderepo/foreach1/atomic2.code new file mode 100755 index 0000000..ee1b9b3 --- /dev/null +++ b/iwir/coderepo/foreach1/atomic2.code @@ -0,0 +1,164 @@ + std::cout << "AtomicActivity2:" << std::endl + << "\telements1Count: " << sin->elements1Count.getValue() << std::endl + << "\telements2Count: " << sin->elements2Count.getValue() << std::endl + << "\tloopPort1: " << sin->loopPort1.getValue() << std::endl + << "\tloopPort2: " << sin->loopPort2.getValue() << std::endl + << "\toutPort1: " << sin->outPort1.getValue() << std::endl + << "\toutPort2: " << sin->outPort2.getValue() << std::endl + << "\toutLoopPort1: " << sin->outLoopPort1.getValue() << std::endl + << "\toutLoopPort2: " << sin->outLoopPort2.getValue() << std::endl; + #include + auto elemMin = std::min(sin->elements1Count.getValue(), sin->elements2Count.getValue()); + if (elemMin <= 0) { + std::stringstream ss; + ss << "Test Failure: elemMin [" << elemMin << "] is not greater than zero."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->loopPort1.getValue() != elemMin) { + std::stringstream ss; + ss << "Test Failure: loopPort1 [" << sin->loopPort1.getValue() << "] is not equal elemMin [" << elemMin << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->loopPort2.getValue() != elemMin) { + std::stringstream ss; + ss << "Test Failure: loopPort2 [" << sin->loopPort2.getValue() << "] is not equal elemMin [" << elemMin << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->outPort1.getValue() != elemMin) { + std::stringstream ss; + ss << "Test Failure: outPort1 [" << sin->outPort1.getValue() << "] is not equal elemMin [" << elemMin << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->outPort2.getValue() != elemMin) { + std::stringstream ss; + ss << "Test Failure: outPort2 [" << sin->outPort2.getValue() << "] is not equal elemMin [" << elemMin << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->outLoopPort1.getValue() != elemMin) { + std::stringstream ss; + ss << "Test Failure: outLoopPort1 [" << sin->outLoopPort1.getValue() << "] is not equal elemMin [" << elemMin << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->outLoopPort2.getValue() != elemMin) { + std::stringstream ss; + ss << "Test Failure: outLoopPort2 [" << sin->outLoopPort2.getValue() << "] is not equal elemMin [" << elemMin << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->elements1orig.getSize() != sin->elements1Count.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: elements1orig collection size [" << sin->elements1orig.getSize() << "] is not equal elements1Count [" << sin->elements1Count.getValue() << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + std::cout << "\telements1orig: [ "; + bool isFirst = true; + for (wfr_id_t t = 0; t < sin->elements1orig.getSize(); t++) { + if (sin->elements1orig.getEntryValue(t) != t+1) { + #include + std::stringstream ss; + ss << "Test Failure: elements1orig collection value index [" << t << "] does not have correct value [" << sin->elements1orig.getEntryValue(t)<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << sin->elements1orig.getEntryValue(t); + } + std::cout << " ]" << std::endl; + if (sin->elements2orig.getSize() != sin->elements2Count.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: elements2orig collection size [" << sin->elements2orig.getSize() << "] is not equal elements2Count [" << sin->elements2Count.getValue() << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + std::cout << "\telements2orig: [ "; + isFirst = true; + for (wfr_id_t t = 0; t < sin->elements2orig.getSize(); t++) { + if (sin->elements2orig.getEntryValue(t) != t+1) { + #include + std::stringstream ss; + ss << "Test Failure: elements2orig collection value index [" << t << "] does not have correct value [" << sin->elements2orig.getEntryValue(t)<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << sin->elements2orig.getEntryValue(t); + } + std::cout << " ]" << std::endl; + if (sin->elements1in.getSize() != elemMin) { + #include + std::stringstream ss; + ss << "Test Failure: elements1in collection size [" << sin->elements1in.getSize() << "] is not equal elemMin [" << elemMin << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + std::cout << "\telements1in: [ "; + isFirst = true; + for (wfr_id_t t = 0; t < sin->elements1in.getSize(); t++) { + if (sin->elements1in.getEntryValue(t) != t+1) { + #include + std::stringstream ss; + ss << "Test Failure: elements1in collection value index [" << t << "] does not have correct value [" << sin->elements1in.getEntryValue(t)<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << sin->elements1in.getEntryValue(t); + } + std::cout << " ]" << std::endl; + if (sin->elements2in.getSize() != elemMin) { + #include + std::stringstream ss; + ss << "Test Failure: elements2in collection size [" << sin->elements2in.getSize() << "] is not equal elemMin [" << elemMin << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + std::cout << "\telements2in: [ "; + isFirst = true; + for (wfr_id_t t = 0; t < sin->elements2in.getSize(); t++) { + if (sin->elements2in.getEntryValue(t) != t+1) { + #include + std::stringstream ss; + ss << "Test Failure: elements2in collection value index [" << t << "] does not have correct value [" << sin->elements2in.getEntryValue(t)<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << sin->elements2in.getEntryValue(t); + } + std::cout << " ]" << std::endl; + if (sin->isOkUnion1.getSize() != elemMin) { + #include + std::stringstream ss; + ss << "Test Failure: isOkUnion1 collection size [" << sin->isOkUnion1.getSize() << "] is not equal elemMin [" << elemMin << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + std::cout << "\tisOkUnion1: [ "; + isFirst = true; + for (wfr_id_t t = 0; t < sin->isOkUnion1.getSize(); t++) { + if (!sin->isOkUnion1.getEntryValue(t)) { + #include + std::stringstream ss; + ss << "Test Failure: isOkUnion1 collection value index [" << t << "] does not have correct value [" << sin->isOkUnion1.getEntryValue(t)<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << sin->isOkUnion1.getEntryValue(t); + } + std::cout << " ]" << std::endl; + sout->elements1 = sin->elements1in; + sout->elements2 = sin->elements2in; + sout->isOK.setValue(true); \ No newline at end of file diff --git a/iwir/coderepo/foreach1/atomic2.properties b/iwir/coderepo/foreach1/atomic2.properties new file mode 100755 index 0000000..5cba370 --- /dev/null +++ b/iwir/coderepo/foreach1/atomic2.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity2 +entries=1 +entry.0=atomic2.code diff --git a/iwir/coderepo/foreach1/wfInput.code b/iwir/coderepo/foreach1/wfInput.code new file mode 100755 index 0000000..f190523 --- /dev/null +++ b/iwir/coderepo/foreach1/wfInput.code @@ -0,0 +1,19 @@ + wfr::lwd::iwir_collection elements1; + elements1.init(4); + elements1.setEntryValue(0, 1); + elements1.setEntryValue(1, 2); + elements1.setEntryValue(2, 3); + elements1.setEntryValue(3, 4); + elements1.setFinalised(true); + wfr::lwd::iwir_collection elements2; + elements2.init(5); + elements2.setEntryValue(0, 1); + elements2.setEntryValue(1, 2); + elements2.setEntryValue(2, 3); + elements2.setEntryValue(3, 4); + elements2.setEntryValue(4, 5); + elements2.setFinalised(true); + wfInput.elements1Count.setValue(elements1.getSize()); + wfInput.gelements1 = elements1; + wfInput.elements2Count.setValue(elements2.getSize()); + wfInput.gelements2 = elements2; \ No newline at end of file diff --git a/iwir/coderepo/foreach1/wfOutput.code b/iwir/coderepo/foreach1/wfOutput.code new file mode 100755 index 0000000..5b2e9b9 --- /dev/null +++ b/iwir/coderepo/foreach1/wfOutput.code @@ -0,0 +1,60 @@ + std::cout << "wfOutput:" << std::endl + << "\tisOk: " << wfOutput.isOK.getValue() << std::endl; + if (!wfOutput.isOK.getValue()) { + std::stringstream ss; + ss << "Test Failure: isOk [" << wfOutput.isOK.getValue() << "] is not true."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + #include + auto elemMin = std::min(wfInput.elements1Count.getValue(), wfInput.elements2Count.getValue()); + if (elemMin <= 0) { + std::stringstream ss; + ss << "Test Failure: elemMin [" << elemMin << "] is not greater than zero."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (wfOutput.elements1.getSize() != elemMin) { + #include + std::stringstream ss; + ss << "Test Failure: elements1 collection size [" << wfOutput.elements1.getSize() << "] is not equal elemMin [" << elemMin << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + std::cout << "\telements1: [ "; + bool isFirst = true; + for (wfr_id_t t = 0; t < wfOutput.elements1.getSize(); t++) { + if (wfOutput.elements1.getEntryValue(t) != t+1) { + #include + std::stringstream ss; + ss << "Test Failure: elements1 collection value index [" << t << "] does not have correct value [" << wfOutput.elements1.getEntryValue(t)<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << wfOutput.elements1.getEntryValue(t); + } + std::cout << " ]" << std::endl; + if (wfOutput.elements2.getSize() != elemMin) { + #include + std::stringstream ss; + ss << "Test Failure: elements2 collection size [" << wfOutput.elements2.getSize() << "] is not equal elemMin [" << elemMin << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + std::cout << "\telements2: [ "; + isFirst = true; + for (wfr_id_t t = 0; t < wfOutput.elements2.getSize(); t++) { + if (wfOutput.elements2.getEntryValue(t) != t+1) { + #include + std::stringstream ss; + ss << "Test Failure: elements2 collection value index [" << t << "] does not have correct value [" << wfOutput.elements2.getEntryValue(t)<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << wfOutput.elements2.getEntryValue(t); + } + std::cout << " ]" << std::endl; \ No newline at end of file diff --git a/iwir/coderepo/if1.properties b/iwir/coderepo/if1.properties new file mode 100755 index 0000000..a74e199 --- /dev/null +++ b/iwir/coderepo/if1.properties @@ -0,0 +1,14 @@ + +wfinput=if1/wfInput.code +wfoutput=if1/wfOutput.code +includes=if1/includes.code + +atomicTask.0=if1/atomic1.properties +atomicTask.1=if1/atomic2.properties +atomicTask.2=if1/atomic3.properties +atomicTask.3=if1/atomic4.properties +atomicTask.4=if1/atomic5.properties +atomicTask.5=if1/atomic6.properties +atomicTask.6=if1/atomic7.properties +atomicTask.7=if1/atomic8.properties + diff --git a/iwir/coderepo/if1/atomic1.code b/iwir/coderepo/if1/atomic1.code new file mode 100755 index 0000000..954b493 --- /dev/null +++ b/iwir/coderepo/if1/atomic1.code @@ -0,0 +1,3 @@ + sout->if1condOut.setValue(sin->if1cond.getValue()); + sout->if1ValueOut.setValue(sin->if1Value.getValue()); + \ No newline at end of file diff --git a/iwir/coderepo/if1/atomic1.properties b/iwir/coderepo/if1/atomic1.properties new file mode 100755 index 0000000..f069424 --- /dev/null +++ b/iwir/coderepo/if1/atomic1.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity1 +entries=1 +entry.0=atomic1.code diff --git a/iwir/coderepo/if1/atomic2.code b/iwir/coderepo/if1/atomic2.code new file mode 100755 index 0000000..f946234 --- /dev/null +++ b/iwir/coderepo/if1/atomic2.code @@ -0,0 +1,16 @@ + std::cout << "AtomicActivity2:" << std::endl + << "\tif1cond: " << sin->if1cond.getValue() << std::endl + << "\tif1value: " << sin->if1Value.getValue() << std::endl; + if (!sin->if1cond.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: if1cond [" << sin->if1cond.getValue() << "] is not true."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->if1Value.getValue() != -1) { + #include + std::stringstream ss; + ss << "Test Failure: if1Value [" << sin->if1Value.getValue() << "] is not -1."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + sout->if1ValueOut.setValue(2); diff --git a/iwir/coderepo/if1/atomic2.properties b/iwir/coderepo/if1/atomic2.properties new file mode 100755 index 0000000..5cba370 --- /dev/null +++ b/iwir/coderepo/if1/atomic2.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity2 +entries=1 +entry.0=atomic2.code diff --git a/iwir/coderepo/if1/atomic3.code b/iwir/coderepo/if1/atomic3.code new file mode 100755 index 0000000..bcc16c7 --- /dev/null +++ b/iwir/coderepo/if1/atomic3.code @@ -0,0 +1,16 @@ + std::cout << "AtomicActivity3:" << std::endl + << "\tif1cond: " << sin->if1Cond.getValue() << std::endl + << "\tif1value: " << sin->if1Value.getValue() << std::endl; + if (sin->if1Cond.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: if1cond [" << sin->if1Cond.getValue() << "] is not false."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->if1Value.getValue() != -1) { + #include + std::stringstream ss; + ss << "Test Failure: if1Value [" << sin->if1Value.getValue() << "] is not -1."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + sout->if1ValueOut.setValue(3); diff --git a/iwir/coderepo/if1/atomic3.properties b/iwir/coderepo/if1/atomic3.properties new file mode 100755 index 0000000..9863629 --- /dev/null +++ b/iwir/coderepo/if1/atomic3.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity3 +entries=1 +entry.0=atomic3.code diff --git a/iwir/coderepo/if1/atomic4.code b/iwir/coderepo/if1/atomic4.code new file mode 100755 index 0000000..2dc16b6 --- /dev/null +++ b/iwir/coderepo/if1/atomic4.code @@ -0,0 +1,16 @@ + std::cout << "AtomicActivity4:" << std::endl + << "\tif2cond: " << sin->if2cond.getValue() << std::endl + << "\tif2value: " << sin->if2value.getValue() << std::endl; + if (!sin->if2cond.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: if2cond [" << sin->if2cond.getValue() << "] is not true."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->if2value.getValue() != -1) { + #include + std::stringstream ss; + ss << "Test Failure: if2Value [" << sin->if2value.getValue() << "] is not -1."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + sout->if2valueOut.setValue(4); diff --git a/iwir/coderepo/if1/atomic4.properties b/iwir/coderepo/if1/atomic4.properties new file mode 100755 index 0000000..e53f51c --- /dev/null +++ b/iwir/coderepo/if1/atomic4.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity4 +entries=1 +entry.0=atomic4.code diff --git a/iwir/coderepo/if1/atomic5.code b/iwir/coderepo/if1/atomic5.code new file mode 100755 index 0000000..37fdad2 --- /dev/null +++ b/iwir/coderepo/if1/atomic5.code @@ -0,0 +1,47 @@ + std::cout << "AtomicActivity5:" << std::endl + << "\tif1cond: " << sin->if1cond.getValue() << std::endl + << "\tif2cond: " << sin->if2cond.getValue() << std::endl + << "\tif3cond: " << sin->if3cond.getValue() << std::endl + << "\tif4cond: " << sin->if4cond.getValue() << std::endl + << "\tif1valueOrig: " << sin->if1valueOrig.getValue() << std::endl + << "\tif1valueOut: " << sin->if1valueOut.getValue() << std::endl + << "\tif2valueOrig: " << sin->if2valueOrig.getValue() << std::endl + << "\tif2valueOut: " << sin->if2valueOut.getValue() << std::endl; + if (sin->if1valueOrig.getValue() != -1) { + #include + std::stringstream ss; + ss << "Test Failure: if1valueOrig [" << sin->if1valueOrig.getValue() << "] is not -1."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->if2valueOrig.getValue() != -1) { + #include + std::stringstream ss; + ss << "Test Failure: if2valueOrig [" << sin->if2valueOrig.getValue() << "] is not -1."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->if1cond.getValue() && sin->if1valueOut.getValue() != 2) { + #include + std::stringstream ss; + ss << "Test Failure: if1valueOut [" << sin->if1valueOut.getValue() << "] is not 2."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } else if (!sin->if1cond.getValue() && sin->if1valueOut.getValue() != 3) { + #include + std::stringstream ss; + ss << "Test Failure: if1valueOut [" << sin->if1valueOut.getValue() << "] is not 3."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->if2cond.getValue() && sin->if2valueOut.getValue() != 4) { + #include + std::stringstream ss; + ss << "Test Failure: if2valueOut [" << sin->if2valueOut.getValue() << "] is not 4."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } else if (!sin->if2cond.getValue() && sin->if2valueOut.getValue() != -1) { + #include + std::stringstream ss; + ss << "Test Failure: if2valueOut [" << sin->if2valueOut.getValue() << "] is not -1."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + sout->if3condOut.setValue(sin->if3cond.getValue()); + sout->if4condOut.setValue(sin->if4cond.getValue()); + sout->isOk.setValue(true); + \ No newline at end of file diff --git a/iwir/coderepo/if1/atomic5.properties b/iwir/coderepo/if1/atomic5.properties new file mode 100755 index 0000000..c97fcfb --- /dev/null +++ b/iwir/coderepo/if1/atomic5.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity5 +entries=1 +entry.0=atomic5.code diff --git a/iwir/coderepo/if1/atomic6.code b/iwir/coderepo/if1/atomic6.code new file mode 100755 index 0000000..141d3f5 --- /dev/null +++ b/iwir/coderepo/if1/atomic6.code @@ -0,0 +1,16 @@ + std::cout << "AtomicActivity6:" << std::endl + << "\tif3cond: " << sin->if3cond.getValue() << std::endl + << "\tif3value: " << sin->if3value.getValue() << std::endl; + if (sin->if3cond.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: if3cond [" << sin->if3cond.getValue() << "] is not false."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->if3value.getValue() != -1) { + #include + std::stringstream ss; + ss << "Test Failure: if3Value [" << sin->if3value.getValue() << "] is not -1."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + sout->if3valueOut.setValue(6); diff --git a/iwir/coderepo/if1/atomic6.properties b/iwir/coderepo/if1/atomic6.properties new file mode 100755 index 0000000..f35a658 --- /dev/null +++ b/iwir/coderepo/if1/atomic6.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity6 +entries=1 +entry.0=atomic6.code diff --git a/iwir/coderepo/if1/atomic7.code b/iwir/coderepo/if1/atomic7.code new file mode 100755 index 0000000..fe4b8c8 --- /dev/null +++ b/iwir/coderepo/if1/atomic7.code @@ -0,0 +1,16 @@ + std::cout << "AtomicActivity7:" << std::endl + << "\tif4cond: " << sin->if4cond.getValue() << std::endl + << "\tif4value: " << sin->if4value.getValue() << std::endl; + if (!sin->if4cond.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: if4cond [" << sin->if4cond.getValue() << "] is not true."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->if4value.getValue() != -1) { + #include + std::stringstream ss; + ss << "Test Failure: if4Value [" << sin->if4value.getValue() << "] is not -1."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + sout->if4valueOut.setValue(7); diff --git a/iwir/coderepo/if1/atomic7.properties b/iwir/coderepo/if1/atomic7.properties new file mode 100755 index 0000000..f17d9e0 --- /dev/null +++ b/iwir/coderepo/if1/atomic7.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity7 +entries=1 +entry.0=atomic7.code diff --git a/iwir/coderepo/if1/atomic8.code b/iwir/coderepo/if1/atomic8.code new file mode 100755 index 0000000..94382f3 --- /dev/null +++ b/iwir/coderepo/if1/atomic8.code @@ -0,0 +1,42 @@ + std::cout << "AtomicActivity8:" << std::endl + << "\tif3cond: " << sin->if3cond.getValue() << std::endl + << "\tif4cond: " << sin->if4cond.getValue() << std::endl + << "\tif3valueOrig: " << sin->if3valueOrig.getValue() << std::endl + << "\tif3valueOut: " << sin->if3valueOut.getValue() << std::endl + << "\tif4valueOrig: " << sin->if4valueOrig.getValue() << std::endl + << "\tif4valueOut: " << sin->if4ValueOut.getValue() << std::endl; + if (sin->if3valueOrig.getValue() != -1) { + #include + std::stringstream ss; + ss << "Test Failure: if3valueOrig [" << sin->if3valueOrig.getValue() << "] is not -1."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->if4valueOrig.getValue() != -1) { + #include + std::stringstream ss; + ss << "Test Failure: if4valueOrig [" << sin->if4valueOrig.getValue() << "] is not -1."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->if3cond.getValue() && sin->if3valueOut.getValue() != -1) { + #include + std::stringstream ss; + ss << "Test Failure: if3valueOut [" << sin->if3valueOut.getValue() << "] is not -1."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } else if (!sin->if3cond.getValue() && sin->if3valueOut.getValue() != 6) { + #include + std::stringstream ss; + ss << "Test Failure: if3valueOut [" << sin->if3valueOut.getValue() << "] is not 6."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->if4cond.getValue() && sin->if4ValueOut.getValue() != 7) { + #include + std::stringstream ss; + ss << "Test Failure: if4valueOut [" << sin->if4ValueOut.getValue() << "] is not 7."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } else if (!sin->if4cond.getValue() && sin->if4ValueOut.getValue() != -1) { + #include + std::stringstream ss; + ss << "Test Failure: if4valueOut [" << sin->if4ValueOut.getValue() << "] is not -1."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + sout->isOk.setValue(true); diff --git a/iwir/coderepo/if1/atomic8.properties b/iwir/coderepo/if1/atomic8.properties new file mode 100755 index 0000000..8e828ac --- /dev/null +++ b/iwir/coderepo/if1/atomic8.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity8 +entries=1 +entry.0=atomic8.code diff --git a/iwir/coderepo/if1/includes.code b/iwir/coderepo/if1/includes.code new file mode 100755 index 0000000..ea1a2da --- /dev/null +++ b/iwir/coderepo/if1/includes.code @@ -0,0 +1,2 @@ +#include +#include \ No newline at end of file diff --git a/iwir/coderepo/if1/wfInput.code b/iwir/coderepo/if1/wfInput.code new file mode 100755 index 0000000..13fc6ec --- /dev/null +++ b/iwir/coderepo/if1/wfInput.code @@ -0,0 +1,47 @@ + + bool isHelp = false; + bool if1Cond = true; + bool if2Cond = true; + bool if3Cond = true; + bool if4Cond = true; + boost::program_options::options_description opts("if1 Options"); + opts.add_options() + ("help", "Print help message.") + ("if1", boost::program_options::value(), "if1 condition") + ("if2", boost::program_options::value(), "if2 condition") + ("if3", boost::program_options::value(), "if3 condition") + ("if4", boost::program_options::value(), "if4 condition"); + boost::program_options::variables_map vm; + auto parsed = boost::program_options::command_line_parser(argc, argv).options(opts).allow_unregistered().run(); + boost::program_options::store(parsed, vm); + boost::program_options::notify(vm); + if (vm.count("help")) { + std::cerr << opts << std::endl; + isHelp = true; + } else { + if (vm.count("if1")) { + if1Cond = vm["if1"].as(); + } + if (vm.count("if2")) { + if2Cond = vm["if2"].as(); + } + if (vm.count("if3")) { + if3Cond = vm["if3"].as(); + } + if (vm.count("if4")) { + if4Cond = vm["if4"].as(); + } + std::cerr << "if1 = " << if1Cond << std::endl; + std::cerr << "if2 = " << if2Cond << std::endl; + std::cerr << "if3 = " << if3Cond << std::endl; + std::cerr << "if4 = " << if4Cond << std::endl; + } + wfInput.if1cond.setValue(if1Cond); + wfInput.if2cond.setValue(if2Cond); + wfInput.if3cond.setValue(if3Cond); + wfInput.if4cond.setValue(if4Cond); + wfInput.if1Value.setValue(-1); + wfInput.if2Value.setValue(-1); + wfInput.if3Value.setValue(-1); + wfInput.if4Value.setValue(-1); + \ No newline at end of file diff --git a/iwir/coderepo/if1/wfOutput.code b/iwir/coderepo/if1/wfOutput.code new file mode 100755 index 0000000..06190f5 --- /dev/null +++ b/iwir/coderepo/if1/wfOutput.code @@ -0,0 +1,63 @@ + std::cout << "wfOutput:" << std::endl + << "\tisOk1: " << wfOutput.isOk1.getValue() << std::endl + << "\tisOk2: " << wfOutput.isOk2.getValue() << std::endl + << "\tif1valueOut: " << wfOutput.if1valueOut.getValue() << std::endl + << "\tif2valueOut: " << wfOutput.if2ValueOut.getValue() << std::endl + << "\tif3valueOut: " << wfOutput.if3ValueOut.getValue() << std::endl + << "\tif4valueOut: " << wfOutput.if4ValueOut.getValue() << std::endl; + if (wfOutput.isOk1.getValue() != true) { + #include + std::stringstream ss; + ss << "Test Failure: isOk1 [" << wfOutput.isOk1.getValue() << "] is not true."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (wfOutput.isOk2.getValue() != true) { + #include + std::stringstream ss; + ss << "Test Failure: isOk2 [" << wfOutput.isOk2.getValue() << "] is not true."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (wfInput.if1cond.getValue() && wfOutput.if1valueOut.getValue() != 2) { + #include + std::stringstream ss; + ss << "Test Failure: if1valueOut [" << wfOutput.if1valueOut.getValue() << "] is not 2."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } else if (!wfInput.if1cond.getValue() && wfOutput.if1valueOut.getValue() != 3) { + #include + std::stringstream ss; + ss << "Test Failure: if1valueOut [" << wfOutput.if1valueOut.getValue() << "] is not 3."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (wfInput.if2cond.getValue() && wfOutput.if2ValueOut.getValue() != 4) { + #include + std::stringstream ss; + ss << "Test Failure: if2valueOut [" << wfOutput.if2ValueOut.getValue() << "] is not 4."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } else if (!wfInput.if2cond.getValue() && wfOutput.if2ValueOut.getValue() != -1) { + #include + std::stringstream ss; + ss << "Test Failure: if2valueOut [" << wfOutput.if2ValueOut.getValue() << "] is not -1."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (wfInput.if3cond.getValue() && wfOutput.if3ValueOut.getValue() != -1) { + #include + std::stringstream ss; + ss << "Test Failure: if3valueOut [" << wfOutput.if3ValueOut.getValue() << "] is not -1."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } else if (!wfInput.if3cond.getValue() && wfOutput.if3ValueOut.getValue() != 6) { + #include + std::stringstream ss; + ss << "Test Failure: if3valueOut [" << wfOutput.if3ValueOut.getValue() << "] is not 6."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (wfInput.if4cond.getValue() && wfOutput.if4ValueOut.getValue() != 7) { + #include + std::stringstream ss; + ss << "Test Failure: if4valueOut [" << wfOutput.if4ValueOut.getValue() << "] is not 7."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } else if (!wfInput.if4cond.getValue() && wfOutput.if4ValueOut.getValue() != -1) { + #include + std::stringstream ss; + ss << "Test Failure: if4valueOut [" << wfOutput.if4ValueOut.getValue() << "] is not -1."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } diff --git a/iwir/coderepo/if2.properties b/iwir/coderepo/if2.properties new file mode 100755 index 0000000..0f1c4e5 --- /dev/null +++ b/iwir/coderepo/if2.properties @@ -0,0 +1,8 @@ + +wfinput=if2/wfInput.code +wfoutput=if2/wfOutput.code + +atomicTask.0=if2/atomic1.properties +atomicTask.1=if2/atomic2.properties +atomicTask.2=if2/atomic3.properties + diff --git a/iwir/coderepo/if2/atomic1.code b/iwir/coderepo/if2/atomic1.code new file mode 100755 index 0000000..75a053e --- /dev/null +++ b/iwir/coderepo/if2/atomic1.code @@ -0,0 +1,10 @@ + std::cout << "AtomicActivity1:" << std::endl + << "\tinput: " << sin->input.getValue() << std::endl; + if (!sin->input.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: input [" << sin->input.getValue() << "] is not true."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + sout->output.setValue(10); + \ No newline at end of file diff --git a/iwir/coderepo/if2/atomic1.properties b/iwir/coderepo/if2/atomic1.properties new file mode 100755 index 0000000..f069424 --- /dev/null +++ b/iwir/coderepo/if2/atomic1.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity1 +entries=1 +entry.0=atomic1.code diff --git a/iwir/coderepo/if2/atomic2.code b/iwir/coderepo/if2/atomic2.code new file mode 100755 index 0000000..5ffc9a6 --- /dev/null +++ b/iwir/coderepo/if2/atomic2.code @@ -0,0 +1,9 @@ + std::cout << "AtomicActivity2:" << std::endl + << "\tinput: " << sin->input.getValue() << std::endl; + if (sin->input.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: input [" << sin->input.getValue() << "] is not false."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + sout->output.setValue(-10); diff --git a/iwir/coderepo/if2/atomic2.properties b/iwir/coderepo/if2/atomic2.properties new file mode 100755 index 0000000..5cba370 --- /dev/null +++ b/iwir/coderepo/if2/atomic2.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity2 +entries=1 +entry.0=atomic2.code diff --git a/iwir/coderepo/if2/atomic3.code b/iwir/coderepo/if2/atomic3.code new file mode 100755 index 0000000..5c1fe38 --- /dev/null +++ b/iwir/coderepo/if2/atomic3.code @@ -0,0 +1,44 @@ + std::cout << "AtomicActivity3:" << std::endl; + if (sin->input.getSize() <= 0) { + #include + std::stringstream ss; + ss << "Test Failure: input size [" << sin->input.getSize() << "] is not greater than zero."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->input.getSize() != sin->gIn1.getSize()) { + #include + std::stringstream ss; + ss << "Test Failure: input [" << sin->input.getSize() << "] and gIn1 [" << sin->gIn1.getSize() << "] differ in size."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + std::cout << "\tgIn1: [ "; + bool isFirst = true; + for (wfr_id_t t = 0; t < sin->gIn1.getSize(); t++) { + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << sin->gIn1.getEntryValue(t); + } + std::cout << " ]" << std::endl; + std::cout << "\tinput: [ "; + isFirst = true; + for (wfr_id_t t = 0; t < sin->input.getSize(); t++) { + if ( (sin->gIn1.getEntryValue(t) && sin->input.getEntryValue(t) != 10) || + (!sin->gIn1.getEntryValue(t) && sin->input.getEntryValue(t) != -10) ) { + #include + std::stringstream ss; + ss << "Test Failure: input [" << sin->input.getEntryValue(t) << "] and gIn1 [" << sin->gIn1.getEntryValue(t) << "] do not match."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << sin->input.getEntryValue(t); + } + std::cout << " ]" << std::endl; + sout->isOk.setValue(true); + \ No newline at end of file diff --git a/iwir/coderepo/if2/atomic3.properties b/iwir/coderepo/if2/atomic3.properties new file mode 100755 index 0000000..9863629 --- /dev/null +++ b/iwir/coderepo/if2/atomic3.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity3 +entries=1 +entry.0=atomic3.code diff --git a/iwir/coderepo/if2/wfInput.code b/iwir/coderepo/if2/wfInput.code new file mode 100755 index 0000000..a345898 --- /dev/null +++ b/iwir/coderepo/if2/wfInput.code @@ -0,0 +1,12 @@ + wfr::lwd::iwir_collection elements1; + elements1.init(8); + elements1.setEntryValue(0, true); + elements1.setEntryValue(1, false); + elements1.setEntryValue(2, true); + elements1.setEntryValue(3, false); + elements1.setEntryValue(4, true); + elements1.setEntryValue(5, false); + elements1.setEntryValue(6, true); + elements1.setEntryValue(7, false); + elements1.setFinalised(true); + wfInput.gIn1 = elements1; \ No newline at end of file diff --git a/iwir/coderepo/if2/wfOutput.code b/iwir/coderepo/if2/wfOutput.code new file mode 100755 index 0000000..a4353ae --- /dev/null +++ b/iwir/coderepo/if2/wfOutput.code @@ -0,0 +1,8 @@ + std::cout << "wfOutput:" << std::endl + << "\tisOk: " << wfOutput.isOk.getValue() << std::endl; + if (!wfOutput.isOk.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: isOk [" << wfOutput.isOk.getValue() << "] is not true."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } diff --git a/iwir/coderepo/pfor1.properties b/iwir/coderepo/pfor1.properties new file mode 100755 index 0000000..5bef604 --- /dev/null +++ b/iwir/coderepo/pfor1.properties @@ -0,0 +1,7 @@ + +wfinput=pfor1/wfInput.code +wfoutput=pfor1/wfOutput.code + +atomicTask.0=pfor1/atomic1.properties +atomicTask.1=pfor1/atomic2.properties + diff --git a/iwir/coderepo/pfor1/atomic1.code b/iwir/coderepo/pfor1/atomic1.code new file mode 100755 index 0000000..f14e5c5 --- /dev/null +++ b/iwir/coderepo/pfor1/atomic1.code @@ -0,0 +1,21 @@ + auto myiter = WFR_SELF_GETITERATIONID(); + std::cout << "AtomicActivity1 [" << myiter << "]:" << std::endl + << "\tin1: " << sin->in1.getValue() << std::endl + << "\tin2: " << sin->in2.getValue() << std::endl; + #include + if (sin->in2.getValue() <= 0) { + std::stringstream ss; + ss << "Test Failure: in2 value [" << sin->in2.getValue() << "] is not greater than zero."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (myiter+1 != sin->in1.getValue()) { + std::stringstream ss; + ss << "Test Failure: in1 value [" << sin->in1.getValue() << "] is not equal to iterationID+1 [" << myiter+1 << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->in1.getValue() > sin->in2.getValue()) { + std::stringstream ss; + ss << "Test Failure: in1 value [" << sin->in1.getValue() << "] is not less equal than in2 value [" << sin->in2.getValue() << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + sout->out1.setValue(sin->in1.getValue()); \ No newline at end of file diff --git a/iwir/coderepo/pfor1/atomic1.properties b/iwir/coderepo/pfor1/atomic1.properties new file mode 100755 index 0000000..f069424 --- /dev/null +++ b/iwir/coderepo/pfor1/atomic1.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity1 +entries=1 +entry.0=atomic1.code diff --git a/iwir/coderepo/pfor1/atomic2.code b/iwir/coderepo/pfor1/atomic2.code new file mode 100755 index 0000000..e465bc0 --- /dev/null +++ b/iwir/coderepo/pfor1/atomic2.code @@ -0,0 +1,32 @@ + std::cout << "AtomicActivity2:" << std::endl + << "\tin1: " << sin->in1.getValue() << std::endl; + #include + if (sin->in1.getValue() <= 0) { + std::stringstream ss; + ss << "Test Failure: in1 value [" << sin->in1.getValue() << "] is not greater than zero."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->in1.getValue() != sin->in2.getSize()) { + std::stringstream ss; + ss << "Test Failure: in2 collection size [" << sin->in2.getSize() << "] is not equal in1 [" << sin->in1.getValue() << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + std::cout << "\tin2: [ "; + bool isFirst = true; + for (wfr_id_t t = 0; t < sin->in2.getSize(); t++) { + if (sin->in2.getEntryValue(t) != t+1) { + #include + std::stringstream ss; + ss << "Test Failure: in2 collection value index [" << t << "] does not has correct value [" << sin->in2.getEntryValue(t)<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << sin->in2.getEntryValue(t); + } + std::cout << " ]" << std::endl; + sout->out1 = sin->in2; + sout->isOk.setValue(true); \ No newline at end of file diff --git a/iwir/coderepo/pfor1/atomic2.properties b/iwir/coderepo/pfor1/atomic2.properties new file mode 100755 index 0000000..5cba370 --- /dev/null +++ b/iwir/coderepo/pfor1/atomic2.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity2 +entries=1 +entry.0=atomic2.code diff --git a/iwir/coderepo/pfor1/wfInput.code b/iwir/coderepo/pfor1/wfInput.code new file mode 100755 index 0000000..61df2dd --- /dev/null +++ b/iwir/coderepo/pfor1/wfInput.code @@ -0,0 +1,2 @@ + wfInput.iterationCount.setValue(4); + \ No newline at end of file diff --git a/iwir/coderepo/pfor1/wfOutput.code b/iwir/coderepo/pfor1/wfOutput.code new file mode 100755 index 0000000..73024b0 --- /dev/null +++ b/iwir/coderepo/pfor1/wfOutput.code @@ -0,0 +1,31 @@ + std::cout << "wfOutput:" << std::endl + << "\tglobalOut1: " << wfOutput.globalOut1.getValue() << std::endl; + if (!wfOutput.globalOut1.getValue()) { + std::stringstream ss; + ss << "Test Failure: globalOut1 [" << wfOutput.globalOut1.getValue() << "] is not true."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + + if (wfOutput.globalOut2.getSize() != wfInput.iterationCount.getValue()) { + #include + std::stringstream ss; + ss << "Test Failure: globalOut2 collection size [" << wfOutput.globalOut2.getSize() << "] is not equal iterationCount [" << wfInput.iterationCount.getValue() << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + std::cout << "\tglobalOut2: [ "; + bool isFirst = true; + for (wfr_id_t t = 0; t < wfOutput.globalOut2.getSize(); t++) { + if (wfOutput.globalOut2.getEntryValue(t) != t+1) { + #include + std::stringstream ss; + ss << "Test Failure: globalOut2 collection value index [" << t << "] does not have correct value [" << wfOutput.globalOut2.getEntryValue(t)<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << wfOutput.globalOut2.getEntryValue(t); + } + std::cout << " ]" << std::endl; \ No newline at end of file diff --git a/iwir/coderepo/pforeach1.properties b/iwir/coderepo/pforeach1.properties new file mode 100755 index 0000000..acb6ec0 --- /dev/null +++ b/iwir/coderepo/pforeach1.properties @@ -0,0 +1,7 @@ + +wfinput=pforeach1/wfInput.code +wfoutput=pforeach1/wfOutput.code + +atomicTask.0=pforeach1/atomic1.properties +atomicTask.1=pforeach1/atomic2.properties + diff --git a/iwir/coderepo/pforeach1/atomic1.code b/iwir/coderepo/pforeach1/atomic1.code new file mode 100755 index 0000000..7a4ba73 --- /dev/null +++ b/iwir/coderepo/pforeach1/atomic1.code @@ -0,0 +1,21 @@ + auto myiter = WFR_SELF_GETITERATIONID(); + std::cout << "AtomicActivity1 [" << myiter << "]:" << std::endl + << "\tin1: " << sin->in1.getValue() << std::endl + << "\tin2: " << sin->in2.getValue() << std::endl; + #include + if (sin->in2.getValue() <= 0) { + std::stringstream ss; + ss << "Test Failure: in2 value [" << sin->in2.getValue() << "] is not greater than zero."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (myiter+1 != sin->in1.getValue()) { + std::stringstream ss; + ss << "Test Failure: in1 value [" << sin->in1.getValue() << "] is not equal to iterationID+1 [" << myiter+1 << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->in1.getValue() > sin->in2.getValue()) { + std::stringstream ss; + ss << "Test Failure: in1 value [" << sin->in1.getValue() << "] is not less/equal than in2 value [" << sin->in2.getValue() << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + sout->out1.setValue(sin->in1.getValue()); \ No newline at end of file diff --git a/iwir/coderepo/pforeach1/atomic1.properties b/iwir/coderepo/pforeach1/atomic1.properties new file mode 100755 index 0000000..f069424 --- /dev/null +++ b/iwir/coderepo/pforeach1/atomic1.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity1 +entries=1 +entry.0=atomic1.code diff --git a/iwir/coderepo/pforeach1/atomic2.code b/iwir/coderepo/pforeach1/atomic2.code new file mode 100755 index 0000000..f597afb --- /dev/null +++ b/iwir/coderepo/pforeach1/atomic2.code @@ -0,0 +1,32 @@ + std::cout << "AtomicActivity2:" << std::endl + << "\tin2: " << sin->in2.getValue() << std::endl; + #include + if (sin->in2.getValue() <= 0) { + std::stringstream ss; + ss << "Test Failure: in2 value [" << sin->in2.getValue() << "] is not greater than zero."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->in2.getValue() != sin->in1.getSize()) { + std::stringstream ss; + ss << "Test Failure: in1 collection size [" << sin->in1.getSize() << "] is not equal in2 [" << sin->in2.getValue() << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + std::cout << "\tin1: [ "; + bool isFirst = true; + for (wfr_id_t t = 0; t < sin->in1.getSize(); t++) { + if (sin->in1.getEntryValue(t) != t+1) { + #include + std::stringstream ss; + ss << "Test Failure: in1 collection value index [" << t << "] does not have correct value [" << sin->in1.getEntryValue(t)<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << sin->in1.getEntryValue(t); + } + std::cout << " ]" << std::endl; + sout->out1 = sin->in1; + sout->isOk.setValue(true); \ No newline at end of file diff --git a/iwir/coderepo/pforeach1/atomic2.properties b/iwir/coderepo/pforeach1/atomic2.properties new file mode 100755 index 0000000..5cba370 --- /dev/null +++ b/iwir/coderepo/pforeach1/atomic2.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity2 +entries=1 +entry.0=atomic2.code diff --git a/iwir/coderepo/pforeach1/wfInput.code b/iwir/coderepo/pforeach1/wfInput.code new file mode 100755 index 0000000..716b068 --- /dev/null +++ b/iwir/coderepo/pforeach1/wfInput.code @@ -0,0 +1,9 @@ + wfr::lwd::iwir_collection elements1; + elements1.init(4); + elements1.setEntryValue(0, 1); + elements1.setEntryValue(1, 2); + elements1.setEntryValue(2, 3); + elements1.setEntryValue(3, 4); + elements1.setFinalised(true); + wfInput.globalIn1 = elements1; + wfInput.globalIn2.setValue(elements1.getSize()); \ No newline at end of file diff --git a/iwir/coderepo/pforeach1/wfOutput.code b/iwir/coderepo/pforeach1/wfOutput.code new file mode 100755 index 0000000..5742cac --- /dev/null +++ b/iwir/coderepo/pforeach1/wfOutput.code @@ -0,0 +1,31 @@ + std::cout << "wfOutput:" << std::endl + << "\tisOK: " << wfOutput.isOK.getValue() << std::endl; + if (!wfOutput.isOK.getValue()) { + std::stringstream ss; + ss << "Test Failure: isOK [" << wfOutput.isOK.getValue() << "] is not true."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + + if (wfOutput.globalOut1.getSize() != wfInput.globalIn1.getSize()) { + #include + std::stringstream ss; + ss << "Test Failure: globalOut1 collection size [" << wfOutput.globalOut1.getSize() << "] is not equal globalIn1 size [" << wfInput.globalIn1.getSize() << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + std::cout << "\tglobalOut1: [ "; + bool isFirst = true; + for (wfr_id_t t = 0; t < wfOutput.globalOut1.getSize(); t++) { + if (wfOutput.globalOut1.getEntryValue(t) != wfInput.globalIn1.getEntryValue(t)) { + #include + std::stringstream ss; + ss << "Test Failure: globalOut1 collection value index [" << t << "] does not have correct value [" << wfOutput.globalOut1.getEntryValue(t)<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << wfOutput.globalOut1.getEntryValue(t); + } + std::cout << " ]" << std::endl; \ No newline at end of file diff --git a/iwir/coderepo/sparselu-wfr.properties b/iwir/coderepo/sparselu-wfr.properties new file mode 100755 index 0000000..9f26225 --- /dev/null +++ b/iwir/coderepo/sparselu-wfr.properties @@ -0,0 +1,8 @@ + +includes=sparselu/includes.code + +atomicTask.0=sparselu/atomic1.properties +atomicTask.1=sparselu/atomic2.properties +atomicTask.2=sparselu/atomic3.properties +atomicTask.3=sparselu/atomic4.properties + diff --git a/iwir/coderepo/sparselu/atomic1.code b/iwir/coderepo/sparselu/atomic1.code new file mode 100755 index 0000000..7193c8c --- /dev/null +++ b/iwir/coderepo/sparselu/atomic1.code @@ -0,0 +1,5 @@ + float** BENCH = sin->BENCH.getValue(); + int bots_arg_size = sin->bots_arg_size.getValue(); + int kk = sin->kk.getValue(); + lu0(BENCH[kk*bots_arg_size+kk]); + sout->BENCHout.setValue(BENCH); \ No newline at end of file diff --git a/iwir/coderepo/sparselu/atomic1.properties b/iwir/coderepo/sparselu/atomic1.properties new file mode 100755 index 0000000..cea6877 --- /dev/null +++ b/iwir/coderepo/sparselu/atomic1.properties @@ -0,0 +1,4 @@ + +name=lu0 +entries=1 +entry.0=atomic1.code diff --git a/iwir/coderepo/sparselu/atomic2.code b/iwir/coderepo/sparselu/atomic2.code new file mode 100755 index 0000000..0830ec0 --- /dev/null +++ b/iwir/coderepo/sparselu/atomic2.code @@ -0,0 +1,17 @@ + float** BENCH = sin->BENCH.getValue(); + int bots_arg_size = sin->bots_arg_size.getValue(); + int kk = sin->kk.getValue(); + int tmax = sin->tmax.getValue(); + int t = sin->tindex.getValue(); + int itercount = bots_arg_size - (kk+1); + int iterslice = itercount / (tmax+1); + int start = kk+1 + iterslice*t; + int stop = kk+1 + iterslice*(t+1); + if (t == tmax-1 && stop != bots_arg_size) { + stop = bots_arg_size; + } + for (int jj=start; jjBENCHout.setValue(BENCH); \ No newline at end of file diff --git a/iwir/coderepo/sparselu/atomic2.properties b/iwir/coderepo/sparselu/atomic2.properties new file mode 100755 index 0000000..618b019 --- /dev/null +++ b/iwir/coderepo/sparselu/atomic2.properties @@ -0,0 +1,4 @@ + +name=fwd +entries=1 +entry.0=atomic2.code diff --git a/iwir/coderepo/sparselu/atomic3.code b/iwir/coderepo/sparselu/atomic3.code new file mode 100755 index 0000000..e8dbd89 --- /dev/null +++ b/iwir/coderepo/sparselu/atomic3.code @@ -0,0 +1,18 @@ + float** BENCH = sin->BENCH.getEntryValue(0); + int bots_arg_size = sin->bots_arg_size.getValue(); + int kk = sin->kk.getValue(); + int tmax = sin->tmax.getValue(); + int t = sin->tindex.getValue(); + int itercount = bots_arg_size - (kk+1); + int iterslice = itercount / (tmax+1); + int start = kk+1 + iterslice*t; + int stop = kk+1 + iterslice*(t+1); + if (t == tmax-1 && stop != bots_arg_size) { + stop = bots_arg_size; + } + for (int ii=start; iiBENCHout.setValue(BENCH); \ No newline at end of file diff --git a/iwir/coderepo/sparselu/atomic3.properties b/iwir/coderepo/sparselu/atomic3.properties new file mode 100755 index 0000000..88b2a10 --- /dev/null +++ b/iwir/coderepo/sparselu/atomic3.properties @@ -0,0 +1,4 @@ + +name=bdiv +entries=1 +entry.0=atomic3.code diff --git a/iwir/coderepo/sparselu/atomic4.code b/iwir/coderepo/sparselu/atomic4.code new file mode 100755 index 0000000..493374d --- /dev/null +++ b/iwir/coderepo/sparselu/atomic4.code @@ -0,0 +1,22 @@ + float** BENCH = sin->BENCH.getEntryValue(0); + int bots_arg_size = sin->bots_arg_size.getValue(); + int kk = sin->kk.getValue(); + int tmax = sin->tmax.getValue(); + int t = sin->tindex.getValue(); + int itercount = bots_arg_size - (kk+1); + int iterslice = itercount / (tmax+1); + int start = kk+1 + iterslice*t; + int stop = kk+1 + iterslice*(t+1); + if (t == tmax-1 && stop != bots_arg_size) { + stop = bots_arg_size; + } + for (int ii=start; iiBENCHout.setValue(BENCH); \ No newline at end of file diff --git a/iwir/coderepo/sparselu/atomic4.properties b/iwir/coderepo/sparselu/atomic4.properties new file mode 100755 index 0000000..8a2675b --- /dev/null +++ b/iwir/coderepo/sparselu/atomic4.properties @@ -0,0 +1,4 @@ + +name=bmod +entries=1 +entry.0=atomic4.code diff --git a/iwir/coderepo/sparselu/includes.code b/iwir/coderepo/sparselu/includes.code new file mode 100755 index 0000000..fe84772 --- /dev/null +++ b/iwir/coderepo/sparselu/includes.code @@ -0,0 +1 @@ +#include "sparselu.h" \ No newline at end of file diff --git a/iwir/coderepo/wavefront.properties b/iwir/coderepo/wavefront.properties new file mode 100755 index 0000000..098ca1d --- /dev/null +++ b/iwir/coderepo/wavefront.properties @@ -0,0 +1,7 @@ + +wfinput=wavefront/wfInput.code +wfoutput=wavefront/wfOutput.code +includes=wavefront/includes.code + +atomicTask.0=wavefront/atomic1.properties + diff --git a/iwir/coderepo/wavefront/atomic1.code b/iwir/coderepo/wavefront/atomic1.code new file mode 100755 index 0000000..315d5ed --- /dev/null +++ b/iwir/coderepo/wavefront/atomic1.code @@ -0,0 +1,23 @@ + #define Idx2D(x, y) (x)*(N+1)+(y) + double* mat_a = sin->mat_a.getValue(); + long chunksize = sin->chunksize.getValue(); + long N = sin->N.getValue(); + long i_min = sin->i.getValue(); + long i_max = std::min(i_min + chunksize, 2*N-2); + //fprintf(stderr, "i = [%d, %d)\n", i_min, i_max); + for(long i=i_min; iresult.setValue(mat_a); diff --git a/iwir/coderepo/wavefront/atomic1.properties b/iwir/coderepo/wavefront/atomic1.properties new file mode 100755 index 0000000..dcb69ff --- /dev/null +++ b/iwir/coderepo/wavefront/atomic1.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity +entries=1 +entry.0=atomic1.code diff --git a/iwir/coderepo/wavefront/includes.code b/iwir/coderepo/wavefront/includes.code new file mode 100755 index 0000000..83324fb --- /dev/null +++ b/iwir/coderepo/wavefront/includes.code @@ -0,0 +1,2 @@ +#include +#include \ No newline at end of file diff --git a/iwir/coderepo/wavefront/wfInput.code b/iwir/coderepo/wavefront/wfInput.code new file mode 100755 index 0000000..2d33a68 --- /dev/null +++ b/iwir/coderepo/wavefront/wfInput.code @@ -0,0 +1,63 @@ + long N = 2000; + long iterMax = 100; + long chunksize = -1; + bool isHelp = false; + bool disableCheck = false; + boost::program_options::options_description opts("Wavefront Options"); + opts.add_options() + ("help", "Print help message.") + ("itermax", boost::program_options::value(), "Iteration count.") + ("n", boost::program_options::value(), "Array size (n+1 x n+1).") + ("chunksize", boost::program_options::value(), "Chunk size.") + ("disable-check", "Don't check for correctness."); + boost::program_options::variables_map vm; + auto parsed = boost::program_options::command_line_parser(argc, argv).options(opts).allow_unregistered().run(); + boost::program_options::store(parsed, vm); + boost::program_options::notify(vm); + if (vm.count("help")) { + std::cerr << opts << std::endl; + isHelp = true; + } else { + if (vm.count("itermax")) { + iterMax = vm["itermax"].as(); + } + if (vm.count("n")) { + N = vm["n"].as(); + } + if (vm.count("chunksize")) { + chunksize = vm["chunksize"].as(); + } + if (vm.count("disable-check")) { + disableCheck = true; + } + } + long _2N2 = 2*N-2; + if (chunksize <= 0) { + chunksize = (_2N2/8)+1; + } + if (!isHelp) { + std::cerr << "itermax = " << iterMax << std::endl; + std::cerr << "N = " << N << std::endl; + std::cerr << "chunksize = " << chunksize << std::endl; + if (disableCheck) { + std::cerr << "disableCheck = true" << std::endl; + } else { + std::cerr << "disableCheck = false" << std::endl; + } + } + wfInput.iterMax.setValue(iterMax); + wfInput.N.setValue(N); + wfInput._2N2.setValue(_2N2); + wfInput.chunksize.setValue(chunksize); + #define Idx2D(x, y) (x)*(N+1)+(y) + double* mat_a = (double*)malloc(sizeof(double)*(N+1)*(N+1)); + double* mat_b = (double*)malloc(sizeof(double)*(N+1)*(N+1)); + //srand(time(NULL)); + srand(20); + for(int i=0; i + std::stringstream ss; + ss << "Test Failure: nok [" << nok << "] is not zero."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + } \ No newline at end of file diff --git a/iwir/coderepo/while1.properties b/iwir/coderepo/while1.properties new file mode 100755 index 0000000..8d25d7f --- /dev/null +++ b/iwir/coderepo/while1.properties @@ -0,0 +1,7 @@ + +wfinput=while1/wfInput.code +wfoutput=while1/wfOutput.code + +atomicTask.0=while1/atomic1.properties +atomicTask.1=while1/atomic2.properties + diff --git a/iwir/coderepo/while1/atomic1.code b/iwir/coderepo/while1/atomic1.code new file mode 100755 index 0000000..da40fa7 --- /dev/null +++ b/iwir/coderepo/while1/atomic1.code @@ -0,0 +1,21 @@ + auto myiter = WFR_SELF_GETITERATIONID(); + std::cout << "AtomicActivity1 [" << myiter << "]:" << std::endl + << "\titerCount: " << sin->iterCount.getValue() << std::endl + << "\tloopPortIn1: " << sin->loopPortIn1.getValue() << std::endl; + #include + if (myiter != sin->loopPortIn1.getValue()) { + std::stringstream ss; + ss << "Test Failure: IterationID [" << myiter << "] does not match loopPortIn1 [" << sin->loopPortIn1.getValue()<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->iterCount.getValue() <= 0) { + std::stringstream ss; + ss << "Test Failure: iterCount [" << sin->iterCount.getValue() << "] is not greater than zero."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->iterCount.getValue() < sin->loopPortIn1.getValue()) { + std::stringstream ss; + ss << "Test Failure: loopPortIn1 [" << sin->loopPortIn1.getValue() << "] is greater than iterCount [" << sin->iterCount.getValue() << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + sout->taskOut1.setValue(sin->loopPortIn1.getValue()+1); \ No newline at end of file diff --git a/iwir/coderepo/while1/atomic1.properties b/iwir/coderepo/while1/atomic1.properties new file mode 100755 index 0000000..f069424 --- /dev/null +++ b/iwir/coderepo/while1/atomic1.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity1 +entries=1 +entry.0=atomic1.code diff --git a/iwir/coderepo/while1/atomic2.code b/iwir/coderepo/while1/atomic2.code new file mode 100755 index 0000000..96e48c0 --- /dev/null +++ b/iwir/coderepo/while1/atomic2.code @@ -0,0 +1,28 @@ + std::cout << "AtomicActivity2:" << std::endl + << "\titerCount: " << sin->iterCount.getValue() << std::endl + << "\tin1: " << sin->in1.getValue() << std::endl + << "\tin3: " << sin->in3.getValue() << std::endl + << "\tin4: " << sin->in4.getValue() << std::endl; + if (sin->iterCount.getValue() <= 0) { + std::stringstream ss; + ss << "Test Failure: iterCount [" << sin->iterCount.getValue() << "] is not greater than zero."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->iterCount.getValue()+1 != sin->in1.getValue()) { + std::stringstream ss; + ss << "Test Failure: in1 [" << sin->in1.getValue() << "] is not equal iterCount+1."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->iterCount.getValue()+1 != sin->in3.getValue()) { + std::stringstream ss; + ss << "Test Failure: in3 [" << sin->in3.getValue() << "] is not equal iterCount+1."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (sin->iterCount.getValue()+1 != sin->in4.getValue()) { + std::stringstream ss; + ss << "Test Failure: in4 [" << sin->in4.getValue() << "] is not equal iterCount+1."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + sout->out1.setValue(sin->in1.getValue()); + sout->out2 = sin->in2; + sout->isOK.setValue(true); \ No newline at end of file diff --git a/iwir/coderepo/while1/atomic2.properties b/iwir/coderepo/while1/atomic2.properties new file mode 100755 index 0000000..5cba370 --- /dev/null +++ b/iwir/coderepo/while1/atomic2.properties @@ -0,0 +1,4 @@ + +name=AtomicActivity2 +entries=1 +entry.0=atomic2.code diff --git a/iwir/coderepo/while1/wfInput.code b/iwir/coderepo/while1/wfInput.code new file mode 100755 index 0000000..761951c --- /dev/null +++ b/iwir/coderepo/while1/wfInput.code @@ -0,0 +1,3 @@ + wfInput.iterationStart.setValue(0); + wfInput.iterationCount.setValue(4); + \ No newline at end of file diff --git a/iwir/coderepo/while1/wfOutput.code b/iwir/coderepo/while1/wfOutput.code new file mode 100755 index 0000000..c3c50af --- /dev/null +++ b/iwir/coderepo/while1/wfOutput.code @@ -0,0 +1,26 @@ + std::cout << "wfOutput:" << std::endl + << "\tglobalOut1: " << wfOutput.globalOut1.getValue() << std::endl + << "\tisOK: " << wfOutput.isOK.getValue() << std::endl; + std::cout << "\tglobalOut2: [ "; + bool isFirst = true; + for (wfr_id_t t = 0; t < wfOutput.globalOut2.getSize(); t++) { + if (wfOutput.globalOut2.getEntryValue(t) != t+1) { + #include + std::stringstream ss; + ss << "Test Failure: globalOut2 collection value index [" << t << "] does not have correct value [" << wfOutput.globalOut2.getEntryValue(t)<< "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } + if (isFirst) { + isFirst = false; + } else { + std::cout << ", "; + } + std::cout << wfOutput.globalOut2.getEntryValue(t); + } + std::cout << " ]" << std::endl; + if (wfOutput.globalOut2.getSize() != wfInput.iterationCount.getValue()+1) { + #include + std::stringstream ss; + ss << "Test Failure: globalOut2 size [" << wfOutput.globalOut2.getSize() << "] is not equal iterationCount+1 [" << wfInput.iterationCount.getValue()+1 << "]."; + throw wfr::exception::wfr_fatal_error(ss.str()); + } \ No newline at end of file diff --git a/iwir/for1.iwir b/iwir/for1.iwir new file mode 100755 index 0000000..f92f104 --- /dev/null +++ b/iwir/for1.iwir @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/iwir/foreach1.iwir b/iwir/foreach1.iwir new file mode 100755 index 0000000..434f668 --- /dev/null +++ b/iwir/foreach1.iwir @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/iwir/if1.iwir b/iwir/if1.iwir new file mode 100755 index 0000000..b2442dc --- /dev/null +++ b/iwir/if1.iwir @@ -0,0 +1,227 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + if1cond = true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + if2cond = true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + if4cond = true + + + + + + + + + + + + + + + + + + + + + + + + + + + if3cond = true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/iwir/if2.iwir b/iwir/if2.iwir new file mode 100755 index 0000000..9a2f576 --- /dev/null +++ b/iwir/if2.iwir @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + input = true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/iwir/pfor1.iwir b/iwir/pfor1.iwir new file mode 100755 index 0000000..763e46a --- /dev/null +++ b/iwir/pfor1.iwir @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/iwir/pforeach1.iwir b/iwir/pforeach1.iwir new file mode 100755 index 0000000..a04150d --- /dev/null +++ b/iwir/pforeach1.iwir @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/iwir/sparselu-wfr.iwir b/iwir/sparselu-wfr.iwir new file mode 100755 index 0000000..0268ed3 --- /dev/null +++ b/iwir/sparselu-wfr.iwir @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/iwir/wavefront.iwir b/iwir/wavefront.iwir new file mode 100755 index 0000000..9d5f3b1 --- /dev/null +++ b/iwir/wavefront.iwir @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/iwir/while1.iwir b/iwir/while1.iwir new file mode 100755 index 0000000..548f3f5 --- /dev/null +++ b/iwir/while1.iwir @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + whileLoopPort1 <= iterCount + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/.directory b/src/.directory new file mode 100755 index 0000000..64c390c --- /dev/null +++ b/src/.directory @@ -0,0 +1,4 @@ +[Dolphin] +Timestamp=2015,3,24,17,3,20 +Version=3 +ViewMode=1 diff --git a/src/sparselu/app-desc.h b/src/sparselu/app-desc.h new file mode 100755 index 0000000..d8428b3 --- /dev/null +++ b/src/sparselu/app-desc.h @@ -0,0 +1,53 @@ +/**********************************************************************************************/ +/* This program is part of the Barcelona OpenMP Tasks Suite */ +/* Copyright (C) 2009 Barcelona Supercomputing Center - Centro Nacional de Supercomputacion */ +/* Copyright (C) 2009 Universitat Politecnica de Catalunya */ +/* */ +/* This program is free software; you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation; either version 2 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +/**********************************************************************************************/ + +#include "omp-tasks-app.h" + +#define BOTS_APP_NAME "SparseLU (For version)" +#define BOTS_APP_PARAMETERS_DESC "S1=%dx%d, S2=%dx%d" +#define BOTS_APP_PARAMETERS_LIST ,bots_arg_size,bots_arg_size,bots_arg_size_1,bots_arg_size_1 + +#define BOTS_APP_USES_ARG_SIZE +#define BOTS_APP_DEF_ARG_SIZE 50 +#define BOTS_APP_DESC_ARG_SIZE "Matrix Size" + +#define BOTS_APP_USES_ARG_SIZE_1 +#define BOTS_APP_DEF_ARG_SIZE_1 100 +#define BOTS_APP_DESC_ARG_SIZE_1 "Submatrix Size" + +#define BOTS_APP_INIT float **SEQ,**BENCH; + +void sparselu_init(float ***pM, char *pass); +void sparselu_fini(float **M, char *pass); +void sparselu_seq_call(float **SEQ); +void sparselu_par_call(float **BENCH, int argc, char* argv[]); +int sparselu_check(float **SEQ, float **BENCH); + +#define KERNEL_INIT sparselu_init(&BENCH,"benchmark"); +#define KERNEL_CALL sparselu_par_call(BENCH, argc, argv); +#define KERNEL_FINI sparselu_fini(BENCH,"benchmark"); + +#define KERNEL_SEQ_INIT sparselu_init(&SEQ,"serial"); +#define KERNEL_SEQ_CALL sparselu_seq_call(SEQ); +#define KERNEL_SEQ_FINI sparselu_fini(SEQ,"serial"); + +#define BOTS_APP_CHECK_USES_SEQ_RESULT +#define KERNEL_CHECK sparselu_check(SEQ,BENCH); + diff --git a/src/sparselu/bots.h b/src/sparselu/bots.h new file mode 100755 index 0000000..ba2169a --- /dev/null +++ b/src/sparselu/bots.h @@ -0,0 +1,113 @@ +/**********************************************************************************************/ +/* This program is part of the Barcelona OpenMP Tasks Suite */ +/* Copyright (C) 2009 Barcelona Supercomputing Center - Centro Nacional de Supercomputacion */ +/* Copyright (C) 2009 Universitat Politecnica de Catalunya */ +/* */ +/* This program is free software; you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation; either version 2 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +/**********************************************************************************************/ + +#ifndef _BOTS_H_ + +#include +#include + +/* common flags */ +extern int bots_sequential_flag; +extern int bots_benchmark_flag; +extern int bots_check_flag; +extern int bots_result; +extern int bots_output_format; +extern int bots_print_header; +extern int bots_print_times; +/* common variables */ +extern char bots_name[]; +extern char bots_parameters[]; +extern char bots_model[]; +extern char bots_resources[]; +/* compile and execution information */ +extern char bots_exec_date[]; +extern char bots_exec_message[]; +extern char bots_comp_date[]; +extern char bots_comp_message[]; +extern char bots_cc[]; +extern char bots_cflags[]; +extern char bots_ld[]; +extern char bots_ldflags[]; +/* time variables */ +extern double bots_time_program; +extern double bots_time_sequential; + +/* number of tasks variable */ +extern unsigned long long bots_number_of_tasks; /* forcing 8 bytes size on -m32 and -m64 */ + +extern char bots_cutoff[]; +extern int bots_cutoff_value; + +extern int bots_app_cutoff_value; +extern int bots_app_cutoff_value_1; +extern int bots_app_cutoff_value_2; + +extern int bots_arg_size; +extern int bots_arg_size_1; +extern int bots_arg_size_2; + +/* function could be used in app. code but are implemented in bots_common.c */ +long bots_usecs(); +void bots_error(int error, char *message); +void bots_warning(int warning, char *message); + +#define BOTS_RESULT_NA 0 +#define BOTS_RESULT_SUCCESSFUL 1 +#define BOTS_RESULT_UNSUCCESSFUL 2 +#define BOTS_RESULT_NOT_REQUESTED 3 + + +typedef enum { BOTS_VERBOSE_NONE=0, + BOTS_VERBOSE_DEFAULT, + BOTS_VERBOSE_DEBUG } bots_verbose_mode_t; + +extern bots_verbose_mode_t bots_verbose_mode; + +#define bots_message(msg, ...) \ + {\ + if ( bots_verbose_mode >= BOTS_VERBOSE_DEFAULT ) {\ + fprintf(stdout, msg , ##__VA_ARGS__);\ + }\ + } + +#ifdef BOTS_DEBUG +#define bots_debug(msg, ...) \ + {\ + if ( bots_verbose_mode >= BOTS_VERBOSE_DEBUG ) {\ + fprintf(stdout, msg , ##__VA_ARGS__);\ + }\ + } +#define bots_debug_with_location_info(msg, ...) \ + {\ + if ( bots_verbose_mode >= BOTS_VERBOSE_DEBUG ) {\ + fprintf(stdout, "%s:%d:%s:" msg ,__FILE__, __LINE__,__func__,##__VA_ARGS__);\ + }\ + } +#else +#define bots_debug(msg, ...) +#define bots_debug_with_location_info(msg, ...) +#endif + +#define FALSE 0 +#define TRUE 1 + +#endif + + diff --git a/src/sparselu/bots_common.cpp b/src/sparselu/bots_common.cpp new file mode 100755 index 0000000..cc8984a --- /dev/null +++ b/src/sparselu/bots_common.cpp @@ -0,0 +1,346 @@ +/**********************************************************************************************/ +/* This program is part of the Barcelona OpenMP Tasks Suite */ +/* Copyright (C) 2009 Barcelona Supercomputing Center - Centro Nacional de Supercomputacion */ +/* Copyright (C) 2009 Universitat Politecnica de Catalunya */ +/* */ +/* This program is free software; you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation; either version 2 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +/**********************************************************************************************/ + +#include +#include +#include +#include +#include +#include +#ifndef _WIN32 + #include + #include +#endif + + +#include "bots_common.h" +#include "bots_main.h" +#include "bots.h" + +void +bots_error(int error, char *message) +{ + if (message == NULL) + { + switch(error) + { + case BOTS_ERROR: + fprintf(stderr, "Error (%d): %s\n",error,"Unspecified error."); + break; + case BOTS_ERROR_NOT_ENOUGH_MEMORY: + fprintf(stderr, "Error (%d): %s\n",error,"Not enough memory."); + break; + case BOTS_ERROR_UNRECOGNIZED_PARAMETER: + fprintf(stderr, "Error (%d): %s\n",error,"Unrecognized parameter."); + bots_print_usage(); + break; + default: + fprintf(stderr, "Error (%d): %s\n",error,"Invalid error code."); + break; + } + } + else fprintf(stderr, "Error (%d): %s\n",error,message); + exit(100+error); +} + +void +bots_warning(int warning, char *message) +{ + if (message == NULL) + { + switch(warning) + { + case BOTS_WARNING: + fprintf(stderr, "Warning (%d): %s\n",warning,"Unspecified warning."); + break; + default: + fprintf(stderr, "Warning (%d): %s\n",warning,"Invalid warning code."); + break; + } + } + else fprintf(stderr, "Warning (%d): %s\n",warning,message); +} + +long bots_usecs (void) +{ + struct timeval t; + gettimeofday(&t,NULL); + return t.tv_sec*1000000+t.tv_usec; +} + +void +bots_get_date(char *str) +{ + time_t now; + time(&now); + strftime(str, 32, "%Y/%m/%d;%H:%M", gmtime(&now)); +} + +void bots_get_architecture(char *str) +{ + #ifdef _WIN32 + str = "Win32"; + #else + int ncpus = sysconf(_SC_NPROCESSORS_CONF); + struct utsname architecture; + uname(&architecture); + snprintf(str, BOTS_TMP_STR_SZ, "%s-%s;%d" ,architecture.sysname, architecture.machine, ncpus); + #endif +} + +#if defined (DISABLED_FOR_INSIEME_TEST) +//#if defined (__linux) +/* ****************************************************************** */ +void bots_get_load_average(char *str) +{ + double loadavg[3]; + getloadavg (loadavg, 3); + snprintf(str, BOTS_TMP_STR_SZ, "%.2f;%.2f;%.2f",loadavg[0],loadavg[1],loadavg[2]); +} +#else +/* ****************************************************************** */ +void bots_get_load_average(char *str) { sprintf(str,";;"); } +#endif + +void bots_print_results() +{ + char str_name[BOTS_TMP_STR_SZ]; + char str_parameters[BOTS_TMP_STR_SZ]; + char str_model[BOTS_TMP_STR_SZ]; + char str_resources[BOTS_TMP_STR_SZ]; + char str_result[15]; + char str_time_program[15]; + char str_time_sequential[15]; + char str_speed_up[15]; + char str_number_of_tasks[15]; + char str_number_of_tasks_per_second[15]; + char str_exec_date[BOTS_TMP_STR_SZ]; + char str_exec_message[BOTS_TMP_STR_SZ]; + char str_architecture[BOTS_TMP_STR_SZ]; + char str_load_avg[BOTS_TMP_STR_SZ]; + char str_comp_date[BOTS_TMP_STR_SZ]; + char str_comp_message[BOTS_TMP_STR_SZ]; + char str_cc[BOTS_TMP_STR_SZ]; + char str_cflags[BOTS_TMP_STR_SZ]; + char str_ld[BOTS_TMP_STR_SZ]; + char str_ldflags[BOTS_TMP_STR_SZ]; + char str_cutoff[BOTS_TMP_STR_SZ]; + + /* compute output strings */ + sprintf(str_name, "%s", bots_name); + sprintf(str_parameters, "%s", bots_parameters); + sprintf(str_model, "%s", bots_model); + sprintf(str_cutoff, "%s", bots_cutoff); + sprintf(str_resources, "%s", bots_resources); + switch(bots_result) + { + case BOTS_RESULT_NA: + sprintf(str_result, "n/a"); + break; + case BOTS_RESULT_SUCCESSFUL: + sprintf(str_result, "successful"); + break; + case BOTS_RESULT_UNSUCCESSFUL: + sprintf(str_result, "UNSUCCESSFUL"); + break; + case BOTS_RESULT_NOT_REQUESTED: + sprintf(str_result, "Not requested"); + break; + default: + sprintf(str_result, "error"); + break; + } + sprintf(str_time_program, "%f", bots_time_program); + if (bots_sequential_flag) sprintf(str_time_sequential, "%f", bots_time_sequential); + else sprintf(str_time_sequential, "n/a"); + if (bots_sequential_flag) + sprintf(str_speed_up, "%3.2f", bots_time_sequential/bots_time_program); + else sprintf(str_speed_up, "n/a"); + + sprintf(str_number_of_tasks, "%3.2f", (float) bots_number_of_tasks); + sprintf(str_number_of_tasks_per_second, "%3.2f", (float) bots_number_of_tasks/bots_time_program); + + sprintf(str_exec_date, "%s", bots_exec_date); + sprintf(str_exec_message, "%s", bots_exec_message); + bots_get_architecture(str_architecture); + bots_get_load_average(str_load_avg); + sprintf(str_comp_date, "%s", bots_comp_date); + sprintf(str_comp_message, "%s", bots_comp_message); + sprintf(str_cc, "%s", bots_cc); + sprintf(str_cflags, "%s", bots_cflags); + sprintf(str_ld, "%s", bots_ld); + sprintf(str_ldflags, "%s", bots_ldflags); + + if(bots_print_header) + { + switch(bots_output_format) + { + case 0: + break; + case 1: + break; + case 2: +fprintf(stdout, +"Benchmark;Parameters;Model;Cutoff;Resources;Result;\ +Time;Sequential;Speed-up;\ +Nodes;Nodes/Sec;\ +Exec Date;Exec Time;Exec Message;\ +Architecture;Processors;Load Avg-1;Load Avg-5;Load Avg-15;\ +Comp Date;Comp Time;Comp Message;CC;CFLAGS;LD;LDFLAGS\n"); + break; + case 3: + break; + case 4: +fprintf(stdout, +"Benchmark;Parameters;Model;Cutoff;Resources;Result;\ +Time;Sequential;Speed-up;\ +Nodes;Nodes/Sec;\n"); + break; + default: + break; + } + } + + /* print results */ + switch(bots_output_format) + { + case 0: + break; + case 1: + fprintf(stdout, "\n"); + fprintf(stdout, "Program = %s\n", str_name); /*fix*/ + fprintf(stdout, "Parameters = %s\n", str_parameters); /*fix*/ + fprintf(stdout, "Model = %s\n", str_model); + fprintf(stdout, "Embedded cut-off = %s\n", str_cutoff); +// fprintf(stdout, "# of Threads = %s\n", str_resources); + fprintf(stdout, "Verification = %s\n", str_result); + + if (bots_print_times) { + fprintf(stdout, "Time Program = %s seconds\n", str_time_program); + if (bots_sequential_flag) { + fprintf(stdout, "Time Sequential = %s seconds\n", str_time_sequential); + fprintf(stdout, "Speed-up = %s\n", str_speed_up); + } + } + + if ( bots_number_of_tasks > 0 ) { + fprintf(stdout, "Nodes = %s\n", str_number_of_tasks); + fprintf(stdout, "Nodes/Sec = %s\n", str_number_of_tasks_per_second); + } + +// fprintf(stdout, "Execution Date = %s\n", str_exec_date); + fprintf(stdout, "Execution Message = %s\n", str_exec_message); + + fprintf(stdout, "Architecture = %s\n", str_architecture); +// fprintf(stdout, "Load Avg [1:5:15] = %s\n", str_load_avg); + + fprintf(stdout, "Compilation Date = %s\n", str_comp_date); + fprintf(stdout, "Compilation Message = %s\n", str_comp_message); + + fprintf(stdout, "Compiler = %s\n", str_cc); + fprintf(stdout, "Compiler Flags = %s\n", str_cflags); + fprintf(stdout, "Linker = %s\n", str_ld); + fprintf(stdout, "Linker Flags = %s\n", str_ldflags); + fflush(stdout); + break; + case 2: + fprintf(stdout,"%s;%s;%s;%s;%s;%s;", + str_name, + str_parameters, + str_model, + str_cutoff, + str_resources, + str_result + ); + fprintf(stdout,"%s;%s;%s;", + str_time_program, + str_time_sequential, + str_speed_up + ); + fprintf(stdout,"%s;%s;", + str_number_of_tasks, + str_number_of_tasks_per_second + ); + fprintf(stdout,"%s;%s;", + str_exec_date, + str_exec_message + ); + fprintf(stdout,"%s;%s;", + str_architecture, + str_load_avg + ); + fprintf(stdout,"%s;%s;", + str_comp_date, + str_comp_message + ); + fprintf(stdout,"%s;%s;%s;%s;", + str_cc, + str_cflags, + str_ld, + str_ldflags + ); + fprintf(stdout,"\n"); + break; + case 3: + fprintf(stdout, "\n"); + fprintf(stdout, "Program = %s\n", str_name); /*fix*/ + fprintf(stdout, "Parameters = %s\n", str_parameters); /*fix*/ + fprintf(stdout, "Model = %s\n", str_model); + fprintf(stdout, "Embedded cut-off = %s\n", str_cutoff); + fprintf(stdout, "# of Threads = %s\n", str_resources); + fprintf(stdout, "Verification = %s\n", str_result); + + fprintf(stdout, "Time Program = %s seconds\n", str_time_program); + if (bots_sequential_flag) { + fprintf(stdout, "Time Sequential = %s seconds\n", str_time_sequential); + fprintf(stdout, "Speed-up = %s\n", str_speed_up); + } + + if ( bots_number_of_tasks > 0 ) { + fprintf(stdout, "Nodes = %s\n", str_number_of_tasks); + fprintf(stdout, "Nodes/Sec = %s\n", str_number_of_tasks_per_second); + } + break; + case 4: + fprintf(stdout,"%s;%s;%s;%s;%s;%s;", + str_name, + str_parameters, + str_model, + str_cutoff, + str_resources, + str_result + ); + fprintf(stdout,"%s;%s;%s;", + str_time_program, + str_time_sequential, + str_speed_up + ); + fprintf(stdout,"%s;%s;", + str_number_of_tasks, + str_number_of_tasks_per_second + ); + fprintf(stdout,"\n"); + break; + default: + bots_error(BOTS_ERROR, (char*)"No valid output format\n"); + break; + } +} + diff --git a/src/sparselu/bots_common.h b/src/sparselu/bots_common.h new file mode 100755 index 0000000..63268ae --- /dev/null +++ b/src/sparselu/bots_common.h @@ -0,0 +1,56 @@ +/**********************************************************************************************/ +/* This program is part of the Barcelona OpenMP Tasks Suite */ +/* Copyright (C) 2009 Barcelona Supercomputing Center - Centro Nacional de Supercomputacion */ +/* Copyright (C) 2009 Universitat Politecnica de Catalunya */ +/* */ +/* This program is free software; you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation; either version 2 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +/**********************************************************************************************/ + +#ifndef _COMMON_H +#define _COMMON_H + +#ifndef CC +#define CC "" +#endif +#ifndef CFLAGS +#define CFLAGS "" +#endif +#ifndef LD +#define LD "" +#endif +#ifndef LDFLAGS +#define LDFLAGS "" +#endif +#ifndef CDATE +#define CDATE "" +#endif +#ifndef CMESSAGE +#define CMESSAGE "" +#endif + +#define BOTS_ERROR 0 +#define BOTS_ERROR_NOT_ENOUGH_MEMORY 1 +#define BOTS_ERROR_UNRECOGNIZED_PARAMETER 2 + +#define BOTS_WARNING 0 + +void bots_get_date(char *str); +void bots_get_architecture(char *str); +void bots_get_load_average(char *str); +void bots_print_results(void); + +#define BOTS_TMP_STR_SZ 256 + +#endif diff --git a/src/sparselu/bots_main.cpp b/src/sparselu/bots_main.cpp new file mode 100755 index 0000000..a6cea89 --- /dev/null +++ b/src/sparselu/bots_main.cpp @@ -0,0 +1,559 @@ +/**********************************************************************************************/ +/* This program is part of the Barcelona OpenMP Tasks Suite */ +/* Copyright (C) 2009 Barcelona Supercomputing Center - Centro Nacional de Supercomputacion */ +/* Copyright (C) 2009 Universitat Politecnica de Catalunya */ +/* */ +/* This program is free software; you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation; either version 2 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +/**********************************************************************************************/ + +/*********************************************************************** + * main function & common behaviour of the benchmark. + **********************************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include "bots_common.h" +#include "bots_main.h" +#include "bots.h" +#include "app-desc.h" + +#include + +/*********************************************************************** + * DEFAULT VALUES + *********************************************************************/ +/* common flags */ +int bots_sequential_flag = FALSE; +int bots_check_flag = FALSE; +bots_verbose_mode_t bots_verbose_mode = BOTS_VERBOSE_DEFAULT; +int bots_result = BOTS_RESULT_NOT_REQUESTED; +int bots_output_format = 1; +int bots_print_header = FALSE; +/* common variables */ +char bots_name[BOTS_TMP_STR_SZ]; +char bots_execname[BOTS_TMP_STR_SZ]; +char bots_parameters[BOTS_TMP_STR_SZ]; +char bots_model[BOTS_TMP_STR_SZ]; +char bots_resources[BOTS_TMP_STR_SZ]; +/* compile and execution information */ +char bots_exec_date[BOTS_TMP_STR_SZ]; +char bots_exec_message[BOTS_TMP_STR_SZ]; +char bots_comp_date[BOTS_TMP_STR_SZ]; +char bots_comp_message[BOTS_TMP_STR_SZ]; +char bots_cc[BOTS_TMP_STR_SZ]; +char bots_cflags[BOTS_TMP_STR_SZ]; +char bots_ld[BOTS_TMP_STR_SZ]; +char bots_ldflags[BOTS_TMP_STR_SZ]; +char bots_cutoff[BOTS_TMP_STR_SZ]; + +/* time variables */ +double bots_time_program = 0.0; +double bots_time_sequential = 0.0; +unsigned long long bots_number_of_tasks = 0; /* forcing 8 bytes size in -m32 and -m64 */ + +/* + * Application dependent info + */ + +#ifndef BOTS_APP_NAME +#error "Application name must be defined (#define BOTS_APP_NAME)" +#endif + +#ifndef BOTS_APP_PARAMETERS_DESC +#define BOTS_APP_PARAMETERS_DESC "" +#endif + +#ifndef BOTS_APP_PARAMETERS_LIST +#define BOTS_APP_PARAMETERS_LIST +#endif + +#ifndef BOTS_APP_INIT +#define BOTS_APP_INIT +#endif + +#ifndef BOTS_APP_FINI +#define BOTS_APP_FINI +#endif + +#ifndef KERNEL_CALL +#error "Initial kernell call must be specified (#define KERNEL_CALL)" +#endif + +#ifndef KERNEL_INIT +#define KERNEL_INIT +#endif + +#ifndef KERNEL_FINI +#define KERNEL_FINI +#endif + +#ifndef KERNEL_SEQ_INIT +#define KERNEL_SEQ_INIT +#endif + +#ifndef KERNEL_SEQ_FINI +#define KERNEL_SEQ_FINI +#endif + +#ifndef BOTS_MODEL_DESC +#define BOTS_MODEL_DESC "Unknown" +#endif + +#ifdef BOTS_APP_USES_ARG_SIZE +#ifndef BOTS_APP_DEF_ARG_SIZE +#error "Default vaule for argument size must be specified (#define BOTS_APP_DEF_ARG_SIZE)" +#endif +#ifndef BOTS_APP_DESC_ARG_SIZE +#error "Help description for argument size must be specified (#define BOTS_APP_DESC_ARG_SIZE)" +#endif +int bots_arg_size = BOTS_APP_DEF_ARG_SIZE; +#endif + +#ifdef BOTS_APP_USES_ARG_SIZE_1 +#ifndef BOTS_APP_DEF_ARG_SIZE_1 +#error "Default vaule for argument size must be specified (#define BOTS_APP_DEF_ARG_SIZE_1)" +#endif +#ifndef BOTS_APP_DESC_ARG_SIZE_1 +#error "Help description for argument size must be specified (#define BOTS_APP_DESC_ARG_SIZE_1)" +#endif +int bots_arg_size_1 = BOTS_APP_DEF_ARG_SIZE_1; +#endif + +#ifdef BOTS_APP_USES_ARG_SIZE_2 +#ifndef BOTS_APP_DEF_ARG_SIZE_2 +#error "Default vaule for argument size must be specified (#define BOTS_APP_DEF_ARG_SIZE_2)" +#endif +#ifndef BOTS_APP_DESC_ARG_SIZE_2 +#error "Help description for argument size must be specified (#define BOTS_APP_DESC_ARG_SIZE_2)" +#endif +int bots_arg_size_2 = BOTS_APP_DEF_ARG_SIZE_2; +#endif + +#ifdef BOTS_APP_USES_ARG_REPETITIONS +#ifndef BOTS_APP_DEF_ARG_REPETITIONS +#error "Default vaule for argument repetitions must be specified (#define BOTS_APP_DEF_ARG_REPETITIONS)" +#endif +#ifndef BOTS_APP_DESC_ARG_REPETITIONS +#error "Help description for argument repetitions must be specified (#define BOTS_APP_DESC_ARG_REPETITIONS)" +#endif +int bots_arg_repetitions = BOTS_APP_DEF_ARG_REPETITIONS; +#endif + +#ifdef BOTS_APP_USES_ARG_FILE +#ifndef BOTS_APP_DESC_ARG_FILE +#error "Help description for argument file must be specified (#define BOTS_APP_DESC_ARG_FILE)" +#endif +char bots_arg_file[255]=""; +#endif + +#ifdef BOTS_APP_USES_ARG_BLOCK +#ifndef BOTS_APP_DEF_ARG_BLOCK +#error "Default value for argument block must be specified (#define BOTS_APP_DEF_ARG_BLOCK)" +#endif +#ifndef BOTS_APP_DESC_ARG_BLOCK +#error "Help description for argument block must be specified (#define BOTS_APP_DESC_ARG_BLOCK)" +#endif +int bots_arg_block = BOTS_APP_DEF_ARG_BLOCK; +#endif + +#ifdef BOTS_APP_USES_ARG_CUTOFF +#ifndef BOTS_APP_DEF_ARG_CUTOFF +#error "Default value for argument cutoff must be specified (#define BOTS_APP_DEF_ARG_CUTOFF)" +#endif +#ifndef BOTS_APP_DESC_ARG_CUTOFF +#error "Help description for argument cutoff must be specified (#define BOTS_APP_DESC_ARG_CUTOFF)" +#endif +int bots_app_cutoff_value = BOTS_APP_DEF_ARG_CUTOFF; +#endif + +#ifdef BOTS_APP_USES_ARG_CUTOFF_1 +#ifndef BOTS_APP_DEF_ARG_CUTOFF_1 +#error "Default value for argument cutoff must be specified (#define BOTS_APP_DEF_ARG_CUTOFF_1)" +#endif +#ifndef BOTS_APP_DESC_ARG_CUTOFF_1 +#error "Help description for argument cutoff must be specified (#define BOTS_APP_DESC_ARG_CUTOFF_1)" +#endif +int bots_app_cutoff_value_1 = BOTS_APP_DEF_ARG_CUTOFF_1; +#endif + +#ifdef BOTS_APP_USES_ARG_CUTOFF_2 +#ifndef BOTS_APP_DEF_ARG_CUTOFF_2 +#error "Default value for argument cutoff must be specified (#define BOTS_APP_DEF_ARG_CUTOFF_2)" +#endif +#ifndef BOTS_APP_DESC_ARG_CUTOFF_2 +#error "Help description for argument cutoff must be specified (#define BOTS_APP_DESC_ARG_CUTOFF_2)" +#endif +int bots_app_cutoff_value_2 = BOTS_APP_DEF_ARG_CUTOFF_2; +#endif + +#if defined(MANUAL_CUTOFF) || defined(IF_CUTOFF) || defined(FINAL_CUTOFF) +int bots_cutoff_value = BOTS_CUTOFF_DEF_VALUE; +#endif + +// a flag added to allow bots to be used within integration tests +int bots_print_times = 1; + +/*********************************************************************** + * print_usage: + **********************************************************************/ +void bots_print_usage() +{ + fprintf(stderr, "\n"); + fprintf(stderr, "Usage: %s -[options]\n", bots_execname); + fprintf(stderr, "\n"); + fprintf(stderr, "Where options are:\n"); +#ifdef BOTS_APP_USES_REPETITIONS + fprintf(stderr, " -r : Set the number of repetitions (default = 1).\n"); +#endif +#ifdef BOTS_APP_USES_ARG_SIZE + fprintf(stderr, " -n : " BOTS_APP_DESC_ARG_SIZE "\n"); +#endif +#ifdef BOTS_APP_USES_ARG_SIZE_1 + fprintf(stderr, " -m : " BOTS_APP_DESC_ARG_SIZE_1 "\n"); +#endif +#ifdef BOTS_APP_USES_ARG_SIZE_2 + fprintf(stderr, " -l : " BOTS_APP_DESC_ARG_SIZE_2 "\n"); +#endif +#ifdef BOTS_APP_USES_ARG_FILE + fprintf(stderr, " -f : " BOTS_APP_DESC_ARG_FILE "\n"); +#endif +#if defined(MANUAL_CUTOFF) || defined(IF_CUTOFF) || defined(FINAL_CUTOFF) + fprintf(stderr, " -x : OpenMP tasks cut-off value (default=%d)\n",BOTS_CUTOFF_DEF_VALUE); +#endif +#ifdef BOTS_APP_USES_ARG_CUTOFF + fprintf(stderr, " -y : " BOTS_APP_DESC_ARG_CUTOFF "(default=%d)\n", BOTS_APP_DEF_ARG_CUTOFF); +#endif +#ifdef BOTS_APP_USES_ARG_CUTOFF_1 + fprintf(stderr, " -a : " BOTS_APP_DESC_ARG_CUTOFF_1 "(default=%d)\n", BOTS_APP_DEF_ARG_CUTOFF_1); +#endif +#ifdef BOTS_APP_USES_ARG_CUTOFF_2 + fprintf(stderr, " -b : " BOTS_APP_DESC_ARG_CUTOFF_2 "(default=%d)\n", BOTS_APP_DEF_ARG_CUTOFF_2); +#endif + + fprintf(stderr, "\n"); + fprintf(stderr, " -e : Include 'str' execution message.\n"); + fprintf(stderr, " -v : Set verbose level (default = 1).\n"); + fprintf(stderr, " 0 - none.\n"); + fprintf(stderr, " 1 - default.\n"); + fprintf(stderr, " 2 - debug.\n"); + fprintf(stderr, " -o : Set output format mode (default = 1).\n"); + fprintf(stderr, " 0 - no benchmark output.\n"); + fprintf(stderr, " 1 - detailed list format.\n"); + fprintf(stderr, " 2 - detailed row format.\n"); + fprintf(stderr, " 3 - abridged list format.\n"); + fprintf(stderr, " 4 - abridged row format.\n"); + fprintf(stderr, " -z : Print row header (if output format is a row variant).\n"); + fprintf(stderr, "\n"); +#ifdef KERNEL_SEQ_CALL + fprintf(stderr, " -s : Run sequential version.\n"); +#endif +#ifdef BOTS_APP_CHECK_USES_SEQ_RESULT + fprintf(stderr, " -c : Check mode ON (implies running sequential version).\n"); +#else + fprintf(stderr, " -c : Check mode ON.\n"); +#endif + fprintf(stderr, "\n"); + fprintf(stderr, " -h : Print program's usage (this help).\n"); + fprintf(stderr, "\n"); + fprintf(stderr, " -t : Disable printing of times (for integration tests).\n"); + fprintf(stderr, "\n"); +} +/*********************************************************************** + * bots_get_params_common: + **********************************************************************/ +void +bots_get_params_common(int argc, char **argv) +{ + int i = 1; + strcpy(bots_execname, basename(argv[0])); + bots_get_date(bots_exec_date); + strcpy(bots_exec_message,""); + while (i 1 ) { + fprintf(stderr, "Error: Configure the suite using '--debug' option in order to use a verbose level greather than 1.\n"); + exit(100); + } +#endif + break; +#if defined(MANUAL_CUTOFF) || defined(IF_CUTOFF) || defined(FINAL_CUTOFF) + case 'x': + argv[i][1] = '*'; + i++; + if (argc == i) { bots_print_usage(); exit(100); } + bots_cutoff_value = atoi(argv[i]); + break; +#endif +#ifdef BOTS_APP_USES_ARG_CUTOFF + case 'y': + argv[i][1] = '*'; + i++; + if (argc == i) { bots_print_usage(); exit(100); } + bots_app_cutoff_value = atoi(argv[i]); + break; +#endif + case 'z': + argv[i][1] = '*'; + bots_print_header = TRUE; + break; + + case 't': + argv[i][1] = '*'; + bots_print_times = FALSE; + break; + + default: + // As at the moment there are only common paramenters + // we launch an error. Otherwise we have to ignore the + // parameter and to check, after specific parameters are + // completely read, if there are unrecognized parameters. + //fprintf(stderr, "Error: Unrecognized parameter.\n"); + //bots_print_usage(); + //exit (100); + break; + } + } + else + { + // As at the moment there are only common paramenters + // we launch an error. Otherwise we have to ignore the + // parameter and to check, after specific parameters are + // completely read, if there are unrecognized parameters. + //fprintf(stderr, "Error: Unrecognized parameter.\n"); + //bots_print_usage(); + //exit (100); + } + ++i; + } +} +/*********************************************************************** + * bots_get_params_common: + **********************************************************************/ +void +bots_get_params(int argc, char **argv) +{ + bots_get_params_common(argc, argv); +// bots_get_params_specific(argc, argv); +} + + +/*********************************************************************** + * bots_set_info + **********************************************************************/ +void bots_set_info () +{ + /* program specific info */ + snprintf(bots_name, BOTS_TMP_STR_SZ, BOTS_APP_NAME); + snprintf(bots_parameters, BOTS_TMP_STR_SZ, BOTS_APP_PARAMETERS_DESC BOTS_APP_PARAMETERS_LIST); + snprintf(bots_model, BOTS_TMP_STR_SZ, BOTS_MODEL_DESC); + snprintf(bots_resources, BOTS_TMP_STR_SZ, "%d", omp_get_max_threads()); + + /* compilation info (do not modify) */ + snprintf(bots_comp_date, BOTS_TMP_STR_SZ, CDATE); + snprintf(bots_comp_message, BOTS_TMP_STR_SZ, CMESSAGE); + snprintf(bots_cc, BOTS_TMP_STR_SZ, CC); + snprintf(bots_cflags, BOTS_TMP_STR_SZ, CFLAGS); + snprintf(bots_ld, BOTS_TMP_STR_SZ, LD); + snprintf(bots_ldflags, BOTS_TMP_STR_SZ, LDFLAGS); + +#if defined(MANUAL_CUTOFF) + snprintf(bots_cutoff, BOTS_TMP_STR_SZ, "manual (%d)",bots_cutoff_value); +#elif defined(IF_CUTOFF) + snprintf(bots_cutoff, BOTS_TMP_STR_SZ, "pragma-if (%d)",bots_cutoff_value); +#elif defined(FINAL_CUTOFF) + snprintf(bots_cutoff, BOTS_TMP_STR_SZ, "final (%d)",bots_cutoff_value); +#else + strcpy(bots_cutoff,"none"); +#endif +} + +/*********************************************************************** + * main: + **********************************************************************/ +#if not defined (SPARSELU_SKIP_BOTS_MAIN) +int +main(int argc, char* argv[]) +{ +#ifndef BOTS_APP_SELF_TIMING + long bots_t_start; + long bots_t_end; +#endif + + bots_get_params(argc,argv); + BOTS_APP_INIT; + bots_set_info(); + +#ifdef KERNEL_SEQ_CALL +#ifdef BOTS_APP_CHECK_USES_SEQ_RESULT + if (bots_sequential_flag || bots_check_flag) +#else + if (bots_sequential_flag) +#endif + { + bots_sequential_flag = 1; + KERNEL_SEQ_INIT; +#ifdef BOTS_APP_SELF_TIMING + bots_time_sequential = KERNEL_SEQ_CALL; +#else + bots_t_start = bots_usecs(); + KERNEL_SEQ_CALL; + bots_t_end = bots_usecs(); + bots_time_sequential = ((double)(bots_t_end-bots_t_start))/1000000; +#endif + KERNEL_SEQ_FINI; + } +#endif + + KERNEL_INIT; +#ifdef BOTS_APP_SELF_TIMING + bots_time_program = KERNEL_CALL; +#else + bots_t_start = bots_usecs(); + KERNEL_CALL; + bots_t_end = bots_usecs(); + bots_time_program = ((double)(bots_t_end-bots_t_start))/1000000; +#endif + KERNEL_FINI; + +#ifdef KERNEL_CHECK + if (bots_check_flag) { + bots_result = KERNEL_CHECK; + } +#endif + + BOTS_APP_FINI; + + bots_print_results(); + switch(bots_result) { + case BOTS_RESULT_NA: + throw wfr::exception::wfr_fatal_error("BOTS_RESULT_NA"); + case BOTS_RESULT_SUCCESSFUL: + break; + case BOTS_RESULT_UNSUCCESSFUL: + throw wfr::exception::wfr_fatal_error("BOTS_RESULT_UNSUCCESSFUL"); + case BOTS_RESULT_NOT_REQUESTED: + break; + default: + throw wfr::exception::wfr_fatal_error("unknown bots results"); + } + return (0); +} +#endif diff --git a/src/sparselu/bots_main.h b/src/sparselu/bots_main.h new file mode 100755 index 0000000..6fcbab8 --- /dev/null +++ b/src/sparselu/bots_main.h @@ -0,0 +1,51 @@ +/**********************************************************************************************/ +/* This program is part of the Barcelona OpenMP Tasks Suite */ +/* Copyright (C) 2009 Barcelona Supercomputing Center - Centro Nacional de Supercomputacion */ +/* Copyright (C) 2009 Universitat Politecnica de Catalunya */ +/* */ +/* This program is free software; you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation; either version 2 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +/**********************************************************************************************/ + +#define BOTS_PARAM_TYPE_NONE 0 +#define BOTS_PARAM_TYPE_INT 1 +#define BOTS_PARAM_TYPE_BOOL 2 +#define BOTS_PARAM_TYPE_STR 3 + +#ifdef _OPENMP +# include +#else +# define omp_get_max_threads() 1 +# define omp_get_thread_num() 0 +# define omp_set_num_threads(x) +#endif + +void bots_print_usage(void); +void bots_print_usage_option(char opt, int type, char* description, char *val, int subc, char **subv); + +/*********************************************************************** + * BENCHMARK HEADERS + *********************************************************************/ +void bots_initialize(); +void bots_finalize(); +void bots_sequential_ini(); +long bots_sequential(); +void bots_sequential_fini(); +int bots_check_result(); +void bots_print_usage_specific(); +void bots_get_params_specific(int argc, char **argv); +void bots_set_info(); + +void bots_get_params_common(int argc, char **argv); +void bots_get_params(int argc, char **argv); diff --git a/src/sparselu/omp-tasks-app.h b/src/sparselu/omp-tasks-app.h new file mode 100755 index 0000000..9482297 --- /dev/null +++ b/src/sparselu/omp-tasks-app.h @@ -0,0 +1,33 @@ +/**********************************************************************************************/ +/* This program is part of the Barcelona OpenMP Tasks Suite */ +/* Copyright (C) 2009 Barcelona Supercomputing Center - Centro Nacional de Supercomputacion */ +/* Copyright (C) 2009 Universitat Politecnica de Catalunya */ +/* */ +/* This program is free software; you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation; either version 2 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +/**********************************************************************************************/ + +#ifdef _OPENMP +#include +#endif + +#define MODEL OMP-TASKS + +#ifdef FORCE_TIED_TASKS +#define BOTS_MODEL_DESC "OpenMP (using tied tasks)" +#else +#define BOTS_MODEL_DESC "OpenMP (using tasks)" +#endif + + diff --git a/src/sparselu/sparselu.h b/src/sparselu/sparselu.h new file mode 100755 index 0000000..1c83719 --- /dev/null +++ b/src/sparselu/sparselu.h @@ -0,0 +1,24 @@ +#ifndef SPARSELU_H +#define SPARSELU_H + +#define EPSILON 1.0E-6 + +int checkmat (float *M, float *N); +void genmat (float *M[]); +void print_structure(char *name, float *M[]); +float * allocate_clean_block(); +void lu0(float *diag); +void bdiv(float *diag, float *row); +void bmod(float *row, float *col, float *inner); +void fwd(float *diag, float *col); + +void sparselu_init (float ***pBENCH, char *pass); +void sparselu(float **BENCH); +void sparselu_fini (float **BENCH, char *pass); + +void sparselu_seq_call(float **BENCH); +void sparselu_par_call(float **BENCH, int argc, char* argv[]); + +int sparselu_check(float **SEQ, float **BENCH); + +#endif diff --git a/src/sparselu/sparselu_funcs.cpp b/src/sparselu/sparselu_funcs.cpp new file mode 100755 index 0000000..b21759c --- /dev/null +++ b/src/sparselu/sparselu_funcs.cpp @@ -0,0 +1,289 @@ +/* + * sparselu_funcs.cpp + * + * Created on: 30.09.2014 + * Author: matthias + */ + + +#include +#include +#include +#include +#include +#include +#include "bots.h" +#include "sparselu.h" + +/*********************************************************************** + * checkmat: + **********************************************************************/ +int checkmat (float *M, float *N) +{ + int i, j; + float r_err; + + for (i = 0; i < bots_arg_size_1; i++) + { + for (j = 0; j < bots_arg_size_1; j++) + { + r_err = M[i*bots_arg_size_1+j] - N[i*bots_arg_size_1+j]; + if ( r_err == 0.0 ) continue; + + if (r_err < 0.0 ) r_err = -r_err; + + if ( M[i*bots_arg_size_1+j] == 0 ) + { + bots_message("Checking failure: A[%d][%d]=%f B[%d][%d]=%f; \n", + i,j, M[i*bots_arg_size_1+j], i,j, N[i*bots_arg_size_1+j]); + return FALSE; + } + r_err = r_err / M[i*bots_arg_size_1+j]; + if(r_err > EPSILON) + { + bots_message("Checking failure: A[%d][%d]=%f B[%d][%d]=%f; Relative Error=%f\n", + i,j, M[i*bots_arg_size_1+j], i,j, N[i*bots_arg_size_1+j], r_err); + return FALSE; + } + } + } + return TRUE; +} +/*********************************************************************** + * genmat: + **********************************************************************/ +void genmat (float *M[]) +{ + int null_entry, init_val, i, j, ii, jj; + float *p; + int a=0,b=0; + + init_val = 1325; + + /* generating the structure */ + for (ii=0; ii < bots_arg_size; ii++) + { + for (jj=0; jj < bots_arg_size; jj++) + { + /* computing null entries */ + null_entry=FALSE; + if ((iijj) && (jj%3 !=0)) null_entry = TRUE; + if (ii%2==1) null_entry = TRUE; + if (jj%2==1) null_entry = TRUE; + if (ii==jj) null_entry = FALSE; + if (ii==jj-1) null_entry = FALSE; + if (ii-1 == jj) null_entry = FALSE; + /* allocating matrix */ + if (null_entry == FALSE){ + a++; + M[ii*bots_arg_size+jj] = (float *) malloc(bots_arg_size_1*bots_arg_size_1*sizeof(float)); + if ((M[ii*bots_arg_size+jj] == NULL)) + { + bots_message("Error: Out of memory\n"); + exit(101); + } + /* initializing matrix */ + p = M[ii*bots_arg_size+jj]; + for (i = 0; i < bots_arg_size_1; i++) + { + for (j = 0; j < bots_arg_size_1; j++) + { + init_val = (3125 * init_val) % 65536; + (*p) = (float)((init_val - 32768.0) / 16384.0); + p++; + } + } + } + else + { + b++; + M[ii*bots_arg_size+jj] = NULL; + } + } + } + bots_debug("allo = %d, no = %d, total = %d, factor = %f\n",a,b,a+b,(float)((float)a/(float)(a+b))); +} +/*********************************************************************** + * print_structure: + **********************************************************************/ +void print_structure(char *name, float *M[]) +{ + int ii, jj; + //bots_message("Structure for matrix %s @ 0x%p\n",name, M); + for (ii = 0; ii < bots_arg_size; ii++) { + for (jj = 0; jj < bots_arg_size; jj++) { + if (M[ii*bots_arg_size+jj]!=NULL) {bots_message("x");} + else bots_message(" "); + } + bots_message("\n"); + } + bots_message("\n"); +} +/*********************************************************************** + * allocate_clean_block: + **********************************************************************/ +float * allocate_clean_block() +{ + int i,j; + float *p, *q; + + p = (float *) malloc(bots_arg_size_1*bots_arg_size_1*sizeof(float)); + q=p; + if (p!=NULL){ + for (i = 0; i < bots_arg_size_1; i++) + for (j = 0; j < bots_arg_size_1; j++){(*p)=0.0; p++;} + + } + else + { + bots_message("Error: Out of memory\n"); + exit (101); + } + return (q); +} + +/*********************************************************************** + * lu0: + **********************************************************************/ +void lu0(float *diag) +{ + int i, j, k; + + for (k=0; k +#include +#include +#include + + +int main(int argc, char** argv) { + + long N = 2000; + long iterMax = 100; + long chunksize = -1; + boost::program_options::options_description opts("Wavefront Options"); + opts.add_options() + ("help", "Print help message.") + ("itermax", boost::program_options::value(), "Iteration count.") + ("n", boost::program_options::value(), "Array size (n+1 x n+1).") + ("chunksize", boost::program_options::value(), "Chunk size."); + boost::program_options::variables_map vm; + auto parsed = boost::program_options::command_line_parser(argc, argv).options(opts).allow_unregistered().run(); + boost::program_options::store(parsed, vm); + boost::program_options::notify(vm); + if (vm.count("help")) { + std::cerr << opts << std::endl; + exit(0); + } + if (vm.count("itermax")) { + iterMax = vm["itermax"].as(); + } + if (vm.count("n")) { + N = vm["n"].as(); + } + if (vm.count("chunksize")) { + chunksize = vm["chunksize"].as(); + } + long _2N2 = 2*N-2; + if (chunksize <= 0) { + chunksize = (_2N2/8)+1; + } + std::cerr << "itermax = " << iterMax << std::endl; + std::cerr << "N = " << N << std::endl; + std::cerr << "chunksize = " << chunksize << std::endl; + #define Idx2D(x, y) (x)*(N+1)+(y) + double* mat_b = (double*)malloc(sizeof(double)*(N+1)*(N+1)); + //srand(time(NULL)); + srand(20); + for(int i=0; i