3 icon indicating copy to clipboard operation
3 copied to clipboard

defregion?

Open Chris317 opened this issue 3 years ago • 3 comments

The default region can only set 256 different regions. What should I do if I want to set 300 different Msats?

Chris317 avatar Dec 19 '22 12:12 Chris317

It's not possible with the current mumax binaries. You can modify the source code and recompile mumax. It will probably come at a performance cost but it might not be noticeable. Anyway, if you can find a work around, you should

MathieuMoalic avatar Dec 19 '22 12:12 MathieuMoalic

Hello,

As Mathieu mentioned, there is a limit of 256. If you need more, you will to modify the source code and recompile. You can see an existing topic on the subject here:

https://github.com/mumax/3/issues/124#issue-255113504

It is not too difficult, basically ones needs to change the regions variable from 8-bit type (bytes in Go, uint8_t in Cuda) to something larger (note this will come with a memory penalty which scales as NREGIONS squared).

Instead, I would also recommend trying to find a workaround. Often you can use less regions with some clever tricks without greatly affecting the result. For example, instead of picking 300 separate Msats, have them randomly pick from a distribution of 30 (or 250) or so. Any regions that happen to have the same value can reuse the same region parameter value.

Best, Josh L.

jplauzie avatar Dec 30 '22 23:12 jplauzie

Hello,

As Mathieu mentioned, there is a limit of 256. If you need more, you will to modify the source code and recompile. You can see an existing topic on the subject here:

#124 (comment)

It is not too difficult, basically ones needs to change the regions variable from 8-bit type (bytes in Go, uint8_t in Cuda) to something larger (note this will come with a memory penalty which scales as NREGIONS squared).

Instead, I would also recommend trying to find a workaround. Often you can use less regions with some clever tricks without greatly affecting the result. For example, instead of picking 300 separate Msats, have them randomly pick from a distribution of 30 (or 250) or so. Any regions that happen to have the same value can reuse the same region parameter value.

Best, Josh L.

Thanks for this guide! I want to change the limit too. I have tried to chage the 8-bit type (bytes in Go, uint8_t in Cuda) to 16-bit, but it didnot work, maybe I did not change all the regions variable that should be changed. So, can you please help to point out which files should be changed? Thanks again.

1eevy avatar Feb 09 '23 06:02 1eevy

Due to the prohibitive performance impact associated with increasing the number of regions, mumax³ will stick to supporting a maximum of 256.

JonathanMaes avatar Oct 10 '24 15:10 JonathanMaes