Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121916321
stress.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jul 14, 19:52
Size
480 B
Mime Type
text/x-python
Expires
Wed, Jul 16, 19:52 (2 d)
Engine
blob
Format
Raw Data
Handle
27412893
Attached To
R9795 DCSR Cluster Examples
stress.py
View Options
import
time
import
sys
from
multiprocessing
import
Pool
m_100
=
4
_000_000
# 1.23 secs
m_1G
=
45
_000_000
# 3.47
m_10G
=
450
_000_000
# 26 secs
ncpus
=
1
if
len
(
sys
.
argv
)
>
1
:
ncpus
=
int
(
sys
.
argv
[
1
])
def
kernel
(
n
,
t
=
2
):
str1
=
'aBcd'
*
n
str1
.
replace
(
'aB'
,
'z11aaa'
)
str1
.
swapcase
()
time
.
sleep
(
t
)
print
(
"Kernel finished"
)
if
__name__
==
'__main__'
:
inputs
=
[
m_1G
]
*
30
with
Pool
(
ncpus
)
as
p
:
p
.
map
(
kernel
,
inputs
)
print
(
f
"Run finished"
)
Event Timeline
Log In to Comment