starpu_calibrate_bus.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2011 Centre National de la Recherche Scientifique
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. #include <config.h>
  17. #include <starpu.h>
  18. #ifdef __MINGW32__
  19. #include <windows.h>
  20. #endif
  21. #define PROGNAME "starpu_calibrate_bus"
  22. static void usage(void)
  23. {
  24. (void) fprintf(stdout,
  25. "Force a bus calibration.\n\
  26. \n\
  27. Usage: " PROGNAME " [OPTION]\n\
  28. \n\
  29. Options:\n\
  30. -h, --help display this help and exit\n\
  31. -v, --version output version information and exit\n\
  32. \n\
  33. Report bugs to <" PACKAGE_BUGREPORT ">.\n");
  34. }
  35. static void parse_args(int argc, char **argv)
  36. {
  37. if (argc == 1)
  38. return;
  39. if (argc > 2)
  40. {
  41. usage();
  42. exit(EXIT_FAILURE);
  43. }
  44. if (strcmp(argv[1], "-h") == 0 ||
  45. strcmp(argv[1], "--help") == 0)
  46. {
  47. usage();
  48. exit(EXIT_SUCCESS);
  49. }
  50. else if (strcmp(argv[1], "-v") == 0 ||
  51. strcmp(argv[1], "--version") == 0)
  52. {
  53. (void) fprintf(stdout, "%s %d.%d\n",
  54. PROGNAME, STARPU_MAJOR_VERSION, STARPU_MINOR_VERSION);
  55. exit(EXIT_SUCCESS);
  56. }
  57. else
  58. {
  59. (void) fprintf(stderr, "Unknown arg %s\n", argv[1]);
  60. exit(EXIT_FAILURE);
  61. }
  62. }
  63. int main(int argc, char **argv)
  64. {
  65. #ifdef __MINGW32__
  66. WSADATA wsadata;
  67. WSAStartup(MAKEWORD(1,0), &wsadata);
  68. #endif
  69. parse_args(argc, argv);
  70. starpu_force_bus_sampling();
  71. return 0;
  72. }