Created
January 9, 2013 07:09
-
-
Save UnixJunkie/4491246 to your computer and use it in GitHub Desktop.
Parmap problem Johan Mazel
This file contains hidden or 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
open Printf | |
let main _ = | |
Parmap.debugging true; | |
let cores = 6 in | |
let array1_length = 1000 in | |
let array2_length = 100000 in | |
let float_bound = 10.0 in | |
print_endline "Building array1"; | |
let array1 = | |
Array.init | |
array1_length | |
(fun indice -> | |
Array.init array2_length (fun indice -> Random.float float_bound)) | |
in | |
print_endline "array1 built"; | |
print_endline "Sleeping"; | |
Unix.sleep 10; | |
print_endline "Parmap"; | |
let f = | |
(fun array -> | |
(Array.map | |
(fun float -> float +.Random.float float_bound) | |
array)) | |
in | |
let new_array1 = | |
Parmap.array_parmap | |
~ncores: cores | |
f | |
array1 | |
in | |
print_endline | |
(sprintf | |
"new_array1 length: %d" | |
(Array.length new_array1)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment