text stringlengths 12 786k |
|---|
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 .... |
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 ( ) += 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 ... |
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 (... |
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 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 = Sundial... |
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 ... |
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 =... |
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... |
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 = Sun... |
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... |
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 ( ... |
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... |
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 ... |
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 . ... |
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... |
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 : ... |
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 |> f... |
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_strin... |
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_o... |
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 transparen... |
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 { | ( ob... |
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 ) } ] | ; ; |
let int = Observer . int test_observer Observer . int ( m_int ( module Int ) ) ; [ % expect { | ( observer transparent ) } ] | ; ; |
let int32 = Observer . int32 test_observer Observer . int32 ( m_int ( module Int32 ) ) ; [ % expect { | ( observer transparent ) } ] | ; ; |
let int63 = Observer . int63 test_observer Observer . int63 ( m_int ( module Int63 ) ) ; [ % expect { | ( observer transparent ) } ] | ; ; |
let int64 = Observer . int64 test_observer Observer . int64 ( m_int ( module Int64 ) ) ; [ % expect { | ( observer transparent ) } ] | ; ; |
let nativeint = Observer . nativeint test_observer Observer . nativeint ( m_int ( module Nativeint ) ) ; [ % expect { | ( observer transparent ) } ] | ; ; |
let float = Observer . float test_observer Observer . float m_float ; [ % expect { | ( observer transparent ) } ] | ; ; |
let sexp = Observer . sexp test_observer Observer . sexp m_sexp ; [ % expect { | ( observer transparent ) } ] | ; ; |
let option = Observer . option [ % expect { | } ] ; | test_observer ( Observer . option Observer . bool ) ( m_option m_bool ) ; [ % expect { | ( observer transparent ) } ] | ; ; |
let list = Observer . list test_observer ( Observer . list Observer . bool ) ( m_list m_bool ) ; [ % expect { | ( observer transparent ) } ] | ; ; |
let either = Observer . either test_observer ( Observer . either Observer . bool Observer . bool ) ( m_either m_bool m_bool ) ; [ % expect { | ( observer transparent ) } ] | ; ; |
let result = Observer . result test_observer ( Observer . result Observer . bool Observer . bool ) ( m_result m_bool m_bool ) ; [ % expect { | ( observer transparent ) } ] | ; ; |
let map_tree = Observer . map_tree test_observer ( Observer . map_t Observer . bool Observer . bool ) ( m_map ( module Bool ) m_bool m_bool ) ; [ % expect { | ( observer transparent ) } ] | ; ; |
let set_tree = Observer . set_tree test_observer ( Observer . set_t Observer . bool ) ( m_set ( module Bool ) m_bool ) ; [ % expect { | ( observer transparent ) } ] | ; ; |
let of_lazy = Observer . of_lazy test_observer ( Observer . of_lazy ( lazy Observer . string ) ) m_string ; [ % expect { | ( observer transparent ) } ] | ; ; test_observer ( Observer . either Observer . string ( Observer . of_lazy ( lazy ( assert false ) ) ) ) (... |
let bigstring = Observer . bigstring test_observer Observer . bigstring ( m_biject m_string ~ f : Base_bigstring . of_string ~ f_inverse : Base_bigstring . to_string ) ; [ % expect { | ( observer transparent ) } ] | ; ; |
let float64_vec = Observer . float64_vec let test observer kind = ( module struct include ( val m_float ) let examples = [ 1 . ; - 1 . ; Float . nan ] end ) |> m_list |> m_biject ~ f : Array . of_list ~ f_inverse : Array . to_list |> m_biject ~ f ( : Bigarray . Array1 . ... |
let float64_mat = Observer . float64_mat let test observer kind = ( module struct type t = float array array [ @@ deriving compare , sexp_of ] let examples = [ [ ] ; || [ | [ | 0 . ] | ] ; | [ | [ | 0 . ; 1 . ] | ] ; | [ | [ | 0 . ] ; | [ |... |
let report symbol ( ) = print_s [ % message " Called " ( symbol : Symbol . t ) ] |
let alias_of = let symbol = " current - function " |> Symbol . intern in defun_nullary_nil symbol [ % here ] ~ docstring " :< docstring " > ( report symbol ) ; symbol ; ; let obsolete = " foobar - 2 " |> Symbol . intern in defun_nullary_nil obsolete [ % here ] ~ docstring... |
module Common_tests ( S : Cstubs . FOREIGN with type ' a result = ' a and type ' a return = ' a ) = struct module M = Functions . Stubs ( S ) open M let test_oo_hierarchy _ = let module M = struct let camel_vtable_singleton = make camel_methods let idfn = ( fun animal -> let n = call_h... |
let suite = " OO - style tests " >::: [ " OO style ( foreign ) " >:: Foreign_tests . test_oo_hierarchy ; " OO style ( stubs ) " >:: Stub_tests . test_oo_hierarchy ; ] |
let _ = run_test_tt_main suite |
let gpu_to_gray = kern v -> let open Std in let tid = thread_idx_x + block_dim_x * block_idx_x in let tab = make_local 32 in let tab2 = make_shared 32 in tab2 . ( 0 ) <- tab . ( 0 ) + v . [ < 0 ] ; > if tid <= ( 512 * 512 ) then ( let i = ( tid * 4 ) in let res = in... |
let append_text e s = Dom . appendChild e ( document ## createTextNode ( Js . string s ) ) |
let button name action = let b = createInput ~ _type ( : Js . string " button " ) document in b ## value <- ( Js . string name ) ; b ## onclick <- handler action ; b ## style ## margin <- Js . string " 10px " ; b |
let measure_time s f = let t0 = Unix . gettimeofday ( ) in let a = f ( ) in let t1 = Unix . gettimeofday ( ) in Printf . printf " Time % s : % Fs \ n " %! s ( t1 . - t0 ) ; a ; ; |
let compute devid devs data imageData c tf = let dev = devs . ( devid ) in Printf . printf " Will use device : % s " ! ( dev ) . Spoc . Devices . general_info . Spoc . Devices . name ; let gpu_vect = Spoc . Vector . create Vector . int32 ( 512 * 512 * 4 ) in let s = P... |
let f select_devices devs data imageData c tf = ( fun _ -> let select = select_devices ## selectedIndex + 0 in compute select devs data imageData c tf ; Js . _false ) ; ; |
let newLine _ = Dom_html . createBr document |
let nodeJsText t = let sp = Dom_html . createSpan document in Dom . appendChild sp ( document ## createTextNode ( t ) ) ; sp |
let nodeText t = nodeJsText ( Js . string t ) |
let go _ = let body = Js . Opt . get ( document ## getElementById ( Js . string " section1 " ) ) ( fun ( ) -> assert false ) in Dom . appendChild body ( newLine ( ) ) ; let select_devices = createSelect document in Dom . appendChild body ( nodeText " Choose a computing ... |
let _ = window ## onload <- handler go |
module Test_operation_repr = struct open Operation_repr let test_of_list_single_case ( ) = Environment . wrap_tzresult @@ of_list [ Contents ( Manager_operation { fee = Obj . magic 0 ; operation = Obj . magic 0 ; gas_limit = Obj . magic 0 ; storage_limit = Obj . magic 0 ; counter ... |
let tests = [ tztest " of_list : single element input list " ` Quick Test_operation_repr . test_of_list_single_case ; tztest " of_list : multiple element input list " ` Quick Test_operation_repr . test_of_list_multiple_case ; tztest " of_list : empty input list " ` Quick Test_operation_r... |
type assoc = | Left | Right |
type info = { precedence : int ; associativity : assoc ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.