/[escript]/branches/split/escriptcore/src/SplitWorld.h
ViewVC logotype

Contents of /branches/split/escriptcore/src/SplitWorld.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4808 - (show annotations)
Thu Mar 27 05:34:14 2014 UTC (5 years, 3 months ago) by jfenwick
File MIME type: text/plain
File size: 2797 byte(s)
More work towards export
1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2014 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 #ifndef escript_SplitWorld_H
18 #define escript_SplitWorld_H
19 #include <boost/python.hpp>
20 #include <boost/smart_ptr.hpp>
21 #include "esysUtils/Esys_MPI.h"
22 #include "SubWorld.h"
23 #include "Reducer.h"
24 namespace escript
25 {
26
27 /** class to hold a collection of MPI ranks and a communicator linking them
28 */
29 class SplitWorld
30 {
31 public:
32 SplitWorld(unsigned int numgroups, MPI_Comm global=MPI_COMM_WORLD);
33 ~SplitWorld();
34 boost::python::object buildDomains(boost::python::tuple t, boost::python::dict kwargs);
35
36 void runJobs();
37
38 void addJob(boost::python::object creator, boost::python::tuple tup, boost::python::dict kw);
39
40 void addVariable(std::string name, boost::python::object creator, boost::python::tuple ntup, boost::python::dict kwargs);
41 void removeVariable(std::string name);
42 void clearActiveJobs();
43
44
45
46
47
48 private:
49 /*
50 MPI_Comm globalcom; // don't free this because we don't own it
51 MPI_Comm subcom;
52 */
53 esysUtils::JMPI globalcom;
54 esysUtils::JMPI subcom;
55 escript::SubWorld_ptr localworld; // subworld which this process belongs to
56 unsigned int swcount; // number of subwords
57 unsigned int localid; // position of localworld in overall world sequence
58
59
60 // details of jobs to be created
61 std::vector<boost::python::object> create;
62 std::vector<boost::python::tuple> tupargs;
63 std::vector<boost::python::dict> kwargs;
64
65 unsigned int jobcounter; // note that the id of the first job is 1 not 0.
66 bool manualimport; // if false, all reduced vars will be shipped to all subworlds
67 void clearPendingJobs();
68 void distributeJobs();
69 };
70
71
72 /**
73 used to invoke the SplitWorld version from python (in lieu of a method based equivalent to raw_function)
74 */
75 boost::python::object raw_buildDomains(boost::python::tuple t, boost::python::dict kwargs);
76
77 /**
78 used to invoke the SplitWorld version from python (in lieu of a method based equivalent to raw_function)
79 */
80 boost::python::object raw_addJob(boost::python::tuple t, boost::python::dict kwargs);
81
82 /**
83 used to add a reducer for shared values.
84 */
85 boost::python::object raw_addVariable(boost::python::tuple t, boost::python::dict kwargs);
86 }
87 #endif

  ViewVC Help
Powered by ViewVC 1.1.26