代写代考 MEMORY LAYOUT EXERCISE

MEMORY LAYOUT EXERCISE

Introduction
• This exercise looks at inspecting memory layout from a High level language

Copyright By PowCoder代写 加微信 powcoder

• Download memory.tar from learn
• Extract with tar xvf Memory.tar
• Load the compilers module load intel-compilers-19 • Compile using icc or ifort as appropriate

• Sample code contains a number of HLL variable declarations.
• For each of the following print the size of the type in bytes and its address (in hexadecimal)
• In C use the sizeof and & operators • In Fortran use SIZEOF and LOC
• These are common extensions though not part of the Fortran standard.

64-bit floating point
32-bit floating point
Structure/type
Structure components
var.a var.s var.d
var%a var%b var%d
Array element
a(1,:) a(3,:)
Array column
a(:.1) a(:,3)

Things to look for
• How is the compiler allocating the variables.
• Compare the Intel and Gnu compilers do they behave
differently?
• How is the memory alignment of the variables related to their size?
• How are the addresses of the type components related to the address of the full type.
• What happens if you permute the order of the components?
• In Fortran what happens if you add the sequence keyword to the type.

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com