PIPS
task_mapping.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include "genC.h"
#include "linear.h"
#include "resources.h"
#include "database.h"
#include "ri.h"
#include "ri-util.h"
#include "pipsdbm.h"
#include "misc.h"
#include "properties.h"
#include "task_private.h"
#include "task_parallelization.h"
#include "prettyprint.h"
+ Include dependency graph for task_mapping.c:

Go to the source code of this file.

Data Structures

struct  ctx_pragma
 ctx_pragma_t: on_cluster on which cluster the pragma may be run (=-1 if run on all cluster) synchro if the communication between cluster are synchro (true) or asynchro(false) if on_cluster=-1 we don't care about the value of synchro d_... More...
 
struct  ctx_task
 ctx_task_t: pragma information from the pragma task_id id of the task private list of entity, private variables for the task More...
 

Macros

#define PRAGMA_DISTRIBUTED   "distributed"
 

Typedefs

typedef struct ctx_pragma ctx_pragma_t
 ctx_pragma_t: on_cluster on which cluster the pragma may be run (=-1 if run on all cluster) synchro if the communication between cluster are synchro (true) or asynchro(false) if on_cluster=-1 we don't care about the value of synchro d_... More...
 
typedef struct ctx_task ctx_task_t
 ctx_task_t: pragma information from the pragma task_id id of the task private list of entity, private variables for the task More...
 

Functions

void print_task (task t)
 Pass: TASK_MAPPING Debug mode: MPI_GENERATION_DEBUG_LEVEL Resource generated: More...
 
string task_to_string (task t, bool pretty_print)
 
static void print_ctx_pragma (const ctx_pragma_t ctx)
 
static ctx_pragma_t init_ctx_pragma ()
 init a ctx_pragma_t by default ctx.on_cluster = -1 run on all cluster ctx.synchro = true com synchro More...
 
static string pragma_parameter_unknown_message (string s)
 ‍** More...
 
static bool pragma_PRAGMA_DISTRIBUTED_p (pragma p)
 Test if the pragma is a PRAGMA_DISTRIBUTED check the first element f the pragma. More...
 
static ctx_pragma_t pragma_parse_PRAGMA_DISTRIBUTED (pragma p)
 parse the pragma to generate a ctx_pragma_t need to checked that the pragma sended is a PRAGMA_DISTRIBUTED before More...
 
static ctx_pragma_t ctx_pragma_merge (ctx_pragma_t ctx1, ctx_pragma_t ctx2)
 Merge value of 2 ctx_pragma_t, the 2 ctx_pragma_t can't conflict on value. More...
 
static void print_ctx_task (const ctx_task_t ctx)
 
static void compute_private_entity_list (statement st, ctx_task_t *ctx)
 compute what it must be add in the private entity list essentially internal declaration of the statement More...
 
static void assign_statement_task_mapping (statement st, ctx_task_t *ctx)
 assign a task for the statement st More...
 
static bool make_task_mapping (__attribute__((unused)) entity module, statement module_statement)
 compute the task mapping requires the module statement as param only parse pragma on fisrt level statement of the module then recurse on all sub-statement to assign the task More...
 
bool task_mapping (const char *module_name)
 PIPS pass. More...
 

Macro Definition Documentation

◆ PRAGMA_DISTRIBUTED

#define PRAGMA_DISTRIBUTED   "distributed"

Definition at line 105 of file task_mapping.c.

Typedef Documentation

◆ ctx_pragma_t

typedef struct ctx_pragma ctx_pragma_t

ctx_pragma_t: on_cluster on which cluster the pragma may be run (=-1 if run on all cluster) synchro if the communication between cluster are synchro (true) or asynchro(false) if on_cluster=-1 we don't care about the value of synchro d_...

if it's a default value or value ask by user

◆ ctx_task_t

typedef struct ctx_task ctx_task_t

ctx_task_t: pragma information from the pragma task_id id of the task private list of entity, private variables for the task

Function Documentation

◆ assign_statement_task_mapping()

static void assign_statement_task_mapping ( statement  st,
ctx_task_t ctx 
)
static

assign a task for the statement st

Parameters
ststatement to be assigned
ctxcontext where information about the task are store

Definition at line 348 of file task_mapping.c.

348  {
349  task t;
350  if (ctx->pragma.on_cluster == -1)
351  t = make_task(ctx->task_id, NIL, ctx->pragma.on_cluster, ctx->pragma.synchro);
352  else
353  t = make_task(ctx->task_id, gen_copy_seq(ctx->private), ctx->pragma.on_cluster, ctx->pragma.synchro);
355  ifdebug(4) {
356  pips_debug(4, "associate statement %p to task %p\n", st, load_parallel_task_mapping(st));
357  pips_debug(4, "statement:\n");
358  print_statement(st);
359  pips_debug(4, "task:\n");
361  }
362 }
task make_task(intptr_t a1, list a2, intptr_t a3, bool a4)
Definition: task_private.c:109
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
list gen_copy_seq(list l)
Copy a list structure.
Definition: list.c:501
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
void print_statement(statement)
Print a statement on stderr.
Definition: statement.c:98
#define ifdebug(n)
Definition: sg.c:47
list private
Definition: task_mapping.c:316
ctx_pragma_t pragma
Definition: task_mapping.c:314
void print_task(task t)
Pass: TASK_MAPPING Debug mode: MPI_GENERATION_DEBUG_LEVEL Resource generated:
Definition: task_mapping.c:73
task load_parallel_task_mapping(statement)
void store_or_update_parallel_task_mapping(statement, task)

References gen_copy_seq(), ifdebug, load_parallel_task_mapping(), make_task(), NIL, ctx_pragma::on_cluster, pips_debug, ctx_task::pragma, print_statement(), print_task(), ctx_task::private, store_or_update_parallel_task_mapping(), ctx_pragma::synchro, and ctx_task::task_id.

Referenced by make_task_mapping().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compute_private_entity_list()

static void compute_private_entity_list ( statement  st,
ctx_task_t ctx 
)
static

compute what it must be add in the private entity list essentially internal declaration of the statement

Parameters
ststatement to check
ctxcontext where private list is store and update

Definition at line 335 of file task_mapping.c.

335  {
336  if (declaration_statement_p(st)) {
337  // declarations list of entity declared
338  list declarations = statement_declarations(st);
339  ctx->private = gen_nconc(ctx->private, gen_copy_seq(declarations));
340  }
341 }
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
bool declaration_statement_p(statement)
Had to be optimized according to Beatrice Creusillet.
Definition: statement.c:224
#define statement_declarations(x)
Definition: ri.h:2460
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References declaration_statement_p(), gen_copy_seq(), gen_nconc(), ctx_task::private, and statement_declarations.

Referenced by make_task_mapping().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ctx_pragma_merge()

static ctx_pragma_t ctx_pragma_merge ( ctx_pragma_t  ctx1,
ctx_pragma_t  ctx2 
)
static

Merge value of 2 ctx_pragma_t, the 2 ctx_pragma_t can't conflict on value.

Parameters
ctx1ctx_pragma_t to merge
ctx2ctx_pragma_t to merge
Returns
a new ctx_pragma_t with value of ctx1 and ctx2

Definition at line 252 of file task_mapping.c.

252  {
254 
255  if (!ctx1.d_on_cluster) {
256  ctx.d_on_cluster = false;
257  ctx.on_cluster = ctx1.on_cluster;
258  if (!(!ctx2.d_on_cluster && ctx1.on_cluster==ctx2.on_cluster)) {
259  pips_user_error("conflict between value ask by the user in pragma about on_cluster %d and %d\n", ctx1.on_cluster, ctx2.on_cluster);
260  }
261  } else if (!ctx2.d_on_cluster) {
262  ctx.d_on_cluster = false;
263  ctx.on_cluster = ctx2.on_cluster;
264  }
265 
266  if (!ctx1.d_synchro) {
267  ctx.d_synchro = false;
268  ctx.synchro = ctx1.synchro;
269  if (!(!ctx2.d_synchro && ctx1.synchro==ctx2.synchro)) {
270  pips_user_error("conflict between value ask by the user in pragma about synchro(wait/nowait) %d and %d\n", ctx1.synchro, ctx2.synchro);
271  }
272  } else if (!ctx2.d_synchro) {
273  ctx.d_synchro = false;
274  ctx.synchro = ctx2.synchro;
275  }
276 
277  return ctx;
278 }
#define pips_user_error
Definition: misc-local.h:147
ctx_pragma_t: on_cluster on which cluster the pragma may be run (=-1 if run on all cluster) synchro i...
Definition: task_mapping.c:114
bool d_synchro
Definition: task_mapping.c:119
bool d_on_cluster
Definition: task_mapping.c:117
static ctx_pragma_t init_ctx_pragma()
init a ctx_pragma_t by default ctx.on_cluster = -1 run on all cluster ctx.synchro = true com synchro
Definition: task_mapping.c:134

References ctx_pragma::d_on_cluster, ctx_pragma::d_synchro, init_ctx_pragma(), ctx_pragma::on_cluster, pips_user_error, and ctx_pragma::synchro.

Referenced by make_task_mapping().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_ctx_pragma()

static ctx_pragma_t init_ctx_pragma ( )
static

init a ctx_pragma_t by default ctx.on_cluster = -1 run on all cluster ctx.synchro = true com synchro

Definition at line 134 of file task_mapping.c.

134  {
135  ctx_pragma_t ctx;
136  ctx.on_cluster = -1;
137  ctx.d_on_cluster = true;
138  ctx.synchro = true;
139  ctx.d_synchro = true;
140  return ctx;
141 }

References ctx_pragma::d_on_cluster, ctx_pragma::d_synchro, ctx_pragma::on_cluster, and ctx_pragma::synchro.

Referenced by ctx_pragma_merge(), make_task_mapping(), and pragma_parse_PRAGMA_DISTRIBUTED().

+ Here is the caller graph for this function:

◆ make_task_mapping()

static bool make_task_mapping ( __attribute__((unused)) entity  module,
statement  module_statement 
)
static

compute the task mapping requires the module statement as param only parse pragma on fisrt level statement of the module then recurse on all sub-statement to assign the task

Parameters
module_statementmodule statement to work on

Definition at line 370 of file task_mapping.c.

370  {
372  pips_internal_error("module_statement have to be the statement of the module/function\n");
373  return false;
374  }
375 
376  int task_number = 0;
377  // FOREACH statement of the module/function,
379  //init a a pragma context (execution on all cluster
380  ctx_pragma_t ctxp = init_ctx_pragma();
381  //check if statement st have a pragma, if true modify pragma context in consequences
382  if (statement_with_pragma_p(st)) {
383  list lpragmas = statement_pragmas(st);
384  FOREACH(PRAGMA, p, lpragmas) {
387  ctxp = ctx_pragma_merge(ctxp, ctxp_temp);
388  }
389  }
390  }
391 
392  //init the task context
393  ctx_task_t ctx;
394  ctx.task_id = task_number;
395  ctx.pragma = ctxp;
396  ctx.private = NIL;
397 
398  ifdebug(2) {
399  pips_debug(2, "work on statement:\n");
400  print_statement(st);
401  print_ctx_task(ctx);
402  }
403 
404  //make the job
405  //first compute_private_entity_list to recursively add private entity
406  //second assign_statement_task_mapping to assign a task to each statement
407  //can't make the 2 gen_curse into 1 because I want the full private list variable before the assignment of task to statement
410 
411  task_number++;
412  }
413 
414  // only present in case of gen_recurse with module_statement to not have seg fault
415  // But normally will never be useful
416  ctx_task_t ctx;
417  ctx.task_id = -1;
418  ctx.pragma = init_ctx_pragma();
419  ctx.private = NIL;
420  //no need
421  //compute_private_entity_list(module_statement, &ctx);
423 
424  return true;
425 }
static statement module_statement
Definition: alias_check.c:125
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
Definition: genC.h:285
bool gen_true2(__attribute__((unused)) gen_chunk *u1, __attribute__((unused)) void *u2)
Definition: genClib.c:2785
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
sequence statement_sequence(statement)
Get the sequence of a statement sequence.
Definition: statement.c:1328
bool statement_sequence_p(statement)
Statement classes induced from instruction type.
Definition: statement.c:335
bool statement_with_pragma_p(statement)
Test if a statement has some pragma.
Definition: statement.c:3836
list statement_pragmas(statement)
get the list of pragma of a statement s
Definition: statement.c:3851
#define pips_internal_error
Definition: misc-local.h:149
#define PRAGMA(x)
PRAGMA.
Definition: ri.h:1991
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
#define sequence_statements(x)
Definition: ri.h:2360
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
ctx_task_t: pragma information from the pragma task_id id of the task private list of entity,...
Definition: task_mapping.c:313
static ctx_pragma_t pragma_parse_PRAGMA_DISTRIBUTED(pragma p)
parse the pragma to generate a ctx_pragma_t need to checked that the pragma sended is a PRAGMA_DISTRI...
Definition: task_mapping.c:201
static void assign_statement_task_mapping(statement st, ctx_task_t *ctx)
assign a task for the statement st
Definition: task_mapping.c:348
static void compute_private_entity_list(statement st, ctx_task_t *ctx)
compute what it must be add in the private entity list essentially internal declaration of the statem...
Definition: task_mapping.c:335
static ctx_pragma_t ctx_pragma_merge(ctx_pragma_t ctx1, ctx_pragma_t ctx2)
Merge value of 2 ctx_pragma_t, the 2 ctx_pragma_t can't conflict on value.
Definition: task_mapping.c:252
static void print_ctx_task(const ctx_task_t ctx)
Definition: task_mapping.c:319
static bool pragma_PRAGMA_DISTRIBUTED_p(pragma p)
Test if the pragma is a PRAGMA_DISTRIBUTED check the first element f the pragma.
Definition: task_mapping.c:171

References assign_statement_task_mapping(), compute_private_entity_list(), ctx_pragma_merge(), FOREACH, gen_context_recurse, gen_true2(), ifdebug, init_ctx_pragma(), module_statement, NIL, pips_debug, pips_internal_error, PRAGMA, ctx_task::pragma, pragma_parse_PRAGMA_DISTRIBUTED(), pragma_PRAGMA_DISTRIBUTED_p(), print_ctx_task(), print_statement(), ctx_task::private, sequence_statements, STATEMENT, statement_domain, statement_pragmas(), statement_sequence(), statement_sequence_p(), statement_with_pragma_p(), and ctx_task::task_id.

Referenced by task_mapping().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pragma_parameter_unknown_message()

static string pragma_parameter_unknown_message ( string  s)
static

‍**

generate a error message about the for the parameter of the pragma to use

Definition at line 158 of file task_mapping.c.

158  {
159  return concatenate("\nUnknown ", s, " parameter.\n"
160  "Allowed parameters are:\n"
161  "\ton_cluster=n with n a positive number\n"
162  "\tnowait|wait\n", NULL);
163 }
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183

References concatenate().

Referenced by pragma_parse_PRAGMA_DISTRIBUTED().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pragma_parse_PRAGMA_DISTRIBUTED()

static ctx_pragma_t pragma_parse_PRAGMA_DISTRIBUTED ( pragma  p)
static

parse the pragma to generate a ctx_pragma_t need to checked that the pragma sended is a PRAGMA_DISTRIBUTED before

Parameters
ppragma to be parsed
Returns
a ctx_pragma_t with the value of the pragma

Definition at line 201 of file task_mapping.c.

201  {
203  pips_debug(6, "begin\n parse pragma %p\n", p);
204 
205  if(pragma_string_p(p)) {
206  list lst = strsplit(pragma_string(p), " ");
207  //start at the second parameter so CDR(lst)
208  FOREACH(STRING, str, CDR(lst)) {
209  if(strncasecmp(str, "on_cluster=", 11) == 0) {
210  list cluster = strsplit(str, "=");
211  if (gen_length(cluster) == 2) {
212  string cluster_number = STRING(gen_nth(1, cluster));
213  //TODO a better function than atoi may be use, atoi doesn't manage error, strtol too much work is need, remake a custom function?
214  ctx.on_cluster = atoi(cluster_number);
215  ctx.d_on_cluster = false;
216  } else {
217  pips_user_warning("unexpected value for parameter on_cluster: %s\n", str);
218  }
219  }
220  else if(strncasecmp(str, "nowait", 7) == 0) {
221  ctx.synchro = false;
222  ctx.d_synchro = false;
223  }
224  else if(strncasecmp(str, "wait", 5) == 0) {
225  ctx.synchro = true;
226  ctx.d_synchro = false;
227  }
228  else {
230  }
231  }
232  }
233  //This case normally never appear.
234  else if(pragma_expression_p(p)) {
235  pips_user_warning("Parse pragma expressions for pragma %s not implemented. This case normally never appear.\n", PRAGMA_DISTRIBUTED);
236  }
237  else {
238  pips_internal_error("We don't know how to handle this kind of pragma !\n");
239  }
240 
241  pips_debug(6, "end\n");
242  return ctx;
243 }
#define STRING(x)
Definition: genC.h:87
size_t gen_length(const list l)
Definition: list.c:150
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
gen_chunk gen_nth(int n, const list l)
to be used as ENTITY(gen_nth(3, l))...
Definition: list.c:710
#define pips_user_warning
Definition: misc-local.h:146
list strsplit(const char *, const char *)
Definition: string.c:318
#define pragma_expression_p(x)
Definition: ri.h:2034
#define pragma_string(x)
Definition: ri.h:2033
#define pragma_string_p(x)
Definition: ri.h:2031
static string pragma_parameter_unknown_message(string s)
‍**
Definition: task_mapping.c:158
#define PRAGMA_DISTRIBUTED
Definition: task_mapping.c:105

References CDR, ctx_pragma::d_on_cluster, ctx_pragma::d_synchro, FOREACH, gen_length(), gen_nth(), init_ctx_pragma(), ctx_pragma::on_cluster, pips_debug, pips_internal_error, pips_user_warning, PRAGMA_DISTRIBUTED, pragma_expression_p, pragma_parameter_unknown_message(), pragma_string, pragma_string_p, STRING, strsplit(), and ctx_pragma::synchro.

Referenced by make_task_mapping().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pragma_PRAGMA_DISTRIBUTED_p()

static bool pragma_PRAGMA_DISTRIBUTED_p ( pragma  p)
static

Test if the pragma is a PRAGMA_DISTRIBUTED check the first element f the pragma.

Parameters
ppragma to check
Returns
true if p is a PRAGMA_DISTRIBUTED

Definition at line 171 of file task_mapping.c.

171  {
172  bool r = false;
173  if(pragma_string_p(p)) {
174  if(strncasecmp(PRAGMA_DISTRIBUTED, pragma_string(p), strlen(PRAGMA_DISTRIBUTED)) == 0) {
175  r = true;
176  }
177  }
178  else if(pragma_expression_p(p)) {
179  list expr = pragma_expression(p);
180  // The list is reversed !
181  expression begin = EXPRESSION(CAR(gen_last(expr)));
182  if(expression_call_p(begin)) {
183  entity called = call_function(expression_call(begin));
184  if(strncasecmp(PRAGMA_DISTRIBUTED, entity_local_name(called), strlen(PRAGMA_DISTRIBUTED)) == 0) {
185  r = true;
186  }
187  }
188  }
189  else {
190  pips_internal_error("We don't know how to handle this kind of pragma !\n");
191  }
192  return r;
193 }
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
list gen_last(list l)
Return the last element of a list.
Definition: list.c:578
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
bool expression_call_p(expression e)
Definition: expression.c:415
call expression_call(expression e)
Definition: expression.c:445
#define call_function(x)
Definition: ri.h:709
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define pragma_expression(x)
Definition: ri.h:2036

References call_function, CAR, entity_local_name(), EXPRESSION, expression_call(), expression_call_p(), gen_last(), pips_internal_error, PRAGMA_DISTRIBUTED, pragma_expression, pragma_expression_p, pragma_string, and pragma_string_p.

Referenced by make_task_mapping().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_ctx_pragma()

static void print_ctx_pragma ( const ctx_pragma_t  ctx)
static

Definition at line 122 of file task_mapping.c.

122  {
123  fprintf(stderr, "pragma info:\n");
124  fprintf(stderr, "on_cluster=%d\n", ctx.on_cluster);
125  fprintf(stderr, "synchro=%s\n", ctx.synchro?"true":"false");
126 }
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

References fprintf(), ctx_pragma::on_cluster, and ctx_pragma::synchro.

Referenced by print_ctx_task().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_ctx_task()

static void print_ctx_task ( const ctx_task_t  ctx)
static

Definition at line 319 of file task_mapping.c.

319  {
321  fprintf(stderr, "task_id=%d\n", ctx.task_id);
322  fprintf(stderr, "private list entities:\n");
323  FOREACH(ENTITY, e, ctx.private) {
325  fprintf(stderr, "\n");
326  }
327 }
void print_entity_variable(entity e)
print_entity_variable(e)
Definition: entity.c:56
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
static void print_ctx_pragma(const ctx_pragma_t ctx)
Definition: task_mapping.c:122

References ENTITY, FOREACH, fprintf(), ctx_task::pragma, print_ctx_pragma(), print_entity_variable(), ctx_task::private, and ctx_task::task_id.

Referenced by make_task_mapping().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_task()

void print_task ( task  t)

Pass: TASK_MAPPING Debug mode: MPI_GENERATION_DEBUG_LEVEL Resource generated:

  • DBR_TASK

Definition at line 73 of file task_mapping.c.

73  {
74  if(task_undefined_p(t))
75  fprintf(stderr, "Undefined task\n");
76  // For debugging with gdb, dynamic type checking
77  else if(task_domain_number(t)!=task_domain)
78  (void) fprintf(stderr,"Arg. \"t\"is not a task.\n");
79  else {
80  fprintf(stderr, "%s", task_to_string(t, false));
81  }
82 }
string task_to_string(task t, bool pretty_print)
Definition: task_mapping.c:84
#define task_undefined_p(x)
Definition: task_private.h:90
#define task_domain_number(x)
Definition: task_private.h:113
#define task_domain
newgen_statement_task_domain_defined
Definition: task_private.h:32

References fprintf(), task_domain, task_domain_number, task_to_string(), and task_undefined_p.

Referenced by assign_statement_task_mapping(), and print_ctx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ task_mapping()

bool task_mapping ( const char *  module_name)

PIPS pass.

Parameters
module_nameodule_name

Definition at line 430 of file task_mapping.c.

430  {
431  entity module;
433  bool good_result_p = true;
434 
435  debug_on("MPI_GENERATION_DEBUG_LEVEL");
436  pips_debug(1, "begin\n");
437 
438  //-- configure environment --//
441 
443  db_get_memory_resource(DBR_CODE, module_name, true) );
445 
446  pips_assert("Statement should be OK before...",
448 
450 
451  //-- get dependencies --//
452  // nothing except code and entity done before.
453 
454  //TODO look to add parameter in private list?
455  // look module is type functionnal -> list parameter convert to list entitty
456 
457  //-- Make the job -- //
459  // gen_recurse(module_statement, statement_domain, gen_true, print_pragma);
460 
461  //useless, normally we don't modify the code
462  //pips_assert("Statement should be OK after...",
463  // statement_consistent_p(module_statement));
464 
465  //-- Save modified code to database --//
466  // DB_PUT_MEMORY_RESOURCE(DBR_CODE, strdup(module_name), module_statement);
468  // DB_PUT_MEMORY_RESOURCE(DBR_CALLEES, module_name,
469  // compute_callees(module_statement));
470 
474 
475  pips_debug(1, "end\n");
476  debug_off();
477 
478  return (good_result_p);
479 }
bool statement_consistent_p(statement p)
Definition: ri.c:2195
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
statement get_current_module_statement(void)
Get the current module statement.
Definition: static.c:208
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
#define debug_on(env)
Definition: misc-local.h:157
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define debug_off()
Definition: misc-local.h:160
static char * module
Definition: pips.c:74
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
static bool make_task_mapping(__attribute__((unused)) entity module, statement module_statement)
compute the task mapping requires the module statement as param only parse pragma on fisrt level stat...
Definition: task_mapping.c:370
void init_parallel_task_mapping(void)
void reset_parallel_task_mapping(void)
statement_task get_parallel_task_mapping(void)

References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, get_current_module_entity(), get_current_module_statement(), get_parallel_task_mapping(), init_parallel_task_mapping(), make_task_mapping(), module, module_name(), module_name_to_entity(), module_statement, pips_assert, pips_debug, reset_current_module_entity(), reset_current_module_statement(), reset_parallel_task_mapping(), set_current_module_entity(), set_current_module_statement(), and statement_consistent_p().

+ Here is the call graph for this function:

◆ task_to_string()

string task_to_string ( task  t,
bool  pretty_print 
)
Parameters
pretty_printretty_print

Definition at line 84 of file task_mapping.c.

84  {
85  char tid[10+4];
86  string tprivate = "";
87  char tcluster[18+4];
88  char tsync[23+5];
89  snprintf(tid, 10+4, "task_id=%"_intFMT"\n", task_id(t));
90  snprintf(tcluster, 18+4, "task_on_cluster=%"_intFMT"\n", task_on_cluster(t));
91  snprintf(tsync, 23+5, "task_synchronization=%s\n", task_synchronization(t)?"true":"false");
92  tprivate = "task_private_data={";
94  pips_debug(8, "%s", entity_name(ep));
95  tprivate = concatenate(tprivate, pretty_print?entity_user_name(ep):entity_name(ep), "; ", (char *) NULL);
96  }
97  tprivate = strdup(concatenate(tprivate, "}\n", (char *) NULL));
98  return concatenate(tid, tprivate, tcluster, tsync, (char *) NULL);
99 }
#define _intFMT
Definition: newgen_types.h:57
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
Definition: entity.c:487
#define entity_name(x)
Definition: ri.h:2790
char * strdup()
#define task_synchronization(x)
Definition: task_private.h:121
#define task_id(x)
Definition: task_private.h:115
#define task_on_cluster(x)
Definition: task_private.h:119
#define task_private_data(x)
Definition: task_private.h:117

References _intFMT, concatenate(), ENTITY, entity_name, entity_user_name(), FOREACH, pips_debug, strdup(), task_id, task_on_cluster, task_private_data, and task_synchronization.

Referenced by prepare_context(), and print_task().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: