simgrid.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2012-2017 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_early(int *argc, char ***argv);
  35. void _starpu_simgrid_init(void);
  36. void _starpu_simgrid_deinit(void);
  37. void _starpu_simgrid_wait_tasks(int workerid);
  38. void _starpu_simgrid_submit_job(int workerid, struct _starpu_job *job, struct starpu_perfmodel_arch* perf_arch, double length, unsigned *finished);
  39. int _starpu_simgrid_transfer(size_t size, unsigned src_node, unsigned dst_node, struct _starpu_data_request *req);
  40. int _starpu_simgrid_wait_transfer_event(union _starpu_async_channel_event *event);
  41. int _starpu_simgrid_test_transfer_event(union _starpu_async_channel_event *event);
  42. /* Return the number of hosts prefixed by PREFIX */
  43. int _starpu_simgrid_get_nbhosts(const char *prefix);
  44. unsigned long long _starpu_simgrid_get_memsize(const char *prefix, unsigned devid);
  45. msg_host_t _starpu_simgrid_get_host_by_name(const char *name);
  46. msg_host_t _starpu_simgrid_get_memnode_host(unsigned node);
  47. struct _starpu_worker;
  48. msg_host_t _starpu_simgrid_get_host_by_worker(struct _starpu_worker *worker);
  49. void _starpu_simgrid_get_platform_path(int version, char *path, size_t maxlen);
  50. msg_as_t _starpu_simgrid_get_as_by_name(const char *name);
  51. #pragma weak starpu_mpi_world_rank
  52. extern int starpu_mpi_world_rank(void);
  53. #pragma weak _starpu_mpi_simgrid_init
  54. int _starpu_mpi_simgrid_init(int argc, char *argv[]);
  55. starpu_pthread_queue_t _starpu_simgrid_transfer_queue[STARPU_MAXNODES];
  56. starpu_pthread_queue_t _starpu_simgrid_task_queue[STARPU_NMAXWORKERS];
  57. #define _starpu_simgrid_cuda_malloc_cost() starpu_get_env_number_default("STARPU_SIMGRID_CUDA_MALLOC_COST", 1)
  58. #define _starpu_simgrid_queue_malloc_cost() starpu_get_env_number_default("STARPU_SIMGRID_QUEUE_MALLOC_COST", 1)
  59. #define _starpu_simgrid_task_submit_cost() starpu_get_env_number_default("STARPU_SIMGRID_TASK_SUBMIT_COST", 1)
  60. #define _starpu_simgrid_fetching_input_cost() starpu_get_env_number_default("STARPU_SIMGRID_FETCHING_INPUT_COST", 1)
  61. /* Called at initialization to count how many GPUs are interfering with each
  62. * bus */
  63. void _starpu_simgrid_count_ngpus(void);
  64. void _starpu_simgrid_xbt_thread_create(const char *name, void_f_pvoid_t code,
  65. void *param);
  66. #endif
  67. #endif // __SIMGRID_H__