IBM Support

How is compiler performance impacted when using defferent memory model?

Troubleshooting


Problem

How is compiler performance impacted when using defferent memory model?

Resolving The Problem

We have to put large memory model option when we compile any parallel libraries to use more than 2GB of memory per process for parallel computing. How is compiler performance impacted when using defferent memory model?

1. Intel Compiler Website provides a description on Memory Models:
------------------------------------------------------------------------
Small, Medium and Large Memory Models on Intel® EM64T-based Systems
Applications built to take advantage of Intel EM64T can be built with one of three
memory models:

Small (default)
Code and data are restricted to the first 2GB of address space, so that all
accesses of code and data can be done with Instruction Pointer (IP)-relative
addressing

Medium (-mcmodel=medium)
Code is restricted to the first 2GB, no restriction on data; code can be accessed
with IP-relative addressing, but access of data must use absolute addressing.

Large ( -mcmodel=large)
No restrictions on code or data; accesses to both code and data use absolute addressing IP-relative addressing requires only 32 bits, whereas absolute addressing requires 64-bits. This can affect code size and performance (IP-relative addressing is somewhat faster.)

Note:
When the medium or large memory models are specified, you must also specify -i-dynamic to ensure that the correct dynamic versions of the Intel run-time libraries are used.

When shared objects (.so) are built, Position-Independent Code (PIC) is specified ( - fpic is added by the compiler driver) so that a single .so can support all three memory models. However, code that is to be placed in a static library, or linked statically, must be built with the proper memory model specified. Note that there is a performance impact to specifying the Medium or Large memory models
------------------------------------------------------------------------

 


2. Portalnd Group Compiler Website also provides illustration on Memory Models:
------------------------------------------------------------------------

 

The -mcmodel=medium option must be used to compile/link a program whose data and .bss sections exceed 2GB. In order for the program to use these large data sections, additional addressing instructions that support 64-bit offsets need to be generated. The effect this option has on performance is a function of the amount of data-use in the application. Therefore, this option should be used only when the aggregate data size exceeds 2GB.

------------------------------------------------------------------------

 

 

 

 

3. Memory Model is also a matter in GNU compiler:

The important thing is "additional addressing instructions that support 64-bit offsets need to be generated" and this is not only for the PGI or Intel compilers. Paper from GCC dev team also says that there is a 2% slowdown for gcc when using -mcmodel=medium, but it was in 2003.

[{"Product":{"code":"SSZUCA","label":"IBM Spectrum Cluster Foundation"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"--","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"4.4.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}},{"Product":{"code":"SSZUCA","label":"IBM Spectrum Cluster Foundation"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":null,"Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
16 September 2018

UID

isg3T1014413