diff options
-rw-r--r-- | src/experiment.cpp | 6 | ||||
-rw-r--r-- | src/experiment.h | 2 | ||||
-rw-r--r-- | src/output.cpp | 20 | ||||
-rw-r--r-- | src/output.h | 1 | ||||
-rw-r--r-- | src/run.cpp | 17 | ||||
-rwxr-xr-x | tinos.sh | 17 |
6 files changed, 45 insertions, 18 deletions
diff --git a/src/experiment.cpp b/src/experiment.cpp index 7551d1f..60ae4bc 100644 --- a/src/experiment.cpp +++ b/src/experiment.cpp @@ -22,9 +22,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#if defined(NUMA) #include <numa.h> -#endif // Local includes #include "chain.h" @@ -321,6 +319,8 @@ int Experiment::parse_args(int argc, char* argv[]) { this->output_mode = HEADER; } else if (strcasecmp(argv[i], "header") == 0) { this->output_mode = HEADER; + } else if (strcasecmp(argv[i], "dfatool") == 0) { + this->output_mode = DFATOOL; } else { snprintf(errorString, errorStringSize, "invalid output format -- '%s'", argv[i]); error = true; @@ -490,10 +490,8 @@ int Experiment::parse_args(int argc, char* argv[]) { break; } -#if defined(NUMA) this->numa_max_domain = numa_max_node(); this->num_numa_domains = this->numa_max_domain + 1; -#endif switch (this->numa_placement) { case LOCAL: diff --git a/src/experiment.h b/src/experiment.h index 38aee3c..47716cf 100644 --- a/src/experiment.h +++ b/src/experiment.h @@ -63,7 +63,7 @@ public: enum { NONE, T0, T1, T2, NTA } prefetch_hint; // use of prefetching - enum { CSV, BOTH, HEADER, TABLE } + enum { CSV, BOTH, HEADER, TABLE, DFATOOL } output_mode; // results output mode enum { RANDOM, STRIDED } diff --git a/src/output.cpp b/src/output.cpp index 75ae845..7c65fc2 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -22,6 +22,7 @@ #include <stdlib.h> #include <string.h> +#include <numa.h> // // Implementation @@ -37,10 +38,15 @@ void Output::print(Experiment &e, int64 ops, std::vector<double> seconds, double Output::header(e, ops, ck_res); for (int i = 0; i < seconds.size(); i++) Output::csv(e, ops, seconds[i], ck_res); + } else if (e.output_mode == Experiment::DFATOOL) { + for (int i = 0; i < seconds.size(); i++) { + Output::dfatool(e, ops, seconds[i], ck_res); + } } else { long double averaged_seconds = 0; - for (int i = 0; i < seconds.size(); i++) + for (int i = 0; i < seconds.size(); i++) { averaged_seconds += seconds[i]; + } Output::table(e, ops, (double) (averaged_seconds/seconds.size()), ck_res); } } @@ -118,6 +124,18 @@ void Output::csv(Experiment &e, int64 ops, double secs, double ck_res) { fflush(stdout); } +void Output::dfatool(Experiment &e, int64 ops, double secs, double ck_res) { + printf("[::] pChase | pointer_B=%ld cacheline_B=%ld page_B=%ld chain_B=%ld thread_B=%ld test_B=%ld e_pattern=%s stride=%d cpu_numa_node=%d ram_numa_node=%d numa_distance_cpu_ram=%d", + e.pointer_size, e.bytes_per_line, e.bytes_per_page, e.bytes_per_chain, e.bytes_per_thread, e.bytes_per_test, + e.access(), e.stride, e.thread_domain[0], e.chain_domain[0][0], numa_distance(e.thread_domain[0], e.chain_domain[0][0]) + ); + printf(" | latency_ns=%.2f bandwidth_MBps=%.3f\n", + (secs / (ops * e.iterations)) * 1e9, + ((ops * e.iterations * e.chains_per_thread * e.num_threads * e.bytes_per_line) / secs) * 1e-6 + ); + fflush(stdout); +} + void Output::table(Experiment &e, int64 ops, double secs, double ck_res) { printf("pointer size = %ld (bytes)\n", e.pointer_size); printf("cache line size = %ld (bytes)\n", e.bytes_per_line); diff --git a/src/output.h b/src/output.h index af718f0..34a22fe 100644 --- a/src/output.h +++ b/src/output.h @@ -36,6 +36,7 @@ public: static void header(Experiment &e, int64 ops, double ck_res); static void csv(Experiment &e, int64 ops, double seconds, double ck_res); static void table(Experiment &e, int64 ops, double seconds, double ck_res); + static void dfatool(Experiment &e, int64 ops, double seconds, double ck_res); private: }; diff --git a/src/run.cpp b/src/run.cpp index 44a8319..3d41f71 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -23,9 +23,7 @@ #include <unistd.h> #include <cstddef> #include <algorithm> -#if defined(NUMA) #include <numa.h> -#endif // Local includes #include <AsmJit/AsmJit.h> @@ -67,7 +65,6 @@ int Run::run() { Chain** chain_memory = new Chain*[this->exp->chains_per_thread]; Chain** root = new Chain*[this->exp->chains_per_thread]; -#if defined(NUMA) // establish the node id where this thread // will run. threads are mapped to nodes // by the set-up code for Experiment. @@ -78,18 +75,14 @@ int Run::run() { // memory will be allocated. for (int i=0; i < this->exp->chains_per_thread; i++) { int alloc_node_id = this->exp->chain_domain[this->thread_id()][i]; - nodemask_t alloc_mask; - nodemask_zero(&alloc_mask); - nodemask_set(&alloc_mask, alloc_node_id); - numa_set_membind(&alloc_mask); + struct bitmask *bitmask = numa_allocate_nodemask(); + numa_bitmask_clearall(bitmask); + numa_bitmask_setbit(bitmask, alloc_node_id); + numa_set_membind(bitmask); + numa_free_nodemask(bitmask); chain_memory[i] = new Chain[ this->exp->links_per_chain ]; } -#else - for (int i = 0; i < this->exp->chains_per_thread; i++) { - chain_memory[i] = new Chain[this->exp->links_per_chain]; - } -#endif // initialize the chains and // select the function that diff --git a/tinos.sh b/tinos.sh new file mode 100755 index 0000000..1864afc --- /dev/null +++ b/tinos.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +mkdir -p log +fn=log/${HOST} + +parallel -j1 --eta --joblog ${fn}.1.joblog --resume --header : \ + build/chase -c 536870912 -i 1 -e 100 -o dfatool -n map {cpu}:{ram} \ + ::: cpu $(seq 0 1) \ + ::: ram $(seq 0 1) \ +>> ${fn}.txt + +parallel -j1 --eta --joblog ${fn}.2.joblog --resume --header : \ + build/chase -c 536870912 -i 1 -e 100 -o dfatool -n map {cpu}:{ram} -a forward {stride} \ + ::: cpu $(seq 0 1) \ + ::: ram $(seq 0 1) \ + ::: stride 1 2 4 8 16 32 64 \ +>> ${fn}.txt |