Skip to content
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

n-body benchmark: read the inputs from args, as the orignal shoutout code does #1404

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 deletions src/test/bench/shootout-nbody.rs
Original file line number Diff line number Diff line change
@@ -7,25 +7,16 @@ native mod llvm {
fn sqrt(n: float) -> float;
}

fn main() {
//
// Leave these commented out to
// finish in a reasonable time
// during 'make check' under valgrind
// 5000000
// 50000000
let inputs: [int] = [50000, 500000];
fn main(args: [str]) {
let n = int::from_str(args[1]);

let bodies: [Body::props] = NBodySystem::MakeNBodySystem();

log(debug, NBodySystem::energy(bodies));

for n: int in inputs {
log(debug, NBodySystem::energy(bodies));

let i: int = 0;
while i < n { NBodySystem::advance(bodies, 0.01); i += 1; }
log(debug, NBodySystem::energy(bodies));
}
let i: int = 0;
while i < n { NBodySystem::advance(bodies, 0.01); i += 1; }
log(debug, NBodySystem::energy(bodies));
}

// Body::props is a record of floats, so