Replies: 1 comment
|
I think it's a good idea, or at least to have
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
It may be possible to save a significant amount of memory if connectivity variables are stored as int32 instead of int64. Right now it looks like the default for connectivity is
INT_DYPE = np.intp, which resolves tonp.int64on 64-bit machines, andnp.int32on 32-bit machines.int32 can store values up to roughly 2.1 billion, which is likely sufficient even in most (all?) large use cases. Could also check something like "are there <2.1 billion faces, nodes, and edges? If yes, use int32, else use int64" to be safe. For reference, the 3km MPAS grid has roughly 65 million faces, which should fit comfortably into int32.
Advantages of int32:
face_node_connectivity) and it is usually has a sizeable memory cost due to having two dimensions (e.g.n_face, n_max_face_nodes)Possible disadvantages:
np.intpif not already that type (e.g.:mydata[grid.face_node_connectivity]castsgrid.face_node_connectivitytoint64on 64-bit machines). Although, indexing by connectivity directly is tricky anyway since faces have differing numbers of nodes. I think most internal uxarray code uses numba when utilizing connectivity variables, not numpy indexing. I believe numba wouldn't do any surprising type-casting like this.Questions:
uxarray.set_options(connectivity_can_use_int32=True))?All reactions