Commit 7766172e authored by partain's avatar partain
Browse files

[project @ 1996-01-23 11:11:20 by partain]

Final(?) 1.2-compiler base fixes
parent e14bc01c
This diff is collapsed.
......@@ -538,13 +538,18 @@ NL [\n\r]
<GhcPragma>"_TUP_"{D}+ { hsnewid(yytext, yyleng); RETURN(CONID); }
<GhcPragma>[a-z]{i}*"$"[a-z]{i}* { hsnewid(yytext, yyleng); RETURN(TYVAR_TEMPLATE_ID); }
<GlaExt,GhcPragma,UserPragma>{Id}"#" {
%{
/* These SHOULDNAE work in "Code" (sigh) */
%}
<Code,GlaExt,GhcPragma,UserPragma>{Id}"#" {
if (! (nonstandardFlag || in_interface)) {
char errbuf[ERR_BUF_SIZE];
sprintf(errbuf, "Non-standard identifier (trailing `#'): %s\n", yytext);
hsperror(errbuf);
}
hsnewid(yytext, yyleng);
RETURN(_isconstr(yytext) ? CONID : VARID);
}
%{
/* This SHOULDNAE work in "Code" (sigh) */
%}
<Code,GlaExt,GhcPragma,UserPragma>_+{Id} {
if (! (nonstandardFlag || in_interface)) {
char errbuf[ERR_BUF_SIZE];
......
......@@ -981,9 +981,9 @@ PACKET packet;
{
GLOBAL_TASK_ID sender = Sender_Task(packet);
OPCODE opcode = Opcode(packet);
#if 0
fprintf(stderr,"STG_Exception: Received %s (%x), sender %x\n",GetOpName(opcode),opcode,sender);
#endif
switch (opcode) {
case PP_FINISH:
......
......@@ -276,13 +276,16 @@ GLOBAL_TASK_ID who;
rtsBool match;
do {
#if 0
fprintf(stderr,"WaitForPEOp: op = %x, who = %x\n",op,who);
#endif
while((p = pvm_recv(ANY_TASK,ANY_OPCODE)) < 0)
pvm_perror("WaitForPEOp: Waiting for PEOp");
pvm_bufinfo( p, &nbytes, &opcode, &sender_id );
#if 0
fprintf(stderr,"WaitForPEOp: received: opcode = %x, sender_id = %x\n",opcode,sender_id);
#endif
match = (op == ANY_OPCODE || op == opcode) && (who == ANY_TASK || who == sender_id);
if(match)
......@@ -333,8 +336,11 @@ GLOBAL_TASK_ID *psender_id;
@PEStartUp@ does the low-level comms specific startup stuff for a
PE. It initialises the comms system, joins the appropriate groups,
synchronises with the other PEs. Finally it receives from Control the
array of Global Task Ids.
synchronises with the other PEs. Receives and records in a global
variable the task-id of SysMan. If this is the main thread (discovered
in main.lc), identifies itself to SysMan. Finally it receives
from SysMan an array of the Global Task Ids of each PE, which is
returned as the value of the function.
\begin{code}
GLOBAL_TASK_ID *
......@@ -349,13 +355,13 @@ unsigned nPEs;
mytid = _my_gtid; /* Initialise PVM and get task id into global var.*/
fprintf(stderr,"PEStartup, Task id = [%x], No. PEs = %d \n", mytid, nPEs);
/* fprintf(stderr,"PEStartup, Task id = [%x], No. PEs = %d \n", mytid, nPEs); */
checkComms(pvm_joingroup(PEGROUP), "PEStartup");
fprintf(stderr,"PEStartup, Joined PEGROUP\n");
/* fprintf(stderr,"PEStartup, Joined PEGROUP\n"); */
checkComms(pvm_joingroup(PECTLGROUP), "PEStartup");
fprintf(stderr,"PEStartup, Joined PECTLGROUP\n");
/* fprintf(stderr,"PEStartup, Joined PECTLGROUP\n"); */
checkComms(pvm_barrier(PECTLGROUP, nPEs+1), "PEStartup");
fprintf(stderr,"PEStartup, Passed PECTLGROUP barrier\n");
/* fprintf(stderr,"PEStartup, Passed PECTLGROUP barrier\n"); */
addr = WaitForPEOp(PP_SYSMAN_TID, ANY_GLOBAL_TASK);
SysManTask = Sender_Task(addr);
......@@ -365,11 +371,12 @@ unsigned nPEs;
}
addr = WaitForPEOp(PP_PETIDS, ANY_GLOBAL_TASK);
GetArgs(buffer, nPEs);
#if 0
for (i = 0; i < nPEs; ++i) {
PEs[i] = (GLOBAL_TASK_ID) buffer[i];
fprintf(stderr,"PEs[%d] = %x \n", i, PEs[i]);
}
#endif
free(buffer);
return PEs;
}
......
......@@ -7,14 +7,16 @@
%
%****************************************************************************
The Sysman task controls initiation, termination, global GC
synchronisation and statistics gathering of a parallel Haskell program
running under GUM. Based on K. Hammond's SysMan.lc in Graph for
PVM. SysMan is unusual in that it is not part of the executable
produced by ghc: it is a free-standing program that spawns PVM tasks
(logical PEs) to evaluate the program.
The Sysman task currently controls initiation, termination, of a
parallel Haskell program running under GUM. In the future it may
control global GC synchronisation and statistics gathering. Based on
K. Hammond's SysMan.lc in Graph for PVM. SysMan is unusual in that it
is not part of the executable produced by ghc: it is a free-standing
program that spawns PVM tasks (logical PEs) to evaluate the
program. After initialisation it runs in parallel with the PE tasks,
awaiting messages.
OK children, buckle down for some serious weirdness, it works like this.
OK children, buckle down for some serious weirdness, it works like this ...
\begin{itemize}
\item The argument vector (argv) for SysMan has one the following 2 shapes:
......@@ -68,7 +70,7 @@ The pvm-executable run by each PE-task, is initialised as follows.
\item Receives and records the task-id of SysMan, for future use.
\item If the PE is the main thread it sends its task-id to SysMan.
\item Receives and records the array of task-ids of the other PEs.
\item Begins execution
\item Begins execution.
\end{itemize}
\end{itemize}
......@@ -90,7 +92,7 @@ rtsBool IAmMainThread;
\begin{code}
static GLOBAL_TASK_ID gtids[MAX_PES], StatsTask = 0;
static GLOBAL_TASK_ID gtids[MAX_PES];
static long PEbuffer[MAX_PES];
int nPEs = 0;
static GLOBAL_TASK_ID sysman_id, sender_id, mainThread_id;
......@@ -168,7 +170,7 @@ main(int argc, char **argv)
nPEs--;
/* Initialise the PE task arguments from Sysman's arguments */
pargv = argv + 2;
#if 1
#if 0
fprintf(stderr, "Spawning %d PEs(%s) ...\n", nPEs, petask);
fprintf(stderr, " args: ");
for (i = 0; pargv[i]; ++i)
......@@ -182,7 +184,7 @@ main(int argc, char **argv)
*/
for (i = 0; i < nPEs; i++)
PEbuffer[i+1] = (long) gtids[i];
#if 1
#if 0
fprintf(stderr, "Spawned /* PWT */\n");
#endif
}
......@@ -195,7 +197,7 @@ main(int argc, char **argv)
nPEs++; /* Record that the number of PEs is increasing */
if (cc = fork()) {
checkerr(cc); /* Parent continues as SysMan */
#if 1
#if 0
fprintf(stderr, "SysMan Task is [t%x]\n", sysman_id);
#endif
/*
......@@ -208,12 +210,12 @@ main(int argc, char **argv)
garbage collector manager.
*/
checkerr(pvm_joingroup(PECTLGROUP));
#if 1
#if 0
fprintf(stderr, "Joined PECTLGROUP /* PWT */\n");
#endif
/* Wait for all the PEs to arrive */
checkerr(pvm_barrier(PECTLGROUP, nPEs + 1));
#if 1
#if 0
fprintf(stderr, "PECTLGROUP barrier passed /* HWL */\n");
#endif
/* Broadcast SysMan's ID, so Main Thread PE knows it */
......@@ -224,14 +226,14 @@ main(int argc, char **argv)
addr = WaitForPEOp(PP_MAIN_TASK, ANY_GLOBAL_TASK);
pvm_bufinfo(addr, &nbytes, &opcode, &mainThread_id );
PEbuffer[0] = mainThread_id;
#if 1
#if 0
fprintf(stderr,"SysMan received Main Task = %x\n",mainThread_id);
#endif
/* Now that we have them all, broadcast Global Task Ids of all PEs */
pvm_initsend(PvmDataDefault);
PutArgs(PEbuffer, nPEs);
pvm_bcast(PEGROUP, PP_PETIDS);
#if 1
#if 0
fprintf(stderr, "Sysman successfully initialized!\n");
#endif
/* Process incoming messages */
......@@ -260,12 +262,10 @@ main(int argc, char **argv)
break;
case PP_FINISH:
fprintf(stderr, "Finish from %x\n", sender_id);
if (!Finishing) {
long buf = (long) StatsTask;
fprintf(stderr, "\nFinish from %x\n", sender_id);
Finishing = rtsTrue;
pvm_initsend(PvmDataDefault);
pvm_pklong(&buf, 1, 1);
pvm_bcast(PEGROUP, PP_FINISH);
} else {
++PEsTerminated;
......
......@@ -122,10 +122,10 @@ Manager's requirements.
\begin{code}
#ifdef PAR
if (*argv[0] == '-') { /* Look to see whether we're the Main Thread */
if (*argv[0] == '-') { /* Look to see whether we're the Main Thread */
IAmMainThread = rtsTrue;
argv++; argc--;
fprintf(stderr, "I am Main Thread\n");
argv++; argc--; /* Strip off flag argument */
/* fprintf(stderr, "I am Main Thread\n"); */
}
/*
* Grab the number of PEs out of the argument vector, and
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment