如何在32位Linux上编译程序以使其能够使用> 4GB内存? [英] How to compile a program to make it capable to use >4GB memory on 32-bit Linux?

查看:69
本文介绍了如何在32位Linux上编译程序以使其能够使用> 4GB内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

整个代码是用C,C ++和Fortran编写的. 是否有可能使它使用超过4GB的内存. 现在,当它达到3GB内存时,它总是会崩溃.

The whole code is written in C, C++, and Fortran. Is it possible to make it to use more than 4GB memory. Now it is always crashed when it reaches 3GB memory.

如果可能,如何设置编译选项(或配置标志)?

If it is possible, how to set up the compiling options (or configure flags)?

我们可以使用gcc,g ++,...或intel编译器

We can use gcc, g++, ...or intel compilers

我们的操作系统:Fedora 12 x32

our OS: Fedora 12 x32

cat /proc/cpuinfo
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority
bogomips : 5319.72
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual

推荐答案

不幸的是,您达到了极限

Unfortunately you are hitting the limit that

R> 2^32
[1] 4294967296

这是您的4 GB限制.因此,无论使用什么操作系统,您都无法对单个应用程序的进行索引.

which is your 4 gb limit. So you simply cannot index beyond for a single application, no matter what the OS.

这是我们许多人转向操作系统的64位版本的原因之一.自1990年代后期以来,Linux就一直对此提供支持.只需切换到64位FC(或Ubuntu或...).

This is one of the reasons many of us switched to 64 bit versions of our OSs. Linux has supported this since the late 1990s. Just switch to FC (or Ubuntu or ...) in 64bit.

一个可能的选择是安装更多的RAM(Linux将处理),并在应用程序的多个实例上分段您的任务,从而有效地并行运行它.但这也许不值得麻烦...

One possible alternative is installing more RAM (which Linux will handle) and segmenting your task over several instances of the application, effectively running it in parallel. But that may not be worth the trouble...

这篇关于如何在32位Linux上编译程序以使其能够使用> 4GB内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆