Skip to content

Commit dc2e28c

Browse files
author
Thomas Weise
committed
Added StructTest.c Struct Layout Output for Two Computers
1 parent fe0641d commit dc2e28c

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

mpi/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ Build: `mpicc reducePrimes.c -o reducePrimes -lm`
125125
This example does no communication at all, but it prints the memory layout of a `struct`. This shows that the compiler may align fields in many ways and we cannot compute on where a field of a `struct` but need to use proper addressing.
126126

127127
1. [structTest.c](http://github.com/thomasWeise/distributedComputingExamples/tree/master/mpi/structTest.c)
128+
2. [structTest_32bit_intel_atom_N280_gcc_4.8.4.txt](http://github.com/thomasWeise/distributedComputingExamples/tree/master/mpi/structTest_32bit_intel_atom_N280_gcc_4.8.4.txt)
129+
2. [structTest_64bit_intel_xeon_e3-1230_gcc_5.2.1.txt](http://github.com/thomasWeise/distributedComputingExamples/tree/master/mpi/structTest_64bit_intel_xeon_e3-1230_gcc_5.2.1.txt)
128130

129131
Build: `mpicc structTest.c -o structTest`
130132

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Struct is 28 bytes large.
2+
Field "myIntA" begins at offset 0 and is 4 bytes large.
3+
Field "myIntB" begins at offset 4 and is 4 bytes large.
4+
Field "myShort" begins at offset 8 and is 2 bytes large.
5+
Field "myDouble" begins at offset 12 and is 8 bytes large.
6+
Field "myChar" begins at offset 20 and is 1 bytes large.
7+
Field "myFloat" begins at offset 24 and is 4 bytes large.
8+
Effectively used data size is 23.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Struct is 32 bytes large.
2+
Field "myIntA" begins at offset 0 and is 4 bytes large.
3+
Field "myIntB" begins at offset 4 and is 4 bytes large.
4+
Field "myShort" begins at offset 8 and is 2 bytes large.
5+
Field "myDouble" begins at offset 16 and is 8 bytes large.
6+
Field "myChar" begins at offset 24 and is 1 bytes large.
7+
Field "myFloat" begins at offset 28 and is 4 bytes large.
8+
Effectively used data size is 23.

0 commit comments

Comments
 (0)