topology.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2010, 2012, 2014 Université de Bordeaux
  4. * Copyright (C) 2010, 2015 CNRS
  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 __TOPOLOGY_H__
  18. #define __TOPOLOGY_H__
  19. #include <starpu.h>
  20. #include <common/config.h>
  21. #include <common/list.h>
  22. #include <common/fxt.h>
  23. /* TODO actually move this struct into this header */
  24. struct _starpu_machine_config;
  25. /* Detect the number of memory nodes and where to bind the different workers. */
  26. int _starpu_build_topology(struct _starpu_machine_config *config, int no_mp_config);
  27. /* Should be called instead of _starpu_destroy_topology when _starpu_build_topology returns a non zero value. */
  28. void _starpu_destroy_machine_config(struct _starpu_machine_config *config);
  29. /* Destroy all resources used to store the topology of the machine. */
  30. void _starpu_destroy_topology(struct _starpu_machine_config *config);
  31. /* returns the number of physical cpus */
  32. unsigned _starpu_topology_get_nhwcpu(struct _starpu_machine_config *config);
  33. /* returns the number of logical cpus */
  34. unsigned _starpu_topology_get_nhwpu(struct _starpu_machine_config *config);
  35. /* Bind the current thread on the CPU logically identified by "cpuid". The
  36. * logical ordering of the processors is either that of hwloc (if available),
  37. * or the ordering exposed by the OS. */
  38. void _starpu_bind_thread_on_cpu(struct _starpu_machine_config *config, int cpuid);
  39. struct _starpu_combined_worker;
  40. /* Bind the current thread on the set of CPUs for the given combined worker. */
  41. void _starpu_bind_thread_on_cpus(struct _starpu_machine_config *config STARPU_ATTRIBUTE_UNUSED, struct _starpu_combined_worker *combined_worker);
  42. #endif // __TOPOLOGY_H__