-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a5ccaee
commit 0a00738
Showing
13 changed files
with
439 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Configuration file for JuliaFormatter.jl | ||
# For more information, see: https://domluna.github.io/JuliaFormatter.jl/stable/config/ | ||
|
||
indent = 4 | ||
margin = 120 | ||
always_for_in = true | ||
align_assignment = true | ||
align_struct_field = true | ||
whitespace_typedefs = true | ||
whitespace_ops_in_indices = false | ||
remove_extra_newlines = true | ||
import_to_using = false | ||
pipe_to_function_call = false | ||
short_to_long_function_def = false | ||
long_to_short_function_def = false | ||
whitespace_in_kwargs = true | ||
annotate_untyped_fields_with_any = true | ||
format_docstrings = true | ||
conditional_to_if = false | ||
normalize_line_endings = "auto" | ||
trailing_comma = true | ||
join_lines_based_on_source = true | ||
indent_submodule = false | ||
separate_kwargs_with_semicolon = true | ||
surround_whereop_typeparameters = true | ||
always_use_return = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: format-check | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- release-* | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: julia-actions/setup-julia@latest | ||
with: | ||
version: '1' | ||
- uses: actions/checkout@v1 | ||
- name: Format check | ||
shell: julia --color=yes {0} | ||
run: | | ||
using Pkg | ||
# If you update the version, also update the style guide docs. | ||
Pkg.add(PackageSpec(name="JuliaFormatter", version="1")) | ||
using JuliaFormatter | ||
format("src", verbose=true) | ||
format("test", verbose=true) | ||
format("docs", verbose=true) | ||
out = String(read(Cmd(`git diff`))) | ||
if isempty(out) | ||
exit(0) | ||
end | ||
@error "Some files have not been formatted !!!" | ||
write(stdout, out) | ||
exit(1) | ||
# Workflow from https://github.com/jump-dev/JuMP.jl/blob/master/.github/workflows/format_check.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Test | ||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
jobs: | ||
test: | ||
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- version: '1' | ||
os: windows-latest | ||
arch: x64 | ||
- version: '1.6' | ||
os: windows-latest | ||
arch: x64 | ||
- version: '1' | ||
os: ubuntu-latest | ||
arch: x64 | ||
- version: '1.6' | ||
os: ubuntu-latest | ||
arch: x64 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: ${{ matrix.version }} | ||
arch: ${{ matrix.arch }} | ||
- uses: actions/cache@v1 | ||
env: | ||
cache-name: cache-artifacts | ||
with: | ||
path: ~/.julia/artifacts | ||
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-test-${{ env.cache-name }}- | ||
${{ runner.os }}-test- | ||
${{ runner.os }}- | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
- uses: julia-actions/julia-runtest@v1 | ||
- uses: julia-actions/julia-processcoverage@v1 | ||
- uses: codecov/codecov-action@v1 | ||
with: | ||
file: lcov.info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Copyright (C) 2023 Guilherme Bodin | ||
# License is MIT "Expat" | ||
# | ||
# Commentary: | ||
# | ||
# Command line utility to call the `mpiexec` binary used by the `MPI.jl` version | ||
# in the given Julia project. It has the same syntax as the `mpiexec` binary | ||
# that would be called, with the additional `--project=...` flag to select a | ||
# different Julia project. | ||
# | ||
# Examples of usage (the MPI flags available depend on the MPI implementation | ||
# called): | ||
# | ||
# $ mpiexecjl -n 40 julia mpi-script.jl | ||
# $ mpiexecjl --project=my_experiment -n 80 --oversubscribe julia mpi-script.jl | ||
# To call the application in parallel in the non-compiled mode powershell.exe -ExecutionPolicy ByPass -File .\mpiexecjl.ps1 -n 3 --project=. julia .\main.jl | ||
|
||
function usage { | ||
Write-Host "Usage: $([System.IO.Path]::GetFileNameWithoutExtension($MyInvocation.MyCommand.Name)) [--project=...] MPIEXEC_ARGUMENTS..." | ||
Write-Host "Call the mpiexec binary in the Julia environment specified by the --project option." | ||
Write-Host "If no project is specified, the MPI associated with the global Julia environment will be used." | ||
Write-Host "All other arguments are forwarded to mpiexec." | ||
} | ||
|
||
$julia_args = @() | ||
$PROJECT_ARG = "" | ||
|
||
foreach ($arg in $args) { | ||
if ($arg -match "^--project(=.*)?$") { | ||
$PROJECT_ARG = $arg | ||
} | ||
elseif ($arg -eq "-h" -or $arg -eq "--help") { | ||
$helpRequested = $true | ||
usage | ||
Write-Host "Below is the help of the current mpiexec." | ||
Write-Host | ||
exit 0 | ||
} | ||
else { | ||
$julia_args += $arg | ||
} | ||
} | ||
|
||
if (-not $julia_args) { | ||
Write-Error "ERROR: no arguments specified." | ||
usage | ||
exit 1 | ||
} | ||
|
||
if ($env:JULIA_BINDIR) { | ||
$JULIA_CMD = Join-Path $env:JULIA_BINDIR "julia" | ||
} else { | ||
$JULIA_CMD = "julia" | ||
} | ||
|
||
$SCRIPT = @' | ||
using MPI | ||
ENV[\"JULIA_PROJECT\"] = dirname(Base.active_project()) | ||
mpiexec(exe -> run(`$exe $ARGS`)) | ||
'@ | ||
|
||
$PRECOMPILATION_SCRIPT = @' | ||
println(\"precompiling current project before running MPI\") | ||
import Pkg | ||
Pkg.activate(dirname(Base.active_project())) | ||
Pkg.instantiate() | ||
println(\"precompilation finished\") | ||
'@ | ||
|
||
& $JULIA_CMD $PROJECT_ARG -e $PRECOMPILATION_SCRIPT | ||
|
||
if ($PROJECT_ARG) { | ||
& $JULIA_CMD $PROJECT_ARG --color=yes --startup-file=no --compile=min -O0 -e $SCRIPT -- $julia_args | ||
} else { | ||
& $JULIA_CMD --color=yes --startup-file=no --compile=min -O0 -e $SCRIPT -- $julia_args | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
abstract type AbstractJob end | ||
|
||
mutable struct Job <: AbstractJob | ||
message::Any | ||
f::Function | ||
end | ||
|
||
mutable struct JobAnswer <: AbstractJob | ||
message::Any | ||
end | ||
|
||
get_message(job::AbstractJob) = job.message | ||
get_task(job::Job) = job.f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[deps] | ||
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
using Test | ||
using JobQueueMPI | ||
using MPI | ||
ENV["JULIA_PROJECT"] = dirname(Base.active_project()) | ||
|
||
@testset "JobQueueMPI" begin | ||
@test true | ||
end | ||
JQM = JobQueueMPI | ||
|
||
@testset verbose = true "JobQueueMPI Tests" begin | ||
mpiexec(exe -> run(`$exe -n 3 $(Base.julia_cmd()) --project ..\\test\\test1.jl`)) | ||
mpiexec(exe -> run(`$exe -n 3 $(Base.julia_cmd()) --project ..\\test\\test2.jl`)) | ||
end |
Oops, something went wrong.