56 lines
1.5 KiB
Python
56 lines
1.5 KiB
Python
import random
|
|
|
|
BASE="""
|
|
salloc -N {nodes} --exclusive \\
|
|
mpirun --bind-to none -mca btl ^openib -npernode 1 \\
|
|
numactl --physcpubind 0-39 \\
|
|
./main -v -p {padding} -d {dilation} -s {stride} {N} {C} {H} {W} {K} {R} {S} \\
|
|
"""
|
|
|
|
for i in range(10):
|
|
nodes=random.randint(1,2)
|
|
padding=random.randint(0,10)
|
|
stride=random.randint(1,5)
|
|
dilation=random.randint(1,5)
|
|
N=random.randint(1,128)
|
|
C=random.randint(1,128)
|
|
H=random.randint(1,128)
|
|
W=random.randint(1,128)
|
|
K=random.randint(1,128)
|
|
R=random.randint(1,128)
|
|
S=random.randint(1,128)
|
|
|
|
OH = (H + 2 * padding - dilation * (R - 1) - 1) // stride + 1
|
|
OW = (W + 2 * padding - dilation * (S - 1) - 1) // stride + 1
|
|
FLOPS = 2 * N * K * OH * OW * C * R * S
|
|
|
|
while not(OH > 0 and OW > 0 and FLOPS < 100 * 1e9):
|
|
padding=random.randint(0,10)
|
|
stride=random.randint(1,5)
|
|
dilation=random.randint(1,5)
|
|
N=random.randint(1,128)
|
|
C=random.randint(1,128)
|
|
H=random.randint(1,128)
|
|
W=random.randint(1,128)
|
|
K=random.randint(1,128)
|
|
R=random.randint(1,128)
|
|
S=random.randint(1,128)
|
|
OH = (H + 2 * padding - dilation * (R - 1) - 1) // stride + 1
|
|
OW = (W + 2 * padding - dilation * (S - 1) - 1) // stride + 1
|
|
FLOPS = 2 * N * K * OH * OW * C * R * S
|
|
|
|
|
|
print(BASE.format(
|
|
nodes=nodes,
|
|
padding=padding,
|
|
stride=stride,
|
|
dilation=dilation,
|
|
N=N,
|
|
C=C,
|
|
H=H,
|
|
W=W,
|
|
K=K,
|
|
R=R,
|
|
S=S,
|
|
))
|