Commit 0c5705a2 authored by pugmire's avatar pugmire

This checkin allows us to run visitconvert in parallel (Yeah!!!!!)

A big thanks to Hank for putting the parallelization code into convert.C and the BOV writer. His changes are part of this commit.

I added some additional logic to BOV writer to control how many decimals it uses for each bricklet. It was previously 4. Now it uses 4 as a default, but will use a larger number if the -target_chunks warrants.

Here is an example run command:

visit -convert_par -np 4 -l mpirun      noise.silo testBOV   BOV -target_chunks 8 -target_zones 80000





git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@7234 18c085ea-50e0-402c-830e-de6fd14e8384
parent b615b67e
......@@ -69,6 +69,9 @@ exec perl -x $0 ${1+"$@"};
# Quote the $visitdir string by adding backslashes to special
# characters before passing it into a regular expression.
#
# Dave Pugmire, Thu May 7 13:46:51 EDT 2009
# Add support for running visitconvert in parallel.
#
###############################################################################
......@@ -187,6 +190,11 @@ while (scalar(@ARGV) > 0) {
print STDERR "no longer necessary.\nIn the future, you should ";
print STDERR "just run '$progname' instead.\n\n";
}
elsif ($arg eq "-visitconvert_par" or
$arg eq "-convert_par")
{
$progname = "visitconvert_par";
}
elsif ($arg eq "-mpeg2encode" or
$arg eq "-mpeg_encode")
{
......
......@@ -54,11 +54,11 @@
#include <vtkRectilinearGrid.h>
#include <avtDatabaseMetaData.h>
#include <avtParallel.h>
#include <InvalidDBTypeException.h>
#include <ImproperUseException.h>
using std::string;
using std::vector;
......@@ -104,6 +104,9 @@ avtBOVWriter::OpenFile(const string &stemname, int nb)
// Use the real number of blocks, not what is in the meta-data. (There
// may be SIL selection or there may be a resample operator.
//
// Dave Pugmire, Thu May 7 12:59:09 EDT 2009
// Allow multi-block export in parallel.
//
// ****************************************************************************
void
......@@ -111,11 +114,13 @@ avtBOVWriter::WriteHeaders(const avtDatabaseMetaData *md,
vector<string> &scalars, vector<string> &vectors,
vector<string> &materials)
{
//
// We can only handle single block files.
//
if (nblocks != 1)
if (shouldChangeTotalZones || shouldChangeChunks)
{
//We are running from visitconvert, multiblock is ok.
}
else if (nblocks != 1)
{
// We can only handle single block files from file export.
EXCEPTION1(InvalidDBTypeException,
"The BOV writer can only handle single block files.");
}
......@@ -323,6 +328,10 @@ ResampleGrid(vtkRectilinearGrid *rgrid, float *ptr, float *samples, int numCompo
// Use const char* for string literals.
// Remove unnecessary format modifiers in sprintf that caused warnings.
//
// Dave Pugmire (on behalf of Hank Childs), Thu May 7 12:59:09 EDT 2009
// Allow parallel writing of BOV files. Also, change bov file formatting
// to consider how many chunks are written.
//
// ****************************************************************************
void
......@@ -415,10 +424,15 @@ avtBOVWriter::WriteChunk(vtkDataSet *ds, int chunk)
brickletNK = approxCubeRoot;
}
int numDecimals = 4;
if (nBricklets > 1)
{
numDecimals = (int)log10(nBricklets)+1;
if (numDecimals < 4)
numDecimals = 4;
char str[1024];
sprintf(str, "%s_%%0.4d.bof.gz", stem.c_str());
sprintf(str, "%s_%%0.%dd.bof.gz", stem.c_str(), numDecimals);
ofile << "DATA_FILE: " << str << endl;
}
else
......@@ -504,6 +518,10 @@ avtBOVWriter::WriteChunk(vtkDataSet *ds, int chunk)
{
for (int k = 0 ; k < brickletsPerZ ; k++)
{
int brick = k*brickletsPerY*brickletsPerX
+ j*brickletsPerX + i;
if ((brick % PAR_Size()) != PAR_Rank())
continue;
float brick_bounds[6];
float x_step = (bounds[1] - bounds[0]) / brickletsPerX;
brick_bounds[0] = bounds[0] + i*x_step;
......@@ -517,11 +535,11 @@ avtBOVWriter::WriteChunk(vtkDataSet *ds, int chunk)
int brick_dims[3] = { brickletNI, brickletNJ, brickletNK };
ResampleGrid(rgrid, ptr, samples, arr->GetNumberOfComponents(),brick_bounds,brick_dims);
char str[1024];
int brick = k*brickletsPerY*brickletsPerX
+ j*brickletsPerX + i;
if (nBricklets > 1)
{
sprintf(str, "%s_%.4d.bof.gz", stem.c_str(), brick);
char fmt[1024];
sprintf(fmt, "%s_%%0.%dd.bof.gz", stem.c_str(), numDecimals);
sprintf(str, fmt, brick);
void *gz_handle = gzopen(str, "w");
gzwrite(gz_handle, samples,
vals_per_bricklet*sizeof(float));
......
......@@ -59,6 +59,7 @@
#include <avtExpressionEvaluatorFilter.h>
#include <avtExprNodeFactory.h>
#endif
#include <avtParallel.h>
#include <DBOptionsAttributes.h>
#include <VisItException.h>
......@@ -213,21 +214,25 @@ FillOptionsFromCommandline(DBOptionsAttributes *opts)
// Brad Whitlock, Tue Jun 24 16:58:35 PDT 2008
// The plugin manager is no longer a singleton.
//
// Dave Pugmire (on behalf of Hank Childs), Thu May 7 13:43:28 EDT 2009
// Support for running visitconvert in parallel.
//
// ****************************************************************************
int main(int argc, char *argv[])
{
int i;
bool parallel = false;
#ifdef PARALLEL
parallel = true;
PAR_Init(argc, argv);
#endif
VisItInit::Initialize(argc, argv);
//
// Initialize the plugin readers.
//
bool parallel = false;
#ifdef PARALLEL
parallel = true;
#endif
DatabasePluginManager *dbmgr = new DatabasePluginManager;
dbmgr->Initialize(DatabasePluginManager::Engine, parallel);
dbmgr->LoadPluginsNow();
......@@ -305,8 +310,11 @@ int main(int argc, char *argv[])
}
else if (strcmp(argv[i], "-no_options") == 0)
noOptions = true;
else
UsageAndExit(dbmgr, argv[0]);
{
//Ignore....
}
}
}
......@@ -502,6 +510,10 @@ int main(int argc, char *argv[])
delete dbmgr;
#ifdef PARALLEL
PAR_Exit();
#endif
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment