text
stringlengths
12
786k
type managed_ktyp = { mk_name : string ; mk_crepr : string ; }
let type_repr = Hashtbl . create 10
let rec has_of = function | ( _ , Some t ) :: q -> true | ( _ , None ) :: q -> has_of q | [ ] -> false
let gen_ctypes _loc kt name = let gen_repr _loc t name = let managed_ktypes = Hashtbl . create 5 in let sarek_type_name = name " ^ _sarek " in Hashtbl . add sarek_types_tbl name sarek_type_name ; let ctype = begin let fieldsML = match t with | Custom ( KRecord ( ctypes , idents , _ ) , ...
let $ lid " : custom " ( ^ String . capitalize_ascii name ) $ : ( ( $ lid : name , $$ lid : sarek_type_name ) $ Vector . custom ) = ] @ ( <: str_item < Kirc . constructors := $ str : a " ^\ n " $ :: ! Kirc . constructors ) >> ) ) end
let gen_labels _loc ( t1 : ident * ctyp * bool ) ( t2 : ( ctyp list * ident list * bool list ) option ) : ctyp list * ident list * bool list = let s , t , m = t1 in let t1 = TyCol ( _loc , ( TyId ( _loc , s ) ) , t ) in match t2 with | Some ( t2 , s2 , m2 ) -> ...
let gen_constructors _loc ( t1 : string * ctyp option ) ( t2 : ( string * ctyp option ) list option ) : ( string * ctyp option ) list = match t2 with | Some t -> t1 :: t | None -> t1 [ ] ::
let ba_kind_is_float ( type a b ) ( k : ( a , b ) Bigarray . kind ) = let open Bigarray in match k with | Float32 -> true | Float64 -> true | Complex32 -> true | Complex64 -> true | Int8_signed -> false | Int8_unsigned -> false | Int16_signed -> false | Int16_unsigned -> false | Int32...
let mpi_error s = raise ( Error s )
let _ = Callback . register_exception " Mpi . Error " ( Error " " ) ; init Sys . argv ; at_exit finalize
let comm_world = get_comm_world ( ) communicator -> communicator -> bool = " caml_mpi_comm_compare "
type color = int communicator -> color -> int -> communicator = " caml_mpi_comm_split "
let color_none = get_undefined ( ) communicator -> int array -> bool array -> bool -> communicator = " caml_mpi_cart_create " communicator -> rank -> int array = " caml_mpi_cart_coords "
let any_source = get_any_source ( ) ' a -> Marshal . extern_flags list -> rank -> tag -> communicator -> unit = " caml_mpi_send "
let send data dest tag comm = send_basic data [ Marshal . Closures ] dest tag comm int -> int -> communicator -> int * int * int = " caml_mpi_probe " int -> int -> communicator -> ( int * int * int ) option = " caml_mpi_iprobe " int -> rank -> tag -> communicator -> ' a = " caml_...
let receive source tag comm = let ( len , actual_source , actual_tag ) = probe source tag comm in receive_basic len source tag comm
let receive_status source tag comm = let ( len , actual_source , actual_tag ) = probe source tag comm in let v = receive_basic len source tag comm in ( v , actual_source , actual_tag )
let probe source tag comm = let ( len , actual_source , actual_tag ) = probe source tag comm in ( actual_source , actual_tag )
let iprobe source tag comm = match iprobe source tag comm with | None -> None | Some ( len , actual_source , actual_tag ) -> Some ( actual_source , actual_tag ) int -> rank -> tag -> communicator -> unit = " caml_mpi_send_int " rank -> tag -> communicator -> int = " caml_mpi_receive_in...
let send_bigarray0 x = send_bigarray ( Bigarray . ( genarray_of_array0 x ) )
let send_bigarray1 x = send_bigarray ( Bigarray . ( genarray_of_array1 x ) )
let send_bigarray2 x = send_bigarray ( Bigarray . ( genarray_of_array2 x ) )
let send_bigarray3 x = send_bigarray ( Bigarray . ( genarray_of_array3 x ) )
let receive_bigarray0 x = receive_bigarray ( Bigarray . ( genarray_of_array0 x ) )
let receive_bigarray1 x = receive_bigarray ( Bigarray . ( genarray_of_array1 x ) )
let receive_bigarray2 x = receive_bigarray ( Bigarray . ( genarray_of_array2 x ) )
let receive_bigarray3 x = receive_bigarray ( Bigarray . ( genarray_of_array3 x ) )
let null_request = alloc_request ( ) ' a -> Marshal . extern_flags list -> rank -> tag -> communicator -> request = " caml_mpi_isend "
let isend data dest tag comm = isend_basic data [ Marshal . Closures ] dest tag comm ' a -> Marshal . extern_flags list -> rank -> tag -> communicator -> request * request = " caml_mpi_isend_varlength "
let isend_varlength data dest tag comm = isend_basic_varlength data [ Marshal . Closures ] dest tag comm int -> rank -> tag -> communicator -> request = " caml_mpi_ireceive " rank -> tag -> communicator -> request = " caml_mpi_ireceive_varlength "
let wait_pair ( req1 , req2 ) = wait req1 ; wait req2
let broadcast v root comm = let myself = comm_rank comm in if myself = root then begin let data = Marshal . to_bytes v [ Marshal . Closures ] in ignore ( broadcast_int ( Bytes . length data ) root comm ) ; broadcast_bytes data root comm ; v end else begin let len = broadcast_int 0 root comm ...
let broadcast_opt data root comm = match data with Some d -> broadcast d root comm | None -> if root = comm_rank comm then mpi_error " Mpi . broadcast_opt : no data at root " else broadcast ( Obj . magic ( ) ) root comm float -> rank -> communicator -> float = " caml_mpi_broadcast_float " ...
let broadcast_bigarray0 x = broadcast_bigarray ( Bigarray . ( genarray_of_array0 x ) )
let broadcast_bigarray1 x = broadcast_bigarray ( Bigarray . ( genarray_of_array1 x ) )
let broadcast_bigarray2 x = broadcast_bigarray ( Bigarray . ( genarray_of_array2 x ) )
let broadcast_bigarray3 x = broadcast_bigarray ( Bigarray . ( genarray_of_array3 x ) ) bytes -> int array -> bytes -> int -> communicator -> unit = " caml_mpi_scatter " = " caml_mpi_scatter_int "
let scatter data root comm = let myself = comm_rank comm in let nprocs = comm_size comm in if myself = root then begin if Array . length data <> nprocs then mpi_error " Mpi . scatter : wrong array size " ; let buffers = Array . map ( fun d -> Marshal . to_bytes d [ Marshal . Closures ] ) ...
let scatter_from_bigarray1 x = scatter_from_bigarray ( Bigarray . ( genarray_of_array1 x ) )
let scatter_from_bigarray2 x = scatter_from_bigarray ( Bigarray . ( genarray_of_array2 x ) )
let scatter_from_bigarray3 x = scatter_from_bigarray ( Bigarray . ( genarray_of_array3 x ) ) int array -> int array -> rank -> communicator -> unit = " caml_mpi_scatter_intarray "
let scatter_int_array src dst rank comm = if rank = comm_rank comm && Array . length src <> Array . length dst * comm_size comm then mpi_error " Mpi . scatter_int_array : array size mismatch " else scatter_int_array src dst rank comm float array -> float array -> rank -> communicator -> unit = " ...
let scatter_float_array src dst rank comm = if rank = comm_rank comm && Array . length src <> Array . length dst * comm_size comm then mpi_error " Mpi . scatter_float_array : array size mismatch " else scatter_float_array src dst rank comm ( ' a , ' b , ' c ) Bigarray . Genarray . t -...
let scatter_bigarray1 s d = scatter_bigarray ( Bigarray . ( genarray_of_array1 s ) ) ( Bigarray . ( genarray_of_array1 d ) ) bytes -> bytes -> int array -> int -> communicator -> unit = " caml_mpi_gather " = " caml_mpi_gather_int "
let gather data root comm = let myself = comm_rank comm in let nprocs = comm_size comm in let send_buffer = Marshal . to_bytes data [ Marshal . Closures ] in if myself = root then begin let lengths = Array . make nprocs 0 in gather_int ( Bytes . length send_buffer ) lengths root comm ; let tota...
let gather_int src dst rank comm = if rank = comm_rank comm && Array . length dst <> comm_size comm then mpi_error " Mpi . gather_int : array size mismatch " else gather_int src dst rank comm float -> float array -> rank -> communicator -> unit = " caml_mpi_gather_float "
let gather_float src dst rank comm = if rank = comm_rank comm && Array . length dst <> comm_size comm then mpi_error " Mpi . gather_float : array size mismatch " else gather_float src dst rank comm ' a -> ( ' a , ' b , ' c ) Bigarray . Genarray . t -> rank -> communicator -> unit =...
let gather_to_bigarray1 s d = gather_to_bigarray s ( Bigarray . ( genarray_of_array1 d ) )
let gather_to_bigarray2 s d = gather_to_bigarray s ( Bigarray . ( genarray_of_array2 d ) )
let gather_to_bigarray3 s d = gather_to_bigarray s ( Bigarray . ( genarray_of_array3 d ) ) int array -> int array -> rank -> communicator -> unit = " caml_mpi_gather_intarray "
let gather_int_array src dst rank comm = if rank = comm_rank comm && Array . length dst <> Array . length src * comm_size comm then mpi_error " Mpi . gather_int_array : array size mismatch " else gather_int_array src dst rank comm float array -> float array -> rank -> communicator -> unit = " cam...
let gather_float_array src dst rank comm = if rank = comm_rank comm && Array . length dst <> Array . length src * comm_size comm then mpi_error " Mpi . gather_float_array : array size mismatch " else gather_float_array src dst rank comm ( ' a , ' b , ' c ) Bigarray . Genarray . t -> (...
let gather_bigarray1 s d = gather_bigarray ( Bigarray . ( genarray_of_array1 s ) ) ( Bigarray . ( genarray_of_array1 d ) ) bytes -> bytes -> int array -> communicator -> unit = " caml_mpi_allgather " = " caml_mpi_allgather_int "
let allgather data comm = let nprocs = comm_size comm in let send_buffer = Marshal . to_bytes data [ Marshal . Closures ] in let lengths = Array . make nprocs 0 in allgather_int ( Bytes . length send_buffer ) lengths comm ; let total_len = Array . fold_left ( ) + 0 lengths in let recv_bu...
let allgather_int src dst comm = if Array . length dst <> comm_size comm then mpi_error " MPI . allgather_int : array size mismatch " else allgather_int src dst comm float -> float array -> communicator -> unit = " caml_mpi_allgather_float "
let allgather_float src dst comm = if Array . length dst <> comm_size comm then mpi_error " MPI . allgather_float : array size mismatch " else allgather_float src dst comm ' a -> ( ' a , ' b , ' c ) Bigarray . Genarray . t -> communicator -> unit = " caml_mpi_allgather_to_bigarray "...
let allgather_to_bigarray1 s d = allgather_to_bigarray s ( Bigarray . ( genarray_of_array1 d ) )
let allgather_to_bigarray2 s d = allgather_to_bigarray s ( Bigarray . ( genarray_of_array2 d ) )
let allgather_to_bigarray3 s d = allgather_to_bigarray s ( Bigarray . ( genarray_of_array3 d ) ) int array -> int array -> communicator -> unit = " caml_mpi_allgather_intarray "
let allgather_int_array src dst comm = if Array . length dst <> Array . length src * comm_size comm then mpi_error " MPI . allgather_int_array : array size mismatch " else allgather_int_array src dst comm float array -> float array -> communicator -> unit = " caml_mpi_allgather_float "
let allgather_float_array src dst comm = if Array . length dst <> Array . length src * comm_size comm then mpi_error " MPI . allgather_float_array : array size mismatch " else allgather_float_array src dst comm ( ' a , ' b , ' c ) Bigarray . Genarray . t -> ( ' a , ' b , ' c...
let allgather_bigarray1 s d = allgather_bigarray ( Bigarray . ( genarray_of_array1 s ) ) ( Bigarray . ( genarray_of_array1 d ) ) int array -> int array -> communicator -> unit = " caml_mpi_alltoall_intarray " bytes -> int array -> bytes -> int array -> communicator -> unit = " caml_...
let alltoall data comm = let nprocs = comm_size comm in if Array . length data <> nprocs then mpi_error " Mpi . alltoall : wrong array size " ; let send_buffers = Array . map ( fun d -> Marshal . to_bytes d [ Marshal . Closures ] ) data in let send_lengths = Array . map Bytes . length...
let alltoall_int_array src dst comm = if Array . length src <> Array . length dst then mpi_error " Mpi . alltoall_int_array : array size mismatch " else alltoall_int_array src dst comm float array -> float array -> communicator -> unit = " caml_mpi_alltoall_floatarray "
let alltoall_float_array src dst comm = if Array . length src <> Array . length dst then mpi_error " Mpi . alltoall_float_array : array size mismatch " else alltoall_float_array src dst comm ( ' a , ' b , ' c ) Bigarray . Genarray . t -> ( ' a , ' b , ' c ) Bigarray . Gen...
let alltoall_bigarray1 s d = alltoall_bigarray ( Bigarray . ( genarray_of_array1 s ) ) ( Bigarray . ( genarray_of_array1 d ) )
let alltoall_bigarray2 s d = alltoall_bigarray ( Bigarray . ( genarray_of_array2 s ) ) ( Bigarray . ( genarray_of_array2 d ) )
let alltoall_bigarray3 s d = alltoall_bigarray ( Bigarray . ( genarray_of_array3 s ) ) ( Bigarray . ( genarray_of_array3 d ) )
type _ op = Max : [ < ` Int | ` Float ] op | Min : [ < ` Int | ` Float ] op | Sum : [ < ` Int | ` Float ] op | Prod : [ < ` Int | ` Float ] op | Land : [ < ` Int ] op | Lor : [ < ` Int ] op | Xor : [ < ` Int ] op | Int_max : [ < ` Int ] ...
let reduce_int_array src dst op rank comm = if rank = comm_rank comm && Array . length src <> Array . length dst then mpi_error " Mpi . reduce_int_array : array size mismatch " else reduce_int_array src dst op rank comm float array -> float array -> [ ` Float ] op -> rank -> communicator -> un...
let reduce_float_array src dst op rank comm = if rank = comm_rank comm && Array . length src <> Array . length dst then mpi_error " Mpi . reduce_float_array : array size mismatch " else reduce_float_array src dst op rank comm ( ' a , ' b , ' c ) Bigarray . Genarray . t -> ( ' a , ...
let reduce_bigarray0 s d = reduce_bigarray ( Bigarray . ( genarray_of_array0 s ) ) ( Bigarray . ( genarray_of_array0 d ) )
let reduce_bigarray1 s d = reduce_bigarray ( Bigarray . ( genarray_of_array1 s ) ) ( Bigarray . ( genarray_of_array1 d ) )
let reduce_bigarray2 s d = reduce_bigarray ( Bigarray . ( genarray_of_array2 s ) ) ( Bigarray . ( genarray_of_array2 d ) )
let reduce_bigarray3 s d = reduce_bigarray ( Bigarray . ( genarray_of_array3 s ) ) ( Bigarray . ( genarray_of_array3 d ) ) int -> [ ` Int ] op -> communicator -> int = " caml_mpi_allreduce_int " float -> [ ` Float ] op -> communicator -> float = " caml_mpi_allreduce_float ...
let allreduce_int_array src dst op comm = if Array . length src <> Array . length dst then mpi_error " Mpi . allreduce_int_array : array size mismatch " else allreduce_int_array src dst op comm float array -> float array -> [ ` Float ] op -> communicator -> unit = " caml_mpi_allreduce_floatarr...
let allreduce_float_array src dst op comm = if Array . length src <> Array . length dst then mpi_error " Mpi . allreduce_float_array : array size mismatch " else allreduce_float_array src dst op comm ( ' a , ' b , ' c ) Bigarray . Genarray . t -> ( ' a , ' b , ' c ) Bigarra...
let allreduce_bigarray0 s d = allreduce_bigarray ( Bigarray . ( genarray_of_array0 s ) ) ( Bigarray . ( genarray_of_array0 d ) )
let allreduce_bigarray1 s d = allreduce_bigarray ( Bigarray . ( genarray_of_array1 s ) ) ( Bigarray . ( genarray_of_array1 d ) )
let allreduce_bigarray2 s d = allreduce_bigarray ( Bigarray . ( genarray_of_array2 s ) ) ( Bigarray . ( genarray_of_array2 d ) )
let allreduce_bigarray3 s d = allreduce_bigarray ( Bigarray . ( genarray_of_array3 s ) ) ( Bigarray . ( genarray_of_array3 d ) ) = " caml_mpi_scan_int " float -> [ ` Float ] op -> communicator -> float = " caml_mpi_scan_float " int array -> int array -> [ ` Int ] op -> c...
let scan_int_array src dst op comm = if Array . length dst <> Array . length src then mpi_error " Mpi . scan_int_array : array size mismatch " else scan_int_array src dst op comm float array -> float array -> [ ` Float ] op -> communicator -> unit = " caml_mpi_scan_floatarray "
let scan_float_array src dst op comm = if Array . length dst <> Array . length src then mpi_error " Mpi . scan_float_array : array size mismatch " else scan_float_array src dst op comm ( ' a , ' b , ' c ) Bigarray . Genarray . t -> ( ' a , ' b , ' c ) Bigarray . Genarray ...
let scan_bigarray0 s d = scan_bigarray ( Bigarray . ( genarray_of_array0 s ) ) ( Bigarray . ( genarray_of_array0 d ) )
let scan_bigarray1 s d = scan_bigarray ( Bigarray . ( genarray_of_array1 s ) ) ( Bigarray . ( genarray_of_array1 d ) )
let scan_bigarray2 s d = scan_bigarray ( Bigarray . ( genarray_of_array2 s ) ) ( Bigarray . ( genarray_of_array2 d ) )
let scan_bigarray3 s d = scan_bigarray ( Bigarray . ( genarray_of_array3 s ) ) ( Bigarray . ( genarray_of_array3 d ) )
type group_range = { range_first : int ; range_last : int ; range_stride : int }
let rec scrape env mty = match mty with Tmty_ident p -> begin try scrape env ( Env . find_modtype_expansion p env ) with Not_found -> mty end | _ -> mty
let freshen mty = Subst . modtype Subst . identity mty
let rec strengthen env mty p = match scrape env mty with Tmty_signature sg -> Tmty_signature ( strengthen_sig env sg p ) | Tmty_functor ( param , arg , res ) when ! Clflags . applicative_functors -> Tmty_functor ( param , arg , strengthen env res ( Papply ( p , Pident param ) ) ) |...
type variance = Co | Contra | Strict
let nondep_supertype env mid mty = let rec nondep_mty env va mty = match mty with Tmty_ident p -> if Path . isfree mid p then nondep_mty env va ( Env . find_modtype_expansion p env ) else mty | Tmty_signature sg -> Tmty_signature ( nondep_sig env va sg ) | Tmty_functor ( param , arg , res ) -...
let enrich_typedecl env p decl = match decl . type_manifest with Some ty -> decl | None -> try let orig_decl = Env . find_type p env in if orig_decl . type_arity <> decl . type_arity then decl else { decl with type_manifest = Some ( Btype . newgenty ( Tconstr ( p , decl . type_params , re...
let rec enrich_modtype env p mty = match mty with Tmty_signature sg -> Tmty_signature ( List . map ( enrich_item env p ) sg ) | _ -> mty Tsig_type ( id , decl , rs ) -> Tsig_type ( id , enrich_typedecl env ( Pdot ( p , Ident . name id , nopos ) ) decl , rs ) | Tsig_module ...
let rec type_paths env p mty = match scrape env mty with Tmty_ident p -> [ ] | Tmty_signature sg -> type_paths_sig env p 0 sg | Tmty_functor ( param , arg , res ) -> [ ] match sg with [ ] -> [ ] | Tsig_value ( id , decl ) :: rem -> let pos ' = match decl . val_kind with Val...
let rec no_code_needed env mty = match scrape env mty with Tmty_ident p -> false | Tmty_signature sg -> no_code_needed_sig env sg | Tmty_functor ( _ , _ , _ ) -> false match sg with [ ] -> true | Tsig_value ( id , decl ) :: rem -> begin match decl . val_kind with | Val_prim _ -> no_c...
let f x = ( multimatch x with ` A -> 1 | ` B -> true ) , ( multimatch x with ` A -> 1 . | ` B -> " 1 " ) ; ;
module M : sig val f : [ < ` A & ' a = int & ' b = float | ` B & ' b = string & ' a = bool ] -> ' a * ' b
module M : sig val f : [ < ` A & ' a = int & ' b = float | ` B & ' b = string & ' a = int ] -> ' a * ' b