I need a list of all combinations of length t
for some computation on a GPU. I used X=itertools.combinations(range(n),t)
to create an iterator. I need to pass all the combinations to the GPU at once, so I use list(X)
to generate all the combinations from the iterator.
For higher values of n and t, I run out of memory. Is there a way to generate multiple smaller lists of all the combinations that can fit in the memory one at a time? For example, if I have n=25
and t=12
, instead of generating all 25 choose 12
combinations, can I get a list of 10,000
combinations at a time which I can process on the GPU?