Topic: any lib for multiplateform multithreading / multiprocessing ?

Is there a way to create/manage multiple thread working on both windows and linux ?

if not, what about multiprocessing ? i was thinking of MPI but it seems to be a pain to make it works on both plateform.

Any other idea/solution/possibility ?

I have some code that need to continuously do tons of computation while still responding to command from stdin.

i was even considering unix socket to communicate between multi process but... windows....

The best case scenario would be phtread of course. But i would need to use cygwin on windows to handle it.
I don't even know how to use pthread from fortran actually.

Re: any lib for multiplateform multithreading / multiprocessing ?

it seems there is a windows version of openmpi, no idea yet how to integrate the whole stuff into simply fortran.
And, ultimately, running openmpi application isn't very user friendly big_smile

Re: any lib for multiplateform multithreading / multiprocessing ?

The most "Fortran" way to do this might be to take advantage of coarray support.  You can have one image continue to respond to input while the other images would be performing calculations.  However, coarray support still isn't ideal for what you're discussing.  It's probably not as flexible as you'd like.  Simply Fortran on Windows supports coarrays without needing MPI, but you'd need MPI on other platforms.

Pthreads aren't particularly portable just because you'll need a wrapper on Windows.  We don't currently ship a Fortran-accessible Pthreads library with Windows, though we could make it available if there was interest.   

We ship OpenMP with all our platforms, so that's also an option.   Again, though, OpenMP might not be as flexible as you'd wish.

Jeff Armstrong
Approximatrix, LLC

Re: any lib for multiplateform multithreading / multiprocessing ?

Do you think it would be difficult to do a pthread module ?
I never ever used C library from fortran so i have no idea.

It could be educational for me to do it but pthread isn't an ideal practice target big_smile

I tried to think of a way to use coarray and openmp for my problem but everything feel like a terribly dirty hack

Re: any lib for multiplateform multithreading / multiprocessing ?

i have the feeling that mixing pthread and openmp would be a terrible nightmare so... i'm not sure.

Re: any lib for multiplateform multithreading / multiprocessing ?

There are Fortran pthread wrappers (here, for example) that should make things easier.  Mixing OpenMP and pthread calls shouldn't be problematic in theory, but it probably is in practice.  We can look at packaging a thread wrapping library, though.  I think that would make sense to include with the compiler.

Jeff Armstrong
Approximatrix, LLC