Memory problem of symmetric groups

asked 2022-04-22 08:26:42 +0100

lijr07 gravatar image

updated 2022-04-22 08:29:34 +0100

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.

edit retag flag offensive close merge delete

Comments

2

Use iterators, do not create a full list. Go and see any basic python manual.

FrédéricC gravatar imageFrédéricC ( 2022-04-22 08:37:33 +0100 )edit

"I do not need to store list(W)" - then why do you create this list?

Max Alekseyev gravatar imageMax Alekseyev ( 2022-04-22 16:19:46 +0100 )edit

@FrédéricC, @max, thanks a lot! I tried to remove list(W) and use iter(W) in the loop

bb = p.starmap(ChTUsingKLPolynomialInSageHalf,[(k,i,w0,w,W,T1) for i in iter(W)])

Maybe it will work. I will try to run it on the computer cluster.

lijr07 gravatar imagelijr07 ( 2022-04-22 16:46:04 +0100 )edit

You could in fact just try for i in W.

John Palmieri gravatar imageJohn Palmieri ( 2022-04-22 16:58:46 +0100 )edit