Hi Mark,

 it's not just the memory savings aspect. I was recently stumbling across
the issue to get meshes on a graphics card, and of course you'll try to be
as general enough to store it all just using "int". However, as GPU's don't
support 64bit integer, it required to convert all the 64bit int's to 32bit
prior to shuffling them to the graphics card. On a 32bit machine that of
course was not required, making the rendering on the 32bit machine faster
than on 64bit. This should just not be the case... so unless there are
data which require more than 4 billion vertices (which can't be directly
rendered any more anyway), doing consistently 32bit everywhere is just
more efficient (in this situation).

        Werner



On Mon, 24 May 2010 12:10:02 -0500, Mark Miller <[email protected]> wrote:

Hi Werner,

Hmm. Well, it certainly is true that 'int' on a 64 bit machine can wind
up being twice as many bytes as 'int' on a 32 bit machine.

But, unless I am really, really cramped for memory, I would just as soon
write my code to use 'int' everywhere and let the compiler and I/O
library handle everything for me automagically.

I don't want to have to worry about sizeof(int) unless I really need to.
And, most often, I don't. Unless I am moving data between 64-bit and
32-bit systems a lot. And then, I am still most interested in portable
code and data.

But, I do see your point that there is a 2x memory savings to be had by
choosing the type carefully.

Mark


On Mon, 2010-05-24 at 09:57, Werner Benger wrote:
On Mon, 24 May 2010 11:40:46 -0500, Quincey Koziol <[email protected]> wrote:
> On May 23, 2010, at 11:27 PM, Mark Miller wrote:
>>
>> b) you write 64-bit integer dataset AND the values stored in it are
>> indeed large enough to REQUIRE 64 bits and your 32 bit system does NOT
>> have an appropriate integer type (e.g. long int or long long or
>> something) to read it back into. Note, if you write 'int' on your 64 bit
>> system and the values are small enough to fit into 32 bit, I am not sure
>> if HDF5 will handle reading it into an 'int' on your 32 bit system or
>> not. I think it will but I am not sure. You could explicitly attempt to
>> read it into long int or long long or int64 if your system supports
>> those types AND they are indeed 64 bit.
>
>    Yes, the conversion will work, but your values may be truncated.
>
If 64-bit values are small enough in their numerical range to fit into
32bit range, it would be better to store them as 32bit "int32_t" and not
int's anyway, even on a 64bit machine...

It's overkill to store all and everything in 64bit even if not required.
For instance, graphics hardware doesn't know about 64bit int's on indices,
even on 64bit machines handling otherwise huge data beyond 2GB.

        Werner


--
___________________________________________________________________________
Dr. Werner Benger                Visualization Research
Laboratory for Creative Arts and Technology (LCAT)
Center for Computation & Technology at Louisiana State University (CCT/LSU)
211 Johnston Hall, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809                        Fax.: +1 225 578-5362

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Reply via email to