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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to