topology.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2010, 2012, 2014 Université de Bordeaux 1
  4. * Copyright (C) 2010 Centre National de la Recherche Scientifique
  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. /* Destroy all resources used to store the topology of the machine. */
  28. void _starpu_destroy_topology(struct _starpu_machine_config *config);
  29. /* returns the number of physical cpus */
  30. unsigned _starpu_topology_get_nhwcpu(struct _starpu_machine_config *config);
  31. /* returns the number of logical cpus */
  32. unsigned _starpu_topology_get_nhwpu(struct _starpu_machine_config *config);
  33. /* Bind the current thread on the CPU logically identified by "cpuid". The
  34. * logical ordering of the processors is either that of hwloc (if available),
  35. * or the ordering exposed by the OS. */
  36. void _starpu_bind_thread_on_cpu(struct _starpu_machine_config *config, int cpuid);
  37. struct _starpu_combined_worker;
  38. /* Bind the current thread on the set of CPUs for the given combined worker. */
  39. void _starpu_bind_thread_on_cpus(struct _starpu_machine_config *config STARPU_ATTRIBUTE_UNUSED, struct _starpu_combined_worker *combined_worker);
  40. #endif // __TOPOLOGY_H__