From 20e2656d51a2d13a6d4783b97933e8098a1ff158 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 31 May 2023 15:44:51 +0200 Subject: TS: port CPU and NMC versions to dfatool --- TS/baselines/cpu/Makefile | 6 +++++- TS/baselines/cpu/run-opti.sh | 15 +++++++++++++++ TS/baselines/cpu/run.sh | 11 +++++++++-- TS/baselines/cpu/streamp_openmp.cpp | 26 +++++++++++++------------- 4 files changed, 42 insertions(+), 16 deletions(-) create mode 100755 TS/baselines/cpu/run-opti.sh (limited to 'TS/baselines') diff --git a/TS/baselines/cpu/Makefile b/TS/baselines/cpu/Makefile index 69121ed..b0b9a86 100644 --- a/TS/baselines/cpu/Makefile +++ b/TS/baselines/cpu/Makefile @@ -1,4 +1,3 @@ - all: streamp_openmp streamp_openmp: streamp_openmp.cpp tools.cpp @@ -13,10 +12,15 @@ streamp_openmp_O2: streamp_openmp.cpp tools.cpp run: streamp_openmp ./streamp_openmp inputs/randomlist33M.txt 256 +# may need OMP_NUM_THREADS=32 (≈ tinos) -- does not work with 88 threads @ ios + run_O0: streamp_openmp_O0 ./streamp_openmp_O0 inputs/randomlist33M.txt 256 run_O2: streamp_openmp_O2 ./streamp_openmp_O2 inputs/randomlist33M.txt 256 +clean: + rm -f streamp_openmp streamp_openmp_O0 streamp_openmp_O2 + .PHONY: all run run_O0 run_O2 clean diff --git a/TS/baselines/cpu/run-opti.sh b/TS/baselines/cpu/run-opti.sh new file mode 100755 index 0000000..9135393 --- /dev/null +++ b/TS/baselines/cpu/run-opti.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +HOST="$(hostname)" + +echo $HOST + +make clean + +for i in $(seq 1 50); do + ( make run_O0 || OMP_NUM_THREADS=32 make run_O0 ) | sed 's/CPU/CPU O0/' +done | tee "${HOST}-O0.txt" + +for i in $(seq 1 50); do + ( make run_O2 || OMP_NUM_THREADS=32 make run_O2 ) | sed 's/CPU/CPU O2/' +done | tee "${HOST}-O2.txt" diff --git a/TS/baselines/cpu/run.sh b/TS/baselines/cpu/run.sh index 7d8fe37..254ca15 100755 --- a/TS/baselines/cpu/run.sh +++ b/TS/baselines/cpu/run.sh @@ -2,15 +2,22 @@ set -e +HOST="$(hostname)" + +echo $HOST + +( + echo "prim-benchmarks TS CPU (dfatool edition)" echo "Started at $(date)" echo "Revision $(git describe --always)" # input size depends on file -> strong scaling only -make +make -B for i in $(seq 1 10); do - for nr_threads in 1 2 4 6 8 12 16 20 24 32; do + for nr_threads in 88 64 44 1 2 4 6 8 12 16 20 24 32; do OMP_NUM_THREADS=${nr_threads} timeout --foreground -k 1m 30m ./streamp_openmp inputs/randomlist33M.txt 256 || true done done +) | tee "${HOST}-explore.txt" diff --git a/TS/baselines/cpu/streamp_openmp.cpp b/TS/baselines/cpu/streamp_openmp.cpp index 94f110f..cc970e2 100644 --- a/TS/baselines/cpu/streamp_openmp.cpp +++ b/TS/baselines/cpu/streamp_openmp.cpp @@ -290,7 +290,7 @@ int main(int argc, char* argv[]) std::cout << "///////////////////////// STREAMP //////////////////////////" << std::endl; std::cout << "############################################################" << std::endl; std::cout << std::endl; - std::cout << "[>>] Reading File..." << std::endl; + //std::cout << "[>>] Reading File..." << std::endl; /* Read time series file */ tstart = std::chrono::high_resolution_clock::now(); @@ -329,7 +329,7 @@ int main(int argc, char* argv[]) std::cout << std::endl; // Preprocess, statistics, get the mean and standard deviation of every subsequence in the time series - std::cout << "[>>] Preprocessing..." << std::endl; + //std::cout << "[>>] Preprocessing..." << std::endl; tstart = std::chrono::high_resolution_clock::now(); tprogstart = tstart; @@ -337,11 +337,11 @@ int main(int argc, char* argv[]) tend = std::chrono::high_resolution_clock::now(); time_elapsed = tend - tstart; - std::cout << "[OK] Preprocess Time: " << std::setprecision(std::numeric_limits::digits10 + 2) << time_elapsed.count() << " seconds." << std::endl; - printf("[::] n_threads=%d e_type=%s n_elements=%d | throughput_preproc_MBps=%f throughput_preproc_MOpps=%f\n", numThreads, XSTR(DTYPE), timeSeriesLength, timeSeriesLength * sizeof(DTYPE) / (time_elapsed.count() * 1e6), timeSeriesLength / (time_elapsed.count() * 1e6)); + //std::cout << "[OK] Preprocess Time: " << std::setprecision(std::numeric_limits::digits10 + 2) << time_elapsed.count() << " seconds." << std::endl; + printf("[::] TS CPU | n_threads=%d e_type=%s n_elements=%d | throughput_preproc_MBps=%f throughput_preproc_MOpps=%f", numThreads, XSTR(DTYPE), timeSeriesLength, timeSeriesLength * sizeof(DTYPE) / (time_elapsed.count() * 1e6), timeSeriesLength / (time_elapsed.count() * 1e6)); //Initialize Matrix Profile and Matrix Profile Index - std::cout << "[>>] Initializing Profile..." << std::endl; + //std::cout << "[>>] Initializing Profile..." << std::endl; tstart = std::chrono::high_resolution_clock::now(); profile = new DTYPE[ProfileLength]; @@ -354,8 +354,8 @@ int main(int argc, char* argv[]) tend = std::chrono::high_resolution_clock::now(); time_elapsed = tend - tstart; - std::cout << "[OK] Initialize Profile Time: " << std::setprecision(std::numeric_limits::digits10 + 2) << time_elapsed.count() << " seconds." << std::endl; - printf("[::] n_threads=%d e_type=%s n_elements=%d | throughput_init_MBps=%f throughput_init_MOpps=%f\n", numThreads, XSTR(DTYPE), timeSeriesLength, timeSeriesLength * sizeof(DTYPE) / (time_elapsed.count() * 1e6), timeSeriesLength / (time_elapsed.count() * 1e6)); + //std::cout << "[OK] Initialize Profile Time: " << std::setprecision(std::numeric_limits::digits10 + 2) << time_elapsed.count() << " seconds." << std::endl; + printf(" throughput_init_MBps=%f throughput_init_MOpps=%f", timeSeriesLength * sizeof(DTYPE) / (time_elapsed.count() * 1e6), timeSeriesLength / (time_elapsed.count() * 1e6)); // Random shuffle the diagonals idx.clear(); @@ -366,15 +366,15 @@ int main(int argc, char* argv[]) std::random_shuffle(idx.begin(), idx.end()); /******************** SCRIMP ********************/ - std::cout << "[>>] Performing STREAMP..." << std::endl; + //std::cout << "[>>] Performing STREAMP..." << std::endl; tstart = std::chrono::high_resolution_clock::now(); streamp(); tend = std::chrono::high_resolution_clock::now(); time_elapsed = tend - tstart; - std::cout << "[OK] STREAMP Time: " << std::setprecision(std::numeric_limits::digits10 + 2) << time_elapsed.count() << " seconds." << std::endl; - printf("[::] n_threads=%d e_type=%s n_elements=%d | throughput_streamp_MBps=%f throughput_streamp_MOpps=%f\n", numThreads, XSTR(DTYPE), timeSeriesLength, timeSeriesLength * sizeof(DTYPE) / (time_elapsed.count() * 1e6), timeSeriesLength / (time_elapsed.count() * 1e6)); + //std::cout << "[OK] STREAMP Time: " << std::setprecision(std::numeric_limits::digits10 + 2) << time_elapsed.count() << " seconds." << std::endl; + printf(" throughput_streamp_MBps=%f throughput_streamp_MOpps=%f", timeSeriesLength * sizeof(DTYPE) / (time_elapsed.count() * 1e6), timeSeriesLength / (time_elapsed.count() * 1e6)); // Save profile to file //std::cout << "[>>] Saving Profile..." << std::endl; @@ -388,9 +388,9 @@ int main(int argc, char* argv[]) // Calculate total time time_elapsed = tend - tprogstart; - std::cout << "[OK] Total Time: " << std::setprecision(std::numeric_limits::digits10 + 2) << time_elapsed.count() << " seconds." << std::endl; - printf("[::] n_threads=%d e_type=%s n_elements=%d | throughput_total_MBps=%f throughput_total_MOpps=%f\n", numThreads, XSTR(DTYPE), timeSeriesLength, timeSeriesLength * sizeof(DTYPE) / (time_elapsed.count() * 1e6), timeSeriesLength / (time_elapsed.count() * 1e6)); - std::cout << std::endl; + //std::cout << "[OK] Total Time: " << std::setprecision(std::numeric_limits::digits10 + 2) << time_elapsed.count() << " seconds." << std::endl; + printf(" throughput_MBps=%f throughput_MOpps=%f\n", timeSeriesLength * sizeof(DTYPE) / (time_elapsed.count() * 1e6), timeSeriesLength / (time_elapsed.count() * 1e6)); + //std::cout << std::endl; delete profile; delete profileIndex; -- cgit v1.2.3