Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix traits GetUniqueTypeId #1021

Conversation

psychocoderHPC
Copy link
Member

  • assert in getUniqueTypeId is triggert with a special environment on hypnos
  • baseUId is not smallest created id

fix:

  • explicit initialize the base TypeId with GetUniqueTypeId<uint8_t>::byte
  • remove pointer address magic
  • add base type with static global counter
  • add boost::numeric::bounds for max value calculation

Environment:

module load gcc/4.8.2
module load cmake/3.0.1
module load cuda/6.5
module load openmpi/1.8.4.kepler
module load boost/1.54.0

# Plugins (optional)
module load pngwriter/0.5.4
module load hdf5-parallel/1.8.14 libsplash/1.2.4
module load numactl/2.0.7
module load paraview/3.98.laser
module load svn
module load gnuplot/4.2.6

Tested with:

  • gnu 4.8.2
  • llvm/3.4
  • pgi/15.5
  • intel/2015.3.187
  • gnu 4.8.2 (on 4 nodes with mpiexec)

@psychocoderHPC psychocoderHPC added the bug a bug in the project's code label Aug 6, 2015
@psychocoderHPC psychocoderHPC added this to the Open Beta milestone Aug 6, 2015
@BenjaminW3
Copy link
Member

I have seen this coming 😄

Currently you specialize the uint8_t case, which is equal to the base id, to be equal to zero. What is then left of the purpose of the base id subtraction? Could we fully remove this subraction?

@n01r
Copy link
Member

n01r commented Aug 6, 2015

Thanks, though - worked for me!

@psychocoderHPC
Copy link
Member Author

@BenjaminW3 If have changed the algorithm to create IDs. Now it is a counter based on the some method like before. Every time a compiler sees a new type the id of the base type is incremented and stored in the new type.

@BenjaminW3
Copy link
Member

In the current version the <iostream> and <cassert> headers can be removed.

@psychocoderHPC
Copy link
Member Author

I removed the not used includes and add some missing one.


#include <sstream>
#include <string>
#include <exception>
Copy link
Member

Choose a reason for hiding this comment

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

While testing this header in isolation I found that std::runtime_error is defined in <stdexcept> and not in <exception>.
Could you additionally add the missing #include <climits> for CHAR_BIT?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes we should add both includes, thx

- getUniqueTypeId with a special environment on hypnos
- baseUId is not smallest created id

fix:

- remove pointer address magic
- add base type with static global counter
@psychocoderHPC
Copy link
Member Author

removed bit magic calculation for maxValue with boost::numeric::bounds<ResultType>::highest

@ax3l do you know how I can check in which library boost::numeric::bounds is defined?

  • check if boost::numeric::bounds<> is part of the boost components that are set as required in CMakeLists.txt -> current components program_options regex filesystem system

@psychocoderHPC
Copy link
Member Author

boost::numeric::bounds looks like header only. I checked all boost libraries for a symbol highest and found nothing.

@ax3l ax3l added the component: PMacc in PMacc label Aug 7, 2015
@ax3l
Copy link
Member

ax3l commented Aug 7, 2015

@psychocoderHPC yes it's part of Boost.NumericConversion and header only. I added links in the description and your last comment.

I also have a gist for exactly that question because there is actually a large list which is not header-only.

thank you for taking good care when introducing new libraries, perfect! 🚀

BenjaminW3 added a commit that referenced this pull request Aug 7, 2015
@BenjaminW3 BenjaminW3 merged commit 2c3df57 into ComputationalRadiationPhysics:dev Aug 7, 2015
@ax3l
Copy link
Member

ax3l commented Aug 7, 2015

@BenjaminW3

I have seen this coming 😄

^^ me too. good we added asserts!

@psychocoderHPC psychocoderHPC deleted the fix-traitGetUniqueTypeId branch August 7, 2015 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug a bug in the project's code component: PMacc in PMacc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants