relic-toolkit / relic

Code
Other
458 stars 179 forks source link

What value for MULTI to use relic multithreaded with Windows #229

Closed oliviervibe closed 2 years ago

oliviervibe commented 2 years ago

What value must be defined for MULTI to use multithreading with Windows?

The 2 values that can be defined - PTHREAD, OPENMP - don't seem to be compatible with Windows!

dfaranha commented 2 years ago

Thanks for opening the issue!

When you try one of these, do you see an error message?

oliviervibe commented 2 years ago

Thanks for answering so quickly!

Yes, I tried both and none is working. Under Windows there is no pthread.h or omp.h. Windows has its own threading API and model.

For the moment even using it in a multi-threaded application I haven't seen any error yet, but it could happen!

Thanks

Olivier


From: Diego F. Aranha @.> Sent: Friday, April 8, 2022 3:25 PM To: relic-toolkit/relic @.> Cc: Olivier Rouit @.>; Author @.> Subject: Re: [relic-toolkit/relic] What value for MULTI to use relic multithreaded with Windows (Issue #229)

Thanks for opening the issue!

When you try one of these, do you see an error message?

— Reply to this email directly, view it on GitHubhttps://github.com/relic-toolkit/relic/issues/229#issuecomment-1092538754, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AN6LQ2XPVPLOI5GC35XKY2TVD7NOHANCNFSM5S3H456Q. You are receiving this because you authored the thread.Message ID: @.***>

dfaranha commented 2 years ago

I will add a CI target for Windows multithreading and see what happens. But I would be very surprised if there's no OpenMP support in Windows.

oliviervibe commented 2 years ago

THere is OpenMP on Windows, a colleague confirmed it this weekend. But the switch /openmp is not set with OPENMP for MULTI.

Thanks

Olivier Rouit


From: Diego F. Aranha @.> Sent: Friday, April 8, 2022 4:30 PM To: relic-toolkit/relic @.> Cc: Olivier Rouit @.>; Author @.> Subject: Re: [relic-toolkit/relic] What value for MULTI to use relic multithreaded with Windows (Issue #229)

I will add a CI target for Windows multithreading and see what happens. But I would be very surprised if there's no OpenMP support in Windows.

— Reply to this email directly, view it on GitHubhttps://github.com/relic-toolkit/relic/issues/229#issuecomment-1092597757, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AN6LQ2STI2WUGOQIWYIMIHDVD7VDXANCNFSM5S3H456Q. You are receiving this because you authored the thread.Message ID: @.***>

dfaranha commented 2 years ago

What compiler are you using? The /openmp flag is added if MSVC is detected by CMake.

dfaranha commented 2 years ago

It now builds correctly, as detected by the CI: https://github.com/relic-toolkit/relic/runs/6049937844?check_suite_focus=true

oliviervibe commented 2 years ago

Hi Diego,

I'm using Visual Studio 2019 at the moment for Windows and on other systems VScode with the local toolchains (Linux, MacOS).

We also compile for Android, iOS, and for ARM architecture (with no standard OS).

I also ran in conflicting #define with another library and Windows. Relic defined DOUBLE and it's a very common name in programming! I used RLC_DOUBLE following your naming conventions. You possibly can integrate it as it's very straightforward!

Currently, I keep a local copy of Relic as I want to avoid another issue if the pairing maths of Baretto are changed again.

Thanks a lot,

Olivier Rouit

From: Diego F. Aranha @.> Sent: Saturday, April 16, 2022 11:48 PM To: relic-toolkit/relic @.> Cc: Olivier Rouit @.>; Author @.> Subject: Re: [relic-toolkit/relic] What value for MULTI to use relic multithreaded with Windows (Issue #229)

What compiler are you using? The /openmp flag is added if MSVC is detected by CMake.

— Reply to this email directly, view it on GitHubhttps://github.com/relic-toolkit/relic/issues/229#issuecomment-1100693949, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AN6LQ2WU437MDX2KRDHUWGDVFLOL3ANCNFSM5S3H456Q. You are receiving this because you authored the thread.Message ID: @.***>

dfaranha commented 2 years ago

Thanks for the feedback! I'm slowly improving the configuration to not clash with other libraries and to make it simpler, so this is helpful.