Revision: 121
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=121&view=rev
Author: jmwozniak
Date: 2010-05-14 19:44:34 +0000 (Fri, 14 May 2010)
Log Message:
-----------
Automate selection of CMPI mode implementation
Modified Paths:
--------------
src/cmpi/module.mk.in
Added Paths:
-----------
src/cmpi/mode_pairs.c
Removed Paths:
-------------
src/cmpi/mode_rr.c
Copied: src/cmpi/mode_pairs.c (from rev 120, src/cmpi/mode_rr.c)
===================================================================
--- src/cmpi/mode_pairs.c (rev 0)
+++ src/cmpi/mode_pairs.c 2010-05-14 19:44:34 UTC (rev 121)
@@ -0,0 +1,76 @@
+
+#include <cmpi.h>
+#include <cmpi_mode.h>
+
+/**
+ Pairs:
+ Try to place one node and one client on each physical
+ compute node
+*/
+int cmpi_mode_select(int rank, int size, int nodes)
+{
+ NOTE("using mode_rr");
+ if (size%2 == 1)
+ {
+ printf("MPI size must be even for mode_rr!\n");
+ exit(1);
+ }
+
+ if (rank >= size/2)
+ return CMPI_MODE_CLIENT;
+ return CMPI_MODE_NODE;
+}
+
+struct inlist* cmpi_mode_contacts(int rank, int size, int nodes)
+{
+ struct inlist* result = inlist_create();
+
+ int i = rank % (size/2);
+
+ NOTE_I("contact: ", i);
+ inlist_add(result, i);
+
+ return result;
+}
+
+
+int cmpi_mode_next(int rank, int size, int nodes)
+{
+ int result;
+ int mode = cmpi_mode_select(rank, size, nodes);
+
+ if (mode == CMPI_MODE_NODE)
+ {
+ int next = rank+1;
+ if (next >= size/2)
+ result = -1;
+ else
+ result = next;
+ }
+ else
+ {
+ int next = rank+1;
+ if (next >= size)
+ result = -1;
+ else
+ result = next;
+ }
+
+ return result;
+}
+
+int cmpi_mode_first_client(int rank, int size, int nodes)
+{
+ return size/2;
+}
+
+/**
+ Obtain the list of nodes that this rank is
+ responsible for instructing to quit.
+*/
+struct inlist* cmpi_shutdown_list(int rank, int size, int nodes)
+{
+ struct inlist* result = cmpi_mode_contacts(rank, size, nodes);
+
+ return result;
+}
Deleted: src/cmpi/mode_rr.c
===================================================================
--- src/cmpi/mode_rr.c 2010-05-14 19:42:54 UTC (rev 120)
+++ src/cmpi/mode_rr.c 2010-05-14 19:44:34 UTC (rev 121)
@@ -1,76 +0,0 @@
-
-#include <cmpi.h>
-#include <cmpi_mode.h>
-
-/**
- Pairs:
- Try to place one node and one client on each physical
- compute node
-*/
-int cmpi_mode_select(int rank, int size, int nodes)
-{
- NOTE("using mode_rr");
- if (size%2 == 1)
- {
- printf("MPI size must be even for mode_rr!\n");
- exit(1);
- }
-
- if (rank >= size/2)
- return CMPI_MODE_CLIENT;
- return CMPI_MODE_NODE;
-}
-
-struct inlist* cmpi_mode_contacts(int rank, int size, int nodes)
-{
- struct inlist* result = inlist_create();
-
- int i = rank % (size/2);
-
- NOTE_I("contact: ", i);
- inlist_add(result, i);
-
- return result;
-}
-
-
-int cmpi_mode_next(int rank, int size, int nodes)
-{
- int result;
- int mode = cmpi_mode_select(rank, size, nodes);
-
- if (mode == CMPI_MODE_NODE)
- {
- int next = rank+1;
- if (next >= size/2)
- result = -1;
- else
- result = next;
- }
- else
- {
- int next = rank+1;
- if (next >= size)
- result = -1;
- else
- result = next;
- }
-
- return result;
-}
-
-int cmpi_mode_first_client(int rank, int size, int nodes)
-{
- return size/2;
-}
-
-/**
- Obtain the list of nodes that this rank is
- responsible for instructing to quit.
-*/
-struct inlist* cmpi_shutdown_list(int rank, int size, int nodes)
-{
- struct inlist* result = cmpi_mode_contacts(rank, size, nodes);
-
- return result;
-}
Modified: src/cmpi/module.mk.in
===================================================================
--- src/cmpi/module.mk.in 2010-05-14 19:42:54 UTC (rev 120)
+++ src/cmpi/module.mk.in 2010-05-14 19:44:34 UTC (rev 121)
@@ -7,8 +7,13 @@
CMPI_SRC += $(DIR)/driver.c
CMPI_SRC += $(DIR)/accessor.c
-MODE = $(DIR)/mode_mono.c
-#MODE = $(DIR)/mode_rr.c
+# Select CMPI mode:
+ifeq (@USE_CMPI_MODE@,MONO)
+ MODE := $(DIR)/mode_mono.c
+endif
+ifeq (@USE_CMPI_MODE@,PAIRS)
+ MODE := $(DIR)/mode_pairs.c
+endif
CMPI_SRC += $(MODE)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|