Beispiel #1
0
def run(no_interp=None):
    global _rank
    global startupfiles

    process_inline_options()  # execute well-formed oof options

    # Look for .oof2rc in the user's home directory.
    if not no_rc:
        oofrcpath = os.path.join(os.path.expanduser("~"), ".oof2rc")
        if os.path.exists(oofrcpath):
            startupfiles = [StartUpScriptNoLog(oofrcpath)] + startupfiles

    if thread_enable.query() and not (runtimeflags.text_mode
                                      or config.no_gui()):
        # TODO: Is this still necessary?
        garbage.disable()  # work-around for gtk bug?

    start_parallel_machine()  # start parallel suite (if available)

    if _rank == 0:
        if parallel_enable.enabled():
            from ooflib.SWIG.common import mpitools
            _size = mpitools.Size()
            mpitools.Isend_Bool(thread_enable.enabled(), range(1, _size))

        if parallel_enable.enabled():
            from ooflib.common.IO import socket2me

        if config.petsc():
            print "Going to InitPETSc"
            from ooflib.SWIG.engine.PETSc.petsc_solverdriver import InitPETSc
            InitPETSc(sys.argv)
            for s in sys.argv:
                print s

        start_sockets_Front_End()
        # Import mainmenu only *after* processing command line options, so
        # that the options can affect which menus are loaded.
        global mainmenu
        from ooflib.common.IO import mainmenu
        front_end(no_interp)  # all non-parallel menu items are executed here.
    else:
        # parallel back-end
        parallel_enable.set(True)  # notify back-end of its parallel status

        # thread status at the back-ends
        from ooflib.SWIG.common import mpitools
        thread_enable.set(mpitools.Recv_Bool(0))
        if not thread_enable.enabled():
            lock.disable_all()

        if parallel_enable.enabled():
            from ooflib.common.IO import socket2me

        if config.petsc():
            print "Going to InitPETSc"
            from ooflib.SWIG.engine.PETSc.petsc_solverdriver import InitPETSc
            InitPETSc(sys.argv)
            for s in sys.argv:
                print s

        debug.set_debug_mode()  # set for debugging parallel mode
        from ooflib.common import quit
        quit.set_quiet()  ## back-end exits quietly.
        start_sockets_Back_End()  # socket initialization
        from ooflib.common import backEnd  # import back end machine
        # The back end shouldn't run the gui!
        runtimeflags.text_mode = True
        backEnd.back_end()  # back-end awaits for your command
Beispiel #2
0
def run(no_interp=None):
    global _rank
    global startupfiles

    process_inline_options()  # execute well-formed oof options

    # Look for .oof2rc in the user's home directory.
    if not no_rc:
        oofrcpath = os.path.join(os.path.expanduser("~"), ".oof2rc")
        if os.path.exists(oofrcpath):
            startupfiles = [StartUpScriptNoLog(oofrcpath)]+startupfiles


    if thread_enable.query() and not (runtimeflags.text_mode or config.no_gui()):
        # TODO: Is this still necessary?
        garbage.disable()               # work-around for gtk bug?

    start_parallel_machine()  # start parallel suite (if available)

    if _rank == 0:
        if parallel_enable.enabled():
            from ooflib.SWIG.common import mpitools
            _size = mpitools.Size()
            mpitools.Isend_Bool(thread_enable.enabled(), range(1,_size))
            
        if parallel_enable.enabled():
            from ooflib.common.IO import socket2me

        if config.petsc():
            print "Going to InitPETSc"
            from ooflib.SWIG.engine.PETSc.petsc_solverdriver import InitPETSc
            InitPETSc(sys.argv)
            for s in sys.argv:
                print s

        start_sockets_Front_End()
        # Import mainmenu only *after* processing command line options, so
        # that the options can affect which menus are loaded.
        global mainmenu
        from ooflib.common.IO import mainmenu
        front_end(no_interp)  # all non-parallel menu items are executed here.
    else:
        # parallel back-end
        parallel_enable.set(True)  # notify back-end of its parallel status

        # thread status at the back-ends
        from ooflib.SWIG.common import mpitools
        thread_enable.set(mpitools.Recv_Bool(0))
        if not thread_enable.enabled():
            lock.disable_all()
        
        if parallel_enable.enabled():
            from ooflib.common.IO import socket2me

        if config.petsc():
            print "Going to InitPETSc"
            from ooflib.SWIG.engine.PETSc.petsc_solverdriver import InitPETSc
            InitPETSc(sys.argv)
            for s in sys.argv:
                print s

        debug.set_debug_mode()  # set for debugging parallel mode
        from ooflib.common import quit
        quit.set_quiet() ## back-end exits quietly.
        start_sockets_Back_End()  # socket initialization
        from ooflib.common import backEnd  # import back end machine
        # The back end shouldn't run the gui!
        runtimeflags.text_mode = True
        backEnd.back_end()  # back-end awaits for your command
Beispiel #3
0
     option_list += ['parallel']
 try:
     (optlist, args) = getopt.getopt(sys.argv[1:], '', option_list)
 except getopt.error, message:
     # Malformed arguments have been found.  Exit.
     print message
     state_options_and_quit()
 for opt in optlist:
     if opt[0] == '--gtk':
         gtk_options = opt[1]
         remove_option(opt[0], opt[1])
     elif opt[0] == '--parallel':
         parallel_enable.set(True)
         remove_option(opt[0])
     elif opt[0] in ('--unthreaded', ):
         thread_enable.set(False)
         lock.disable_all()
         remove_option(opt[0])
     elif opt[0] in ('--text', ):
         runtimeflags.text_mode = True
         remove_option(opt[0])
     elif opt[0] in ('--help', ):
         help_mode = True
         remove_option(opt[0])
     elif opt[0] in ('--version', ):
         version_mode = True
         remove_option(opt[0])
     elif opt[0] in ('--script', ):
         startupfiles.append(StartUpScript(opt[1]))
         remove_option(opt[0], opt[1])
     elif opt[0] in ('--command', ):
Beispiel #4
0
     option_list += ['parallel']
 try:
     (optlist, args) = getopt.getopt(sys.argv[1:], '', option_list)
 except getopt.error, message:
     # Malformed arguments have been found.  Exit.
     print message
     state_options_and_quit()
 for opt in optlist:
     if opt[0] == '--gtk':
         gtk_options = opt[1]
         remove_option(opt[0],opt[1])
     elif opt[0] == '--parallel':
         parallel_enable.set(True)
         remove_option(opt[0])
     elif opt[0] in ('--unthreaded',):
         thread_enable.set(False)
         lock.disable_all()
         remove_option(opt[0])
     elif opt[0] in ('--text',):
         runtimeflags.text_mode = True 
         remove_option(opt[0])
     elif opt[0] in ('--help',):
         help_mode = True
         remove_option(opt[0])
     elif opt[0] in ('--version',):
         version_mode = True
         remove_option(opt[0])
     elif opt[0] in ('--script',):
         startupfiles.append(StartUpScript(opt[1]))
         remove_option(opt[0],opt[1])
     elif opt[0] in ('--command',):