[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Working patch for FFTW 3.0.x and Nd FFT's

From: John W. Eaton
Subject: Re: Working patch for FFTW 3.0.x and Nd FFT's
Date: Wed, 18 Feb 2004 16:28:24 -0600

On 18-Feb-2004, Dmitri A. Sergatskov <address@hidden> wrote:

| Being bitten by ~1Gb octave-core few times myself, could we have some
| equivalent of "ulimit -c" which limits size of octave_core?

Saving an incomplete (truncated) file would not be very useful.
Should Octave try to save as much data as possible by sorting the
variables by total size and then skipping the largest (if any) until
the total save size is less than the limit?

Currently we don't have a way to get the size (in bytes) of a
variable, but there were some changes posted recently for modifying
the output of the whos command that included a patch for that, I

| May be just extend crash_dumps_octave_core to indicate
| size in MB (this way current default "1" will not be completely
| meaningless)?

If we decide to go the ulimit route, then I think this might be a
reasonable place to specify the limit.

| Changing default format to octave-binary make sense IMHO.
| Problem with binary formats is that they are not as robust
| as text files, but I do not think those core files that
| valuable to worry that much about them.

OK, with the following patch, saving the 10 million element vector
results in an 80MB file that can be saved to my local disk in a couple
of seconds.

Note that I introduced a new variable octave_core_format that allows
users to select their favorite format for this purpose.



2004-02-18  John W. Eaton  <address@hidden>

        * load-save.cc (Voctave_core_format): New static_variable.
        (octave_core_format): New function.
        (symbols_of_load_save): Add DEFVAR for octave_core_format.
        (get_save_format): Rename from get_default_savae_format.
        Pass name of format as arg.  Change all uses.
        (save_user_variables): Use pass Voctave_core_format to
        get_save_format here.

Index: src/load-save.cc
RCS file: /usr/local/cvsroot/octave/src/load-save.cc,v
retrieving revision 1.186
diff -u -r1.186 load-save.cc
--- src/load-save.cc    23 Jan 2004 20:04:36 -0000      1.186
+++ src/load-save.cc    18 Feb 2004 22:26:43 -0000
@@ -87,6 +87,10 @@
 // "mat-binary", or "hdf5".
 static std::string Vdefault_save_format;
+// The output format for octave-core files.  May be one of "binary",
+// "text", "mat-binary", or "hdf5".
+static std::string Voctave_core_format;
 // The format string for the comment line at the top of text-format
 // save files.  Passed to strftime.  Should begin with `#' and contain
 // no newline characters.
@@ -910,12 +914,10 @@
 static load_save_format
-get_default_save_format (void)
+get_save_format (const std::string& fmt)
   load_save_format retval = LS_ASCII;
-  std::string fmt = Vdefault_save_format;
   if (fmt == "binary")
     retval = LS_BINARY;
   else if (fmt == "mat-binary" || fmt =="mat_binary")
@@ -1046,7 +1048,7 @@
       message (0, "attempting to save variables to `%s'...", fname);
-      load_save_format format = get_default_save_format ();
+      load_save_format format = get_save_format (Voctave_core_format);
       std::ios::openmode mode = std::ios::out|std::ios::trunc;
       if (format == LS_BINARY ||
@@ -1186,7 +1188,7 @@
   bool save_as_floats = false;
-  load_save_format format = get_default_save_format ();
+  load_save_format format = get_save_format (Vdefault_save_format);
   bool append = false;
@@ -1369,6 +1371,24 @@
   return status;
+static int
+octave_core_format (void)
+  int status = 0;
+  std::string s = builtin_string_variable ("octave_core_format");
+  if (s.empty ())
+    {
+      gripe_invalid_value_specified ("octave_core_format");
+      status = -1;
+    }
+  else
+    Voctave_core_format = s;
+  return status;
 static std::string
 default_save_header_format (void)
@@ -1417,6 +1437,18 @@
 It should have one of the following values: @code{\"ascii\"},\n\
 @code{\"binary\"}, @code{float-binary}, or @code{\"mat-binary\"}.  The\n\
 initial default save format is Octave's text format.\n\
address@hidden defvr");
+  DEFVAR (octave_core_format, "binary", octave_core_format,
+    "-*- texinfo -*-\n\
address@hidden {Built-in Variable} octave_core_format\n\
+If Octave aborts, it attempts to save the contents of the top-level\n\
+workspace in a file using this format.  The value of\n\
address@hidden should have one of the following values:\n\
address@hidden"ascii\"}, @code{\"binary\"}, @code{float-binary}, or\n\
address@hidden"mat-binary\"}.  The default value is Octave's binary format.\n\
 @end defvr");
   DEFVAR (save_header_format_string, default_save_header_format (),

reply via email to

[Prev in Thread] Current Thread [Next in Thread]