From c1b85e1b4a10aaabdcaefc266dda48a01dd8f838 Mon Sep 17 00:00:00 2001 From: schnetter Date: Wed, 4 May 2005 15:23:00 +0000 Subject: Add a thorn that commits meta data about runs to permanent storage. The meta data are collected, but no database server is contacted so far. git-svn-id: http://svn.cactuscode.org/arrangements/CactusUtils/Formaline/trunk@2 83718e91-0e4f-0410-abf4-91180603181f --- README | 13 +++++ doc/documentation.tex | 146 ++++++++++++++++++++++++++++++++++++++++++++++++++ interface.ccl | 4 ++ param.ccl | 2 + schedule.ccl | 7 +++ src/formaline.c | 128 +++++++++++++++++++++++++++++++++++++++++++ src/make.code.defn | 8 +++ 7 files changed, 308 insertions(+) create mode 100644 README create mode 100644 doc/documentation.tex create mode 100644 interface.ccl create mode 100644 param.ccl create mode 100644 schedule.ccl create mode 100644 src/formaline.c create mode 100644 src/make.code.defn diff --git a/README b/README new file mode 100644 index 0000000..588210f --- /dev/null +++ b/README @@ -0,0 +1,13 @@ +CVS info : $Header$ + +Cactus Code Thorn Formaline +Thorn Author(s) : Erik Schnett +Thorn Maintainer(s) : Erik Schnett +-------------------------------------------------------------------------- + +Purpose of the thorn: + +Send meta information about a run to a server, so that it is kept +there forever. The information sent is e.g. the parameter file, date, +time, machine, and user id of the run, location of the output data, +number of iterations, an efficiency summary, etc. diff --git a/doc/documentation.tex b/doc/documentation.tex new file mode 100644 index 0000000..4d536bd --- /dev/null +++ b/doc/documentation.tex @@ -0,0 +1,146 @@ +% *======================================================================* +% Cactus Thorn template for ThornGuide documentation +% Author: Ian Kelley +% Date: Sun Jun 02, 2002 +% $Header$ +% +% Thorn documentation in the latex file doc/documentation.tex +% will be included in ThornGuides built with the Cactus make system. +% The scripts employed by the make system automatically include +% pages about variables, parameters and scheduling parsed from the +% relevant thorn CCL files. +% +% This template contains guidelines which help to assure that your +% documentation will be correctly added to ThornGuides. More +% information is available in the Cactus UsersGuide. +% +% Guidelines: +% - Do not change anything before the line +% % START CACTUS THORNGUIDE", +% except for filling in the title, author, date, etc. fields. +% - Each of these fields should only be on ONE line. +% - Author names should be separated with a \\ or a comma. +% - You can define your own macros, but they must appear after +% the START CACTUS THORNGUIDE line, and must not redefine standard +% latex commands. +% - To avoid name clashes with other thorns, 'labels', 'citations', +% 'references', and 'image' names should conform to the following +% convention: +% ARRANGEMENT_THORN_LABEL +% For example, an image wave.eps in the arrangement CactusWave and +% thorn WaveToyC should be renamed to CactusWave_WaveToyC_wave.eps +% - Graphics should only be included using the graphicx package. +% More specifically, with the "\includegraphics" command. Do +% not specify any graphic file extensions in your .tex file. This +% will allow us to create a PDF version of the ThornGuide +% via pdflatex. +% - References should be included with the latex "\bibitem" command. +% - Use \begin{abstract}...\end{abstract} instead of \abstract{...} +% - Do not use \appendix, instead include any appendices you need as +% standard sections. +% - For the benefit of our Perl scripts, and for future extensions, +% please use simple latex. +% +% *======================================================================* +% +% Example of including a graphic image: +% \begin{figure}[ht] +% \begin{center} +% \includegraphics[width=6cm]{MyArrangement_MyThorn_MyFigure} +% \end{center} +% \caption{Illustration of this and that} +% \label{MyArrangement_MyThorn_MyLabel} +% \end{figure} +% +% Example of using a label: +% \label{MyArrangement_MyThorn_MyLabel} +% +% Example of a citation: +% \cite{MyArrangement_MyThorn_Author99} +% +% Example of including a reference +% \bibitem{MyArrangement_MyThorn_Author99} +% {J. Author, {\em The Title of the Book, Journal, or periodical}, 1 (1999), +% 1--16. {\tt http://www.nowhere.com/}} +% +% *======================================================================* + +% If you are using CVS use this line to give version information +% $Header$ + +\documentclass{article} + +% Use the Cactus ThornGuide style file +% (Automatically used from Cactus distribution, if you have a +% thorn without the Cactus Flesh download this from the Cactus +% homepage at www.cactuscode.org) +\usepackage{../../../../doc/latex/cactus} + +\begin{document} + +% The author of the documentation +\author{Erik Schnett \textless schnetter@aei.mgp.de\textgreater} + +% The title of the document (not necessarily the name of the Thorn) +\title{Formaline --- conserve meta data about runs forever} + +% the date your document was last changed, if your document is in CVS, +% please use: +\date{$ $Date$ $} + +\maketitle + +% Do not delete next line +% START CACTUS THORNGUIDE + +% Add all definitions used in this documentation here +% \def\mydef etc + +% Add an abstract for this thorn's documentation +\begin{abstract} +This thorn Formaline contacts a database server at run time and stores +there meta data about the run. Such meta data include e.g.\ the +parameter file, date, time, machine, and user id of the run, location +of the output data, number of iterations, an efficiency summary, etc. +\end{abstract} + +%% % The following sections are suggestive only. +%% % Remove them or add your own. +%% +%% \section{Introduction} +%% +%% \section{Physical System} +%% +%% \section{Numerical Implementation} +%% +%% \section{Using This Thorn} +%% +%% \subsection{Obtaining This Thorn} +%% +%% \subsection{Basic Usage} +%% +%% \subsection{Special Behaviour} +%% +%% \subsection{Interaction With Other Thorns} +%% +%% \subsection{Examples} +%% +%% \subsection{Support and Feedback} +%% +%% \section{History} +%% +%% \subsection{Thorn Source Code} +%% +%% \subsection{Thorn Documentation} +%% +%% \subsection{Acknowledgements} +%% +%% +%% \begin{thebibliography}{9} +%% +%% \end{thebibliography} + +% Do not delete next line +% END CACTUS THORNGUIDE + +\end{document} diff --git a/interface.ccl b/interface.ccl new file mode 100644 index 0000000..37a672d --- /dev/null +++ b/interface.ccl @@ -0,0 +1,4 @@ +# Interface definition for thorn Formaline +# $Header$ + +IMPLEMENTS: Formaline diff --git a/param.ccl b/param.ccl new file mode 100644 index 0000000..582c241 --- /dev/null +++ b/param.ccl @@ -0,0 +1,2 @@ +# Parameter definitions for thorn Formaline +# $Header$ diff --git a/schedule.ccl b/schedule.ccl new file mode 100644 index 0000000..57889dd --- /dev/null +++ b/schedule.ccl @@ -0,0 +1,7 @@ +# Schedule definitions for thorn Formaline +# $Header$ + +SCHEDULE Formaline AT wragh +{ + LANG: C +} "Put some meta information about the current run into permanent storage" diff --git a/src/formaline.c b/src/formaline.c new file mode 100644 index 0000000..88867d8 --- /dev/null +++ b/src/formaline.c @@ -0,0 +1,128 @@ +/* $Header$ */ + +#include + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + + + +static void +StoreIntKey (char const * key, int value); + +static void +StoreStringKey (char const * key, char const * value); + + + +void +Formaline (CCTK_ARGUMENTS) +{ + /* Cactus */ + + { + char const * const cactus_version = CCTK_FullVersion(); + StoreStringKey ("Cactus version", cactus_version); + } + + + + /* Compiling */ + + { + char const * const compile_user = CCTK_CompileUser(); + StoreStringKey ("compile user", compile_user); + } + + { + char const * const compile_date = CCTK_CompileDate(); + StoreStringKey ("compile date", compile_date); + } + + { + char const * const compile_time = CCTK_CompileTime(); + StoreStringKey ("compile time", compile_time); + } + + + + /* Running */ + + { + char const * const run_user = CCTK_RunUser(); + StoreStringKey ("run user", run_user); + } + + { + char run_date [1000]; + Util_CurrentDate (sizeof run_date, run_date); + StoreStringKey ("run date", run_date); + } + + { + char run_time [1000]; + Util_CurrentTime (sizeof run_time, run_time); + StoreStringKey ("run time", run_time); + } + + { + char run_host [1000]; + Util_GetHostName (run_host, sizeof run_host); + StoreStringKey ("run host", run_host); + } + + { + char const * run_title; + int type; + run_title = CCTK_ParameterGet ("run_title", "Cactus", & type); + assert (type == CCTK_VARIABLE_STRING); + StoreStringKey ("run title", run_title); + } + + + + /* Parameters */ + + { + char ** argv; + int argc; + int n; + CCTK_CommandLine (& argv); + for (argc = 0; argv [argc]; ++ argc); + StoreIntKey ("argc", argc); + for (n = 0; n < argc; ++ n) + { + char buffer [1000]; + snprintf (sizeof buffer, buffer, "argv[%d]", n); + StoreStringKey (buffer, argv[n]); + } + } + + { + char parameter_file_name [10000]; + CCTK_ParameterFilename (sizeof parameter_file_name, parameter_file_name); + StoreStringKey ("parameter file name", parameter_file_name); + } +} + + + +/* Dummy implementations */ + +static void +StoreIntKey (char const * const key, int const value) +{ + assert (key); + + /* Do nothing */ +} + +static void +StoreStringKey (char const * const key, char const * const value) +{ + assert (key); + assert (value); + + /* Do nothing */ +} diff --git a/src/make.code.defn b/src/make.code.defn new file mode 100644 index 0000000..7407f5d --- /dev/null +++ b/src/make.code.defn @@ -0,0 +1,8 @@ +# Main make.code.defn file for thorn Formaline +# $Header$ + +# Source files in this directory +SRCS = formaline.c + +# Subdirectories containing source files +SUBDIRS = -- cgit v1.2.3