/[escript]/trunk/escript/src/Utils.h
ViewVC logotype

Contents of /trunk/escript/src/Utils.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4154 - (show annotations)
Tue Jan 22 09:30:23 2013 UTC (6 years, 8 months ago) by jfenwick
File MIME type: text/plain
File size: 2871 byte(s)
Round 1 of copyright fixes
1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2013 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15
16
17 #if !defined escript_Utils_H
18 #define escript_Utils_H
19 #include "system_dep.h"
20
21 namespace escript {
22
23 /**
24 \brief
25 some functions
26
27 */
28
29 /**
30 \brief
31 return the SVN version number used to build this version.
32 \warning Only gives accurate answers for clean checkouts
33 */
34 ESCRIPT_DLL_API int getSvnVersion();
35
36 /**
37 \brief
38 print a message about how many MPI CPUs and OpenMP threads we're using
39 */
40 ESCRIPT_DLL_API void printParallelThreadCnt();
41
42 /**
43 \brief
44 set the number of threads
45 \warning Use of this method is strongly discouraged. It may be deprecated in future.
46 */
47 ESCRIPT_DLL_API void setNumberOfThreads(const int num_threads);
48
49 /**
50 \brief
51 returns the number of threads
52 */
53 ESCRIPT_DLL_API int getNumberOfThreads();
54
55 /**
56 \brief
57 returns the total number of available MPI processes for MPI_COMM_WORLD
58 */
59 ESCRIPT_DLL_API int getMPISizeWorld();
60
61 /**
62 \brief
63 returns the MPI processor number within MPI_COMM_WORLD
64 */
65 ESCRIPT_DLL_API int getMPIRankWorld();
66 /**
67 \brief
68 returns the maximum value of an integer over all processors within MPI_COMM_WORLD
69 */
70 ESCRIPT_DLL_API int getMPIWorldMax(const int val);
71
72 /**
73 \brief returns sum of an integer over all processors with MPI_COMM_WORLD
74 */
75 ESCRIPT_DLL_API int getMPIWorldSum(const int val);
76
77 /**
78 \brief performs a barrier synchronization across all processors.
79 */
80 ESCRIPT_DLL_API void MPIBarrierWorld();
81
82 /**
83 \brief uses MPI_Comm_spawn to run an external MPI program safely.
84 */
85 ESCRIPT_DLL_API int runMPIProgram(const boost::python::list args);
86
87 /**
88 \brief
89 returns machine precision
90 */
91 ESCRIPT_DLL_API double getMachinePrecision();
92 /*
93 \brief
94 return largest positive float
95 */
96 ESCRIPT_DLL_API double getMaxFloat();
97
98 ESCRIPT_DLL_API
99 void
100 saveDataCSV(const std::string& filename, boost::python::dict arg, const std::string& sep, const std::string& csep,
101 bool append=false);
102
103
104 /**
105 Resolve a collection of Data objects together now.
106 To get performance improvements, the objects will need to have the same function space and share Dag components.
107 \param obj A python list or tuple of Data objects to be resolved together.
108
109 */
110 ESCRIPT_DLL_API
111 void
112 resolveGroup(boost::python::object obj);
113
114 } // end of namespace
115 #endif

  ViewVC Help
Powered by ViewVC 1.1.26