compdyn / partmc

Particle-resolved stochastic atmospheric aerosol model
http://lagrange.mechse.illinois.edu/partmc/
GNU General Public License v2.0
27 stars 15 forks source link

Use rxn_offsets instead of rxn_pointers #111

Closed cguzman95 closed 4 years ago

cguzman95 commented 4 years ago

I'm working on GPU implementation, and I need to copy the contents of RXN structure to another structure to improve the memory access on GPU. The case is that using the rxn_pointers, I don't know how much has to copy for the last value.

Thus, I propose to save an array of rxn_offsets. The first value will be always zero (since to access the first value we don't need to move the pointer), the second will be the length of the first rxn, and go on. This is very similar to the implementation of SPARSE matrix

What do you think @mattldawson ?

mattldawson commented 4 years ago

sounds like a good idea to me. we should probably do the same for the aero_rep and sub_model pointers too, just to be consistent.

cguzman95 commented 4 years ago

Ok I will do the three cases

cguzman95 commented 4 years ago

Another related question, can I move n_rxn away from condensed structure? (to model_data->n_rxn). Actually, it difficulties dealing with RXN and I think away from it will be more clear and easier to identify

mattldawson commented 4 years ago

That's fine with me. Can you do the same for n_aero_rep, n_aero_phase, and n_sub_model too? Just so everything works the same.

cguzman95 commented 4 years ago

Yep

cguzman95 commented 4 years ago

Done on issue 99