Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Summa Actors
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Numerical_Simulations_Lab
Actors
Summa Actors
Commits
071f2ee7
Commit
071f2ee7
authored
2 years ago
by
Kyle Klenk (kck540)
Browse files
Options
Downloads
Patches
Plain Diff
new python utility files
parent
08ffeb67
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
config/caf-application.conf
+1
-1
1 addition, 1 deletion
config/caf-application.conf
utils/netcdf/checkbit4bit.py
+46
-0
46 additions, 0 deletions
utils/netcdf/checkbit4bit.py
utils/netcdf/resourageUsage.py
+7
-0
7 additions, 0 deletions
utils/netcdf/resourageUsage.py
with
54 additions
and
1 deletion
config/caf-application.conf
+
1
−
1
View file @
071f2ee7
caf
{
# Parameters selecting a default scheduler.
scheduler
{
max
-
threads
=
2
max
-
threads
=
4
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
utils/netcdf/checkbit4bit.py
0 → 100644
+
46
−
0
View file @
071f2ee7
import
sys
import
numpy
as
np
import
xarray
as
xr
from
pathlib
import
Path
PRINT_MESSAGE
=
'
Test {0: >3} - Filename: {1: <64} - Total difference: {2: <8}
'
ERROR_MESSAGE
=
'
Found differences in test cases: {}
'
SUCCESS_MESSAGE
=
'
SUCCESSFUL TEST RUN: All files match!
'
USAGE
=
'
USAGE: ./check_bit_4_bit.py BENCHMARK_DIRECTORY TEST_DIRECTORY
'
if
len
(
sys
.
argv
)
!=
3
:
print
(
USAGE
)
exit
(
1
)
bench_dir
=
sys
.
argv
[
1
]
test_dir
=
sys
.
argv
[
2
]
bench_files
=
sorted
(
list
(
Path
(
bench_dir
).
glob
(
'
**/*.nc
'
)))
test_files
=
sorted
(
list
(
Path
(
test_dir
).
glob
(
'
**/*.nc
'
)))
assert
len
(
bench_files
)
==
len
(
test_files
),
\
'
Found {} files but need {}!
'
.
format
(
len
(
test_files
),
len
(
bench_files
))
def
rem
(
li1
,
li2
):
return
list
(
set
(
li1
)
-
set
(
li2
))
def
compute_diffs
(
bench_files
,
test_files
):
all_diffs
=
[]
all_tots
=
[]
for
i
,
(
f1
,
f2
)
in
enumerate
(
zip
(
bench_files
,
test_files
)):
ds1
,
ds2
=
xr
.
open_dataset
(
str
(
f1
)),
xr
.
open_dataset
(
str
(
f2
))
diff
=
(
ds1
-
ds2
).
sum
(
dim
=
'
time
'
)
tot
=
0.0
for
v
in
rem
(
list
(
diff
.
variables
.
keys
()),
list
(
diff
.
dims
.
keys
())):
tot
+=
np
.
sum
(
diff
[
v
].
values
)
all_diffs
.
append
(
diff
)
all_tots
.
append
(
tot
)
print
(
PRINT_MESSAGE
.
format
(
i
,
str
(
f1
).
split
(
'
/
'
)[
-
1
],
tot
))
return
all_diffs
,
all_tots
all_diffs
,
all_tots
=
compute_diffs
(
bench_files
,
test_files
)
assert
np
.
sum
(
np
.
absolute
(
all_tots
))
==
0.0
,
\
ERROR_MESSAGE
.
format
(
np
.
argwhere
(
np
.
asarray
(
all_tots
)
!=
0
))
print
(
SUCCESS_MESSAGE
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
utils/netcdf/resourageUsage.py
0 → 100644
+
7
−
0
View file @
071f2ee7
import
subprocess
cmd
=
subprocess
.
Popen
(
'
seff 59326149_1
'
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
)
for
line
in
cmd
.
stdout
:
if
b
'
CPU Utilized:
'
in
line
:
print
(
line
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment