[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Git][ocaml-team/parmap][upstream] New upstream version 1.2.4



Title: GitLab

Stéphane Glondu pushed to branch upstream at Debian OCaml Maintainers / parmap

Commits:

4 changed files:

Changes:

  • dune-project
    1 1
     (lang dune 2.7)
    
    2 2
     
    
    3 3
     (name parmap)
    
    4
    -(version 1.2.3)
    
    4
    +(version 1.2.4)
    
    5 5
     
    
    6 6
     (generate_opam_files true)
    
    7 7
     
    

  • parmap.opam
    1
    -version: "1.2.3"
    
    1
    +version: "1.2.4"
    
    2 2
     # This file is generated by dune, edit dune-project instead
    
    3 3
     opam-version: "2.0"
    
    4 4
     synopsis: "Minimalistic library allowing to exploit multicore architecture"
    

  • src/parmap.ml
    ... ... @@ -718,11 +718,11 @@ let array_float_parmapi
    718 718
           array: the data in Bigarray is placed at offset 1 w.r.t. a normal array,
    
    719 719
           so we get a pointer to that zone into arr_out_as_array, and have it typed
    
    720 720
           as a float array *)
    
    721
    -   let barr_out_as_array = Array.unsafe_get (Obj.magic barr_out) 1 in
    
    721
    +   (*let barr_out_as_array = Array.unsafe_get (Obj.magic barr_out) 1 in*)
    
    722 722
        let compute _ lo hi _ exc_handler =
    
    723 723
          try
    
    724 724
            for i=lo to hi do
    
    725
    -         Array.unsafe_set barr_out_as_array i (f i (Array.unsafe_get al i))
    
    725
    +         Bigarray.Array1.unsafe_set barr_out i (f i (Array.unsafe_get al i))
    
    726 726
            done
    
    727 727
          with e -> exc_handler e lo
    
    728 728
        in
    

  • src/setcore_stubs.c
    ... ... @@ -12,14 +12,26 @@
    12 12
     #include <unistd.h>
    
    13 13
     #include <errno.h>
    
    14 14
     #include <caml/mlvalues.h>
    
    15
    +#ifdef _WIN32
    
    16
    +#include <windows.h>
    
    17
    +#endif
    
    15 18
     
    
    19
    +static int get_numcores() {
    
    20
    +#ifdef _WIN32
    
    21
    +  SYSTEM_INFO sysinfo;
    
    22
    +  GetSystemInfo(&sysinfo);
    
    23
    +  return sysinfo.dwNumberOfProcessors;
    
    24
    +#else
    
    25
    +  return sysconf( _SC_NPROCESSORS_ONLN );
    
    26
    +#endif
    
    27
    +}
    
    16 28
     CAMLprim value numcores(value unit) {
    
    17
    -  int numcores = sysconf( _SC_NPROCESSORS_ONLN );
    
    29
    +  int numcores = get_numcores();
    
    18 30
       return Val_int(numcores);
    
    19 31
     }
    
    20 32
     
    
    21 33
     CAMLprim value setcore(value which) {
    
    22
    -  int numcores = sysconf( _SC_NPROCESSORS_ONLN );
    
    34
    +  int numcores = get_numcores();
    
    23 35
       int w = Int_val(which) % numcores; // stay in the space of existing cores
    
    24 36
     #if HAVE_DECL_SCHED_SETAFFINITY
    
    25 37
       cpu_set_t cpus;   
    


  • Reply to: