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