Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
docs.it4i.cz
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
SCS
docs.it4i.cz
Commits
1ffbe2d4
Commit
1ffbe2d4
authored
1 year ago
by
Lukáš Krupčík
Browse files
Options
Downloads
Patches
Plain Diff
fix-matrix
parent
41666585
No related branches found
No related tags found
No related merge requests found
Pipeline
#38091
failed
1 year ago
Stage: test
Stage: build
Stage: deploy
Stage: after_test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/modules_matrix.py
+24
-35
24 additions, 35 deletions
scripts/modules_matrix.py
with
24 additions
and
35 deletions
scripts/modules_matrix.py
+
24
−
35
View file @
1ffbe2d4
#!/usr/bin/env python
#!/usr/bin/env python
3
# -*- coding: utf-8 -*-
"""
modules_matrix
"""
from
__future__
import
print_function
import
argparse
import
csv
import
itertools
import
json
import
os.path
import
packaging.specifiers
def
arg_parse
():
"""
a
rgument parser
A
rgument parser
"""
parser
=
argparse
.
ArgumentParser
(
description
=
"
Module_matrix
"
...
...
@@ -24,32 +21,29 @@ def arg_parse():
return
parser
.
parse_args
()
def
get_data
(
filename
):
'''
f
unction to read the data f
o
rm the input
csv
file to use in the analysis
'''
"""
F
unction to read the data fr
o
m the input
CSV
file to use in the analysis
"""
reader
=
[]
# Just in case the file open fails
with
open
(
filename
,
'
r
'
)
as
fdata
:
reader
=
csv
.
reader
(
fdata
,
delimiter
=
'
,
'
)
# returns all the data from the csv file in list form
# print(list(reader))
return
list
(
reader
)
# only return the reader when you have finished.
return
list
(
reader
)
# Only return the reader when you have finished.
def
get_datalist
():
"""
g
et
_
datalist
"""
"""
G
et
data
list
"""
datalist
=
[]
for
name
in
[
'
karolina
'
,
'
dgx
'
,
'
barbora
'
]:
path
=
os
.
path
.
join
(
'
scripts
'
,
"
{}.csv
"
.
format
(
name
)
)
path
=
os
.
path
.
join
(
'
scripts
'
,
f
"
{
name
}
.csv
"
)
datalist
+=
get_data
(
path
)
return
datalist
def
get_counts
(
datalist
):
"""
g
et
_
counts
"""
counts
=
dict
()
"""
G
et
counts
"""
counts
=
{}
for
i
in
datalist
:
counts
[
i
[
0
]]
=
counts
.
get
(
i
[
0
],
0
)
+
int
(
i
[
1
])
return
counts
def
get_matrix
():
"""
get_matrix
"""
# 1 2 4 8 16 32
"""
Get matrix
"""
chars
=
[
'
K
'
,
'
B
'
,
'
D
'
]
arr
=
[]
mask
=
''
.
join
(
reversed
(
chars
))
...
...
@@ -65,10 +59,10 @@ def get_matrix():
return
arr
def
get_software
(
datalist
):
"""
g
et
_
software
"""
"""
G
et
software
"""
matrix
=
get_matrix
()
counts
=
get_counts
(
datalist
)
software
=
dict
()
software
=
{}
prev
=
''
for
mat
,
i
in
sorted
(
counts
.
items
()):
split
=
mat
.
split
(
'
/
'
)
...
...
@@ -80,31 +74,28 @@ def get_software(datalist):
return
software
def
packages_json
(
software
):
"""
p
ackages
_json
"""
"""
P
ackages
JSON
"""
packages
=
{}
for
module
in
sorted
(
software
.
items
(),
key
=
lambda
i
:
i
[
0
].
lower
()):
packages
[
module
[
0
]]
=
sorted
(
module
[
1
],
key
=
packaging
.
specifiers
.
LegacyVersion
)[
len
(
module
[
1
])
-
1
]
packages
[
module
[
0
]]
=
sorted
(
module
[
1
])[
-
1
]
data
=
{
'
total
'
:
len
(
packages
),
'
projects
'
:
packages
}
return
data
def
print_software
(
software
):
"""
print_software
"""
versions
=
''
clusters
=
''
"""
Print software
"""
for
module
in
sorted
(
software
.
items
(),
key
=
lambda
i
:
i
[
0
].
lower
()):
software
=
module
[
0
]
software
_name
=
module
[
0
]
versions
=
[]
clusters
=
[]
for
key
in
sorted
(
module
[
1
].
keys
()
,
key
=
packaging
.
specifiers
.
LegacyVersion
):
for
key
in
sorted
(
module
[
1
].
keys
()):
versions
.
append
(
key
)
clusters
.
append
(
module
[
1
][
key
])
print
(
"
| {
} | {} | {} |
"
.
format
(
software
,
'
</br>
'
.
join
(
versions
)
,
'
</br>
'
.
join
(
clusters
)
)
)
print
(
f
"
|
{
software_name
}
|
{
'
</br>
'
.
join
(
versions
)
}
|
{
'
</br>
'
.
join
(
clusters
)
}
|
"
)
print
()
print
(
'
---8<---
"
modules_matrix_search.md
"'
)
def
print_hint
():
"""
p
rint
_
hint
"""
"""
P
rint
hint
"""
print
(
'
!!! Hint
"
Cluster Acronyms
"'
)
print
(
'
```
'
)
print
(
'
D B K
'
)
...
...
@@ -114,13 +105,13 @@ def print_hint():
print
(
'
+--------> DGX
'
)
print
(
'
```
'
)
print
()
print
(
"
{} {} {}
"
.
format
(
'
| Module </br><form><input id=
"
searchInput
"
placeholder=
"
🔍 Filter
"'
,
'
style=
"
width: 8rem; border-radius: 0.2rem; color: black;
'
,
'
padding-left: .2rem;
"
></form> | Versions | Clusters |
'
)
)
print
(
f
"
| Module </br><form><input id=
\
"
searchInput
\
"
placeholder=
\
"
🔍 Filter
\"
"
f
"
style=
\
"
width: 8rem; border-radius: 0.2rem; color: black;
"
f
"
padding-left: .2rem;
\
"
></form> | Versions | Clusters |
"
)
print
(
"
| ------ | -------- | -------- |
"
)
def
print_changelog
():
"""
p
rint
_
changelog
"""
"""
P
rint
changelog
"""
print
(
'
**Modules Changelog**<br>
'
)
print
(
'
You can see the modules changelog for each supercomputer here:<br>
'
)
print
(
'
[DGX modules changelog][1]<br>
'
)
...
...
@@ -128,15 +119,13 @@ def print_changelog():
print
(
'
[Karolina modules changelog][3]<br>
'
)
def
print_links
():
"""
p
rint
_
links
"""
"""
P
rint
links
"""
print
(
'
[1]: https://code.it4i.cz/sccs/it4i-modules/-/blob/master/dgx-changelog.md
'
)
print
(
'
[2]: https://code.it4i.cz/sccs/it4i-modules/-/blob/master/barbora-changelog.md
'
)
print
(
'
[3]: https://code.it4i.cz/sccs/it4i-modules/-/blob/master/karolina-changelog.md
'
)
def
main
():
"""
main function
"""
"""
Main function
"""
arg
=
arg_parse
()
datalist
=
get_datalist
()
software
=
get_software
(
datalist
)
...
...
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