From 067ef79b71895e8b61dcba8f67af14c15cb837b0 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Tue, 25 Oct 2005 19:27:17 +0000
Subject: [PATCH] relocate_to_slurm_trunk

---
 testsuite/expect/test8.4.prog.c | 62 +++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 testsuite/expect/test8.4.prog.c

diff --git a/testsuite/expect/test8.4.prog.c b/testsuite/expect/test8.4.prog.c
new file mode 100644
index 00000000000..962fbb04209
--- /dev/null
+++ b/testsuite/expect/test8.4.prog.c
@@ -0,0 +1,62 @@
+/*****************************************************************************\
+ *  test8.4.prog.c - Simple ping test of operation with SLURM.
+ *****************************************************************************
+ *  Copyright (C) 2004 The Regents of the University of California.
+ *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
+ *  Written by Dong Ang <dahn@llnl.gov>
+ *  UCRL-CODE-2002-040.
+ *  
+ *  This file is part of SLURM, a resource management program.
+ *  For details, see <http://www.llnl.gov/linux/slurm/>.
+ *  
+ *  SLURM is free software; you can redistribute it and/or modify it under
+ *  the terms of the GNU General Public License as published by the Free
+ *  Software Foundation; either version 2 of the License, or (at your option)
+ *  any later version.
+ *  
+ *  SLURM 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 General Public License for more
+ *  details.
+ *  
+ *  You should have received a copy of the GNU General Public License along
+ *  with SLURM; if not, write to the Free Software Foundation, Inc.,
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
+\*****************************************************************************/
+
+#include <stdio.h>
+#include <mpi.h>
+
+#define COMM_TAG 1000
+
+static void pass_its_neighbor(const int rank, const int size, const int* buf)
+{
+	MPI_Request request[2];
+	MPI_Status status[2];
+
+	MPI_Irecv((void *)buf, 1, MPI_INT, ((rank+size-1)%size), COMM_TAG,
+		MPI_COMM_WORLD, &request[0]);
+	MPI_Isend((void *)&rank, 1, MPI_INT, ((rank+1)%size), COMM_TAG,
+		MPI_COMM_WORLD, &request[1]);
+	MPI_Waitall(2, request, status);
+
+	fprintf(stdout, "Rank[%d] I just received msg from Rank %d\n", 
+		rank, *buf);
+}
+
+int main(int argc, char * argv[])
+{
+	int size, rank,buf;
+
+	MPI_Init(&argc, &argv);
+	MPI_Comm_size(MPI_COMM_WORLD, &size);
+	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+
+	buf = rank;	/* we only pass rank */
+
+	pass_its_neighbor(rank, size, &buf);
+
+	MPI_Finalize();
+	return 0;
+}
+
-- 
GitLab