Memory problem of symmetric groups
In my program I need to use all elements of a symmetric group $S_n$. In the case of $n=15$, it is said that there is memory problem. I sent the codes to a computer cluster and obtained the following error:
Traceback (most recent call last):
File "/home/fs71797/lij21/chTGr49.sage.py", line 3426, in <module>
c2=ChTUsingKLPolynomialInSage(T1,k)
File "/home/fs71797/lij21/chTGr49.sage.py", line 74, in ChTUsingKLPolynomialInSage
l=list(W)
MemoryError
My code is as follows:
l=list(W)
with Pool() as p: #...map below action to as many cores as available
bb = p.starmap(ChTUsingKLPolynomialInSageHalf,[(k,l[i],w0,w,W,T1) for i in range(len(l))])
W is $S_n$. I do not need to store list(W) but only need to take every element of list(W).
The slurm script I used is as follows:
#!/bin/bash
#SBATCH -n 48
#SBATCH -N 1
#SBATCH -t 3-0:00
#SBATCH --mem=96000
#SBATCH -o clusterGr49.o
#SBATCH -e clusterGr49.e
module load sage
sage chTGr49.sage
Is there some way to solve this memory problem? Thank you very much.
Use iterators, do not create a full list. Go and see any basic python manual.
"I do not need to store list(W)" - then why do you create this list?
@FrédéricC, @max, thanks a lot! I tried to remove list(W) and use iter(W) in the loop
Maybe it will work. I will try to run it on the computer cluster.
You could in fact just try
for i in W
.