aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <schnetter@83718e91-0e4f-0410-abf4-91180603181f>2006-05-14 03:36:40 +0000
committerschnetter <schnetter@83718e91-0e4f-0410-abf4-91180603181f>2006-05-14 03:36:40 +0000
commit9263c5dab827c6ea9869ee57deb77220cbab7521 (patch)
tree1fe4b742462e124ba0a3788301a16180cfaaa2e5
parent479459caed50c5b4e810fb89467fc67ec7d8eff9 (diff)
Start Formaline in WRAGH instead of STARTUP; this is less trouble.
Remove the logic that delayed outputting the tarballs. Add code to collect the host names of all nodes of a run. This code is not active yet. Find out in which arrangements the compiled thorns are. Call the perl script gethostname.pl only after it has been copied to the scratch directory. git-svn-id: http://svn.cactuscode.org/arrangements/CactusUtils/Formaline/trunk@79 83718e91-0e4f-0410-abf4-91180603181f
-rw-r--r--schedule.ccl2
-rw-r--r--src/announce.cc58
-rw-r--r--src/make.code.defn2
-rw-r--r--src/make.configuration.deps4
-rw-r--r--src/output_source.c36
-rw-r--r--src/thornlist.cc31
-rw-r--r--src/thornlist.hh19
7 files changed, 116 insertions, 36 deletions
diff --git a/schedule.ccl b/schedule.ccl
index db90fed..f930cc1 100644
--- a/schedule.ccl
+++ b/schedule.ccl
@@ -3,7 +3,7 @@
if (output_source)
{
- SCHEDULE Formaline_OutputSource AT startup after IOUtil_Startup
+ SCHEDULE Formaline_OutputSource AT wragh
{
LANG: C
} "Output Cactus source tree"
diff --git a/src/announce.cc b/src/announce.cc
index fe3911e..457985c 100644
--- a/src/announce.cc
+++ b/src/announce.cc
@@ -42,12 +42,17 @@
# include <unistd.h>
#endif
+#ifdef CCTK_MPI
+# include <mpi.h>
+#endif
+
#include "http_Content.h"
#include "file.hh"
#include "multistorage.hh"
#include "portal.hh"
#include "rdf.hh"
+#include "thornlist.hh"
@@ -258,6 +263,37 @@ namespace Formaline
Util_GetHostName (run_host, sizeof run_host);
stores.store ("host", run_host);
}
+
+#if 0
+ {
+ char run_host [1000];
+ char (* run_hosts) [1000] = 0;
+ int const nprocs = CCTK_NumProcs (cctkGH);
+ int n;
+
+ Util_GetHostName (run_host, sizeof run_host);
+ stores.store ("host", run_host);
+
+ run_hosts = malloc (nprocs * sizeof * run_hosts);
+#ifdef CCTK_MPI
+ // Note: Only the root processor actually comes here
+ MPI_Gather (run_host, sizeof run_host, MPI_CHAR,
+ run_hosts, sizeof * run_hosts, MPI_CHAR,
+ 0, MPI_COMM_WORLD);
+#else
+ assert (nprocs == 1);
+ strcpy (run_hosts[0], run_host);
+#endif
+ for (n = 0; n < nprocs; ++ n) {
+ ostringstream namebuf;
+ namebuf << "hosts[" << n << "]";
+ string const namestr = namebuf.str();
+ strcpy (run_host, run_hosts[n]);
+ stores.store (namestr.c_str(), run_host);
+ }
+ free (run_hosts);
+ }
+#endif
{
unsigned long http_port;
@@ -515,6 +551,28 @@ namespace Formaline
}
}
}
+
+ {
+ int const numthorns = ThornList::NumThorns ();
+ char const * const * const thornnames = ThornList::ThornNames ();
+ for (int thorn = 0; thorn < numthorns; ++ thorn)
+ {
+ string const combination = thornnames [thorn];
+ size_t const sep = combination.find ('/');
+ assert (sep != string::npos);
+ string const arrangement = combination.substr (0, sep);
+ string const thornname = combination.substr (sep + 1);
+
+ ostringstream keybuf;
+ keybuf << "thorns_arrangement/" << thornname;
+ string const keystr = keybuf.str();
+ char const * const key = keystr.c_str();
+
+ char const * const value = arrangement.c_str();
+
+ stores.store (key, value);
+ }
+ }
diff --git a/src/make.code.defn b/src/make.code.defn
index 9b4f9e1..ef6e0dc 100644
--- a/src/make.code.defn
+++ b/src/make.code.defn
@@ -2,7 +2,7 @@
# $Header$
# Source files in this directory
-SRCS = announce.cc file.cc multistorage.cc output_source.c portal.cc rdf.cc storage.cc
+SRCS = announce.cc file.cc multistorage.cc output_source.c portal.cc rdf.cc storage.cc thornlist.cc
# Subdirectories containing source files
SUBDIRS =
diff --git a/src/make.configuration.deps b/src/make.configuration.deps
index ada35c9..f8c0f11 100644
--- a/src/make.configuration.deps
+++ b/src/make.configuration.deps
@@ -41,8 +41,10 @@ $(TARBALL_DIR)/build-id.o: $(TARBALL_DIR)/build-id.c
$(CC) $(CFLAGS) -c -o $@ $^
# (force a new ID to be created every time)
+# (do this after the thorn's library has been build, so that the
+# script gethostname.pl has been copied to the scratch directory)
.PHONY: $(TARBALL_DIR)/build-id.c
-$(TARBALL_DIR)/build-id.c:
+$(TARBALL_DIR)/build-id.c: $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)Formaline$(LIBNAME_SUFFIX)
{ \
echo '/* This is an auto-generated file -- do not edit */'; \
hostname=`$(TARBALL_DIR)/gethostname.pl`; \
diff --git a/src/output_source.c b/src/output_source.c
index 07c1808..ff7e9b6 100644
--- a/src/output_source.c
+++ b/src/output_source.c
@@ -32,32 +32,9 @@ extern size_t const cactus_source_length;
void
-Formaline_OutputSource (void);
-
-static void*
-SetupGH (tFleshConfig *config, int convergence_level, cGH *cctkGH);
-
-
-
-/***
- Originally the routine Formaline_OutputSource() used to output the source
- tarballs into <IO::out_dir>/<Formaline::output_source_subdirectory> itself.
-
- With the introduction of the parameter IO::require_empty_output_directory
- this functionality had to be moved to run _after_ IOUtil's setup routine
- where the test for an empty output directory is performed.
- ***/
-void
-Formaline_OutputSource (void)
-{
- const int extension = CCTK_RegisterGHExtension ("Formaline");
-
- CCTK_RegisterGHExtensionSetupGH (extension, SetupGH);
-}
-
-static void*
-SetupGH (tFleshConfig *config, int convergence_level, cGH *cctkGH)
+Formaline_OutputSource (CCTK_ARGUMENTS)
{
+ DECLARE_CCTK_ARGUMENTS;
DECLARE_CCTK_PARAMETERS;
char filename [10000];
@@ -65,11 +42,7 @@ SetupGH (tFleshConfig *config, int convergence_level, cGH *cctkGH)
int count;
struct datainfo const * datainfo;
- /* avoid compiler warnings about unused parameters */
- config = config;
- convergence_level = convergence_level;
-
- if (CCTK_MyProc (cctkGH) != 0) return NULL;
+ if (CCTK_MyProc (cctkGH) != 0) return;
{ CCTK_PRINTSEPARATOR }
CCTK_VInfo (CCTK_THORNSTRING,
@@ -121,7 +94,4 @@ SetupGH (tFleshConfig *config, int convergence_level, cGH *cctkGH)
"executable can then be found in the \"configs\" subdirectory.\n"
);
fclose (file);
-
- /* no need to return a GH extension structure */
- return NULL;
}
diff --git a/src/thornlist.cc b/src/thornlist.cc
new file mode 100644
index 0000000..7ed287b
--- /dev/null
+++ b/src/thornlist.cc
@@ -0,0 +1,31 @@
+// $Header$
+
+#include "thornlist.hh"
+
+namespace Formaline
+{
+
+ namespace ThornList
+ {
+
+ // This header file is automatically generated by the flesh.
+ // It defines
+ // static char const * const thorn_name[];
+ // static int const nthorns;
+#include "thornlist.h"
+
+ char const * const *
+ ThornNames ()
+ {
+ return thorn_name;
+ }
+
+ int
+ NumThorns ()
+ {
+ return nthorns;
+ }
+
+ } // namespace ThornList
+
+} // namespace Formaline
diff --git a/src/thornlist.hh b/src/thornlist.hh
new file mode 100644
index 0000000..895d2ef
--- /dev/null
+++ b/src/thornlist.hh
@@ -0,0 +1,19 @@
+// $Header$
+
+#ifndef FORMALINE_THORNLIST_HH
+#define FORMALINE_THORNLIST_HH
+
+namespace Formaline
+{
+
+ namespace ThornList
+ {
+
+ char const * const * ThornNames ();
+ int NumThorns ();
+
+ } // namespace ThornList
+
+} // namespace Formaline
+
+#endif /* #ifndef FORMALINE_THORNLIST_HH */