Hey Jeff,

so you're formulating it so that the user needs to explicetly activate
OMP using the settings (makefile / vcxproj file)?
If the user doesn't run into any problems if he doesn't have OMP it's
fine for me.

Did you check if VisualStudio provides the _OPENMP macro or if there's a
different one used?
In either case you might want to consider making some
CRYPTOPP_OPENMP_AVAILABLE in config.h, so we can change the behavior at
one single point.

BR

JPM

Am 12.06.2015 um 15:20 schrieb Jeffrey Walton:
> Does anyone see any problems with the following patch?
>
> I found it useful during benchmarking (because I was not getting
> multiple OMP threads like I expected). if you add `-fopenmp` to
> CXXFLAGS, here's the output it produces:
>
>     $ ./cryptest.exe v
>     Using seed: 1434115590
>     Using 1 OMP threads
>
>     Testing Settings...
>
> if there are no issues, I'd like to consider it for the library as a
> patch.
>
> Jeff
>
> $ git diff test.cpp
> diff --git a/test.cpp b/test.cpp
> index 17d4909..9066b2e 100644
> --- a/test.cpp
> +++ b/test.cpp
> @@ -47,6 +47,10 @@
>  #pragma comment(lib, "ws2_32.lib")
>  #endif
>  
> +#if defined(_OPENMP) && (_OPENMP > 0)
> +# include <omp.h>
> +#endif
> +
>  USING_NAMESPACE(CryptoPP)
>  USING_NAMESPACE(std)
>  
> @@ -769,9 +773,15 @@ bool Validate(int alg, bool thorough, const char
> *seedInput
>         std::string seed = seedInput ? std::string(seedInput) :
> IntToString(time
>         seed.resize(16);
>  
> -       cout << "Using seed: " << seed << endl << endl;
> +       cout << "Using seed: " << seed << endl;
>         s_globalRNG.SetKeyWithIV((byte *)seed.data(), 16, (byte
> *)seed.data());
>  
> +#if defined(_OPENMP) && (_OPENMP > 0)
> +       cout << "Using " << omp_get_num_threads() << " OMP threads" <<
> endl;
> +#endif
> +
> +       cout << endl;
> +
>         switch (alg)
>         {
>         case 0: result = ValidateAll(thorough); break;
>
> -- 
> -- 
> You received this message because you are subscribed to the "Crypto++
> Users" Google Group.
> To unsubscribe, send an email to
> [email protected].
> More information about Crypto++ and this group is available at
> http://www.cryptopp.com.
> ---
> You received this message because you are subscribed to the Google
> Groups "Crypto++ Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected]
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout.

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to