Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
multiprocessing-examples
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Gepetto
multiprocessing-examples
Commits
922c2d2d
Commit
922c2d2d
authored
2 years ago
by
Guilhem Saurel
Browse files
Options
Downloads
Patches
Plain Diff
pfc-2: done
parent
74a16fa3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
pfc-2/README.md
+15
-0
15 additions, 0 deletions
pfc-2/README.md
pfc-2/requirements.txt
+1
-0
1 addition, 0 deletions
pfc-2/requirements.txt
pfc-2/schedule.sh
+2
-0
2 additions, 0 deletions
pfc-2/schedule.sh
pfc-2/work.py
+9
-2
9 additions, 2 deletions
pfc-2/work.py
with
27 additions
and
2 deletions
pfc-2/README.md
+
15
−
0
View file @
922c2d2d
# pfcalcul 2
extend pfc-1 with a venv
You'll need:
-
understanding of pfc-1
-
a copy of this example in
`/pfcalcul/work/$USER/pfc-2`
-
create a venv inside and instadd dependencies, eg.:
```
bash
cd
/pfcalcul/work/gsaurel/pfc-2
python3
-m
venv venv
source
venv/bin/activate
python3
-m
pip
install
--upgrade
pip
python3
-m
pip
install
-r
requirements.txt
```
Then, after starting a Manager and a Boss as in pfc-1, you should be good for
`sbatch ./schedule.sh`
This diff is collapsed.
Click to expand it.
pfc-2/requirements.txt
0 → 100644
+
1
−
0
View file @
922c2d2d
pin
This diff is collapsed.
Click to expand it.
pfc-2/schedule.sh
+
2
−
0
View file @
922c2d2d
...
...
@@ -6,4 +6,6 @@
#SBATCH --output=output-%A-%a-%N.log
#SBATCH --error=output-%A-%a-%N.err
source
venv/bin/activate
HOST
=
pfcalcul.laas.fr ./minion.py 10
This diff is collapsed.
Click to expand it.
pfc-2/work.py
+
9
−
2
View file @
922c2d2d
#!/usr/bin/env python3
"""
Hard work here. Not efficient, but hard.
"""
from
typing
import
Tuple
import
pinocchio
as
pin
# type: ignore
def
is_prime
(
number
:
int
)
->
bool
:
"""
Check if a number is prime.
"""
return
not
any
(
number
%
i
==
0
for
i
in
range
(
2
,
number
))
def
find_prime
(
goal
:
int
=
10
,
verbose
:
bool
=
False
)
->
int
:
def
find_prime
(
goal
:
int
=
10
,
verbose
:
bool
=
False
)
->
Tuple
[
int
,
int
]
:
"""
Find the goal-th prime number.
"""
found
=
0
i
=
1
# let's enumerate all numbers
...
...
@@ -17,8 +21,11 @@ def find_prime(goal: int = 10, verbose: bool = False) -> int:
found
+=
1
if
verbose
:
print
(
f
'
the prime number n°
{
found
}
is
{
i
}
'
)
return
i
n
=
pin
.
Quaternion
(
i
,
i
,
i
,
i
).
norm
()
print
(
f
"
the norm of a quaternion with
{
i
}
as all members is
{
n
}
"
)
return
i
,
n
if
__name__
==
'
__main__
'
:
print
(
find_prime
(
50
,
verbose
=
True
))
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