/[escript]/trunk/pythonMPI/src/ScriptMPI.cpp
ViewVC logotype

Diff of /trunk/pythonMPI/src/ScriptMPI.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2702 by jfenwick, Mon Jul 20 06:20:06 2009 UTC revision 2703 by jfenwick, Thu Oct 1 01:22:36 2009 UTC
# Line 54  int main( int argc, char **argv ) { Line 54  int main( int argc, char **argv ) {
54       * Start the python parser       * Start the python parser
55       */       */
56      status = Py_Main(argc, argv);      status = Py_Main(argc, argv);
57      
58        /*
59         * Close down MPI.
60         * status==1 : uncaught python exception
61         * status==2 : invalid python cmd line
62         * status>2 : supposed to be param of sys.exit()
63         *            sys.exit doesn't return as it should.
64         *
65         * I have made an exception for 2 because calling MPI_Abort
66         * can display pretty ugly messages for not typing params
67         * properly.
68         */
69        if ((status!=0) && (status!=2))
70        {
71        MPI_Abort(MPI_COMM_WORLD,status);
72        }
73        else
74        {
75      /*      /*
76       * Finalise MPI for a clean exit.       * Finalise MPI for a clean exit.
77       */       */
78      MPI_Finalize();          MPI_Finalize();
79        }
80      Paso_MPIInfo_free( mpi_info );      Paso_MPIInfo_free( mpi_info );
81    }    }
82    catch (std::runtime_error &e)    catch (std::runtime_error &e)
83    {    {
84      std::cerr << "EXCEPTION: " << e.what() << std::endl;      std::cerr << "EXCEPTION: " << e.what() << std::endl;
85        MPI_Abort(MPI_COMM_WORLD,1);
86      throw;      throw;
87    }    }
88    catch (char *e)    catch (char *e)
89    {    {
90      std::cerr << "EXCEPTION: " << e << std::endl;      std::cerr << "EXCEPTION: " << e << std::endl;
91        MPI_Abort(MPI_COMM_WORLD,1);
92      throw;      throw;
93    }    }
94    catch (...)    catch (...)
95    {    {
96      std::cerr << "EXCEPTION: " << "UNKNOWN." << std::endl;      std::cerr << "EXCEPTION: " << "UNKNOWN." << std::endl;
97        MPI_Abort(MPI_COMM_WORLD,1);
98      throw;      throw;
99    }    }
100    

Legend:
Removed from v.2702  
changed lines
  Added in v.2703

  ViewVC Help
Powered by ViewVC 1.1.26