text
string
let test_bufunpack _ _ myid = if myid = 0 then printf " PASSED test -- N_VBufUnpack \ n " ; 0 end
module Nvector_manyvector_ops = struct include Nvector_many . Ops let get_id = Nvector . get_id type contents = Nvector . any ROArray . t * int let getarray = Nvector_many . unwrap let get ( xxs , _ ) i = let xsub0 = Nvector_serial . Any . unwrap ( ROArray . get xxs 0 ) in let xsub1 = Nvector_serial . Any . unwrap ( RO...
module Test = struct include Test_nvector . Test ( Nvector_manyvector_ops ) let make lens = let num = Array . length lens in Nvector_many . wrap ( ROArray . init num ( fun i -> Nvector_serial . Any . make lens . ( i ) 0 . 0 ) ) let id = Nvector . ManyVector end
let ( ) += r x = r := ! r + x
let main ( ) = let fails = ref 0 in if Array . length Sys . argv < 4 then ( printf " ERROR : THREE ( 3 ) Inputs required : subvector 1 length , subvector 2 length , print timing \ n " ; exit ( - 1 ) ) ; let len1 = int_of_string Sys . argv . ( 1 ) in if len1 <= 0 then ( printf " ERROR : length of subvector 1 must be a p...
let reps = try int_of_string ( Unix . getenv " NUM_REPS " ) with Not_found | Failure _ -> 1
let gc_at_end = try int_of_string ( Unix . getenv " GC_AT_END " ) <> 0 with Not_found | Failure _ -> false
let gc_each_rep = try int_of_string ( Unix . getenv " GC_EACH_REP " ) <> 0 with Not_found | Failure _ -> false
let _ = for _ = 1 to reps do main ( ) ; if gc_each_rep then Gc . compact ( ) done ; if gc_at_end then Gc . compact ( )
module Nvector_parallel_ops = functor ( N : Nvector . NVECTOR with type data = Nvector_parallel . data ) -> struct include N . Ops let get_id = Nvector . get_id type contents = Sundials . RealArray . t let getarray nv = let d , _ , _ = Nvector . unwrap nv in d let get = Sundials . RealArray . get let set = Sundials . R...
module Nvector_generic_ops = struct include Nvector . Ops let get_id = Nvector . get_id type t = Nvector . any type contents = Sundials . RealArray . t let getarray x = match Nvector . unwrap x with | Nvector_parallel . Par ( xd , _ , _ ) -> xd | _ -> raise Nvector . BadGenericType let get = Sundials . RealArray . get ...
module Custom_parallel1 = Nvector_custom . MakeOps ( struct type data = Nvector_parallel . data let ops = { Nvector_custom . check = ( fun ( x , xg , xc ) ( y , yg , yc ) -> Sundials . RealArray . ( length x = length y ) && ( xg <= yg ) && ( xc == yc ) ) ; Nvector_custom . clone = Nvector_parallel . DataOps . clone ; N...
module Custom_parallel2 = Nvector_custom . MakeOps ( struct type data = Nvector_parallel . data module DataOps = Nvector_parallel . MakeOps ( struct type local_data = Sundials . RealArray . t let get = Sundials . RealArray . get let set = Sundials . RealArray . set let fill a v = Sundials . RealArray . fill a v let mak...
module MakeTest = functor ( N : Nvector . NVECTOR with type data = Nvector_parallel . data ) ( NI : sig val id : Nvector . nvector_id val comm : Mpi . communicator val global_length : int end ) -> struct include Test_nvector . Test ( Nvector_parallel_ops ( N ) ) let make ? with_fused_ops n v = N . wrap ? with_fused_ops...
module MakeAnyTest = functor ( NI : sig val comm : Mpi . communicator val global_length : int end ) -> struct include Test_nvector . Test ( Nvector_generic_ops ) let make ? with_fused_ops n v = Nvector_parallel . Any . wrap ? with_fused_ops ( Sundials . RealArray . make n v , NI . global_length , NI . comm ) let id = N...
module type TEST = sig include Test_nvector . TEST val make : ? with_fused_ops : bool -> int -> float -> t val id : Nvector . nvector_id end
let ( ) += r x = r := ! r + x
let main ( ) = let fails = ref 0 in let comm = Mpi . comm_world in let nprocs = Mpi . comm_size comm in let myid = Mpi . comm_rank comm in if Array . length Sys . argv < 3 then begin if myid = 0 then printf " ERROR : TWO ( 2 ) Inputs required : vector length , print timing \ n " ; exit ( - 1 ) end ; let local_length = ...
let reps = try int_of_string ( Unix . getenv " NUM_REPS " ) with Not_found | Failure _ -> 1
let gc_at_end = try int_of_string ( Unix . getenv " GC_AT_END " ) <> 0 with Not_found | Failure _ -> false
let gc_each_rep = try int_of_string ( Unix . getenv " GC_EACH_REP " ) <> 0 with Not_found | Failure _ -> false
let _ = for _ = 1 to reps do main ( ) ; if gc_each_rep then Gc . compact ( ) done ; if gc_at_end then Gc . compact ( )
module Nvector_mpimanyvector_ops = struct include Nvector_mpimany . Ops let get_id = Nvector . get_id type contents = Nvector . any ROArray . t * Mpi . communicator * int let getarray = Nvector_mpimany . unwrap let get ( xxs , _ , _ ) i = let xsub0 = Nvector_serial . Any . unwrap ( ROArray . get xxs 0 ) in let xsub1 , ...
module Test = struct include Test_nvector . Test ( Nvector_mpimanyvector_ops ) let make comm slen plen pglen = Nvector_mpimany . wrap ~ comm ( ROArray . init 2 ( fun i -> if i = 0 then ( Nvector_serial . Any . make slen 0 . 0 ) else ( Nvector_parallel . Any . make plen pglen comm 0 . 0 ) ) ) let id = Nvector . MpiManyV...
let ( ) += r x = r := ! r + x
let main ( ) = let fails = ref 0 in let comm = Mpi . comm_world in let nprocs = Mpi . comm_size comm in let myid = Mpi . comm_rank comm in if Array . length Sys . argv < 4 then ( printf " ERROR : THREE ( 3 ) Inputs required : subvector 1 local vector globlen , subvector 2 local vector globlen , print timing \ n " ; exi...
let reps = try int_of_string ( Unix . getenv " NUM_REPS " ) with Not_found | Failure _ -> 1
let gc_at_end = try int_of_string ( Unix . getenv " GC_AT_END " ) <> 0 with Not_found | Failure _ -> false
let gc_each_rep = try int_of_string ( Unix . getenv " GC_EACH_REP " ) <> 0 with Not_found | Failure _ -> false
let _ = for _ = 1 to reps do main ( ) ; if gc_each_rep then Gc . compact ( ) done ; if gc_at_end then Gc . compact ( )
module Nvector_mpimanyvector_ops = struct include Nvector_mpimany . Ops let get_id = Nvector . get_id type contents = Nvector . any ROArray . t * Mpi . communicator * int let getarray = Nvector_mpimany . unwrap let get ( xxs , _ , _ ) i = let xsub0 = Nvector_serial . Any . unwrap ( ROArray . get xxs 0 ) in let xsub1 , ...
module Test = struct include Test_nvector . Test ( Nvector_mpimanyvector_ops ) let id = Nvector . MpiManyVector end
let ( ) += r x = r := ! r + x
let main ( ) = let fails = ref 0 in let comm = Mpi . comm_world in let nprocs = Mpi . comm_size comm in let myid = Mpi . comm_rank comm in if Array . length Sys . argv < 4 then ( printf " ERROR : THREE ( 3 ) Inputs required : subvector 1 local vector globlen , subvector 2 local vector globlen , print timing \ n " ; exi...
let reps = try int_of_string ( Unix . getenv " NUM_REPS " ) with Not_found | Failure _ -> 1
let gc_at_end = try int_of_string ( Unix . getenv " GC_AT_END " ) <> 0 with Not_found | Failure _ -> false
let gc_each_rep = try int_of_string ( Unix . getenv " GC_EACH_REP " ) <> 0 with Not_found | Failure _ -> false
let _ = for _ = 1 to reps do main ( ) ; if gc_each_rep then Gc . compact ( ) done ; if gc_at_end then Gc . compact ( )
module Nvector_mpimanyvector_ops = struct include Nvector_mpimany . Ops let get_id = Nvector . get_id type contents = Nvector . any ROArray . t * Mpi . communicator * int let getarray = Nvector . unwrap let get ( xxs , _ , _ ) i = let xsub0 = Nvector_serial . Any . unwrap ( ROArray . get xxs 0 ) in let xsub1 = Nvector_...
module Test = struct include Test_nvector . Test ( Nvector_mpimanyvector_ops ) let make ? with_fused_ops lens = let num = Array . length lens in Nvector_mpimany . wrap ~ comm : Mpi . comm_world ( ROArray . init num ( fun i -> Nvector_serial . Any . make lens . ( i ) 0 . 0 ) ) let get_global_length = Nvector_mpimanyvect...
let ( ) += r x = r := ! r + x
let main ( ) = let fails = ref 0 in if Array . length Sys . argv < 4 then ( printf " ERROR : THREE ( 3 ) Inputs required : subvector 1 length , subvector 2 length , print timing \ n " ; exit ( - 1 ) ) ; let len1 = int_of_string Sys . argv . ( 1 ) in if len1 <= 0 then ( printf " ERROR : length of subvector 1 must be a p...
let reps = try int_of_string ( Unix . getenv " NUM_REPS " ) with Not_found | Failure _ -> 1
let gc_at_end = try int_of_string ( Unix . getenv " GC_AT_END " ) <> 0 with Not_found | Failure _ -> false
let gc_each_rep = try int_of_string ( Unix . getenv " GC_EACH_REP " ) <> 0 with Not_found | Failure _ -> false
let _ = for i = 1 to reps do main ( ) ; if gc_each_rep then Gc . compact ( ) done ; if gc_at_end then Gc . compact ( )
module Nvector_mpiplusx_ops = struct include Nvector_mpiplusx . Ops let get_id = Nvector . get_id type contents = Nvector . any * Mpi . communicator let getarray = Nvector . unwrap let get ( xs , _ ) i = let x = Nvector_serial . Any . unwrap xs in Sundials . RealArray . get x i let set ( xs , _ ) i v = let x = Nvector_...
module Test = struct include Test_nvector . Test ( Nvector_mpiplusx_ops ) let id = Nvector . MpiPlusX end
let ( ) += r x = r := ! r + x
let main ( ) = let fails = ref 0 in let comm = Mpi . comm_world in let nprocs = Mpi . comm_size comm in let myid = Mpi . comm_rank comm in if Array . length Sys . argv < 3 then ( printf " ERROR : TWO ( 2 ) Inputs required : vector local length , print timing \ n " ; exit ( - 1 ) ) ; let local_length = int_of_string Sys...
let reps = try int_of_string ( Unix . getenv " NUM_REPS " ) with Not_found | Failure _ -> 1
let gc_at_end = try int_of_string ( Unix . getenv " GC_AT_END " ) <> 0 with Not_found | Failure _ -> false
let gc_each_rep = try int_of_string ( Unix . getenv " GC_EACH_REP " ) <> 0 with Not_found | Failure _ -> false
let _ = for _ = 1 to reps do main ( ) ; if gc_each_rep then Gc . compact ( ) done ; if gc_at_end then Gc . compact ( )
module Nvector_openmp_ops : Test_nvector . NVECTOR_OPS_EXT with type t = Nvector_openmp . t = struct include Nvector_openmp . Ops let get_id = Nvector . get_id type contents = Sundials . RealArray . t let getarray = Nvector_openmp . unwrap let get = Sundials . RealArray . get let set = Sundials . RealArray . set let ma...
module Test = Test_nvector . Test ( Nvector_openmp_ops )
let ( ) += r x = r := ! r + x
let main ( ) = let fails = ref 0 in if Array . length Sys . argv < 4 then ( printf " ERROR : THREE ( 3 ) arguments required : < vector length > < number of threads > < print timing >\ n " ; exit ( - 1 ) ) ; let length = int_of_string Sys . argv . ( 1 ) in if length <= 0 then ( printf " ERROR : length of vector must be ...
let reps = try int_of_string ( Unix . getenv " NUM_REPS " ) with Not_found | Failure _ -> 1
let gc_at_end = try int_of_string ( Unix . getenv " GC_AT_END " ) <> 0 with Not_found | Failure _ -> false
let gc_each_rep = try int_of_string ( Unix . getenv " GC_EACH_REP " ) <> 0 with Not_found | Failure _ -> false
let _ = for _ = 1 to reps do main ( ) ; if gc_each_rep then Gc . compact ( ) done ; if gc_at_end then Gc . compact ( )
module Nvector_pthreads_ops : Test_nvector . NVECTOR_OPS_EXT with type t = Nvector_pthreads . t = struct include Nvector_pthreads . Ops let get_id = Nvector . get_id type contents = Sundials . RealArray . t let getarray = Nvector_pthreads . unwrap let get = Sundials . RealArray . get let set = Sundials . RealArray . se...
module Test = Test_nvector . Test ( Nvector_pthreads_ops )
let ( ) += r x = r := ! r + x
let main ( ) = let fails = ref 0 in if Array . length Sys . argv < 4 then ( printf " ERROR : THREE ( 3 ) Inputs required : vector length , number of threads , print timing \ n " ; exit ( - 1 ) ) ; let length = int_of_string Sys . argv . ( 1 ) in if length <= 0 then ( printf ( " ERROR : length of vector must be a positi...
let reps = try int_of_string ( Unix . getenv " NUM_REPS " ) with Not_found | Failure _ -> 1
let gc_at_end = try int_of_string ( Unix . getenv " GC_AT_END " ) <> 0 with Not_found | Failure _ -> false
let gc_each_rep = try int_of_string ( Unix . getenv " GC_EACH_REP " ) <> 0 with Not_found | Failure _ -> false
let _ = for _ = 1 to reps do main ( ) ; if gc_each_rep then Gc . compact ( ) done ; if gc_at_end then Gc . compact ( )
module Nvector_serial_ops = functor ( N : Nvector . NVECTOR with type data = Sundials . RealArray . t ) -> ( struct include N . Ops let get_id = Nvector . get_id type contents = Sundials . RealArray . t let getarray = Nvector . unwrap let get = Sundials . RealArray . get let set = Sundials . RealArray . set let max_tim...
module Nvector_generic_ops = struct type t = Nvector . any include Nvector . Ops let get_id = Nvector . get_id type contents = Sundials . RealArray . t let getarray x = match Nvector . unwrap x with | Nvector . RA xa -> xa | _ -> raise Nvector . BadGenericType let get = Sundials . RealArray . get let set = Sundials . R...
module Nvector_array_ops = functor ( N : Nvector . NVECTOR with type data = float array ) -> ( struct include N . Ops let get_id = Nvector . get_id type contents = float array let getarray = Nvector . unwrap let get = Array . get let set = Array . set let max_time _ t = t let sync_device ( ) = ( ) end )
module Custom_serial = Nvector_custom . MakeOps ( struct type data = Sundials . RealArray . t let ops = { Nvector_custom . check = ( fun x y -> Sundials . RealArray . ( length x = length y ) ) ; Nvector_custom . clone = Nvector_serial . DataOps . clone ; Nvector_custom . space = Some Nvector_serial . DataOps . space ; ...
module Custom_array1 = Nvector_custom . MakeOps ( struct type data = float array let ops = { Nvector_custom . check = ( fun x y -> Array . ( length x = length y ) ) ; Nvector_custom . clone = Nvector_array . DataOps . clone ; Nvector_custom . space = Some Nvector_array . DataOps . space ; Nvector_custom . getlength = N...
module Custom_array2 = Nvector_array . Make ( struct type data = float array let get = Array . get let set = Array . set let fill = ( fun a -> Array . fill a 0 ( Array . length a ) ) let make = Array . make let clone = Array . copy let length = Array . length end )
module MakeTest = functor ( N : Nvector . NVECTOR with type data = Sundials . RealArray . t ) ( NI : sig val id : Nvector . nvector_id end ) -> struct include Test_nvector . Test ( Nvector_serial_ops ( N ) ) let make ? with_fused_ops n v = N . wrap ? with_fused_ops ( Sundials . RealArray . make n v ) let id = NI . id e...
module MakeAnyTest = struct include Test_nvector . Test ( Nvector_generic_ops ) let make ? with_fused_ops n v = Nvector_serial . Any . make ? with_fused_ops n v let id = Nvector . Serial end
module MakeArrayTest = functor ( N : Nvector . NVECTOR with type data = float array ) ( NI : sig val id : Nvector . nvector_id end ) -> struct include Test_nvector . Test ( Nvector_array_ops ( N ) ) let make ? with_fused_ops n v = N . wrap ? with_fused_ops ( Array . make n v ) let id = NI . id end
module type TEST = sig include Test_nvector . TEST val make : ? with_fused_ops : bool -> int -> float -> t val id : Nvector . nvector_id end
let ( ) += r x = r := ! r + x
let main ( ) = let fails = ref 0 in if Array . length Sys . argv < 3 then ( printf " ERROR : ONE ( 1 ) Input required : vector length , print timing \ n " ; exit ( - 1 ) ) ; let length = int_of_string Sys . argv . ( 1 ) in if length <= 0 then ( printf " ERROR : length of vector must be a positive integer \ n " ; exit (...
let reps = try int_of_string ( Unix . getenv " NUM_REPS " ) with Not_found | Failure _ -> 1
let gc_at_end = try int_of_string ( Unix . getenv " GC_AT_END " ) <> 0 with Not_found | Failure _ -> false
let gc_each_rep = try int_of_string ( Unix . getenv " GC_EACH_REP " ) <> 0 with Not_found | Failure _ -> false
let _ = for _ = 1 to reps do main ( ) ; if gc_each_rep then Gc . compact ( ) done ; if gc_at_end then Gc . compact ( )
let all = ref [ ] in iter standard ~ f ( : fun s -> all := Symbol . name s :: ! all ) ; print_s [ % sexp ( List . length ! all / 100 * 100 : int ) ] ; [ % expect { | 16_100 } ] ; | print_s [ % sexp ( ! all |> List . sort ~ compare : String . compare |> fun l -> List . take l 100 : string list ) ] ; [ % expect { | ( % &...
let print_bool b = print_endline ( string_of_bool b ) let r = ref false in let f x = match Obj . is_int x with | true -> r := true ; true | false -> r := false ; false in print_string " [ not ( is_int 1 ) ] : " ; print_bool ( not ( f ( Obj . repr 1 ) ) ) ; print_string " [ is_int ( 1 , 2 , 3 ) ] : " ; print_bool ( f ( ...
type ' a t = ' a Observer . t
let observe = Observer . observe let obs = Observer . create ( fun x ~ size ~ hash -> hash_fold_int hash ( Int . min x size ) ) in List . init 10 ~ f ( : fun size -> Observer . observe obs 6 ~ size ~ hash ( : Hash . alloc ( ) ) |> Hash . get_hash_value ) |> [ % sexp_of : int list ] |> print_s ; [ % expect { | ( 1058613...
let opaque = Observer . opaque test_observer ~ mode ` : opaque Observer . opaque ( m_nat ~ up_to : 10 ) ; [ % expect { | ( observer opaque ) } ] | ; ;
let unmap = Observer . unmap test_observer ( Observer . unmap Observer . int64 ~ f : Int . to_int64 ) ( m_int ( module Int ) ) ; [ % expect { | ( observer transparent ) } ] | ; ;
let of_hash_fold = Observer . of_hash_fold test_observer ( Observer . of_hash_fold Sexp . hash_fold_t ) m_sexp ; [ % expect { | ( observer transparent ) } ] | ; ;
let fixed_point = Observer . fixed_point test_observer ( Observer . fixed_point ( fun observer -> Observer . unmap ( Observer . option observer ) ~ f ( : function | 0 -> None | n -> Some ( n - 1 ) ) ) ) ( m_nat ~ up_to : 10 ) ; [ % expect { | ( observer transparent ) } ] | ; ;
let fn = Observer . fn let config = { Test . default_config with test_count = 100 } in let first_order = m_arrow m_bool m_bool in let ( module First_order ) = first_order in test_observer ~ config ( Observer . fn Generator . bool Observer . bool ) first_order ; [ % expect { | ( observer transparent ) } ] ; | print_s [ ...
let both = Observer . both test_observer ( Observer . both Observer . bool Observer . bool ) ( m_pair m_bool m_bool ) ; [ % expect { | ( observer transparent ) } ] | ; ;
let unit = Observer . unit test_observer Observer . unit m_unit ; [ % expect { | ( observer transparent ) } ] | ; ;
let bool = Observer . bool test_observer Observer . bool m_bool ; [ % expect { | ( observer transparent ) } ] | ; ;
let char = Observer . char test_observer Observer . char m_char ; [ % expect { | ( observer transparent ) } ] | ; ;
let string = Observer . string test_observer Observer . string m_string ; [ % expect { | ( observer transparent ) } ] | ; ;