Skip to content

Conversation

ursg
Copy link
Contributor

@ursg ursg commented Feb 8, 2021

Without this, writing a 5th refinement level would have silently failed and restarting from those file (or plotting them) would have just given bogus data.

This fixes #517.

Tested with the restart_write and restart_read tests, and by plotting files with visit.

Without this, writing a 5th refinement level would have silently failed.
@ursg ursg added this to the Vlasiator 5.2 milestone Feb 8, 2021
@ykempf
Copy link
Contributor

ykempf commented Feb 8, 2021 via email

@ursg
Copy link
Contributor Author

ursg commented Feb 8, 2021

Yep. It actually only changed a single line, where the data was written.
Indeed, since I just checked: we never even read MESH_DOMAIN_SIZES in the fsgrid reader code, so this would only break the Visit plugin reading.

@ykempf
Copy link
Contributor

ykempf commented Feb 8, 2021 via email

@markusbattarbee
Copy link
Contributor

According to #517, the Visit plugin already reads it correctly so no change is required:

In fact, the visit plugin reads this number as a int64_t, and it seems to be by pure coincidence that it works correctly at all: > https://github.com/fmihpc/vlsv/blob/master/visit-plugin/mesh_metadata_visit_ucd_generic_multi.cpp#L357

@markusbattarbee
Copy link
Contributor

Hmm, actually looks like line

uint32_t domainSize[numberOfDomainTypes];

also has the mesh domain size as uint32_t

And in ioread.cpp we do read the mesh domain size but that's already uint64_t.

@markusbattarbee
Copy link
Contributor

vlsvdiff.cpp line 259
std::array<uint32_t,2> meshDomainSize({globalIds.size(), 0});

@ursg
Copy link
Contributor Author

ursg commented Feb 9, 2021

Hmm, actually looks like line

uint32_t domainSize[numberOfDomainTypes];

also has the mesh domain size as uint32_t

True, but in that case I'm not so worried about it, since that affects vlasovGrid and individiual velocity grids only. For those, we are still very comfortably away from 2³² cells. Of course it doesn't really hurt to just change that also, then we should be future-proof forever in this respect.

And in ioread.cpp we do read the mesh domain size but that's already uint64_t.

And those are really just the velocity space mesh domains. They will remain small for all forseeable future. :)

@markusbattarbee
Copy link
Contributor

But does the visit plugin read those in as uint64s? Even if we don't need the memory space quite yet, we should consolidate the variable size between the different access methods.

@ursg
Copy link
Contributor Author

ursg commented Feb 9, 2021

vlsvdiff.cpp line 259
std::array<uint32_t,2> meshDomainSize({globalIds.size(), 0});

Good catch, I'm fixing and testing this.

@ursg
Copy link
Contributor Author

ursg commented Feb 9, 2021

But does the visit plugin read those in as uint64s? Even if we don't need the memory space quite yet, we should consolidate the variable size between the different access methods.

Yes it does, see here: https://github.com/fmihpc/vlsv/blob/master/visit-plugin/mesh_metadata_visit_ucd_amr.cpp#L251
The vlsvReader::read function at the moment does the datatype upconversion from 32bit to 64bit here: https://github.com/fmihpc/vlsv/blob/master/vlsv_reader.h#L110

ursg added a commit to ursg/vlasiator that referenced this pull request Feb 11, 2021
Compare issue fmihpc#517 and pull request fmihpc#532.
Even though this is not likely to ever be an issue for the ionosphere,
this does squelch two compilation warnings.
@markusbattarbee
Copy link
Contributor

I think we could move this up to Vlasiator-5.1 as it is required for compiling with AOCC / clang on some systems

@ursg ursg modified the milestones: Vlasiator 5.2, Vlasiator 5.1 Mar 1, 2021
@ursg
Copy link
Contributor Author

ursg commented Mar 1, 2021

And actually: is there anything preventing us from merging this immediately? It seems to work well and improve compilation on AOCC.

@markusbattarbee markusbattarbee self-requested a review March 1, 2021 13:09
Copy link
Contributor

@markusbattarbee markusbattarbee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let it merge!

@ursg ursg merged commit a084390 into fmihpc:dev Mar 1, 2021
@ursg ursg deleted the writeFsgrid64bit branch March 1, 2021 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants