Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distributed DataWrangling #207

Closed
wants to merge 820 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
820 commits
Select commit Hold shift + click to select a range
6a53bf5
remove useless file
simone-silvestri Jun 18, 2024
50fe313
bugfix
simone-silvestri Jun 18, 2024
5862a0a
functions for time quantities
simone-silvestri Jun 18, 2024
ebf14fe
bottom drag coefficient
simone-silvestri Jun 18, 2024
103b504
back to reference height
simone-silvestri Jun 18, 2024
7d4eb0e
some improvements
simone-silvestri Jun 18, 2024
8c165b9
bugfix
simone-silvestri Jun 18, 2024
34b6265
revert to chloride
simone-silvestri Jun 18, 2024
c5babb7
changed pipeline
simone-silvestri Jun 18, 2024
215b692
use github documenter for the moment
simone-silvestri Jun 18, 2024
a1ce58b
bugfix
simone-silvestri Jun 18, 2024
31add81
change measurement to reference
simone-silvestri Jun 18, 2024
df0456e
conversion depending on k
simone-silvestri Jun 18, 2024
beaeacf
change to the
simone-silvestri Jun 18, 2024
f235888
change name
simone-silvestri Jun 18, 2024
f3487d9
bugfix
simone-silvestri Jun 18, 2024
c695266
namechange
simone-silvestri Jun 18, 2024
8473926
add surface flux tests
simone-silvestri Jun 19, 2024
2a6b1a4
change name to "gusty" velocity difference
simone-silvestri Jun 19, 2024
36a3e17
typo
simone-silvestri Jun 19, 2024
29993f6
bugfix
simone-silvestri Jun 19, 2024
24a551c
correctly include runoff in forcing
simone-silvestri Jun 19, 2024
f1099d9
bugfix
simone-silvestri Jun 19, 2024
a0682f0
speed up generate fluxes
simone-silvestri Jun 19, 2024
4f1f75e
Merge remote-tracking branch 'origin/ss/omip-simulation' into ss/omip…
simone-silvestri Jun 19, 2024
fc53863
error in project
simone-silvestri Jun 19, 2024
26b8dee
ok found the issue!
simone-silvestri Jun 19, 2024
8de82f2
Merge branch 'ss/omip-with-restoring' of github.com:CliMA/ClimaOcean.…
simone-silvestri Jun 19, 2024
e1f386d
correct the functions
simone-silvestri Jun 19, 2024
0309ddd
change to z_data
simone-silvestri Jun 20, 2024
2378460
improve example
simone-silvestri Jun 20, 2024
f9ba0ca
closure
simone-silvestri Jun 20, 2024
bf8e2e8
Merge remote-tracking branch 'origin/main' into ss/omip-with-restoring
simone-silvestri Jun 20, 2024
05e4c0e
extrinsic-intrinsic
simone-silvestri Jun 20, 2024
7fed375
remove interpolate
simone-silvestri Jun 20, 2024
88bd8fd
z_data instead of h_data
simone-silvestri Jun 20, 2024
4f459e0
add warning for longitude range
simone-silvestri Jun 20, 2024
662552c
small change
simone-silvestri Jun 20, 2024
2914348
Merge branch 'ss/some-fixes' into ss/omip-with-restoring
simone-silvestri Jun 20, 2024
baa271b
change the CFL
simone-silvestri Jun 20, 2024
2b82a95
comments
simone-silvestri Jun 20, 2024
aa25de7
remove zstar prototype
simone-silvestri Jun 20, 2024
d4a2715
bugfix
simone-silvestri Jun 20, 2024
9aa92e6
Merge branch 'main' into ss/omip-with-restoring
simone-silvestri Jun 21, 2024
4268b5d
small bugfix
simone-silvestri Jun 21, 2024
731ad73
Merge branch 'ss/omip-with-restoring' of github.com:CliMA/ClimaOcean.…
simone-silvestri Jun 21, 2024
5c98a49
Merge remote-tracking branch 'origin/main' into ss/omip-with-restoring
simone-silvestri Jun 21, 2024
3cfcf5a
bugfix
simone-silvestri Jun 23, 2024
122dfd3
allow precompilation
simone-silvestri Jun 23, 2024
559ab98
small bugfix
simone-silvestri Jun 23, 2024
5582b14
change default to ecco2daily
simone-silvestri Jun 23, 2024
6559e96
correct JRA55
simone-silvestri Jun 23, 2024
66afab0
remove one division
simone-silvestri Jun 24, 2024
4bced96
some optimizations
simone-silvestri Jun 24, 2024
e015701
let's see if this speeds up the computation
simone-silvestri Jun 25, 2024
bf340cc
updating catke to new syntax
simone-silvestri Jun 25, 2024
00a9ecc
also new manifest
simone-silvestri Jun 25, 2024
d5279a1
add on_architecture
simone-silvestri Jun 25, 2024
f2eca7f
the conversion is done _inside_ fts
simone-silvestri Jun 25, 2024
1f2582e
another try
simone-silvestri Jun 25, 2024
8dc34cc
small verification
simone-silvestri Jun 25, 2024
d5e0797
fix a typo
simone-silvestri Jun 25, 2024
e91d270
typo
simone-silvestri Jun 25, 2024
8198689
last try
simone-silvestri Jun 25, 2024
8c5ce3f
another bugfix
simone-silvestri Jun 25, 2024
2bb12b4
another bugfix
simone-silvestri Jun 26, 2024
4089fdc
fix back
simone-silvestri Jun 26, 2024
2e2ea63
back to square one. Still very slow
simone-silvestri Jun 26, 2024
3add473
switching to an array
simone-silvestri Jun 26, 2024
dfe9ba6
some changes to the docstring
simone-silvestri Jun 26, 2024
c6a726d
bug with reciprocal of rho
simone-silvestri Jun 26, 2024
7fc9554
more fixes
simone-silvestri Jun 26, 2024
aa17c4e
switch reference frames
simone-silvestri Jun 26, 2024
1a460b2
try fixing tests with secret tokens
simone-silvestri Jun 26, 2024
65327db
take ecco 4 monthly
simone-silvestri Jun 26, 2024
35a086c
maybe here it will work?
simone-silvestri Jun 26, 2024
e8b3396
userame and password in docs
simone-silvestri Jun 28, 2024
d899b48
Merge remote-tracking branch 'origin/main' into ss/omip-with-restoring
simone-silvestri Jul 3, 2024
738aac0
ecco secrets in ci
simone-silvestri Jul 3, 2024
e5aee9f
Merge branch 'main' into ss/omip-with-restoring
simone-silvestri Jul 3, 2024
ac42848
remove all ECCO2 from examples
simone-silvestri Jul 3, 2024
ec0445d
Merge branch 'ss/omip-with-restoring' of github.com:CliMA/ClimaOcean.…
simone-silvestri Jul 3, 2024
a297bf9
more verbose error
simone-silvestri Jul 3, 2024
d691f3b
test new buildkite env variables
simone-silvestri Jul 3, 2024
da0aeab
fix tests
simone-silvestri Jul 3, 2024
98881ff
fix tests
simone-silvestri Jul 4, 2024
ecdad34
fix tests
simone-silvestri Jul 4, 2024
0392145
some fixes
simone-silvestri Jul 5, 2024
9caf8af
Merge branch 'main' into ss/omip-with-restoring
simone-silvestri Jul 6, 2024
0796fab
the simulation that is running
simone-silvestri Jul 8, 2024
aacd2e1
Merge branch 'ss/omip-with-restoring' of github.com:CliMA/ClimaOcean.…
simone-silvestri Jul 8, 2024
699958a
Merge branch 'main' into ss/omip-with-restoring
simone-silvestri Jul 22, 2024
e84613b
name changes
simone-silvestri Jul 23, 2024
0d601f4
some changes to the simulation
simone-silvestri Jul 23, 2024
fb99d65
try it out
simone-silvestri Jul 23, 2024
7dec068
test documentation on GPU
simone-silvestri Jul 24, 2024
d4d9c2f
correct docs key
simone-silvestri Jul 24, 2024
b09c835
timeout the docs after 24 hours instead of the default 2
simone-silvestri Jul 24, 2024
3413721
med example on the GPU
simone-silvestri Jul 24, 2024
841e487
update Oceananigans
simone-silvestri Jul 24, 2024
13cc2f8
namechange to pipeline
simone-silvestri Jul 24, 2024
ddbe363
rename the examples build
simone-silvestri Jul 24, 2024
5ef6fa7
remove size threshold
simone-silvestri Jul 24, 2024
68bc957
GLMakie -> CairoMakie
simone-silvestri Jul 24, 2024
03c9038
add GPUs
simone-silvestri Jul 24, 2024
97c6661
yet another bugfix
simone-silvestri Jul 25, 2024
6406bbc
yet another bugfix
simone-silvestri Jul 25, 2024
2a9d613
test on Oceananigans#main
simone-silvestri Jul 25, 2024
00b5571
test on Oceananigans#main
simone-silvestri Jul 25, 2024
a8da3c7
instantiate first
simone-silvestri Jul 25, 2024
f1d6dc9
Oceananigans#main
simone-silvestri Jul 25, 2024
2e7d15b
smooth out a couple of bugs
simone-silvestri Jul 25, 2024
7e4028f
Merge remote-tracking branch 'origin/main' into ss/documentation-on-c…
simone-silvestri Jul 25, 2024
565f4b3
remove Oceananigans from docs Project.toml
simone-silvestri Jul 25, 2024
051e590
fix gpu problem
simone-silvestri Jul 25, 2024
f2a741d
try only the near global at the moment
simone-silvestri Jul 25, 2024
57c2ca9
remove reaive humidity
simone-silvestri Jul 25, 2024
af4649a
remove reative humidity cause not used
simone-silvestri Jul 25, 2024
74d48c0
bugfix
simone-silvestri Jul 26, 2024
91dcf9d
just check the near global configuration
simone-silvestri Jul 26, 2024
d69ae9a
try with everything together
simone-silvestri Jul 26, 2024
48269d6
typo
simone-silvestri Jul 26, 2024
edce55f
try without the giba simulation
simone-silvestri Jul 29, 2024
908066b
simple cpu example
simone-silvestri Jul 29, 2024
f2f9d6b
adding a slurm time
simone-silvestri Jul 30, 2024
d375f0b
try with SSL_no_verify
simone-silvestri Jul 30, 2024
7a7d0a3
try with wget
simone-silvestri Jul 30, 2024
ef8ca0a
typo
simone-silvestri Jul 30, 2024
a12ceee
full fledged model on GPU
simone-silvestri Jul 31, 2024
6d6b0cc
Update .buildkite/examples_build.yml
simone-silvestri Jul 31, 2024
40f75d3
add literate debug
simone-silvestri Jul 31, 2024
3e9bdfc
back to previous project / manifest
simone-silvestri Jul 31, 2024
836b94f
Merge branch 'ss/documentation-on-caltech' of github.com:CliMA/ClimaO…
simone-silvestri Jul 31, 2024
c88ea50
add visualization
simone-silvestri Jul 31, 2024
23ddab5
check if it deploys
simone-silvestri Jul 31, 2024
1f18b8e
test the deploy keys
simone-silvestri Aug 1, 2024
b15e3ac
test reading the ssh key
simone-silvestri Aug 1, 2024
ec7e027
Merge branch 'ss/documentation-on-caltech' of github.com:CliMA/ClimaO…
simone-silvestri Aug 1, 2024
4f5550e
typo
simone-silvestri Aug 1, 2024
e81ef73
the docs deploy?
simone-silvestri Aug 1, 2024
6008b79
check deployment again
simone-silvestri Aug 1, 2024
87a1ad4
test docs deployment
simone-silvestri Aug 1, 2024
447666e
remove `winthenv`
simone-silvestri Aug 1, 2024
3b92297
near global simulation in docs
simone-silvestri Aug 1, 2024
b7c1713
better comments
simone-silvestri Aug 1, 2024
e3c4908
another test
simone-silvestri Aug 1, 2024
297bacd
try new keys
simone-silvestri Aug 2, 2024
2a6d7a9
progress it stuck on single_column_grid
simone-silvestri Aug 2, 2024
8013eef
test only with snapshot
simone-silvestri Aug 2, 2024
5df3f22
gif -> mp4
navidcy Aug 3, 2024
cf46b69
remove also "inspect_ecco_data.jl"
simone-silvestri Aug 3, 2024
91e0139
try with a video?
simone-silvestri Aug 3, 2024
4a007d9
print every 500 iterations
simone-silvestri Aug 3, 2024
70f7c5e
max abs
simone-silvestri Aug 3, 2024
7463008
some changes to simulation details
simone-silvestri Aug 3, 2024
665e88d
smaller titles
simone-silvestri Aug 3, 2024
dc00749
lift correct variables
simone-silvestri Aug 3, 2024
b8a4d0b
reduce frames by a factor of two
simone-silvestri Aug 3, 2024
45f1f91
Merge branch 'main' into ss/documentation-on-caltech
simone-silvestri Aug 3, 2024
5f622a4
bugfix
simone-silvestri Aug 3, 2024
52bb4df
Merge branch 'ss/documentation-on-caltech' of github.com:CliMA/ClimaO…
simone-silvestri Aug 3, 2024
7f2936f
another bugfix
simone-silvestri Aug 3, 2024
51ca046
adding generate bathymetry
simone-silvestri Aug 3, 2024
91f3c5d
some bugfixes
simone-silvestri Aug 3, 2024
6fcd1ce
better colormaps
simone-silvestri Aug 3, 2024
9be7044
more massaging
simone-silvestri Aug 3, 2024
b0e95ac
try the full global ocean
simone-silvestri Aug 3, 2024
a6f80f5
global ocean simulation
simone-silvestri Aug 3, 2024
baaa569
Parameter space problem
simone-silvestri Aug 3, 2024
b89e12f
unfortunately we cannot use active cells map
simone-silvestri Aug 3, 2024
638eb78
few tweaks
navidcy Aug 3, 2024
34a1cfd
code cleanup
navidcy Aug 3, 2024
365472b
code cleanup
navidcy Aug 3, 2024
6f3982c
code cleanup
navidcy Aug 3, 2024
c818e52
clearer explanation
navidcy Aug 3, 2024
c61f648
clearer explanation
navidcy Aug 3, 2024
e2cae09
try the global ocean
simone-silvestri Aug 4, 2024
ea6453f
Merge branch 'ss/documentation-on-caltech' of github.com:CliMA/ClimaO…
simone-silvestri Aug 4, 2024
eead6e5
better visualizations
simone-silvestri Aug 4, 2024
1691ffc
try again
simone-silvestri Aug 4, 2024
34fc86b
Merge branch 'main' into ss/documentation-on-caltech
simone-silvestri Aug 4, 2024
20468f8
fix bug
navidcy Aug 5, 2024
32d25db
change figure size
simone-silvestri Aug 5, 2024
826208d
Merge branch 'ss/documentation-on-caltech' of github.com:CliMA/ClimaO…
simone-silvestri Aug 5, 2024
6f81571
take 2
simone-silvestri Aug 14, 2024
2548528
forse restart build
simone-silvestri Aug 14, 2024
2ae2f6a
Update src/OceanSimulations/OceanSimulations.jl
simone-silvestri Aug 14, 2024
5209b3f
bugfix
simone-silvestri Aug 14, 2024
13e8d91
Merge branch 'ss/immersed-boundary-conditions-take-2' of github.com:C…
simone-silvestri Aug 14, 2024
41d5b19
Merge branch 'main' into ss/immersed-boundary-conditions-take-2
simone-silvestri Aug 15, 2024
9bf8862
adapt to new syntax
simone-silvestri Aug 15, 2024
3b5d200
remove noise...
simone-silvestri Aug 16, 2024
77c0a21
more noise removed
simone-silvestri Aug 16, 2024
db9761a
adding MPIPreferences
simone-silvestri Aug 16, 2024
e92014f
block all external commands
simone-silvestri Aug 16, 2024
cd543e4
preventing deadlocks
simone-silvestri Aug 16, 2024
5d3f8af
less risk of deadlocks
simone-silvestri Aug 16, 2024
92b62ca
add runfile
simone-silvestri Aug 16, 2024
69f341f
added MPI
simone-silvestri Aug 16, 2024
7346030
fixxxing cpu_interpolating indices
simone-silvestri Aug 16, 2024
ea078a5
fix more stuff and start downloading
simone-silvestri Aug 16, 2024
fdd44fb
more fixes
simone-silvestri Aug 16, 2024
394e2ad
let's go!
simone-silvestri Aug 16, 2024
6fa311d
well, now we can test it!
simone-silvestri Aug 16, 2024
ec0a4be
simplified bug time
simone-silvestri Aug 16, 2024
7bf33b9
add correct branch
simone-silvestri Aug 16, 2024
c352b5a
Merge branch 'ss/mpi-simulations-for-conferenve' of github.com:CliMA/…
simone-silvestri Aug 16, 2024
7ad79be
use correct ranks
simone-silvestri Aug 16, 2024
72cabb1
same thing for bathymetry
simone-silvestri Aug 16, 2024
d0feadf
Merge branch 'ss/mpi-simulations-for-conferenve' of https://github.co…
simone-silvestri Aug 16, 2024
ac81066
just do this for the moment
simone-silvestri Aug 18, 2024
0cc204c
push some diagnostics
simone-silvestri Aug 19, 2024
c10855f
mean_drift
simone-silvestri Aug 19, 2024
40e9590
add changes
simone-silvestri Aug 19, 2024
f285577
more chnages
simone-silvestri Aug 19, 2024
5aa9986
add interpolation
simone-silvestri Aug 19, 2024
9653b2c
Merge branch 'main' into ss/immersed-boundary-conditions-take-2
simone-silvestri Aug 19, 2024
be78866
add some cleaning
simone-silvestri Aug 20, 2024
da36d62
Merge branch 'ss/mpi-simulations-for-conferenve' of https://github.co…
simone-silvestri Aug 20, 2024
580087e
try with this interpolation
simone-silvestri Aug 20, 2024
a742991
change manifest
simone-silvestri Aug 20, 2024
f6a1041
changed project and simulation
simone-silvestri Aug 20, 2024
9e853a8
Merge branch 'ss/mpi-simulations-for-conferenve' of https://github.co…
simone-silvestri Aug 20, 2024
714d224
new interpolation
simone-silvestri Aug 20, 2024
83ec082
Merge branch 'ss/mpi-simulations-for-conferenve' of github.com:CliMA/…
simone-silvestri Aug 20, 2024
14c9e94
Merge branch 'main' into ss/immersed-boundary-conditions-take-2
simone-silvestri Aug 20, 2024
9c19dda
try it out?
simone-silvestri Aug 20, 2024
e1ce0b7
bah not nice but it works
simone-silvestri Aug 23, 2024
9bafffa
add climatology
simone-silvestri Aug 23, 2024
50f2046
Merge branch 'main' into ss/immersed-boundary-conditions-take-2
simone-silvestri Aug 27, 2024
18b1ed8
update project
simone-silvestri Aug 28, 2024
cca28de
Merge branch 'main' into ss/immersed-boundary-conditions-take-2
simone-silvestri Sep 6, 2024
fe7faf7
update Oceananigans
simone-silvestri Sep 16, 2024
43379eb
Merge branch 'main' into ss/immersed-boundary-conditions-take-2
simone-silvestri Sep 18, 2024
f62ba36
Merge remote-tracking branch 'origin/main' into ss/mpi-simulations-fo…
simone-silvestri Sep 19, 2024
d449469
test it out on 8 gpus
simone-silvestri Sep 19, 2024
d0da037
Merge remote-tracking branch 'origin/ss/immersed-boundary-conditions-…
simone-silvestri Sep 19, 2024
03b9859
add new prototype
simone-silvestri Sep 19, 2024
407f5fb
only surface restoring
simone-silvestri Sep 19, 2024
5cac620
correct defaults
simone-silvestri Sep 19, 2024
e459a16
Merge branch 'main' into ss/mpi-simulations-for-conferenve
simone-silvestri Oct 31, 2024
c8d97e4
remove diagnostics
simone-silvestri Oct 31, 2024
185c2a4
remove manifest
simone-silvestri Oct 31, 2024
208f011
remove stuff
simone-silvestri Oct 31, 2024
2757ff5
back in OceanSimulations
simone-silvestri Oct 31, 2024
f2b5bd6
back on prototype
simone-silvestri Oct 31, 2024
4741ec1
back also here
simone-silvestri Oct 31, 2024
7033fab
distributed data wrangling
simone-silvestri Oct 31, 2024
f52a0d8
back to previous code
simone-silvestri Oct 31, 2024
26b96e0
better
simone-silvestri Oct 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
ImageMorphology = "787d08f9-d448-5407-9aad-5290dd7ab264"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
Oceananigans = "9e8cae18-63c1-5223-a75c-80ca9d6e9a09"
OrthogonalSphericalShellGrids = "c2be9673-fb75-4747-82dc-aa2bb9f4aed0"
Expand All @@ -40,12 +41,12 @@ JLD2 = "0.4, 0.5"
KernelAbstractions = "0.9"
NCDatasets = "0.12, 0.13, 0.14"
Oceananigans = "0.93.1"
OrthogonalSphericalShellGrids = "0.1.2"
OrthogonalSphericalShellGrids = "0.1.2, 0.2"
Scratch = "1"
SeawaterPolynomials = "0.3.4"
StaticArrays = "1"
Statistics = "1.9"
SurfaceFluxes = "0.11"
SurfaceFluxes = "0.12"
Thermodynamics = "0.12"
julia = "1.9"

Expand Down
31 changes: 12 additions & 19 deletions src/Bathymetry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Bathymetry
export regrid_bathymetry, retrieve_bathymetry

using ImageMorphology
using ..DataWrangling: download_progress
using ..DataWrangling: download_progress, @root

using Oceananigans
using Oceananigans.Architectures: architecture, on_architecture
Expand Down Expand Up @@ -87,26 +87,19 @@ function regrid_bathymetry(target_grid;
major_basins = Inf) # Allow an `Inf` number of ``lakes''

filepath = joinpath(dir, filename)

if isfile(filepath)
@info "Regridding bathymetry from existing file $filepath."
else
@info "Downloading bathymetry..."
if !ispath(dir)
@info "Making bathymetry directory $dir..."
mkdir(dir)
end

fileurl = joinpath(url, filename)

try
Downloads.download(fileurl, filepath; progress=download_progress, verbose=true)
catch
cmd = `wget --no-check-certificate -O $filepath $fileurl`
run(cmd)
fileurl = joinpath(url, filename)

@root begin # perform all this only on rank 0, aka the "root" rank
if !isfile(filepath)
try
Downloads.download(fileurl, filepath; progress=download_progress, verbose=true)
catch
cmd = `wget --no-check-certificate -O $filepath $fileurl`
@root run(cmd)
end
end
end

dataset = Dataset(filepath)

FT = eltype(target_grid)
Expand Down
3 changes: 2 additions & 1 deletion src/ClimaOcean.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export
JRA55_field_time_series,
ECCO_field, ECCOMetadata,
ocean_simulation,
initialize!
initialize!,
@root

using Oceananigans
using Oceananigans.Operators: ℑxyᶠᶜᵃ, ℑxyᶜᶠᵃ
Expand Down
4 changes: 4 additions & 0 deletions src/DataWrangling/DataWrangling.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
module DataWrangling

export @root, @distribute

using Oceananigans
using Downloads
using Printf
using Downloads

using Oceananigans.Architectures: architecture, on_architecture
using Oceananigans.Grids: node
Expand Down Expand Up @@ -71,6 +74,7 @@ function save_field_time_series!(fts; path, name, overwrite_existing=false)
return nothing
end

include("distributed_datawrangling.jl")
include("inpaint_mask.jl")
include("JRA55.jl")
include("ECCO/ECCO.jl")
Expand Down
42 changes: 9 additions & 33 deletions src/DataWrangling/ECCO/ECCO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -216,48 +216,24 @@ function inpainted_ECCO_field(metadata::ECCOMetadata;
inpaint_mask!(f, mask; maxiter)

fill_halo_regions!(f)

return f
end

inpainted_ECCO_field(variable_name::Symbol; kw...) = inpainted_ECCO_field(ECCOMetadata(variable_name); kw...)

function set!(field::DistributedField, ECCO_metadata::ECCOMetadata; kw...)
function set!(field::Field, ecco_metadata::ECCOMetadata; kw...)

# Fields initialized from ECCO
grid = field.grid
arch = architecture(grid)
child_arch = child_architecture(arch)

f_ECCO = if arch.local_rank == 0 # Make sure we read/write the file using only one core
mask = ECCO_mask(ECCO_metadata, child_arch)
inpainted_ECCO_field(ECCO_metadata; mask, architecture = child_arch, kw...)
else
empty_ECCO_field(ECCO_metadata; architecture = child_arch)
end

barrier!(arch)

# Distribute ECCO field to all workers
parent(f_ECCO) .= all_reduce(+, parent(f_ECCO), arch)
arch = child_architecture(grid)
mask = ecco_mask(ecco_metadata, arch)

f_grid = Field(location(ECCO_metadata), grid)
interpolate!(f_grid, f_ECCO)
set!(field, f_grid)

return field
end

function set!(field::Field, ECCO_metadata::ECCOMetadata; kw...)
f = inpainted_ecco_field(ecco_metadata; mask,
architecture = arch,
kw...)

# Fields initialized from ECCO
grid = field.grid
arch = architecture(grid)
mask = ECCO_mask(ECCO_metadata, arch)

f = inpainted_ECCO_field(ECCO_metadata; mask, architecture=arch, kw...)
f_grid = Field(location(ECCO_metadata), grid)
interpolate!(f_grid, f)
set!(field, f_grid)
interpolate!(field, f)

return field
end
Expand Down
21 changes: 13 additions & 8 deletions src/DataWrangling/ECCO/ECCO_metadata.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using CFTime
using Dates
using ClimaOcean.DataWrangling: distributed_run

import Dates: year, month, day

using Base: @propagate_inbounds

Expand Down Expand Up @@ -96,6 +99,9 @@ all_ECCO_dates(::ECCO4Monthly) = DateTimeProlepticGregorian(1992, 1, 1) : Month(
all_ECCO_dates(::ECCO2Monthly) = DateTimeProlepticGregorian(1992, 1, 1) : Month(1) : DateTimeProlepticGregorian(2023, 12, 1)
all_ECCO_dates(::ECCO2Daily) = DateTimeProlepticGregorian(1992, 1, 4) : Day(1) : DateTimeProlepticGregorian(2023, 12, 31)

# File names of metadata containing multiple dates
metadata_filename(metadata) = [metadata_filename(metadatum) for metadatum in metadata]

# File name generation specific to each Dataset version
function metadata_filename(metadata::ECCOMetadata{<:AbstractCFDateTime, <:ECCO4Monthly})
shortname = short_name(metadata)
Expand Down Expand Up @@ -190,28 +196,27 @@ ECCO_USERNAME=myuser ECCO_PASSWORD=mypasswrd julia
function download_dataset!(metadata::ECCOMetadata; url = urls(metadata))
username = get(ENV, "ECCO_USERNAME", nothing)
password = get(ENV, "ECCO_PASSWORD", nothing)
dir = metadata.dir

for metadatum in metadata
filename = metadata_filename(metadatum)
@distribute for metadatum in metadata # Distribute the download among ranks if MPI is initialized

fileurl = metadata_url(url, metadatum)
filepath = metadata_path(metadatum)

if !isfile(filepath)
instructions_msg = "\n See ClimaOcean.jl/src/ECCO/README.md for instructions."
if isnothing(username)
msg = "Could not find the ECCO_PASSWORD environment variable. \
See ClimaOcean.jl/src/ECCO/README.md for instructions on obtaining \
and setting your ECCO_USERNAME and ECCO_PASSWORD."
and setting your ECCO_USERNAME and ECCO_PASSWORD." * instructions_msg
throw(ArgumentError(msg))
elseif isnothing(password)
msg = "Could not find the ECCO_PASSWORD environment variable. \
See ClimaOcean.jl/src/ECCO/README.md for instructions on obtaining \
and setting your ECCO_USERNAME and ECCO_PASSWORD."
and setting your ECCO_USERNAME and ECCO_PASSWORD." * instructions_msg
throw(ArgumentError(msg))
end

fileurl = metadata_url(url, metadatum)
cmd = `wget --http-user=$(username) --http-passwd=$(password) --directory-prefix=$dir $fileurl`

cmd = `wget --http-user=$(username) --http-passwd=$(password) $(fileurl)`
run(cmd)
end
end
Expand Down
10 changes: 7 additions & 3 deletions src/DataWrangling/JRA55.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module JRA55

using Oceananigans
using Oceananigans.Units

using Oceananigans.Architectures: arch_array
using Oceananigans.DistributedComputations
using Oceananigans.DistributedComputations: child_architecture
Expand All @@ -11,6 +11,8 @@ using Oceananigans.Grids: λnodes, φnodes, on_architecture
using Oceananigans.Fields: interpolate!
using Oceananigans.OutputReaders: Cyclical, TotallyInMemory, AbstractInMemoryBackend, FlavorOfFTS, time_indices

using ClimaOcean.DataWrangling: download_progress

using ClimaOcean.OceanSeaIceModels:
PrescribedAtmosphere,
TwoBandDownwellingRadiation
Expand Down Expand Up @@ -370,8 +372,10 @@ function JRA55_field_time_series(variable_name;
fts_name = field_time_series_short_names[variable_name]

# Note, we don't re-use existing jld2 files.
isfile(filepath) || download(url, filepath)
isfile(jld2_filepath) && rm(jld2_filepath)
@root begin
isfile(filepath) || download(url, filepath)
isfile(jld2_filepath) && rm(jld2_filepath)
end

# Determine default time indices
if totally_in_memory
Expand Down
60 changes: 60 additions & 0 deletions src/DataWrangling/distributed_datawrangling.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using MPI

#####
##### Handle commands, typically downloading files
##### which should be executed by only one rank or distributed among ranks
#####

function global_barrier()
if MPI.Initialized()
MPI.Barrier(MPI.COMM_WORLD)
end
end

"""
Perform `exp` only on rank 0, otherwise know as "root" rank.
Other ranks will wait for the root rank to finish before continuing
"""
macro root(exp)
if MPI.Initialized() && MPI.Comm_rank(MPI.COMM_WORLD) != 0
command = quote
global_barrier()
end
else
command = quote
$exp
global_barrier()
end
end

return esc(command)
end

""" Distributed a `for` loop among ranks """
macro distribute(exp)
if exp.head != :for
error("The `@distribute` macro expects a `for` loop")
end

mpi_initialized = MPI.Initialized()
if !mpi_initialized
return esc(exp)
end

rank = MPI.Comm_rank(MPI.COMM_WORLD)
nprocs = MPI.Comm_size(MPI.COMM_WORLD)
iterable = exp.args[1].args[2]
variable = exp.args[1].args[1]
forbody = exp.args[2]

new_loop = quote
for (counter, $variable) in enumerate($iterable)
if $variable % $nprocs == $rank
$forbody
end
end
global_barrier()
end

return esc(new_loop)
end
Loading