util.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2012,2017 CNRS
  4. * Copyright (C) 2010-2013 Université de Bordeaux
  5. * Copyright (C) 2011,2012 Inria
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. #ifndef SOCL_UTIL_H
  19. #define SOCL_UTIL_H
  20. int starpu_worker_get_range_by_id(int id);
  21. int starpu_worker_get_range();
  22. /**
  23. * Duplicate a memory area into a fresh allocated buffer
  24. * Consider using memdup or memdup_safe instead
  25. */
  26. void * memdupa(const void *p, size_t size);
  27. #define memdup(p, size) ((typeof(p))memdupa((const void*)p,size))
  28. #define memdup_safe(p,size) (p == NULL ? NULL : memdup(p,size))
  29. /**
  30. * Duplicate an array of pointers by performing a deep copy
  31. */
  32. void ** memdup_deep_safea(const void **p, unsigned n, size_t size);
  33. #define memdup_deep_safe(p,n,size) ((typeof(p))memdup_deep_safea((const void **)p,n,size))
  34. /**
  35. * Duplicate an array of pointers by performing a deep copy
  36. * Sizes are different for each cell
  37. */
  38. void ** memdup_deep_varsize_safea(const void **p, unsigned n, size_t * size);
  39. #define memdup_deep_varsize_safe(p,n,size) ((typeof(p))memdup_deep_varsize_safea((const void **)p,n,size))
  40. cl_ulong _socl_nanotime();
  41. #endif /* SOCL_UTIL_H */