-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HPCC RandomAccess benchmark added. #286
Open
alexfrolov
wants to merge
6
commits into
uwsampa:master
Choose a base branch
from
alexfrolov:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
67eab85
HPCC RandomAccess benchmark added.
15f34ea
hpcc folder moved to application, CMakeList.txt fixed
66644f5
hpcc randomaccess modified (gce added to monitor completion of updates)
e243124
Minor fixes in HPCC RandomAccess.
e1ce6ca
Bug fixed in HPCC RandomAccess.
5b9b495
Merge remote-tracking branch 'upstream/master'
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#set(SOURCES main.cpp common.hpp) | ||
|
||
add_grappa_application(hpcc_random_access.exe hpcc_random_access.cpp) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
// to run, do something like | ||
// make -j demo-hpcc_random_access | ||
// bin/grappa_run --ppn 8 --nnode 12 -- demo-hpcc_random_access.exe | ||
|
||
#include <Grappa.hpp> | ||
#include <iomanip> | ||
|
||
using namespace Grappa; | ||
|
||
// define command-line flags (third-party 'gflags' library) | ||
DEFINE_int64( scale, 20, "table size = 2 ^ scale * sizeof(uint64_t) * number of PEs" ); | ||
DEFINE_int64( iters, 4, "Number of iterations" ); | ||
|
||
// define custom statistics which are logged by the runtime | ||
// (here we're not using these features, just printing them ourselves) | ||
GRAPPA_DEFINE_METRIC( SimpleMetric<double>, gups_runtime, 0.0 ); | ||
GRAPPA_DEFINE_METRIC( SimpleMetric<double>, gups_throughput, 0.0 ); | ||
|
||
#define POLY 0x0000000000000007ULL | ||
#define PERIOD 1317624576693539401LL | ||
|
||
typedef double time_type; | ||
std::string print_time(time_type t) | ||
{ | ||
std::ostringstream out; | ||
out << std::setiosflags(std::ios::fixed) << std::setprecision(2) << t; | ||
return out.str(); | ||
} | ||
|
||
|
||
uint64_t N; | ||
uint64_t HPCC_starts(int64_t n); | ||
|
||
Grappa::GlobalCompletionEvent gce; | ||
|
||
double run_random_access() { | ||
LOG(INFO) << "HPCC RandomAccess" << std::endl; | ||
N = (1LL << FLAGS_scale) * cores(); | ||
|
||
// create target array that we'll be updating | ||
auto hpcc_table = global_alloc<int64_t>(N); | ||
Grappa::memset( hpcc_table, 0, N); | ||
|
||
double tstart = walltime(); | ||
|
||
on_all_cores([hpcc_table] { | ||
N = (1LL << FLAGS_scale) * cores(); | ||
uint64_t key = HPCC_starts(FLAGS_iters * mycore() * N / cores()); | ||
for(int k = 0; k < FLAGS_iters; k++) | ||
for(uint64_t i = 0; i < N / cores(); i++) { | ||
key = key << 1 ^ ((int64_t) key < 0 ? POLY : 0); | ||
auto addr = hpcc_table + (key & N - 1); | ||
//auto core = key >> (int)log2((double)(N / cores())) & cores() - 1; | ||
delegate::call<async, &gce>(addr.core(), [addr, key] { | ||
//uint64_t offset = key & (N / cores() - 1); | ||
*(addr.pointer()) ^= key; | ||
}); | ||
} | ||
}); | ||
gce.wait(); | ||
|
||
double tend = walltime(); | ||
|
||
LOG(INFO) << "\tTime elapsed " << (double)(tend - tstart) << " sec" << std::endl; | ||
|
||
global_free(hpcc_table); | ||
|
||
return (double)(tend - tstart); | ||
} | ||
|
||
uint64_t HPCC_starts(int64_t n) { | ||
int i, j; | ||
uint64_t m2[64]; | ||
uint64_t temp, ran; | ||
while (n < 0) n += PERIOD; | ||
while (n > PERIOD) n -= PERIOD; | ||
if (n == 0) return 0x1; | ||
temp = 0x1; | ||
for (i = 0; i < 64; i++) { | ||
m2[i] = temp; | ||
temp = temp << 1 ^ ((int64_t) temp < 0 ? POLY : 0); | ||
temp = temp << 1 ^ ((int64_t) temp < 0 ? POLY : 0); | ||
} | ||
for (i = 62; i >= 0; i--) | ||
if (n >> i & 1) | ||
break; | ||
|
||
ran = 0x2; | ||
while (i > 0) { | ||
temp = 0; | ||
for (j = 0; j < 64; j++) | ||
if (ran >> j & 1) | ||
temp ^= m2[j]; | ||
ran = temp; | ||
i -= 1; | ||
if (n >> i & 1) | ||
ran = ran << 1 ^ ((int64_t) ran < 0 ? POLY : 0); | ||
} | ||
return ran; | ||
} | ||
|
||
|
||
int main(int argc, char * argv[]) { | ||
init( &argc, &argv ); | ||
run([]{ | ||
|
||
LOG(INFO) << "\tGlobal table size = 2^" << FLAGS_scale << " * " << cores() << " = " << (1LL << FLAGS_scale) * cores() << " words\n"; | ||
LOG(INFO) << "\tNumber of processes = " << cores() << std::endl; | ||
LOG(INFO) << "\tNumber of updates = " << FLAGS_iters * (1LL << FLAGS_scale) * cores() << std::endl; | ||
|
||
gups_runtime = run_random_access(); | ||
gups_throughput = 1e-9 * FLAGS_iters * N / gups_runtime; | ||
|
||
LOG(INFO) << "[Final] CPU time used " << print_time(gups_runtime.value()) << " seconds, " << print_time(gups_throughput.value()) << " GUPS\n"; | ||
|
||
}); | ||
finalize(); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
down here, after the
on_all_cores
is where I'd explicitly callgce->wait()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, I did forget it)))