1 /****************************************************************************
3 [ParInit.c] Initialising the parallel RTS
5 P. Trinder, January 17th 1995.
6 An extension based on Kevin Hammond's GRAPH for PVM version
8 Adapted for the new RTS
10 ****************************************************************************/
12 #ifdef PAR /* whole file */
14 #define NON_POSIX_SOURCE /* so says Solaris */
21 /* Global conditions defined here. */
24 IAmMainThread = rtsFalse, /* Set for the main thread */
25 GlobalStopPending = rtsFalse; /* Terminating */
27 /* Task identifiers for various interesting global tasks. */
29 GLOBAL_TASK_ID IOTask = 0, /* The IO Task Id */
30 SysManTask = 0, /* The System Manager Task Id */
31 mytid = 0; /* This PE's Task Id */
33 REAL_TIME main_start_time; /* When the program started */
34 REAL_TIME main_stop_time; /* When the program finished */
35 jmp_buf exit_parallel_system; /* How to abort from the RTS */
41 rtsBool TraceSparks = rtsFalse; /* Enable the spark trace mode */
42 rtsBool SparkLocally = rtsFalse; /* Use local threads if possible */
43 rtsBool DelaySparks = rtsFalse; /* Use delayed sparking */
44 rtsBool LocalSparkStrategy = rtsFalse; /* Either delayed threads or local threads*/
45 rtsBool GlobalSparkStrategy = rtsFalse; /* Export all threads */
47 rtsBool DeferGlobalUpdates = rtsFalse; /* Defer updating of global nodes */
50 rtsBool fishing = rtsFalse; /* We have no fish out in the stream */
52 /* Initialisation Routines */
55 par_exit defines how to terminate the program. If the exit code is
56 non-zero (i.e. an error has occurred), the PE should not halt until
57 outstanding error messages have been processed. Otherwise, messages
58 might be sent to non-existent Task Ids. The infinite loop will actually
59 terminate, since STG_Exception will call myexit\tr{(0)} when
60 it received a PP_FINISH from the system manager task.
64 par_exit(I_ n) /* NB: "EXIT" is set to "myexit" for parallel world */
66 GlobalStopPending = rtsTrue;
67 SendOp(PP_FINISH, SysManTask);
71 WaitForPEOp(PP_FINISH, SysManTask);
73 /* fprintf(stderr,"PE %lx shutting down, %ld Threads run, %ld Sparks Ignored\n", (W_) mytid, threadId, sparksIgnored); */
74 fprintf(stderr,"PE %lx shutting down, %ld Threads run\n", (W_) mytid, threadId);
80 time_t time (time_t *);
83 initParallelSystem(void)
85 /* Don't buffer standard channels... */
89 srand48(time(NULL) * getpid()); /*Initialise Random-number generator seed*/
90 /* Used to select target of FISH message*/
96 *SynchroniseSystem synchronises the reduction task with the system
97 *manager, and initialises the Global address tables (LAGA & GALA)
103 SynchroniseSystem(void)
107 PEs = PEStartUp(nPEs);
109 /* Initialize global address tables */
112 /* Record the shortened the PE identifiers for LAGA etc. tables */
113 for (i = 0; i < nPEs; ++i)
114 registerTask(PEs[i]);
118 #endif /* PAR -- whole file */