From 306843802213be69a8a87c5141618caf8e881dca Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 29 May 2012 15:21:44 +0000 Subject: [PATCH] Add scaling tests and script This commit was SVN r26509. --- contrib/scaling/Makefile | 15 +++++++ contrib/scaling/Makefile.include | 26 ++++++++++++ contrib/scaling/mpi_barrier.c | 17 ++++++++ contrib/scaling/mpi_no_op.c | 17 ++++++++ contrib/scaling/orte_no_op.c | 24 +++++++++++ contrib/scaling/scaling.pl | 68 ++++++++++++++++++++++++++++++++ 6 files changed, 167 insertions(+) create mode 100644 contrib/scaling/Makefile create mode 100644 contrib/scaling/Makefile.include create mode 100644 contrib/scaling/mpi_barrier.c create mode 100644 contrib/scaling/mpi_no_op.c create mode 100644 contrib/scaling/orte_no_op.c create mode 100644 contrib/scaling/scaling.pl diff --git a/contrib/scaling/Makefile b/contrib/scaling/Makefile new file mode 100644 index 0000000000..6e905fa609 --- /dev/null +++ b/contrib/scaling/Makefile @@ -0,0 +1,15 @@ +PROGS = orte_no_op mpi_no_op mpi_barrier + +all: $(PROGS) + +CC = mpicc +CFLAGS = -g +CFLAGS_INTERNAL = -I../../.. -I../../../orte/include -I../../../opal/include +CXX = mpic++ +CXXFLAGS = -g +F77 = mpif77 +FC = mpif90 +FFLAGS = -g + +clean: + rm -f $(PROGS) *~ diff --git a/contrib/scaling/Makefile.include b/contrib/scaling/Makefile.include new file mode 100644 index 0000000000..1e2c738bb3 --- /dev/null +++ b/contrib/scaling/Makefile.include @@ -0,0 +1,26 @@ +# -*- makefile -*- +# +# Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# Note that this file does not stand on its own. It is included by a +# higher-level Makefile so that Automake features such as "make dist" +# work properly (and include all the relevant files in this directory +# in the distribution tarball). + +# If you are looking for the file that builds these examples, look at +# "Makefile" in this same directory (it is *NOT* generated by +# Automake). + +EXTRA_DIST += \ + contrib/scaling/Makefile \ + contrib/scaling/mpi_barrier.c \ + contrib/scaling/mpi_no_op.c \ + contrib/scaling/orte_no_op.c \ + scaling.pl + diff --git a/contrib/scaling/mpi_barrier.c b/contrib/scaling/mpi_barrier.c new file mode 100644 index 0000000000..9eeef50b68 --- /dev/null +++ b/contrib/scaling/mpi_barrier.c @@ -0,0 +1,17 @@ +/* -*- C -*- + * + * $HEADER$ + * + * The most basic of MPI applications + */ + +#include +#include "mpi.h" + +int main(int argc, char* argv[]) +{ + MPI_Init(&argc, &argv); + MPI_Barrier(MPI_COMM_WORLD); + MPI_Finalize(); + return 0; +} diff --git a/contrib/scaling/mpi_no_op.c b/contrib/scaling/mpi_no_op.c new file mode 100644 index 0000000000..1d382add87 --- /dev/null +++ b/contrib/scaling/mpi_no_op.c @@ -0,0 +1,17 @@ +/* -*- C -*- + * + * $HEADER$ + * + * The most basic of MPI applications + */ + +#include +#include "mpi.h" + +int main(int argc, char* argv[]) +{ + MPI_Init(&argc, &argv); + + MPI_Finalize(); + return 0; +} diff --git a/contrib/scaling/orte_no_op.c b/contrib/scaling/orte_no_op.c new file mode 100644 index 0000000000..a96c94b66f --- /dev/null +++ b/contrib/scaling/orte_no_op.c @@ -0,0 +1,24 @@ +/* -*- C -*- + * + * $HEADER$ + * + * The most basic of applications + */ + +#include +#include "orte/constants.h" +#include "orte/runtime/runtime.h" + +int main(int argc, char* argv[]) +{ + if (ORTE_SUCCESS != orte_init(&argc, &argv, ORTE_PROC_NON_MPI)) { + fprintf(stderr, "Failed orte_init\n"); + exit(1); + } + + if (ORTE_SUCCESS != orte_finalize()) { + fprintf(stderr, "Failed orte_finalize\n"); + exit(1); + } + return 0; +} diff --git a/contrib/scaling/scaling.pl b/contrib/scaling/scaling.pl new file mode 100644 index 0000000000..c27d9d67c7 --- /dev/null +++ b/contrib/scaling/scaling.pl @@ -0,0 +1,68 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2012 Los Alamos National Security, Inc. +# All rights reserved. + +use strict; + +# globals +my $showme_arg = 0; +my $num_nodes = 0; +my $my_arg; + +my @tests = qw(/bin/true ./orte_no_op ./mpi_no_op ./mpi_barrier); + +# Cannot use the usual GetOpts library as the user might +# be passing -options to us! So have to +# parse the options ourselves to look for help and showme +my $i = 0; +foreach $my_arg (@ARGV) { + if ($my_arg eq "-h" || + $my_arg eq "--h" || + $my_arg eq "-help" || + $my_arg eq "--help") { + print "Options: + --showme Show the actual commands without executing them + --nodes Number of nodes to run the test across + --help | -h This help list\n"; + exit; + } elsif ($my_arg eq "-showme" || + $my_arg eq "--showme") { + $showme_arg = 1; + } elsif ($my_arg eq "-nodes" || + $my_arg eq "--nodes") { + $num_nodes = @ARGV[$i+1]; + } + $i++; +} + +my $n = 1; +my $cmd; + +my $test; +foreach $test (@tests) { + if (-e $test) { + $n = 1; + while ($n <= $num_nodes) { + $cmd = "time mpirun -npernode 1 -max-vm-size " . $n . " $test"; + print $cmd . "\n"; + if (0 == $showme_arg) { + system $cmd; + print "\n"; + } + $n = 2 * $n; + } + if ($n != (2 * $num_nodes)) { + $cmd = "time mpirun -npernode 1 $test"; + if (1 == $showme_arg) { + print $cmd . "\n"; + } else { + system $cmd; + print "\n"; + } + } + print "\n\n"; + } else { + print "Test " . $test . " was not found - test skipped\n\n"; + } +}