286 |
\end{python} |
\end{python} |
287 |
It possible to rerun the mechanism that was originally used to generates |
It possible to rerun the mechanism that was originally used to generates |
288 |
\var{mydomain} to recreate \var{mydomain}. However in most cases using \var{dump} and |
\var{mydomain} to recreate \var{mydomain}. However in most cases using \var{dump} and |
289 |
load is faster in particuar if optimization has been applied. In case that |
load is faster in particular if optimization has been applied. In case that |
290 |
\escript is running on more than one \MPI processor the \var{dump} will create an individual file for each processor containing the local data. In order to avoid conflicts the file name is extended by the \MPI processor rank. |
\escript is running on more than one \MPI processor the \var{dump} will create an individual file for each processor containing the local data. In order to avoid conflicts the file name is extended by the \MPI processor rank. |
291 |
|
|
292 |
The function space of the \Data is stored in {\tt x.nc}, though. |
The function space of the \Data is stored in {\tt x.nc}, though. |
1347 |
|
|
1348 |
|
|
1349 |
\section{Utilities} |
\section{Utilities} |
1350 |
|
|
1351 |
|
The \class{FileWriter} provides a mechanism to write data to a file. |
1352 |
|
In essence, this class wraps the standard \class{file} class to write data |
1353 |
|
that are global in MPI to a file. In fact, data are written on the processor |
1354 |
|
with \MPI rank 0 only. It is recommended to use \class{FileWriter} |
1355 |
|
rather than \class{open} in order to write code that is running |
1356 |
|
with and without \MPI. It is save to use \class{open} under MPI to read data which are global under \MPI. |
1357 |
|
|
1358 |
|
\begin{classdesc}{FileWriter}{fn\optional{,append=\False, \optional{createLocalFiles=\False}})} |
1359 |
|
Opens a file of name \var{fn} for writing. If \var{append} is set to \True |
1360 |
|
written data are append at the end of the file. |
1361 |
|
If running under \MPI only the first processor with rank==0 |
1362 |
|
will open the file and write to it. |
1363 |
|
If \var{createLocalFiles} is set each individual processor will create a file |
1364 |
|
where for any processor with rank>0 the file name is extended by its rank. This option is normally used for debug purposes only. |
1365 |
|
\end{classdesc} |
1366 |
|
|
1367 |
|
The following methods are available: |
1368 |
|
\begin{methoddesc}[FileWriter]{close}{} |
1369 |
|
closes the file. |
1370 |
|
\end{methoddesc} |
1371 |
|
\begin{methoddesc}[FileWriter]{flush}{} |
1372 |
|
flushes the internal buffer to disk. |
1373 |
|
\end{methoddesc} |
1374 |
|
\begin{methoddesc}[FileWriter]{write}{txt} |
1375 |
|
Write string \var{txt} to file. |
1376 |
|
Note that newline is not added. |
1377 |
|
\end{methoddesc} |
1378 |
|
\begin{methoddesc}[FileWriter]{writelines}{txts} |
1379 |
|
Write the list \var{txts} of strings to the file.. |
1380 |
|
Note that newlines are not added. |
1381 |
|
This method is equivalent to call write() for each string. |
1382 |
|
\end{methoddesc} |
1383 |
|
\begin{memberdesc}[FileWriter]{closed} |
1384 |
|
\True if file is closed. |
1385 |
|
\end{memberdesc} |
1386 |
|
\begin{memberdesc}[FileWriter]{mode} |
1387 |
|
access mode. |
1388 |
|
\end{memberdesc} |
1389 |
|
\begin{memberdesc}[FileWriter]{name} |
1390 |
|
file name. |
1391 |
|
\end{memberdesc} |
1392 |
|
\begin{memberdesc}[FileWriter]{newlines} |
1393 |
|
line separator |
1394 |
|
\end{memberdesc} |
1395 |
|
|
1396 |
|
|
1397 |
\begin{funcdesc}{setEscriptParamInt}{name,value} |
\begin{funcdesc}{setEscriptParamInt}{name,value} |
1398 |
assigns the integer value \var{value} to the parameter \var{name}. |
assigns the integer value \var{value} to the parameter \var{name}. |
1399 |
If \var{name}="TOO_MANY_LINES" conversion of any \Data object to a string switches to a |
If \var{name}="TOO_MANY_LINES" conversion of any \Data object to a string switches to a |
1410 |
|
|
1411 |
\begin{funcdesc}{getMPISizeWorld}{} |
\begin{funcdesc}{getMPISizeWorld}{} |
1412 |
returns the number of \MPI processors in use in the \env{MPI_COMM_WORLD} processor group. |
returns the number of \MPI processors in use in the \env{MPI_COMM_WORLD} processor group. |
1413 |
If \MPI is not used 1 is returend. |
If \MPI is not used 1 is returned. |
1414 |
\end{funcdesc} |
\end{funcdesc} |
1415 |
\begin{funcdesc}{getMPIRankWorld}{} |
\begin{funcdesc}{getMPIRankWorld}{} |
1416 |
returns the rank of the process within the \env{MPI_COMM_WORLD} processor group. |
returns the rank of the process within the \env{MPI_COMM_WORLD} processor group. |
1417 |
If \MPI is not used 0 is returend. |
If \MPI is not used 0 is returned. |
1418 |
\end{funcdesc} |
\end{funcdesc} |
1419 |
\begin{funcdesc}{MPIBarrierWorld}{} |
\begin{funcdesc}{MPIBarrierWorld}{} |
1420 |
performs a barrier synchronization across all processors within \env{MPI_COMM_WORLD} |
performs a barrier synchronization across all processors within \env{MPI_COMM_WORLD} |
1421 |
processor group. |
processor group. |
1422 |
\end{funcdesc} |
\end{funcdesc} |
1423 |
\begin{funcdesc}{getMPIWorldMax}{a} |
\begin{funcdesc}{getMPIWorldMax}{a} |
1424 |
returns the maximum value of the interger \var{a} across all |
returns the maximum value of the integer \var{a} across all |
1425 |
processors within \env{MPI_COMM_WORLD}. |
processors within \env{MPI_COMM_WORLD}. |
1426 |
\end{funcdesc} |
\end{funcdesc} |
1427 |
|
|