simgrid.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2012-2016 Université de Bordeaux
  4. * Copyright (C) 2016 INRIA
  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. #ifndef __SIMGRID_H__
  18. #define __SIMGRID_H__
  19. #ifdef STARPU_SIMGRID
  20. #ifdef STARPU_HAVE_SIMGRID_MSG_H
  21. #include <simgrid/msg.h>
  22. #else
  23. #include <msg/msg.h>
  24. #endif
  25. #include <datawizard/data_request.h>
  26. struct _starpu_pthread_args
  27. {
  28. void *(*f)(void*);
  29. void *arg;
  30. };
  31. #define MAX_TSD 16
  32. #define STARPU_MPI_AS_PREFIX "StarPU-MPI"
  33. #define _starpu_simgrid_running_smpi() (getenv("SMPI_GLOBAL_SIZE") != NULL)
  34. void _starpu_simgrid_init(int *argc, char ***argv);
  35. void _starpu_simgrid_deinit(void);
  36. void _starpu_simgrid_wait_tasks(int workerid);
  37. void _starpu_simgrid_submit_job(int workerid, struct _starpu_job *job, struct starpu_perfmodel_arch* perf_arch, double length, unsigned *finished, starpu_pthread_mutex_t *mutex, starpu_pthread_cond_t *cond);
  38. int _starpu_simgrid_transfer(size_t size, unsigned src_node, unsigned dst_node, struct _starpu_data_request *req);
  39. /* Return the number of hosts prefixed by PREFIX */
  40. int _starpu_simgrid_get_nbhosts(const char *prefix);
  41. unsigned long long _starpu_simgrid_get_memsize(const char *prefix, unsigned devid);
  42. msg_host_t _starpu_simgrid_get_host_by_name(const char *name);
  43. msg_host_t _starpu_simgrid_get_memnode_host(unsigned node);
  44. struct _starpu_worker;
  45. msg_host_t _starpu_simgrid_get_host_by_worker(struct _starpu_worker *worker);
  46. void _starpu_simgrid_get_platform_path(int version, char *path, size_t maxlen);
  47. msg_as_t _starpu_simgrid_get_as_by_name(const char *name);
  48. #pragma weak starpu_mpi_world_rank
  49. extern int starpu_mpi_world_rank(void);
  50. #pragma weak _starpu_mpi_simgrid_init
  51. int _starpu_mpi_simgrid_init(int argc, char *argv[]);
  52. starpu_pthread_queue_t _starpu_simgrid_transfer_queue[STARPU_MAXNODES];
  53. starpu_pthread_queue_t _starpu_simgrid_task_queue[STARPU_NMAXWORKERS];
  54. #define _starpu_simgrid_cuda_malloc_cost() starpu_get_env_number_default("STARPU_SIMGRID_CUDA_MALLOC_COST", 1)
  55. #define _starpu_simgrid_queue_malloc_cost() starpu_get_env_number_default("STARPU_SIMGRID_QUEUE_MALLOC_COST", 1)
  56. #define _starpu_simgrid_task_submit_cost() starpu_get_env_number_default("STARPU_SIMGRID_TASK_SUBMIT_COST", 1)
  57. /* Called at initialization to count how many GPUs are interfering with each
  58. * bus */
  59. void _starpu_simgrid_count_ngpus(void);
  60. void _starpu_simgrid_xbt_thread_create(const char *name, void_f_pvoid_t code,
  61. void *param);
  62. #endif
  63. #endif // __SIMGRID_H__