SST/macro
task_mapper.h
Go to the documentation of this file.
1 /*
2  * This file is part of SST/macroscale:
3  * The macroscale architecture simulator from the SST suite.
4  * Copyright (c) 2009 Sandia Corporation.
5  * This software is distributed under the BSD License.
6  * Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
7  * the U.S. Government retains certain rights in this software.
8  * For more information, see the LICENSE file in the top
9  * SST/macroscale directory.
10  */
11 
12 #ifndef SSTMAC_BACKENDS_NATIVE_LAUNCH_INDEXSTRATEGY_H_INCLUDED
13 #define SSTMAC_BACKENDS_NATIVE_LAUNCH_INDEXSTRATEGY_H_INCLUDED
14 
19 #include <sprockit/debug.h>
21 #include <vector>
23 
24 DeclareDebugSlot(indexing);
25 
26 namespace sstmac {
27 namespace sw {
28 
29 /**
30  * Base class for strategies regarding how to sequentially number nodes
31  * in a parallel simulation.
32  */
33 class task_mapper :
35 {
36 
37  public:
38  virtual std::string
39  to_string() const {
40  return "task mapper";
41  }
42 
43  virtual void
44  set_topology(hw::topology* top){
45  topology_ = top;
46  }
47 
48  virtual void
49  init_factory_params(sprockit::sim_parameters *params);
50 
51  virtual
52  ~task_mapper() throw ();
53 
54  /** Assign processes to nodes.
55  @param aid The application ID for the application whose processes are being indexed
56  @param nodes is the set of unique nodes to be used for the allocation
57  @param ppn is the nominal number of processes allocated on each node.
58  @param result is the resulting vector of length nodes (size nproc)
59  @param nproc the total number of processes to allocate
60  @throw value_error if nodes.empty()
61  @throw value_error if ppn <= 0
62  @throw value_error if nodes.size()*ppn < nproc
63  */
64  virtual void
65  map_ranks(
66  const app_id& aid,
67  const ordered_node_set& allocation,
68  int ppn,
69  std::vector<node_id>& result,
70  int nproc) = 0;
71 
72  protected:
74  rt_(rt), topology_(0) {}
75 
76  int
77  validate_nproc(int ppn, int num_nodes, int nproc, const char* name) const;
78 
79  protected:
80  hw::topology* topology_;
82 
83 };
84 
86 
87 }
88 } // end of namespace sstmac
89 
90 #endif
91 
task_mapper(parallel_runtime *rt)
Definition: task_mapper.h:73
std::set< node_id > ordered_node_set
Definition: node_set.h:10
virtual void init_factory_params(sprockit::sim_parameters *params)
int validate_nproc(int ppn, int num_nodes, int nproc, const char *name) const
virtual void map_ranks(const app_id &aid, const ordered_node_set &allocation, int ppn, std::vector< node_id > &result, int nproc)=0
Assign processes to nodes.
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
DeclareFactory(blas_kernel)
parallel_runtime * rt_
Definition: task_mapper.h:81
DeclareDebugSlot(indexing)
virtual std::string to_string() const
Definition: task_mapper.h:39
Base class for strategies regarding how to sequentially number nodes in a parallel simulation...
Definition: task_mapper.h:33
hw::topology * topology_
Definition: task_mapper.h:80
virtual void set_topology(hw::topology *top)
Definition: task_mapper.h:44
int app_id
Definition: app_id.h:20