• This repository has been archived on 04/Mar/2019
  • Stars
    star
    146
  • Rank 252,769 (Top 5 %)
  • Language
    Julia
  • Created about 9 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Static AOT Julia compilation, demos and instructions

NOTE: This repository is mainly for purposes of experimentation and no longer expected to be used going forward. juliac.jl has been merged into PackageCompiler.jl. Please install that package to use juliac.jl.


Static Julia Compiler

Building shared libraries and executables from Julia code.

Run juliac.jl -h for help:

usage: juliac.jl [-v] [-q] [-c] [-J <file>]
                 [--compile {yes|no|all|min}] [-C <target>]
                 [-O {0,1,2,3}] [-g {0,1,2}] [--inline {yes|no}]
                 [--check-bounds {yes|no}] [--math-mode {ieee,fast}]
                 [--depwarn {yes|no|error}] [-a] [-o] [-s] [-e] [-j]
                 [--version] [-h] juliaprog [cprog] [builddir]

Static Julia Compiler

positional arguments:
  juliaprog             Julia program to compile
  cprog                 C program to compile (required only when
                        building an executable; if not provided a
                        minimal standard program is used)
  builddir              build directory, either absolute or relative
                        to the Julia program directory (default:
                        "builddir")

optional arguments:
  -v, --verbose         increase verbosity
  -q, --quiet           suppress non-error messages
  -c, --clean           delete builddir
  -J, --sysimage <file>
                        start up with the given system image file
  --compile {yes|no|all|min}
                        enable or disable JIT compiler, or request
                        exhaustive compilation
  -C, --cpu-target <target>
                        limit usage of CPU features up to <target>
  -O, --optimize {0,1,2,3}
                        set optimization level (type: Int64)
  -g {0,1,2}            set debugging information level (type: Int64)
  --inline {yes|no}     control whether inlining is permitted
  --check-bounds {yes|no}
                        emit bounds checks always or never
  --math-mode {ieee,fast}
                        set floating point optimizations
  --depwarn {yes|no|error}
                        set syntax and method deprecation warnings
  -a, --autodeps        automatically build required dependencies
  -o, --object          build object file
  -s, --shared          build shared library
  -e, --executable      build executable file
  -j, --julialibs       sync Julia libraries to builddir
  --version             show version information and exit
  -h, --help            show this help message and exit

examples:
  juliac.jl -vae hello.jl        # verbose, build executable and deps
  juliac.jl -vae hello.jl prog.c # embed into user defined C program
  juliac.jl -qo hello.jl         # quiet, build object file only
  juliac.jl -vosej hello.jl      # build all and sync Julia libs

Notes

  1. The juliac.jl script uses the ArgParse package, make sure it is installed.

  2. On Windows install Cygwin and the mingw64-x86_64-gcc-core package, see:
    https://github.com/JuliaLang/julia/blob/master/README.windows.md

  3. A shared library containing the system image libhello.so, and a driver binary hello are created in the builddir directory. Running hello produces the following output:

   $ ./hello
   hello, world
   f() = -0.37549581296986956
       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
   100 โ”‚โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โข€โ Žโ”‚
       โ”‚โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โกฐโ โ €โ”‚
       โ”‚โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โฃ โ Šโ €โ €โ €โ”‚
       โ”‚โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โข€โ ”โ โ €โ €โ €โ €โ”‚
       โ”‚โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โข€โ ”โ โ €โ €โ €โ €โ €โ €โ”‚
       โ”‚โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โก โ Šโ €โ €โ €โ €โ €โ €โ €โ €โ”‚
       โ”‚โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โก โ Šโ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ”‚
       โ”‚โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โก โ Šโ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ”‚
       โ”‚โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โข€โ คโ Šโ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ”‚
       โ”‚โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โฃ€โ ”โ โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ”‚
       โ”‚โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โข€โ คโ Šโ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ”‚
       โ”‚โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โฃ€โ คโ ’โ โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ”‚
       โ”‚โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โข€โก โ ”โ Šโ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ”‚
       โ”‚โ €โ €โ €โ €โ €โ €โข€โฃ€โ คโ ”โ Šโ โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ”‚
     0 โ”‚โฃ€โ คโ คโ ”โ ’โ ‰โ โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ”‚
       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       1                                       10

Under the hood

The juliac.jl script uses the --output-o switch to compile the user script into object code, and then builds it into the system image specified by the -J switch. This prepares an object file, which is then linked into a shared library containing the system image and user code. A driver script such as the one in program.c can then be used to build a binary that runs the julia code.

Instead of a driver script, the generated system image can be embedded into a larger program following the embedding examples and relevant sections in the Julia manual. Note that the name of the generated system image ("libhello" for hello.jl) is accessible from C in the preprocessor macro JULIAC_PROGRAM_LIBNAME.

With Julia 0.7, a single large binary can be created, which does not require the driver program to load the shared library. An example of that is in program2.c, where the image file is the binary itself.

For more information on static Julia compilation see:
https://juliacomputing.com/blog/2016/02/09/static-julia.html

For more information on embedding Julia see:
https://github.com/JuliaLang/julia/blob/master/doc/src/manual/embedding.md

More Repositories

1

DataSets.jl

Julia
107
star
2

TableView.jl

A Tables.jl compatible table viewer based on ag-grid
Julia
101
star
3

pluto-vscode

Pluto inside a VS Code Webview, WIP
TypeScript
99
star
4

PlotlyLight.jl

Plotly.js via Julia made easy.
Julia
98
star
5

Miletus.jl

Writing financial contracts in Julia
Julia
83
star
6

XML.jl

Read and write XML in pure Julia
Julia
79
star
7

FemtoCleaner.jl

The code behind femtocleaner
Julia
64
star
8

Kuber.jl

Julia Kubernetes Client
Julia
61
star
9

MultiDocumenter.jl

Aggregating all the docs
Julia
58
star
10

Training

Jupyter Notebook
48
star
11

gRPCClient.jl

A Julia gRPC Client
Julia
47
star
12

Cobweb.jl

๐Ÿ•ธ๏ธ Cobble together web content in Julia
Julia
46
star
13

IRViz.jl

Tools for visualizing Julia IR
Julia
44
star
14

Unums.jl

Unum arithmetic in Julia
Julia
41
star
15

OpenAPI.jl

OpenAPI helper and code generator for Julia
Julia
41
star
16

ModelingToolkitWorkshop

Training materials for ModelingToolkit and JuliaSim
HTML
39
star
17

EasyConfig.jl

Easy-to-write JSON-like data structure for Julia
Julia
39
star
18

OReilly

Jupyter Notebook
39
star
19

Swagger.jl

Swagger (OpenAPI) helper and code generator for Julia
Julia
38
star
20

AMQPClient.jl

A Julia AMQP (Advanced Message Queuing Protocol) / RabbitMQ Client.
Julia
36
star
21

SQLStrings.jl

Safe interpolations for SQL query strings
Julia
32
star
22

HTTPDownloads.jl

Use Downloads.jl as a backend for HTTP.jl
Julia
29
star
23

SQLiteGraph.jl

A lightweight SQLite-based Graph Database for Julia.
Julia
28
star
24

Azure.jl

Julia interface to Azure APIs
Julia
28
star
25

JuliaInXL

JuliaInXL C# code to create JuliaInXL plugin for Microsoft Excel
C#
25
star
26

ODSC2019

Material for "Differentiable programming with Flux" at ODSC East & Europe, 2019
Jupyter Notebook
24
star
27

ScoringEngineDemo.jl

Demo of a scoring engine. From data wrangling to model serving on docker
HTML
22
star
28

Deprecations.jl

A database of julia deprecations and how to fix them
Julia
17
star
29

DepotDelivery.jl

Julia Project โ†’ Standalone Julia Depot
Julia
16
star
30

gdb-solib-wine

GDB enhanced to debug wine processes
C
16
star
31

MosaicPlutoPlugin.jl

A Pluto.jl plugin for embedding Mosaic inside a notebook for interactive schematic analysis
Julia
16
star
32

OmniPackage.jl

Big package depending on a lot of open source repos.
Julia
15
star
33

KML.jl

Write in Google Earth's KML format in pure Julia
Julia
15
star
34

Badges.jl

Badges in Julia
Julia
14
star
35

JuliaHub.jl

A Julia client for the JuliaHub platform
Julia
14
star
36

JuliaInXL.jl

Julia interface to JuliaInXL addin
Julia
13
star
37

Xyce.jl

A Julia wrapper for Xyce.
Julia
12
star
38

nvidia-driver-pcie-rebar

Patches to enable PCIe resizable BARs in the Linux NVIDIA kernel driver
Makefile
12
star
39

SemiringAlgebra.jl

Semiring Algebra
Julia
12
star
40

Humpty.jl

All the kings horses and all the king's men can put our Jacobians together again
Julia
9
star
41

Multibody.jl

Model and simulate multibody systems in Julia
Julia
9
star
42

TrueFX

JuliaDB demonstration using TrueFX data
Jupyter Notebook
8
star
43

JuliaSimIssues

Public issue tracker for JuliaSim by JuliaHub
8
star
44

GitLab.jl

Julia
8
star
45

ScaledNumbersInput.jl

Provides an `@SI` macro for converting numbers with SI prefixes
Julia
8
star
46

GenieAppTutorial.jl

Tutorial for hosting a Genie app on JuliaHub
JavaScript
8
star
47

ORNLTraining

Jupyter Notebook
8
star
48

semgrep-rules-julia

Julia rules for semgrep
Julia
8
star
49

JuliaHubVSCodeExtensionTutorial.jl

Tutorial on usage of JuliaHub VSCode extension
Julia
8
star
50

Training.jl

Collection of Training Materials for Julia
Julia
8
star
51

JuliaPharmaDemo

HTML
7
star
52

HPCDC

Notebooks for Intel's HPC DevCon '17
Jupyter Notebook
7
star
53

Daal.jl

Julia wrapper for Intel Data Analytics Acceleration Library (DAAL)
Julia
7
star
54

FixedSizeStrings.jl

a type for efficiently storing short strings of known size
Julia
7
star
55

CentralizedCaches.jl

Making it possible to clear all your caches at once
Julia
7
star
56

Gunrock.jl

Julia Wrapper for Gunrock library
Julia
6
star
57

JuliaHub-Feedback

Public repo for filing JuliaHub issues
6
star
58

QuanserInterface.jl

An Julia interface to the Quanser hardware devices
Julia
5
star
59

SJCE-workshop

Jupyter Notebook
5
star
60

QGIS.jl

QGIS Processing from Julia
Julia
5
star
61

StateSelection.jl

Common algorithmic core for state selection in MTK, DAECompiler, JuliaSimCompiler
Julia
5
star
62

IntroductionTraining

Julia
4
star
63

CxxrtlCosim

Cosimulation of ModelingToolkit and Cxxrtl
Julia
4
star
64

JuliaRunClient.jl

A client library to invoke JuliaRun HTTP APIs
Julia
4
star
65

NgSpice.jl

This package wraps NgSpice for Julia users
Julia
4
star
66

JSC-Training

Julia
4
star
67

VectorPrisms.jl

Making structs viewable as AbstractVectors
Julia
4
star
68

DynamicScope.jl

Dynamically scoped functions in Julia
Julia
3
star
69

PkgAuthentication.jl

Julia
3
star
70

HTMLSanitizer.jl

HTML sanitization in Julia
Julia
3
star
71

rootfs-images

Julia
2
star
72

SecretAnalysis.jl

Julia
2
star
73

Heise_October

Supplementary Materials for the Julia article in Heise October 2020 issue
HTML
2
star
74

DashTutorials

Tutorials for running Dash.jl apps on JuliaHub
Julia
2
star
75

PyData2017

PyData NYC 2017 Tutorial
Jupyter Notebook
2
star
76

JuliaSimTraining

Julia
2
star
77

InteractiveGeospatial.jl

Julia
2
star
78

IngestTest.jl

project to test ingesting
Julia
2
star
79

ScaledNumbersOutput.jl

Pretty printing of numbers that are rounded and in SI notation (eg 3.25n)
Julia
2
star
80

Webinar_PumasQSP_20230321

Julia
2
star
81

ModelingToolkitSampledData.jl

Julia
2
star
82

PublicNotebooks

Pluto notebooks for demonstrations and public consumption
Julia
1
star
83

OpenPolicyAgent.jl

Julia OpenPolicyAgent Client, Server and CLI.
Julia
1
star
84

JuliaHub101App

Simple Stipple application using the JuliaHub101.jl package
JavaScript
1
star
85

JuliaProIssues

1
star
86

JuliaHub101.jl

Welcome to JuliaHub 101 - explore features and capabilities of the platform with this package.
Julia
1
star
87

JuliaTeam-GCP-k8s

This repo contains the CLI instructions that could be used to deploy JuliaTeam on GCP
Shell
1
star
88

Finance_demos

Jupyter Notebook
1
star
89

QBO.jl

Work with QuickBooksOnline from Julia
Julia
1
star
90

ExampleComponents

An Example JSML Component Library
JavaScript
1
star
91

HTTPQuickstart.jl

Julia
1
star