rdicosmo / parmap

Parmap is a minimalistic library allowing to exploit multicore architecture for OCaml programs with minimal modifications.
http://rdicosmo.github.io/parmap/
Other
94 stars 20 forks source link

fix build on windows #101

Closed EduardoRFS closed 2 years ago

EduardoRFS commented 3 years ago

This patch allows parmap to build on Windows, but not to run on Windows as there is no Unix.fork.

I have no idea if it's possible to make it fully work on Windows at all, using ZwCreateProcess is possible and I was able to make it work, but it's an NT API and that's hackish as it can get.

So with this libraries can still use parmap but just add an if Sys.win32 to not use parmap when it's Windows

rdicosmo commented 2 years ago

Thanks @EduardoRFS for this suggestion: I'm merging it! Parmap relies on the fork POSIX primitive to do its work, and it is hard to get this working in Windows. I have no way of telling if there is interest in having Parmap working natively on Windows, but if you already know how the needed magic to support it, it would be fun to add it :-)

UnixJunkie commented 2 years ago

Since parmap should likely be rewritten for multicore-ocaml, then it should provide windows support easily.

On Wed, Dec 29, 2021 at 12:46 AM Roberto Di Cosmo @.***> wrote:

Merged #101 https://github.com/rdicosmo/parmap/pull/101 into master.

— Reply to this email directly, view it on GitHub https://github.com/rdicosmo/parmap/pull/101#event-5821826520, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFUFAD3AK2PY555AI37QWTUTHLWHANCNFSM43TQ7YRA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

rdicosmo commented 2 years ago

@UnixJunkie: just to avoid confusion, developing a fully compatible equivalent of parmap without Unix.fork is a highly nontrivial task, and there is no such plan at the moment.

EduardoRFS commented 2 years ago

I think using ZwCreateProcess is a bad idea in general, so for windows it should probably just use the main process. So that at least the compatibility is there.