restart.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009, 2010, 2013-2014 Université de Bordeaux
  4. * Copyright (C) 2010, 2011, 2012 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. #include <stdio.h>
  18. #include <unistd.h>
  19. #include <errno.h>
  20. #include <starpu.h>
  21. #include <stdlib.h>
  22. #include "../helper.h"
  23. #ifdef STARPU_QUICK_CHECK
  24. #define N 2
  25. #else
  26. #define N 10
  27. #endif
  28. static double start;
  29. static double end;
  30. int main(int argc, char **argv)
  31. {
  32. unsigned iter;
  33. double init_timing = 0.0;
  34. double shutdown_timing = 0.0;
  35. int ret;
  36. for (iter = 0; iter < N; iter++)
  37. {
  38. start = starpu_timing_now();
  39. /* Initialize StarPU */
  40. ret = starpu_initialize(NULL, &argc, &argv);
  41. end = starpu_timing_now();
  42. if (ret == -ENODEV)
  43. goto enodev;
  44. STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
  45. init_timing += end - start;
  46. start = starpu_timing_now();
  47. /* Shutdown StarPU */
  48. starpu_shutdown();
  49. end = starpu_timing_now();
  50. shutdown_timing += end - start;
  51. }
  52. FPRINTF(stderr, "starpu_init: %2.2f seconds\n", init_timing/(N*1000000));
  53. FPRINTF(stderr, "starpu_shutdown: %2.2f seconds\n", shutdown_timing/(N*1000000));
  54. return EXIT_SUCCESS;
  55. enodev:
  56. return STARPU_TEST_SKIPPED;
  57. }