Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
pchintalapudi committed Mar 6, 2023
1 parent 6b8ec27 commit 5108b40
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
3 changes: 3 additions & 0 deletions doc/src/devdocs/sysimg.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ as many platforms as possible, so as to give vastly improved startup times. On
not ship with a precompiled system image file, one can be generated from the source files shipped
in Julia's `DATAROOTDIR/julia/base` folder.

Julia will by default generate its system image on half of the available system threads. This
may be controlled by the [`JULIA_IMAGE_THREADS`](@ref env-image-threads) environment variable.

This operation is useful for multiple reasons. A user may:

* Build a precompiled shared library system image on a platform that did not ship with one, thereby
Expand Down
15 changes: 14 additions & 1 deletion doc/src/manual/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ To use Visual Studio Code on Windows, set `$JULIA_EDITOR` to `code.cmd`.

## Parallelization

### `JULIA_CPU_THREADS`
### [`JULIA_CPU_THREADS`](@id env-cpu-threads)

Overrides the global variable [`Base.Sys.CPU_THREADS`](@ref), the number of
logical CPU cores available.
Expand Down Expand Up @@ -316,6 +316,19 @@ then spinning threads never sleep. Otherwise, `$JULIA_THREAD_SLEEP_THRESHOLD` is
interpreted as an unsigned 64-bit integer (`uint64_t`) and gives, in
nanoseconds, the amount of time after which spinning threads should sleep.

### [`JULIA_IMAGE_THREADS`](@id env-image-threads)

An unsigned 32-bit integer that sets the number of threads used by image
compilation in this Julia process. The value of this variable may be
ignored if the module is a small module. If left unspecified, the smaller
of the value of [`JULIA_CPU_THREADS`](@ref env-cpu-threads) or half the
number of logical CPU cores is used in its place.

### `JULIA_IMAGE_TIMINGS`

A boolean value that determines if detailed timing information is printed during
during image compilation. Defaults to 0.

### `JULIA_EXCLUSIVE`

If set to anything besides `0`, then Julia's thread policy is consistent with
Expand Down
6 changes: 3 additions & 3 deletions src/aotcompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ static void get_fvars_gvars(Module &M, DenseMap<GlobalValue *, unsigned> &fvars,
// Weight computation
// It is important for multithreaded image building to be able to split work up
// among the threads equally. The weight calculated here is an estimation of
// how expensive a particular function is going to be to compile.
// how expensive a particular function is going to be to compile.

struct FunctionInfo {
size_t weight;
Expand Down Expand Up @@ -1193,7 +1193,7 @@ static void construct_vars(Module &M, Partition &partition) {
}

// Materialization will leave many unused declarations, which multiversioning would otherwise clone.
// This function removes them to avoid unnecessary cloning of declarations.
// This function removes them to avoid unnecessary cloning of declarations.
static void dropUnusedDeclarations(Module &M) {
SmallVector<GlobalValue *> unused;
for (auto &G : M.global_values()) {
Expand All @@ -1211,7 +1211,7 @@ static void dropUnusedDeclarations(Module &M) {
}

// Entrypoint to optionally-multithreaded image compilation. This handles global coordination of the threading,
// as well as partitioning, serialization, and deserialization.
// as well as partitioning, serialization, and deserialization.
static void add_output(Module &M, TargetMachine &TM, std::vector<std::string> &outputs, ArrayRef<StringRef> names,
std::vector<NewArchiveMember> &unopt, std::vector<NewArchiveMember> &opt,
std::vector<NewArchiveMember> &obj, std::vector<NewArchiveMember> &asm_,
Expand Down
6 changes: 2 additions & 4 deletions src/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,10 @@ typedef struct {

// Per-shard data for image shards. Each image contains header->nshards of these.
typedef struct {

// This is the base function pointer
// (all other function pointers are stored as offsets to this address)
const char *fvar_base;

// The array of function pointer offsets (`int32_t`) from the base pointer.
// This includes all julia functions in sysimg as well as all other functions that are cloned.
// The default function pointer is used if the function is cloned.
Expand All @@ -125,7 +124,7 @@ typedef struct {
// staticdata.c relies on the same order of functions in the global function array being
// the same as what it saw when serializing the global function array. However, partitioning
// into multiple shards will cause functions to be reordered. This array is used to map
// back to the original function array for loading.
// back to the original function array for loading.
const uint32_t *fvar_idxs;
// This is the base data pointer
// (all other data pointers in this shard are stored as offsets to this address)
Expand All @@ -136,7 +135,6 @@ typedef struct {
// This is the mapping of shard global variable index -> global global variable index
// Similar to fvar_idxs, but for gvars
const uint32_t *gvar_idxs;

// location and index of relocation slots.
// Stored as pairs of function indices and `int32_t` offsets from `jl_sysimg_gvars_base`.
// The first element is an `uint32_t` giving the number of relocations.
Expand Down

0 comments on commit 5108b40

Please sign in to comment.