Links array#410
Open
alexei-borissov wants to merge 10 commits into
Open
Conversation
Bug fix release
Release 0.24.0
…e correct parameters when recreating colloids info
This reverts commit 5ebd6a8.
Collaborator
There was a problem hiding this comment.
For the allocation of rb it should be possible to do something like (schematically):
rb = (double **) malloc(3);
rb[0] = (double *) malloc(3*nlinks);
/* ... and initialise pointers ... */
for (int i = 1; i < 3; i++) {
rb[i] = rb[i-1] + nlinks;
}
which would be dereferenced rb[X][ilink] etc. So two allocations only.
| tdpAssert(tdpMallocManaged((void **) &pc->links->status, pc->links->max_links*sizeof(int), tdpMemAttachGlobal)); | ||
| tdpAssert(tdpMallocManaged((void **) &pc->links->rb, pc->links->max_links*sizeof(double *), tdpMemAttachGlobal)); | ||
| for (int i = 0; i < pc->links->max_links; i++) { | ||
| tdpAssert(tdpMallocManaged((void **) &pc->links->rb[i], 3*sizeof(double), tdpMemAttachGlobal)); // XXX: change order to reduce number of managed allocations. |
Collaborator
There was a problem hiding this comment.
See general comment.
|
|
||
| colloid_t * bonded[NBOND_MAX]; | ||
|
|
||
| colloid_links_array_t * links; /* Arrays of links for this colloid. */ // XXX: Check that this is copied between host and device versions correctly. |
Collaborator
There was a problem hiding this comment.
Device memory test?
Collaborator
There was a problem hiding this comment.
Utility for, e.g,:
/* Copy data from structure to array at index */
void colloid_link_to index(colloid_links_array_t * array, int index, const colloid_link_t * data);
/* Extract boundary vector from internal storage for link index */
void colloid_link_rb(colloid_links_array_t * array, int index, double rb[3]);
/* "Destructor" */
may be useful.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use array instead of linked list for storing links.