-
Notifications
You must be signed in to change notification settings - Fork 0
/
ziatest.c
54 lines (46 loc) · 1.11 KB
/
ziatest.c
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
/* -*- C -*-
*
* Copyright (c) 2008 Los Alamos National Security, LLC. All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
* Modified by Sue Kelly, January 2010, to allow for a different
* mpirun command and associated options.
*
* $HEADER$
*
*/
#include <stdio.h>
#include <stdbool.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
int main(int argc, char* argv[])
{
int nppn;
char* exe="mpirun -npernode";
struct timeval tv;
char *cmd;
/* check for proper usage */
if (argc > 3) {
printf("usage: ziatest <#procs/node> [exe_and_arg]\n");
exit(1);
}
nppn = strtol(argv[1], NULL, 10);
if (argc == 3) {
exe=argv[2];
}
/* THIS BEGINS THE OFFICIAL TIMING POINT */
/* get a starting time stamp */
gettimeofday(&tv, NULL);
/* form the command */
asprintf(&cmd, "%s %d ./ziaprobe %d %d %d", exe, nppn, (int)tv.tv_sec, (int)tv.tv_usec, nppn);
fprintf(stderr,"%s\n",cmd);
/* execute it */
system(cmd);
/* done */
free(cmd);
return 0;
}