Skip to content

Commit

Permalink
Improve documentation and fixed message errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmolina committed May 29, 2021
1 parent bb7b803 commit 9aafe6b
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 3 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a
Changelog](http://keepachangelog.com/).

## 0.1.8 - (2021-05-29)

### New

* Improve documentation with PackageCompiler.

### Fixes
* Fix annoying error message for closing process during output.

## 0.1.7 - (2021-03-23)
---

### New
### News
* Add option threaded to allow activate or desactivate to use threads with async.
* The function exit() can be used inside the client.

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DaemonMode"
uuid = "d749ddd5-2b29-4920-8305-6ff5a704e36e"
authors = ["Daniel Molina"]
version = "0.1.7"
version = "0.1.8"

[deps]
Crayons = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f"
Expand Down
3 changes: 2 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ makedocs(;
"Quick Start" => "index.md",
"User Guide" => "guide.md",
"Posibilities" => "posibilities.md",
"Public API" => "reference.md"
"with PackageCompiler" => "compiler.md",
"Public API" => "reference.md",
],
)

Expand Down
77 changes: 77 additions & 0 deletions docs/src/compiler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# DaemonMode and PackageCompiler

DaemonMode and
[PackageCompiler.jl](https://github.com/JuliaLang/PackageCompiler.jl) can be
seen as complementary:

- **PackageCompiler** allows users to compile the packages in an image system, so
they will not take time to load them by setting the image (with -J parameter).

- **DaemonMode** allows users to load the packages only once, so in next
scripts/runs they are already loaded, reducing time in new runs (not the first
one).

Each one of them has their own advantages and drawbacks:

- **PackageCompiler** is able to reduce the loading time of the compiled
packages, but it takes some time (minutes) to compile them, and it should be
done when packages are updated to use the newest versions. Also, reduce
greatly the loading time, but for many packages the first execution of
functions is not reduced, mainly the loading time.

- **DaemonMode** only can reduce the loading time of one package after that
package was previously used since the Daemon run. It can applies the newest
version without delay. It cannot reduce first time, but it can reduce time
compiling all functions previously run since last Daemon run (in any program
and/or script).

The good news is that both approach can be together applied:

# DaemonMode with PackageCompiler

It is simple, you can create a simple compile script like:

```julia
# compile.jl
using PackageCompiler
using Pkg

# List of packages to compile (you can custom it)
pkgs = [:StatsBase, :CSV, :DataFrames, :LinearAlgebra, :TimerOutputs, :LoopVectorization, :FLoops, :Tullio, :DataPipes, :Chain]
# Add them
Pkg.add(string.(pkgs))
# Update to last version
Pkg.update()
# Compile to a system file
PackageCompiler.create_sysimage(pkgs; sysimage_path="./ds.jsys")
```

Then, after compiling: ```julia compile.jl``` you will have the packages compiled in an external file `ds.jsys`. You
can decide how frequently you want to update it (I personally use it once every two weeks).

Then, my daemon script for everyday (in bash, for Linux) is `javaDSserver` (in the same directory as `compile.jl`):

```sh
#!/usr/bin/env bash
# Remove previous daemon
pkill -9 julia
# Run daemon with compiled version, using async and disabling checkbounds
julia -J/mnt/home/daniel/bin/ds.jsys --check-bounds=no -e 'using DaemonMode; serve(async=true)' &
```

Running the daemon is simple:

```sh
$ juliaDSserver

```

And running a script is:

```sh
$ jclient script.jl
```

In that way, DaemonMode can run faster the script even first time (loading the
compiled packages). Also, all packages (compiled or non-compiled) and functions
will be run faster after first run.

0 comments on commit 9aafe6b

Please sign in to comment.