Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F95811011
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
Thu, Dec 19, 12:18
Size
480 B
Mime Type
text/x-python
Expires
Sat, Dec 21, 12:18 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23046601
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