303 |
mapping is initialized by reading two configuration files: an |
mapping is initialized by reading two configuration files: an |
304 |
installation-specific one and a user-specific one. After that, the |
installation-specific one and a user-specific one. After that, the |
305 |
mapping can be maintained using CM's interface functions {\tt |
mapping can be maintained using CM's interface functions {\tt |
306 |
CM.setAnchor}, {\tt CM.cancelAnchor}, and {\tt CM.resetPathConfig} |
CM.Anchor.set}, {\tt CM.Anchor.cancel}, and {\tt CM.Anchor.reset} |
307 |
(see Section~\ref{sec:api}). |
(see Section~\ref{sec:api}). |
308 |
|
|
309 |
The default location of the installation-specific configuration file |
The default location of the installation-specific configuration file |
349 |
|
|
350 |
Functions that control CM's operation are accessible as members of a |
Functions that control CM's operation are accessible as members of a |
351 |
structure named {\tt CM}. This structure itself is exported from a |
structure named {\tt CM}. This structure itself is exported from a |
352 |
library called {\tt host-cm.cm}. Other libraries can exploit CM's |
library called {\tt full-cm.cm}. Other libraries can exploit CM's |
353 |
functionality simply by putting a {\tt host-cm.cm} entry into their |
functionality simply by putting a {\tt full-cm.cm} entry into their |
354 |
own description file. Section~\ref{sec:dynlink} shows one |
own description file. Section~\ref{sec:dynlink} shows one |
355 |
interesting used of this feature. |
interesting used of this feature. |
356 |
|
|
357 |
The {\tt host-cm.cm} library is pre-registered at the interactive |
Initially, only a ``minimal'' version of structure {\tt CM} (exported |
358 |
prompt. This is more than a mere convenience: structure {\tt CM} must |
by library {\tt minimal-cm.cm}) is pre-registered at the interactive |
359 |
already be known a-priori at top level because otherwise there would |
prompt. To make the full version of structure {\tt CM} available, one |
360 |
also be no way to make it known. |
must explicitly load {\tt full-cm.cm} using {\tt CM.autoload} or {\tt |
361 |
|
CM.make}, both of which are also available in the minimal version. |
362 |
|
(The minimal structure {\tt CM} contains four members: {\tt |
363 |
|
CM.recomp}, {\tt CM.stabilize}, {\tt CM.make}, and {\tt CM.autoload}.) |
364 |
|
|
365 |
Here is a description of the structure's members: |
Here is a description of all members: |
366 |
|
|
367 |
\subsubsection*{Compiling} |
\subsubsection*{Compiling} |
368 |
|
|
432 |
failure of the {\em registration}. (It does not know yet whether |
failure of the {\em registration}. (It does not know yet whether |
433 |
loading will actually succeed.) |
loading will actually succeed.) |
434 |
|
|
435 |
\subsubsection*{Flags} |
\subsubsection*{Registers} |
436 |
|
|
437 |
Several flags control the operation of CM. Any invocation of the |
Several internal registers control the operation of CM. A register of |
438 |
corresponding {\tt get} function reads the current value of the flag. An |
type $T$ is accessible via a variable of type $T$ {\tt controller}, |
439 |
invocation of the {\tt set} function replaces the current value with |
i.e., a pair of {\tt get} and {\tt set} functions. Any invocation of |
440 |
the argument given to {\tt set}. |
the corresponding {\tt get} function reads the current value of the |
441 |
|
register. An invocation of the {\tt set} function replaces the |
442 |
\begin{verbatim} |
current value with the argument given to {\tt set}. |
443 |
val verbose : { get: unit -> bool, set: bool -> unit } |
|
444 |
val debug : { get: unit -> bool, set: bool -> unit } |
Controllers are members of {\tt CM.Control}, a sub-structure of |
445 |
val keep_going : { get: unit -> bool, set: bool -> unit } |
structure {\tt CM}. |
446 |
val parse_caching : { get: unit -> int, set: int -> unit } |
|
447 |
val warn_obsolete : { get: unit -> bool, set: bool -> unit } |
\begin{verbatim} |
448 |
\end{verbatim} |
type 'a controller = { get: unit -> 'a, set: 'a -> unit } |
449 |
|
structure Control : sig |
450 |
{\tt CM.verbose} can be used to turn off CM's progress messages. The |
val verbose : bool controller |
451 |
default is {\em true} and can be overriden at startup time by the |
val debug : bool controller |
452 |
environment variable {\tt CM\_VERBOSE}. |
val keep_going : bool controller |
453 |
|
val parse_caching : int controller |
454 |
In the case of a compile-time error {\tt CM.keep\_going} instructs the |
val warn_obsolete : bool controller |
455 |
{\tt CM.recomp} phase to continue working on parts of the dependency |
end |
456 |
graph that are not related to the error. (This does not work for |
\end{verbatim} |
457 |
outright syntax errors because a correct parse is needed before CM can |
|
458 |
construct the dependency graph.) The default is {\em false} and can |
{\tt CM.Control.verbose} can be used to turn off CM's progress |
459 |
be overriden at startup by the environment variable {\tt |
messages. The default is {\em true} and can be overriden at startup |
460 |
CM\_KEEP\_GOING}. |
time by the environment variable {\tt CM\_VERBOSE}. |
461 |
|
|
462 |
{\tt CM.parse\_caching} sets a limit on how many parse trees are |
In the case of a compile-time error {\tt CM.Contol.keep\_going} |
463 |
cached in main memory. In certain cases CM must parse source files in |
instructs the {\tt CM.recomp} phase to continue working on parts of |
464 |
order to be able to calculate the dependency graph. Later, the same |
the dependency graph that are not related to the error. (This does |
465 |
files may need to be compiled, in which case an existing parse tree |
not work for outright syntax errors because a correct parse is needed |
466 |
saves the time to parse the file again. Keeping parse trees can be |
before CM can construct the dependency graph.) The default is {\em |
467 |
expensive in terms of memory usage. Moreover, CM makes special |
false} and can be overriden at startup by the environment variable |
468 |
efforts to avoid re-parsing files in the first place unless they have |
{\tt CM\_KEEP\_GOING}. |
469 |
actually been modified. Therefore, it may not make much sense to set |
|
470 |
this value very high. The default is {\em 100} and can be overriden |
{\tt CM.Control.parse\_caching} sets a limit on how many parse trees |
471 |
at startup time by the environment variable {\tt CM\_PARSE\_CACHING}. |
are cached in main memory. In certain cases CM must parse source |
472 |
|
files in order to be able to calculate the dependency graph. Later, |
473 |
|
the same files may need to be compiled, in which case an existing |
474 |
|
parse tree saves the time to parse the file again. Keeping parse |
475 |
|
trees can be expensive in terms of memory usage. Moreover, CM makes |
476 |
|
special efforts to avoid re-parsing files in the first place unless |
477 |
|
they have actually been modified. Therefore, it may not make much |
478 |
|
sense to set this value very high. The default is {\em 100} and can |
479 |
|
be overriden at startup time by the environment variable {\tt |
480 |
|
CM\_PARSE\_CACHING}. |
481 |
|
|
482 |
This version of CM uses an ML-inspired syntax for expressions in its |
This version of CM uses an ML-inspired syntax for expressions in its |
483 |
conditional compilation subsystem (see Section~\ref{sec:preproc}). |
conditional compilation subsystem (see Section~\ref{sec:preproc}). |
484 |
However, for the time being it will accept most of the original |
However, for the time being it will accept most of the original |
485 |
C-inspired expressions but produces a warning for each occurrence of |
C-inspired expressions but produces a warning for each occurrence of |
486 |
an old-style operator. {\tt CM.warn\_obsolete} can be used to turn |
an old-style operator. {\tt CM.Control.warn\_obsolete} can be used to |
487 |
these warnings off. The default is {\em true} and can be overriden at |
turn these warnings off. The default is {\em true} and can be |
488 |
startup time by the environment variable {\tt CM\_WARN\_OBSOLETE}. |
overriden at startup time by the environment variable {\tt |
489 |
|
CM\_WARN\_OBSOLETE}. |
490 |
{\tt CM.debug} can be used to turn on debug mode. This currently has |
|
491 |
the effect of dumping a trace of the master-slave protocol for |
{\tt CM.Control.debug} can be used to turn on debug mode. This |
492 |
parallel and distributed compilation (see Section~\ref{sec:parmake}) |
currently has the effect of dumping a trace of the master-slave |
493 |
to TextIO.stdOut. The default is {\em false} and can be overriden at |
protocol for parallel and distributed compilation (see |
494 |
startup time by the environment variable {\tt CM\_DEBUG}. |
Section~\ref{sec:parmake}) to TextIO.stdOut. The default is {\em |
495 |
|
false} and can be overriden at startup time by the environment |
496 |
|
variable {\tt CM\_DEBUG}. |
497 |
|
|
498 |
\subsubsection*{Path anchors} |
\subsubsection*{Path anchors} |
499 |
|
|
500 |
Structure {\tt CM} also provides functions to explicitly manipulate |
Structure {\tt CM} also provides functions to explicitly manipulate |
501 |
the path anchor configuration. |
the path anchor configuration. These functions are members of |
502 |
|
structure {\tt CM.Anchor}. |
503 |
|
|
504 |
\begin{verbatim} |
\begin{verbatim} |
505 |
val setAnchor : string * string -> unit |
structure Anchor : sig |
506 |
val cancelAnchor : string -> unit |
val set : { anchor: string, path: string } -> unit |
507 |
val resetPathConfig : unit -> unit |
val cancel : string -> unit |
508 |
|
val reset : unit -> unit |
509 |
|
end |
510 |
\end{verbatim} |
\end{verbatim} |
511 |
|
|
512 |
{\tt CM.setAnchor} creates a new association or replaces an existing |
{\tt CM.Anchor.set} creates a new association or replaces an existing |
513 |
association of an anchor name with a directory name. Both names must |
association of an anchor name with a directory name. Both names must |
514 |
be given as strings---the directory name in native syntax. If the |
be given as strings---the directory name in native syntax. If the |
515 |
directory name is a relative path name, then it will be expanded by |
directory name is a relative path name, then it will be expanded by |
516 |
prepending the name of the current working directory. |
prepending the name of the current working directory. |
517 |
|
|
518 |
{\tt CM.cancelAnchor} deletes the association of the given anchor name |
{\tt CM.Anchor.cancel} deletes the association of the given anchor name |
519 |
with its directory should such an association currently exist. |
with its directory should such an association currently exist. |
520 |
Otherwise it will do nothing. |
Otherwise it will do nothing. |
521 |
|
|
522 |
{\tt CM.resetPathConfig} erases the entire existing path configuration |
{\tt CM.Anchor.reset} erases the entire existing path configuration |
523 |
mapping. |
mapping. |
524 |
|
|
525 |
\subsubsection*{Setting CM variables} |
\subsubsection*{Setting CM variables} |
530 |
exist. |
exist. |
531 |
|
|
532 |
\begin{verbatim} |
\begin{verbatim} |
533 |
val symval : string -> |
val symval : string -> int option controller |
|
{ get: unit -> int option, set: int option -> unit } |
|
534 |
\end{verbatim} |
\end{verbatim} |
535 |
|
|
536 |
Function {\tt CM.symval} returns a {\tt get}-{\tt set}-pair for the |
Function {\tt CM.symval} returns a {\tt get}-{\tt set}-pair for the |
547 |
|
|
548 |
Some care is necessary as {\tt CM.symval} does not check whether the |
Some care is necessary as {\tt CM.symval} does not check whether the |
549 |
syntax of the argument string is valid. (However, the worst thing |
syntax of the argument string is valid. (However, the worst thing |
550 |
that could happen is that there is no way of naming the variable |
that could happen is that a variable defined via {\tt CM.symval} is |
551 |
within CM's description files, and that, therefore, the associated |
not accessible from within CM's description files because there is no |
552 |
value cannot be accessed.) |
legal syntax to name it.) |
553 |
|
|
554 |
\subsubsection*{Status inspection} |
\subsubsection*{Library registry} |
555 |
|
|
556 |
CM keeps a lot of internal state. Some of this state can be inspected. |
To be able to share associated data structures, CM maintains an |
557 |
|
internal registry of all stable libraries that it has encountered |
558 |
\begin{verbatim} |
during an ongoing interactive session. The {\tt CM.Library} |
559 |
val showPending : unit -> unit |
sub-structure of structure {\tt CM} provides access to this registry. |
560 |
val listLibs : unit -> unit |
|
561 |
|
\begin{verbatim} |
562 |
|
structure Library : sig |
563 |
|
type lib |
564 |
|
val known : unit -> lib list |
565 |
|
val descr : lib -> string |
566 |
|
val osstring : lib -> string |
567 |
|
val dismiss : lib -> unit |
568 |
|
end |
569 |
\end{verbatim} |
\end{verbatim} |
570 |
|
|
571 |
{\tt CM.showPending} lists to standard output the names of all symbols |
{\tt CM.Library.known}, when called, produces a list of currently |
572 |
which are currently registered as being bound at top level via the |
known stable libraries. Each such library is represented by an |
573 |
autoloading mechanism but so far have not actually been resolved. |
element of the abstract data type {\tt CM.Library.lib}. |
574 |
|
|
575 |
|
{\tt CM.Library.descr} extracts a string describing the location of |
576 |
|
the CM description file associated with the given library. The syntax |
577 |
|
of this string is the same that is also being used by CM's |
578 |
|
master-slave protocol (see section~\ref{sec:pathencode}). |
579 |
|
|
580 |
|
{\tt CM.Library.osstring} produces a string denoting the given |
581 |
|
library's description file using the underlying operating system's |
582 |
|
native pathname syntax. In other words, the result of a call to {\tt |
583 |
|
CM.Library.osstring} is suitable as an argument to {\tt |
584 |
|
TextIO.openIn}. |
585 |
|
|
586 |
|
{\tt CM.Library.dismiss} is used to remove a stable library from CM's |
587 |
|
internal registry. Although removing a library from the registry may |
588 |
|
recover considerable amounts of main memory, doing so also eliminates |
589 |
|
any chance of sharing the associated data structures with later |
590 |
|
references to the same library. Therefore, it is not always in the |
591 |
|
interest of memory-conscious users to use this feature. |
592 |
|
|
593 |
{\tt CM.listLibs} lists to standard output the path names of library |
Sharing of link-time state created by the library is {\em not} |
594 |
description files for those stable libraries that are currently known |
affected by this. |
|
to CM. This list includes libraries which have been accessed |
|
|
``implicitly'' by virtue of being a sub-library of another library |
|
|
that has been accessed in the past. Library state can take up |
|
|
considerable space in main memory. Use {\tt CM.dismissLib} (see |
|
|
below) to remove a library from CM's registry. |
|
595 |
|
|
596 |
\subsubsection*{Altering CM's internal state} |
\subsubsection*{Internal state} |
597 |
|
|
598 |
Sometimes it can become necessary to explicitly change or update CM's |
For CM to work correctly, it must maintain an up-to-date picture of |
599 |
internal state. |
the state of the surrounding world (as far as that state affects CM's |
600 |
|
operation). Most of the time, this happens automatically should be |
601 |
|
transparent to the user. However, occasionally it may become |
602 |
|
necessary to intervene expliticly. |
603 |
|
|
604 |
|
Access to CM's internal state is facilitated by members of the {\tt |
605 |
|
CM.State} structure. |
606 |
|
|
607 |
\begin{verbatim} |
\begin{verbatim} |
608 |
val dismissLib : string -> unit |
structure State : sig |
609 |
|
val pending : unit -> string list |
610 |
val synchronize : unit -> unit |
val synchronize : unit -> unit |
611 |
val reset : unit -> unit |
val reset : unit -> unit |
612 |
|
end |
613 |
\end{verbatim} |
\end{verbatim} |
614 |
|
|
615 |
{\tt CM.dismissLib} is used to remove a stable library from CM's |
{\tt CM.State.pending} produces a list of strings, each string naming |
616 |
internal registry. See the discussion of {\tt CM.listLibs} above. |
one of the symbols that are currently bound but not yet resolved by |
617 |
Although removing a library from the registry may recover considerable |
the autoloading mechanism. |
618 |
amounts of main memory, doing so also eliminates any chance of sharing |
|
619 |
the associated data structures with later references to the same |
{\tt CM.State.synchronize} updates tables internal to CM to reflect |
620 |
library. Therefore, it is not always in the interest of |
changes in the file system. In particular, this will be necessary |
621 |
memory-conscious users to use this feature. |
when the association of file names to ``file IDs'' (in Unix: inode |
622 |
|
numbers) changes during an ongoing session. In practice, the need for |
623 |
Sharing of link-time state created by the library is {\em not} |
this tends to be rare. |
624 |
affected by this. |
|
625 |
|
{\tt CM.State.reset} completely erases all internal state in CM. To |
626 |
{\tt CM.synchronize} updates tables internal to CM to reflect changes |
do this is not very advisable since it will also break the association |
627 |
in the file system. In particular, this will be necessary when the |
with pre-loaded libraries. It may be a useful tool for determining |
628 |
association of file names to ``file IDs'' (in Unix: inode numbers) |
the amount of space taken up by the internal state, though. |
|
changes during an ongoing session. In practice, the need for this |
|
|
tends to be rare. |
|
|
|
|
|
{\tt CM.reset} completely erases all internal state in CM. This is |
|
|
not very advisable since it will also break the association with |
|
|
pre-loaded libraries. It may be a useful tool for determining the |
|
|
amount of space taken up by the internal state, though. |
|
629 |
|
|
630 |
\subsubsection*{Compile servers} |
\subsubsection*{Compile servers} |
631 |
|
|
634 |
using a network file system and the operating system's ``rsh'' |
using a network file system and the operating system's ``rsh'' |
635 |
facility. For a detailed discussion, see Section~\ref{sec:parmake}. |
facility. For a detailed discussion, see Section~\ref{sec:parmake}. |
636 |
|
|
637 |
|
Sub-structure {\tt CM.Server} provides access to and manipulation of |
638 |
|
compile servers. Each attached server is represented by a value of |
639 |
|
type {\tt CM.Server.server}. |
640 |
|
|
641 |
\begin{verbatim} |
\begin{verbatim} |
642 |
val server_start : |
structure Server : sig |
643 |
{ name: string, |
type server |
644 |
|
val start : { name: string, |
645 |
cmd: string * string list, |
cmd: string * string list, |
646 |
pathtrans: (string -> string) option, |
pathtrans: (string -> string) option, |
647 |
pref: int } -> bool |
pref: int } -> server option |
648 |
val server_stop : string -> unit |
val stop : server -> unit |
649 |
val server_kill : string -> unit |
val kill : server -> unit |
650 |
|
val name : server -> string |
651 |
|
end |
652 |
\end{verbatim} |
\end{verbatim} |
653 |
|
|
654 |
CM is put into ``parallel'' mode by attaching at least one compile |
CM is put into ``parallel'' mode by attaching at least one compile |
655 |
server. Compile servers are attached using invocations of {\tt |
server. Compile servers are attached using invocations of {\tt |
656 |
CM.server\_start}. The function takes the name of the server (as an |
CM.Server.start}. The function takes the name of the server (as an |
657 |
arbitrary but unique string) ({\tt name}), the Unix command used to |
arbitrary but unique string) ({\tt name}), the Unix command used to |
658 |
start the server in a form suitable as an argument to {\tt |
start the server in a form suitable as an argument to {\tt |
659 |
Unix.execute} ({\tt cmd}), an optional ``path transformation |
Unix.execute} ({\tt cmd}), an optional ``path transformation |
660 |
function'' for converting local path names to remote pathnames ({\tt |
function'' for converting local path names to remote pathnames ({\tt |
661 |
pathtrans}), and a numeric ``preference'' value that is used to choose |
pathtrans}), and a numeric ``preference'' value that is used to choose |
662 |
servers at times when more than one is idle ({\tt pref}). The boolean |
servers at times when more than one is idle ({\tt pref}). The |
663 |
result indicates success or failure of the attach operation. |
optional result is the handle representing the successfully attached |
664 |
|
server. |
665 |
|
|
666 |
An existing server can be shut down and detached using {\tt |
An existing server can be shut down and detached using {\tt |
667 |
CM.server\_stop} or {\tt CM.server\_kill}. The string argument in |
CM.Server.stop} or {\tt CM.Server.kill}. The argument in either case |
668 |
either case must match the {\tt name} argument of the corresponding |
must be the result of an earlier call to {\tt CM.Server.start}. |
669 |
{\tt server\_start} call. Function {\tt server\_stop} uses CM's |
Function {\tt CM.Server.stop} uses CM's master-slave protocol to |
670 |
master-slave protocol to instruct the server to shut down gracefully. |
instruct the server to shut down gracefully. Only if this fails it |
671 |
Only if this fails it may become necessary to use {\tt server\_kill} |
may become necessary to use {\tt CM.Server.kill} which will send a |
672 |
which will send a Unix KILL signal to destroy the server. |
Unix TERM signal to destroy the server. |
673 |
|
|
674 |
|
Given a server handle, function {\tt CM.Server.name} returns the |
675 |
|
string that was originally given to the call of {\tt CM.Server.start} |
676 |
|
used to created the server. |
677 |
|
|
678 |
\subsection{The autoloader} |
\subsection{The autoloader} |
679 |
\label{sec:autoload} |
\label{sec:autoload} |
1175 |
``rsh'' facility. |
``rsh'' facility. |
1176 |
|
|
1177 |
To perform parallel compilations, one must attach ``compile servers'' to |
To perform parallel compilations, one must attach ``compile servers'' to |
1178 |
CM. This is done using function {\tt CM.server\_start} with the following |
CM. This is done using function {\tt CM.Server.start} with the following |
1179 |
signature: |
signature: |
1180 |
|
|
1181 |
\begin{verbatim} |
\begin{verbatim} |
1182 |
val server_start : |
structure Server : sig |
1183 |
{ name: string, |
type server |
1184 |
|
val start : { name: string, |
1185 |
cmd: string * string list, |
cmd: string * string list, |
1186 |
pathtrans: (string -> string) option, |
pathtrans: (string -> string) option, |
1187 |
pref: int } -> bool |
pref: int } -> server option |
1188 |
|
end |
1189 |
\end{verbatim} |
\end{verbatim} |
1190 |
|
|
|
|
|
1191 |
Here, {\tt name} is a string uniquely identifying the server and {\tt |
Here, {\tt name} is a string uniquely identifying the server and {\tt |
1192 |
cmd} is a value suitable as argument to {\tt Unix.execute}. |
cmd} is a value suitable as argument to {\tt Unix.execute}. |
1193 |
|
|
1198 |
server process on the local machine could be started by |
server process on the local machine could be started by |
1199 |
|
|
1200 |
\begin{verbatim} |
\begin{verbatim} |
1201 |
CM.server_start { name = "A", pathtrans = NONE, pref = 0, |
CM.Server.start { name = "A", pathtrans = NONE, pref = 0, |
1202 |
cmd = ("/path/to/smlnj/bin/sml", |
cmd = ("/path/to/smlnj/bin/sml", |
1203 |
["@CMslave"]) }; |
["@CMslave"]) }; |
1204 |
\end{verbatim} |
\end{verbatim} |
1205 |
|
|
1206 |
To run a process on a remote machine, e.g., ``thatmachine'', as |
To run a process on a remote machine, e.g., ``thatmachine'', as |
1207 |
compute server, one can use ``rsh''. Unfortunately, at the moment it |
compute server, one can use ``rsh''.\footnote{On certain systems it |
1208 |
|
may be necessary to wrap {\tt rsh} into a script that protects rsh |
1209 |
|
from interrupt signals.} Unfortunately, at the moment it |
1210 |
is necessary to specify the full path to ``rsh'' because {\tt |
is necessary to specify the full path to ``rsh'' because {\tt |
1211 |
Unix.execute} (and therefore {\tt CM.server\_start}) does not perform |
Unix.execute} (and therefore {\tt CM.Server.start}) does not perform |
1212 |
a {\tt PATH} search. The remote machine |
a {\tt PATH} search. The remote machine |
1213 |
must share the file system with the local machine, for example via NFS. |
must share the file system with the local machine, for example via NFS. |
1214 |
|
|
1215 |
\begin{verbatim} |
\begin{verbatim} |
1216 |
CM.server_start { name = "thatmachine", |
CM.Server.start { name = "thatmachine", |
1217 |
pathtrans = NONE, pref = 0, |
pathtrans = NONE, pref = 0, |
1218 |
cmd = ("/usr/ucb/rsh", |
cmd = ("/usr/ucb/rsh", |
1219 |
["thatmachine", |
["thatmachine", |
1226 |
attach at least two (unless you want to attach one that runs on a |
attach at least two (unless you want to attach one that runs on a |
1227 |
machine vastly more powerful than your local one). Local servers make |
machine vastly more powerful than your local one). Local servers make |
1228 |
sense on multi-CPU machines: start as many servers as there are CPUs. |
sense on multi-CPU machines: start as many servers as there are CPUs. |
1229 |
|
Parallel make is most effective on multiprocessor machines because |
1230 |
|
network latencies can have a severely limiting effect on what can be |
1231 |
|
gained in the distributed case. |
1232 |
(Be careful, though. Since there is no memory-sharing to speak of |
(Be careful, though. Since there is no memory-sharing to speak of |
1233 |
between separate instances of {\tt sml}, you should be sure to check |
between separate instances of {\tt sml}, you should be sure to check |
1234 |
that your machine has enough main memory.) |
that your machine has enough main memory.) |
1240 |
better throughput.) All attached servers must use the same |
better throughput.) All attached servers must use the same |
1241 |
architecture-OS combination as the controlling machine. |
architecture-OS combination as the controlling machine. |
1242 |
|
|
1243 |
|
In parallel mode, the master process itself normally does not compile |
1244 |
|
anything. Therefore, if you want to utilize the master's CPU for |
1245 |
|
compilation, you should start a compile server on the same machine |
1246 |
|
that the master runs on (even if it is a uniprocessor machine). |
1247 |
|
|
1248 |
The {\tt pathtrans} argument is used when connecting to a machine with |
The {\tt pathtrans} argument is used when connecting to a machine with |
1249 |
a different file-system layout. |
a different file-system layout. For local servers, it can safely be |
1250 |
For local servers, it can safely be left at {\tt NONE}. The ``path |
left at {\tt NONE}. The ``path transformation'' function is used to |
1251 |
transformation'' function is used to translate local path |
translate local path names to their remote counterparts. This can be |
1252 |
names to their remote counterparts. |
a bit tricky to get right, especially if the machines use automounters |
1253 |
This can be a bit tricky to get right, especially if the |
or similar devices. The {\tt pathtrans} functions consumes and |
1254 |
machines use automounters or similar devices. |
produces names in CM's internal ``protocol encoding'' (see |
1255 |
The {\tt pathtrans} functions consumes and produces names in CM's |
Section~\ref{sec:pathencode}). |
|
internal ``protocol encoding'' (see Section~\ref{sec:pathencode}). |
|
1256 |
|
|
1257 |
Once servers have been attached, one can invoke functions like |
Once servers have been attached, one can invoke functions like |
1258 |
{\tt CM.recomp}, {\tt CM.make}, and {\tt CM.stabilize}. They should |
{\tt CM.recomp}, {\tt CM.make}, and {\tt CM.stabilize}. They should |
1417 |
|
|
1418 |
For the new {\tt f.sml} to be compiled successfully it must be placed |
For the new {\tt f.sml} to be compiled successfully it must be placed |
1419 |
into a library {\tt f.cm} that mentions {\tt f-hook.cm} and {\tt |
into a library {\tt f.cm} that mentions {\tt f-hook.cm} and {\tt |
1420 |
host-cm.cm}. As we have seen, {\tt f-hook.cm} exports {\tt F\_Hook.f} |
full-cm.cm}. As we have seen, {\tt f-hook.cm} exports {\tt F\_Hook.f} |
1421 |
and {\tt host-cm.cm} is needed because it exports {\tt CM.make}: |
and {\tt full-cm.cm} is needed\footnote{The reduced version of |
1422 |
|
structure {\tt CM} as exported by library {\tt minimal-cm.cm} would |
1423 |
|
have been sufficient, too.} because it exports {\tt CM.make}: |
1424 |
\begin{verbatim} |
\begin{verbatim} |
1425 |
Library |
Library |
1426 |
structure F |
structure F |
1427 |
is |
is |
1428 |
f.sml |
f.sml |
1429 |
f-hook.cm |
f-hook.cm |
1430 |
host-cm.cm |
full-cm.cm |
1431 |
\end{verbatim} |
\end{verbatim} |
1432 |
|
|
1433 |
\noindent{\bf Beware!} This solution makes use of {\tt host-cm.cm} |
\noindent{\bf Beware!} This solution makes use of {\tt full-cm.cm} |
1434 |
which in turn requires the SML/NJ compiler to be present. Therefore, |
which in turn requires the SML/NJ compiler to be present. Therefore, |
1435 |
is worthwhile only for really large program modules where the benefits |
is worthwhile only for really large program modules where the benefits |
1436 |
of their absence are not outweighed be the need for the compiler. |
of their absence are not outweighed be the need for the compiler. |