/[escript]/branches/subworld2/escriptcore/src/Utils.h
ViewVC logotype

Contents of /branches/subworld2/escriptcore/src/Utils.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5504 - (show annotations)
Wed Mar 4 22:58:13 2015 UTC (4 years, 1 month ago) by jfenwick
File MIME type: text/plain
File size: 2972 byte(s)
Again with a more up to date copy


1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2015 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 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17 #if !defined escript_Utils_H
18 #define escript_Utils_H
19
20 #include "system_dep.h"
21 #include <boost/python/dict.hpp>
22
23 namespace escript {
24
25 /**
26 \brief
27 some functions
28
29 */
30
31 /**
32 \brief
33 return the SVN version number used to build this version.
34 \warning Only gives accurate answers for clean checkouts
35 */
36 ESCRIPT_DLL_API int getSvnVersion();
37
38 /**
39 \brief
40 print a message about how many MPI CPUs and OpenMP threads we're using
41 */
42 ESCRIPT_DLL_API void printParallelThreadCnt();
43
44 /**
45 \brief
46 set the number of threads
47 \warning Use of this method is strongly discouraged. It may be deprecated in future.
48 */
49 ESCRIPT_DLL_API void setNumberOfThreads(const int num_threads);
50
51 /**
52 \brief
53 returns the number of threads
54 */
55 ESCRIPT_DLL_API int getNumberOfThreads();
56
57 /**
58 \brief
59 returns the total number of available MPI processes for MPI_COMM_WORLD
60 */
61 ESCRIPT_DLL_API int getMPISizeWorld();
62
63 /**
64 \brief
65 returns the MPI processor number within MPI_COMM_WORLD
66 */
67 ESCRIPT_DLL_API int getMPIRankWorld();
68 /**
69 \brief
70 returns the maximum value of an integer over all processors within MPI_COMM_WORLD
71 */
72 ESCRIPT_DLL_API int getMPIWorldMax(const int val);
73
74 /**
75 \brief returns sum of an integer over all processors with MPI_COMM_WORLD
76 */
77 ESCRIPT_DLL_API int getMPIWorldSum(const int val);
78
79 /**
80 \brief performs a barrier synchronization across all processors.
81 */
82 ESCRIPT_DLL_API void MPIBarrierWorld();
83
84 /**
85 \brief uses MPI_Comm_spawn to run an external MPI program safely.
86 */
87 ESCRIPT_DLL_API int runMPIProgram(const boost::python::list args);
88
89 /**
90 \brief
91 returns machine precision
92 */
93 ESCRIPT_DLL_API double getMachinePrecision();
94 /*
95 \brief
96 return largest positive float
97 */
98 ESCRIPT_DLL_API double getMaxFloat();
99
100 ESCRIPT_DLL_API
101 void
102 saveDataCSV(const std::string& filename, boost::python::dict arg, const std::string& sep, const std::string& csep,
103 bool append=false);
104
105
106 /**
107 Resolve a collection of Data objects together now.
108 To get performance improvements, the objects will need to have the same function space and share Dag components.
109 \param obj A python list or tuple of Data objects to be resolved together.
110
111 */
112 ESCRIPT_DLL_API
113 void
114 resolveGroup(boost::python::object obj);
115
116 } // end of namespace
117 #endif

  ViewVC Help
Powered by ViewVC 1.1.26