1 // ==========================================================================
2 //                 SeqAn - The Library for Sequence Analysis
3 // ==========================================================================
4 // Copyright (c) 2006-2018, Knut Reinert, FU Berlin
5 // All rights reserved.
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions are met:
9 //
10 //     * Redistributions of source code must retain the above copyright
11 //       notice, this list of conditions and the following disclaimer.
12 //     * Redistributions in binary form must reproduce the above copyright
13 //       notice, this list of conditions and the following disclaimer in the
14 //       documentation and/or other materials provided with the distribution.
15 //     * Neither the name of Knut Reinert or the FU Berlin nor the names of
16 //       its contributors may be used to endorse or promote products derived
17 //       from this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 // ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE
23 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
29 // DAMAGE.
30 //
31 // ==========================================================================
32 // Author: Manuel Holtgrewe <manuel.holtgrewe@fu-berlin.de>
33 // ==========================================================================
34 // This sub module contains simple, generic support code for parallelism in
35 // SeqAn.
36 //
37 // It mainly defines the macro SEQAN_ENABLE_PARALLELISM.
38 // ==========================================================================
39 
40 #ifndef SEQAN_INCLUDE_SEQAN_BASIC_BASIC_PARALLELISM_H_
41 #define SEQAN_INCLUDE_SEQAN_BASIC_BASIC_PARALLELISM_H_
42 
43 /*!
44  * @macro SEQAN_ENABLE_PARALLELISM
45  * @headerfile <seqan/basic.h>
46  * @brief Indicates whether parallelism is enabled with value 0/1.
47  *
48  * @signature SEQAN_ENABLE_PARALLELISM
49  *
50  * By default, set to 1 if <tt>_OPENMP</tt> is defined and set to 0 otherwise.
51  *
52  * @section Examples
53  *
54  * If you want to change tihs value then you have to define this value before include any SeqAn header.
55  *
56  * @code{.cpp}
57  * #define SEQAN_ENABLE_PARALLELISM 0  // ALWAYS switch off parallelism!
58  *
59  * #include <seqan/basic.h>
60  *
61  * int main(int argc, char ** argv)
62  * {
63  *     return 0;
64  * }
65  * @endcode
66  */
67 
68 #if !defined(SEQAN_ENABLE_PARALLELISM)
69 #if defined(_OPENMP)
70 #define SEQAN_ENABLE_PARALLELISM 1
71 #else  // defined(_OPENMP)
72 #define SEQAN_ENABLE_PARALLELISM 0
73 #endif  // defined(_OPENMP)
74 #endif  // !defined(SEQAN_ENABLE_PARALLELISM)
75 
76 #endif  // SEQAN_INCLUDE_SEQAN_BASIC_BASIC_PARALLELISM_H_
77