File: ziatest.c

package info (click to toggle)
openmpi 4.1.0-10
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 126,560 kB
  • sloc: ansic: 685,465; makefile: 42,952; f90: 19,220; sh: 7,002; java: 6,360; perl: 3,524; cpp: 2,227; python: 1,350; lex: 989; fortran: 61; tcl: 12
file content (52 lines) | stat: -rw-r--r-- 992 bytes parent folder | download | duplicates (4)
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
/* -*- C -*-
 *
 * Copyright (c) 2008 Los Alamos National Security, LLC.  All rights reserved.
 *
 * Copyright (c) 2015 Cisco Systems, Inc.  All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 *
 */
#include <stdio.h>
#include <stdbool.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>

#include <mpi.h>

int main(int argc, char* argv[])
{
    int nppn;
    struct timeval tv;
    char *cmd;

    /* check for proper usage */
    if (2 < argc) {
        printf("usage: ziatest <#procs/node>\n");
        exit(1);
    }

    nppn = strtol(argv[1], NULL, 10);

    /* THIS BEGINS THE OFFICIAL TIMING POINT */

    /* get a starting time stamp */
    gettimeofday(&tv, NULL);

    /* form the command */
    asprintf(&cmd, "mpirun -npernode %d ./ziaprobe %ld %d",
             nppn, (long) tv.tv_sec, tv.tv_usec);

    /* execute it */
    system(cmd);

    /* done */
    free(cmd);
    return 0;
}