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

Diff of /trunk/pythonMPI/src/ScriptMPIredirect.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 55  int main( int argc, char **argv ) { Line 55  int main( int argc, char **argv ) {
55       * Start the python parser       * Start the python parser
56       */       */
57      status = Py_Main(argc, argv);      status = Py_Main(argc, argv);
58      
59        /*
60         * Close down MPI.
61         * status==1 : uncaught python exception
62         * status==2 : invalid python cmd line
63         * status>2 : supposed to be param of sys.exit()
64         *            sys.exit doesn't return as it should.
65         *
66         * I have made an exception for 2 because calling MPI_Abort
67         * can display pretty ugly messages for not typing params
68         * properly.
69         * Yes that means you probably shouldn't use 2 as an exit code
70         * but we don't really recommend sys.exit anyway.
71         */
72        if ((status!=0) && (status!=2))
73        {
74            MPI_Abort(MPI_COMM_WORLD,status);
75        }  
76        else
77        {
78      /*      /*
79       * Finalise MPI for a clean exit.       * Finalise MPI for a clean exit.
80       */       */
81      MPI_Finalize();          MPI_Finalize();
82        }
83    
84      Paso_MPIInfo_free( mpi_info );      Paso_MPIInfo_free( mpi_info );
85    }    }
86    catch (std::runtime_error &e)    catch (std::runtime_error &e)
87    {    {
88      std::cerr << "EXCEPTION: " << e.what() << std::endl;      std::cerr << "EXCEPTION: " << e.what() << std::endl;
89        MPI_Abort(MPI_COMM_WORLD,1);
90      throw;      throw;
91    }    }
92    catch (char *e)    catch (char *e)
93    {    {
94      std::cerr << "EXCEPTION: " << e << std::endl;      std::cerr << "EXCEPTION: " << e << std::endl;
95        MPI_Abort(MPI_COMM_WORLD,1);
96      throw;      throw;
97    }    }
98    catch (...)    catch (...)
99    {    {
100      std::cerr << "EXCEPTION: " << "UNKNOWN." << std::endl;      std::cerr << "EXCEPTION: " << "UNKNOWN." << std::endl;
101        MPI_Abort(MPI_COMM_WORLD,1);
102      throw;      throw;
103    }    }
104    

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

  ViewVC Help
Powered by ViewVC 1.1.26