2 This source code file is part of thread_mpi.
3 Written by Sander Pronk, Erik Lindahl, and possibly others.
5 Copyright (c) 2009, Sander Pronk, Erik Lindahl.
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
10 1) Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12 2) 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 3) Neither the name of the copyright holders nor the
16 names of its contributors may be used to endorse or promote products
17 derived from this software without specific prior written permission.
19 THIS SOFTWARE IS PROVIDED BY US ''AS IS'' AND ANY
20 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 DISCLAIMED. IN NO EVENT SHALL WE BE LIABLE FOR ANY
23 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 If you want to redistribute modifications, please consider that
31 scientific software is very special. Version control is crucial -
32 bugs must be traceable. We will be happy to consider code for
33 inclusion in the official distribution, but derived work should not
34 be called official thread_mpi. Details are found in the README & COPYING
39 /*#define TMPI_DEBUG*/
42 /* If this is defined, thread_mpi will print a message when for every MPI
43 call is called or returns. Useful for debugging MPI-related issues
44 in the calling program. */
45 /*#define TMPI_TRACE*/
47 /* if this is defined, MPI will warn/hang/crash on practices that don't conform
48 to the MPI standard (such as not calling tMPI_Comm_free on all threads that
49 are part of the comm being freed). */
52 /* whether to warn if there are mallocs at performance-critical sections
53 (due to preallocations being too small) */
54 /*#define TMPI_WARN_MALLOC*/
57 /* the number of envelopes to allocate per thread-to-thread path */
60 /* the normal maximum number of threads for pre-defined arrays
61 (if the actual number of threads is bigger than this, it'll
62 allocate/deallocate arrays, so no problems will arise). */
63 #define MAX_PREALLOC_THREADS 64
65 /* Whether to use lock-free lists using compare-and-swap (cmpxchg on x86)
66 pointer functions. Message passing using blocking Send/Recv, and multicasts
67 are is still blocking, of course. */
68 #define TMPI_LOCK_FREE_LISTS
70 /* Whether to disable yielding to the OS scheduler during waits. Disabling
71 this improves performance very slightly if Nthreads<=Ncores on an
72 otherwise idle system because waits have slightly lower latencies, but
73 causes very poor performance if threads are competing for CPU time (for
74 example, when Nthreads>Ncores, or another process is running on the
77 This option can be set with cmake. */
78 /*#define TMPI_WAIT_FOR_NO_ONE */
82 /* whether to enable double-copying (where the sender copies data to an
83 intermediate buffer for small enough buffers, allowing it to return
84 from a blocking send call early. The receiver is free to copy from the
85 original buffer while the sender is copying, possibly allowing them to
88 This option can be set with cmake. */
89 /*#define TMPI_COPY_BUFFER*/
92 /* The size (in bytes) of the maximum transmission size for which double
93 copying is allowed (i.e. the sender doesn't wait for the receiver to
94 become ready, but posts a copied buffer in its envelope).
96 A size of 8192 bytes was chosen after some testing with Gromacs. */
97 #define COPY_BUFFER_SIZE 8192
98 #ifdef TMPI_COPY_BUFFER
99 /* We can separately specify whether we want copy buffers for send/recv or
100 multicast communications: */
101 #define USE_SEND_RECV_COPY_BUFFER
102 #define USE_COLLECTIVE_COPY_BUFFER
106 /* The number of collective envelopes per comm object. This is the maximum
107 number of simulataneous collective communications that can
108 take place per comm object. If TMPI_NO_COPY_BUFFER is set, simultaneous
109 collective communications don't happen and 2 is the right value. */
110 #ifdef USE_COLLECTIVE_COPY_BUFFER
111 #define N_COLL_ENV 12
117 /* Whether to do profiling of the number of MPI communication calls. A
118 report with the total number of calls for each communication function
119 will be generated at MPI_Finalize().
121 This option can be set with cmake.*/
122 /*#define TMPI_PROFILE*/