Stéphane Glondu pushed to branch master at Debian OCaml Maintainers / parmap
Commits:
-
ed5aa77f
by Stephane Glondu at 2022-02-20T17:59:18+01:00
-
6f6bbc1d
by Stephane Glondu at 2022-02-20T17:59:19+01:00
-
f12c1244
by Stephane Glondu at 2022-02-20T17:59:24+01:00
-
4c71803d
by Stephane Glondu at 2022-02-20T18:00:22+01:00
-
c3350681
by Stephane Glondu at 2022-02-20T18:00:47+01:00
6 changed files:
Changes:
| 1 |
+parmap (1.2.4-1) unstable; urgency=medium
|
|
| 2 |
+ |
|
| 3 |
+ * Team upload
|
|
| 4 |
+ * New upstream release
|
|
| 5 |
+ |
|
| 6 |
+ -- Stéphane Glondu <glondu@debian.org> Sun, 20 Feb 2022 18:00:43 +0100
|
|
| 7 |
+ |
|
| 1 | 8 |
parmap (1.2.3-1) unstable; urgency=medium
|
| 2 | 9 |
|
| 3 | 10 |
[ Stéphane Glondu ]
|
| ... | ... | @@ -5,7 +5,7 @@ Maintainer: Debian OCaml Maintainers <debian-ocaml-maint@lists.debian.org> |
| 5 | 5 |
Uploaders: Mehdi Dogguy <mehdi@debian.org>
|
| 6 | 6 |
Build-Depends:
|
| 7 | 7 |
debhelper-compat (= 13),
|
| 8 |
- ocaml-nox,
|
|
| 8 |
+ ocaml,
|
|
| 9 | 9 |
ocaml-dune,
|
| 10 | 10 |
libdune-ocaml-dev,
|
| 11 | 11 |
dh-ocaml
|
| 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 |
|
| 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"
|
| ... | ... | @@ -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
|
| ... | ... | @@ -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;
|