Message Boards Message Boards

Use CUDA to compute large output calculations?

Posted 6 years ago

Could I use CUDA to compute

Tuples[{1,0},26];

Or at 27th with more than 240m possibilities

POSTED BY: Omar Mahmoud
8 Replies

Hi,

this is the image I get after a couple of seconds:

enter image description here

I have access to more powerful machines, but that probably won't be enough if you need to test all permutations. Can you exploit symmetries or anything?

Cheers,

Marco

POSTED BY: Marco Thiel
Posted 6 years ago

I don't need to test "all" permutation but I do need to sort them as you can see now i select "random" rules with no apparent sequence or rythem thus not expecting what to come next in turn not able to optimize the design therefore using this logic i need a list of all permutations so i can call them in order into that code but that list is too heavy on a humble machine thus i thought maybe CUDA could "compile" or "bake" the list where it is faster to call elements in sequence

POSTED BY: Omar Mahmoud

Dear Omar,

well I might be misunderstand what you want to achieve. I also used a machine with 16GB only. So, here is what I did:

alltuples = Tuples[{1, 0}, 27];

Note that I do not (!) print that out on the screen. This is

alltuples // ByteCount
(*28991029392*)

29 GB, but my 16 GB physical memory handle it gracefully. The Wolfram Kernel uses 27.24GB (compressed 26.04) I can recall the tuples, e.g.:

alltuples[[341535]]
(*{1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, \
0, 0, 0, 1}*)

I think I could apply them as substitution rules now. That might take a while and you might want to use "Dispatch". What would these substitution rules look like?

I am not sure whether substitution rules are the best way to go when dealing with such large sets of vectors/sequences.

Best wishes, Marco

PS: I am on OSX 10.13.6.

POSTED BY: Marco Thiel
Posted 6 years ago

Dear Marco,

Thank you for the swift reply and understanding,

u = Table[0, {3}, {3}, {3}];
Ran := Table[RandomInteger[{1, 0}], {3}, {3}, {3}]
SeedRandom[2013]; 
Graphics3D[Cuboid /@ Position[#, 1], ImageSize -> Large, 
   Boxed -> False] &@
 ImageData[
  Binarize@GaussianFilter[(Image3D /@ 
       SubstitutionSystem[{1 -> Ran, 0 -> u}, 1, 5])[[5]], 7]]

Attached is a simple code used to randomly choose one of the "Tuples" discussed above as a rule based substitution system which achieves some desirable outcomes for architectural study im experimenting with.

But using SeedRandom to control the randomness and using randomness in general doesn't give us a sense of what this space of exploration looks like thus needing to sort these rules to be relative to each other, therefore the need for tupling to get these 27 arrays of the 134m permutations in relative order.

I hope this clarifies a bit of why im doing this

As for not printing it out i did that too but yet still not able to calculate it i tried on windows and mac both at 16 GB of ram maybe i need to free some C space and try again. EDIT: C Space is at 123GB of Free storage yet it freezes for more than 3 hours

Attached is a picture of the outcome of this substitution enter image description here

POSTED BY: Omar Mahmoud

Hi everyone,

AbsoluteTiming[Tuples[{1, 0}, 26];]
(*{11.0603, Null}*)

and

AbsoluteTiming[Tuples[{1, 0}, 27];]
(*{24.4937, Null}*)

Cheers,

Marco

POSTED BY: Marco Thiel
Posted 6 years ago

Good evening marco

Well i did try that but at 16GB of RAM there is insufficient physical memory so do you recommend anyway to calculate this tupeling with less memory and being able to recall them in order?

Please refer to my previous reply to get what im trying to achive

POSTED BY: Omar Mahmoud
Posted 6 years ago

How do you suppose that Tuples[{1,0},27]; has over 240m possibilities? 2^27 = 134,217,728

But 134,217,728 length 27 arrays might require well above the amount of memory available on some consumer machines.

Generally if you're dealing with stuff like this you might want to search for a more efficient algorithm for whatever you're trying to accomplish.

POSTED BY: Kyle Martin
Posted 6 years ago

My apologies i did assume on 28th, I'm trying to sort every possible outcome of a binary - on or off- of a 3 dimensional object hence the number 27 where 1 centroid surrounded by 26 cuboids and use these 134,217,728 possibile permutations as bases for rule substitution in 3D

POSTED BY: Omar Mahmoud
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract