misc.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2012,2013,2017 CNRS
  4. * Copyright (C) 2012,2014,2015,2017 Université de Bordeaux
  5. *
  6. * StarPU is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published by
  8. * the Free Software Foundation; either version 2.1 of the License, or (at
  9. * your option) any later version.
  10. *
  11. * StarPU is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. *
  15. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. */
  17. #include <starpu.h>
  18. #include <common/utils.h>
  19. #include <core/jobs.h>
  20. const char *_starpu_codelet_get_model_name(struct starpu_codelet *cl)
  21. {
  22. if (!cl)
  23. return NULL;
  24. if (cl->model && cl->model->symbol && cl->model->symbol[0])
  25. return cl->model->symbol;
  26. else
  27. return cl->name;
  28. }
  29. const char *_starpu_job_get_model_name(struct _starpu_job *j)
  30. {
  31. if (!j)
  32. return NULL;
  33. struct starpu_task *task = j->task;
  34. if (!task)
  35. return NULL;
  36. return _starpu_codelet_get_model_name(task->cl);
  37. }
  38. const char *_starpu_job_get_task_name(struct _starpu_job *j)
  39. {
  40. if (!j)
  41. return NULL;
  42. struct starpu_task *task = j->task;
  43. if (!task)
  44. return NULL;
  45. if (task->name)
  46. return task->name;
  47. else
  48. return _starpu_job_get_model_name(j);
  49. }
  50. const char *starpu_task_get_model_name(struct starpu_task *task)
  51. {
  52. if (!task)
  53. return NULL;
  54. return _starpu_codelet_get_model_name(task->cl);
  55. }
  56. const char *starpu_task_get_name(struct starpu_task *task)
  57. {
  58. if (!task)
  59. return NULL;
  60. if (task->name)
  61. return task->name;
  62. else
  63. return starpu_task_get_model_name(task);
  64. }