-
Notifications
You must be signed in to change notification settings - Fork 38
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
New implementations of kernel 2 and 3 for graph500 #388
Open
moazzammoriani
wants to merge
5
commits into
ocaml-bench:main
Choose a base branch
from
moazzammoriani:graph500_kernel2and3
base: main
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
5 commits
Select commit
Hold shift + click to select a range
54d4086
Copy work from https://github.com/moazzammoriani/graph500
moazzammoriani ea8eae1
Remove dune-project
moazzammoriani 8a13182
Remove GraphTypes stanza from graph500seq dune file
moazzammoriani cae646d
Remove unnecessary stanzas
moazzammoriani 4ff7f33
Refactor cleanup and document
moazzammoriani 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,10 @@ | ||
let to_file ~filename (data : 'a ) = | ||
let out = open_out filename in | ||
Marshal.to_channel out data []; | ||
close_out out | ||
|
||
let from_file filename = | ||
let in_ = open_in filename in | ||
let res : 'a = Marshal.from_channel in_ in | ||
close_in in_; | ||
res |
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,3 @@ | ||
val to_file : filename:string -> 'a -> unit | ||
|
||
val from_file : string -> 'a | ||
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,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCALE=$1 | ||
|
||
gen () { ./_build/default/gen.exe -scale $SCALE edges.data; } | ||
|
||
kernel1 () { ./_build/default/kernel1_run.exe edges.data -o sparse.data; } | ||
|
||
getSamples () { ./_build/default/sampleSearchKeys.exe sparse.data -o samples.data; } | ||
|
||
gen && kernel1 && getSamples | ||
|
||
|
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,3 @@ | ||
let _ = | ||
let samples = Array.init nsamples (fun _ -> SparseGraphSeq.get_sample graph) in | ||
FileHandler.to_file ~filename:!filename samples |
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 |
---|---|---|
@@ -1,6 +1,4 @@ | ||
open GraphTypes | ||
|
||
val go : scale:int -> edge_factor:int -> edge array | ||
val to_file : filename:string -> edge array -> unit | ||
val from_file : string -> edge array | ||
val generate_to_file : scale:int -> edge_factor:int -> filename:string -> unit |
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,3 @@ | ||
type vertex = int | ||
type weight = float | ||
type edge = vertex * vertex * weight |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,18 +1,23 @@ | ||
let filename = ref "" | ||
let usage_msg = "kernel1Seq_run.exe <edge_list_input_file> -o <sparse_graph_output_file>" | ||
let edge_list_input_filename = ref "" | ||
let sparse_graph_output_filename = ref "" | ||
|
||
let speclist = [("-o", Arg.Set_string sparse_graph_output_filename, "Set output file name")] | ||
|
||
let () = | ||
Random.self_init (); | ||
Arg.parse [] (fun s -> filename := s) | ||
"kernel1Par.exe EDGE_LIST_FILE"; | ||
if !filename = "" then begin | ||
Printf.eprintf "Must provide graph file argument.\n"; exit 1 | ||
Arg.parse speclist (fun s -> edge_list_input_filename := s) usage_msg; | ||
if !edge_list_input_filename = "" then begin | ||
Printf.eprintf "Must provide edge list input file argument.\n"; exit 1 | ||
end; | ||
Printf.printf "Reading edge list from %s...\n%!" !filename; | ||
Printf.printf "Reading edge list from %s...\n%!" !edge_list_input_filename; | ||
let t0 = Unix.gettimeofday () in | ||
let edges = GenerateSeq.from_file !filename in | ||
let edges = FileHandler.from_file !edge_list_input_filename in | ||
let t1 = Unix.gettimeofday () in | ||
Printf.printf "Done. Time: %f s.\nBuilding sparse representation...\n%!" (t1 -. t0); | ||
let t0 = Unix.gettimeofday () in | ||
ignore @@ Sys.opaque_identity @@ Kernel1Seq.kernel1 edges; | ||
let sparse_graph = Kernel1Seq.kernel1 edges in | ||
let t1 = Unix.gettimeofday () in | ||
Printf.printf "Done. Time: %f\n" (t1 -. t0); | ||
FileHandler.to_file ~filename:!sparse_graph_output_filename sparse_graph; | ||
|
Oops, something went wrong.
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.
I believe the
Marshal
usage came from previous work, but it is rather unsafe as it stands, because it doesn't (and cannot) check that the value returned is of the correct type. You could make it safer in a number of ways. I'd perhaps recommend finding a library that offers a type safe version of marshaling/serialization/pickling.