DGtal  1.2.0
testOpenMP.cpp
Go to the documentation of this file.
1 
31 #include <iostream>
32 #include "DGtal/base/Common.h"
34 
35 using namespace std;
36 using namespace DGtal;
37 
39 // Functions for testing class OpenMP.
41 
45 bool testOpenMP()
46 {
47  trace.beginBlock ( "Testing basic OpenMP ..." );
48 
49 #ifdef WITH_OPENMP
50  trace.info() << "Parallel helloworld"<<std::endl;
51 #pragma omp parallel
52  trace.info()<<"Hello, world.\n";
53 #else
54  trace.info() << "no parallel helloworld"<<std::endl;
55 #endif
56 
57  trace.endBlock();
58 
59  return true;
60 }
61 
63 // Standard services - public :
64 
65 int main( int argc, char** argv )
66 {
67  trace.beginBlock ( "Testing class OpenMP" );
68  trace.info() << "Args:";
69  for ( int i = 0; i < argc; ++i )
70  trace.info() << " " << argv[ i ];
71  trace.info() << endl;
72 
73  bool res = testOpenMP(); // && ... other tests
74  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
75  trace.endBlock();
76  return res ? 0 : 1;
77 }
78 // //
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
std::ostream & info()
double endBlock()
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition: Common.h:154
int main(int argc, char **argv)
Definition: testOpenMP.cpp:65
bool testOpenMP()
Definition: testOpenMP.cpp:45