-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
16 changed files
with
918 additions
and
0 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,2 @@ | ||
[deps] | ||
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899" |
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,8 @@ | ||
clima_formatter_options = ( | ||
indent = 4, | ||
margin = 80, | ||
always_for_in = true, | ||
whitespace_typedefs = true, | ||
whitespace_ops_in_indices = true, | ||
remove_extra_newlines = false, | ||
) |
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,85 @@ | ||
#!/usr/bin/env julia | ||
# | ||
# This is an adapted version of format.jl from JuliaFormatter with the | ||
# following license: | ||
# | ||
# MIT License | ||
# Copyright (c) 2019 Dominique Luna | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a | ||
# copy of this software and associated documentation files (the | ||
# "Software"), to deal in the Software without restriction, including | ||
# without limitation the rights to use, copy, modify, merge, publish, | ||
# distribute, sublicense, and/or sell copies of the Software, and to permit | ||
# persons to whom the Software is furnished to do so, subject to the | ||
# following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included | ||
# in all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
# USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
# | ||
using Pkg | ||
Pkg.activate(@__DIR__) | ||
Pkg.instantiate() | ||
|
||
using JuliaFormatter | ||
|
||
include("clima_formatter_options.jl") | ||
|
||
help = """ | ||
Usage: climaformat.jl [flags] [FILE/PATH]... | ||
Formats the given julia files using the CLIMA formatting options. If paths | ||
are given it will format the julia files in the paths. Otherwise, it will | ||
format all changed julia files. | ||
-v, --verbose | ||
Print the name of the files being formatted with relevant details. | ||
-h, --help | ||
Print this message. | ||
""" | ||
|
||
function parse_opts!(args::Vector{String}) | ||
i = 1 | ||
opts = Dict{Symbol, Union{Int, Bool}}() | ||
while i ≤ length(args) | ||
arg = args[i] | ||
if arg[1] != '-' | ||
i += 1 | ||
continue | ||
end | ||
if arg == "-v" || arg == "--verbose" | ||
opt = :verbose | ||
elseif arg == "-h" || arg == "--help" | ||
opt = :help | ||
else | ||
error("invalid option $arg") | ||
end | ||
if opt in (:verbose, :help) | ||
opts[opt] = true | ||
deleteat!(args, i) | ||
end | ||
end | ||
return opts | ||
end | ||
|
||
opts = parse_opts!(ARGS) | ||
if haskey(opts, :help) | ||
write(stdout, help) | ||
exit(0) | ||
end | ||
if isempty(ARGS) | ||
filenames = readlines(`git ls-files "*.jl"`) | ||
else | ||
filenames = ARGS | ||
end | ||
|
||
format(filenames; clima_formatter_options..., opts...) |
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,85 @@ | ||
name: OS Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test-os: | ||
timeout-minutes: 60 | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
# Setup a filter and only run if src/ test/ folder content changes | ||
# or project depedencies | ||
- uses: dorny/paths-filter@v2 | ||
id: filter | ||
with: | ||
filters: | | ||
run_test: | ||
- '.github/workflows/OS-Tests.yml' | ||
- 'src/**' | ||
- 'test/**' | ||
- 'Project.toml' | ||
- name: Set up Julia | ||
uses: julia-actions/setup-julia@latest | ||
if: steps.filter.outputs.run_test == 'true' | ||
with: | ||
version: 1.6 | ||
|
||
- name: Cache artifacts | ||
uses: actions/cache@v1 | ||
if: steps.filter.outputs.run_test == 'true' | ||
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 }}- | ||
- name: Install Project Packages | ||
if: steps.filter.outputs.run_test == 'true' | ||
run: | | ||
julia --color=yes --project -e 'using Pkg; Pkg.instantiate()' | ||
julia --color=yes --project -e 'using Pkg; Pkg.precompile(;strict=true)' | ||
julia --color=yes --project -e 'using Pkg; Pkg.status()' | ||
- name: Project Manifest | ||
if: steps.filter.outputs.run_test == 'true' | ||
run: | | ||
julia --color=no --project -e 'using Pkg; Pkg.status(mode=Pkg.PKGMODE_MANIFEST)' | ||
- name: Install Project Test Packages | ||
if: steps.filter.outputs.run_test == 'true' | ||
run: | | ||
julia --color=yes --project=test -e 'using Pkg; Pkg.develop(path=pwd()); Pkg.instantiate()' | ||
julia --color=yes --project=test -e 'using Pkg; Pkg.precompile(;strict=true)' | ||
julia --color=yes --project=test -e 'using Pkg; Pkg.status()' | ||
- name: Project Test Manifest | ||
if: steps.filter.outputs.run_test == 'true' | ||
run: | | ||
julia --color=no --project=test -e 'using Pkg; Pkg.status(mode=Pkg.PKGMODE_MANIFEST)' | ||
- name: Run Unit Tests | ||
if: steps.filter.outputs.run_test == 'true' | ||
run: | | ||
julia --color=yes --project=test test/runtests.jl |
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,29 @@ | ||
name: Documentation | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- trying | ||
- staging | ||
tags: '*' | ||
pull_request: | ||
|
||
jobs: | ||
docbuild: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: julia-actions/setup-julia@latest | ||
with: | ||
version: 1.6.0 | ||
- name: Install dependencies | ||
run: | | ||
julia --project -e 'using Pkg; Pkg.instantiate()' | ||
julia --project=docs/ -e 'using Pkg; Pkg.instantiate()' | ||
- name: Build and deploy | ||
env: | ||
GKSwstype: "100" # headless GR: https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988/2 | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token | ||
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key | ||
run: julia --project=docs/ docs/make.jl |
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,10 @@ | ||
name = "ClimaComms" | ||
uuid = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d" | ||
authors = ["CliMA Contributors <[email protected]>"] | ||
version = "0.1.0" | ||
|
||
[deps] | ||
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" | ||
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c" | ||
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" | ||
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" |
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,2 @@ | ||
[deps] | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" |
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,29 @@ | ||
if joinpath(@__DIR__, "..") ∉ LOAD_PATH | ||
push!(LOAD_PATH, joinpath(@__DIR__, "..")) | ||
end | ||
using Documenter, ClimaComms | ||
|
||
format = Documenter.HTML( | ||
prettyurls = !isempty(get(ENV, "CI", "")), | ||
collapselevel = 1, | ||
) | ||
makedocs( | ||
sitename = "ClimaComms.jl", | ||
strict = false, | ||
format = format, | ||
checkdocs = :exports, | ||
clean = true, | ||
doctest = true, | ||
modules = [ClimaComms], | ||
pages = Any["Home" => "index.md", "API" => "api.md"], | ||
) | ||
|
||
#= | ||
deploydocs( | ||
repo = "github.com/CliMA/ClimaComms.jl.git", | ||
target = "build", | ||
push_preview = true, | ||
devbranch = "main", | ||
forcepush = 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,22 @@ | ||
# ClimaComms API | ||
|
||
```@meta | ||
CurrentModule = ClimaComms | ||
``` | ||
|
||
```@docs | ||
ClimaComms | ||
``` | ||
|
||
### Types | ||
```@docs | ||
ClimaComms.MPICommsType | ||
``` | ||
|
||
### Interface | ||
```@docs | ||
ClimaComms.init | ||
ClimaComms.start | ||
ClimaComms.progress | ||
ClimaComms.finish | ||
``` |
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 @@ | ||
# ClimaComms.jl |
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,29 @@ | ||
""" | ||
ClimaComms | ||
Abstracts the communications interface for the various CliMA components | ||
to enable use of MPI/SharedArrays/Gasp/etc. | ||
Call `init()` with the type of the communications infrastructure desired. | ||
Create a `RelayBuffer` to hold the data to be communicated; one each for | ||
every neighbor/direction. Call `get_stage()` for each send buffer and fill | ||
them. Call `start()` to initiate communication; `progress()` to drive the | ||
communication progress. To complete communication, call `finish()`. At | ||
this point, call `get_stage()` for each receive buffer and empty them. | ||
""" | ||
module ClimaComms | ||
|
||
abstract type AbstractCommsType end | ||
function init end | ||
function start end | ||
function progress end | ||
function finish end | ||
|
||
function init(::Type{CT}) where {CT <: AbstractCommsType} | ||
error("No `init` method defined for $CT") | ||
end | ||
|
||
include("relay_buffers.jl") | ||
include("mpi_comms.jl") | ||
|
||
end # module |
Oops, something went wrong.