32位matlab程序,64位windows,如何获得6GB RAM?
我有一些只能在 32 位 Windows 上运行的 matlab 代码,但我需要至少 6 GB 的 RAM 才能运行它。在我的实验室中,唯一一台拥有 6GB RAM 的机器正在运行 64 位 Windows,有什么方法可以在这里运行此代码吗? 我正在考虑模拟 32 位 Windows 并在其上运行,这可行吗?
I have some matlab code that will only run on 32 bit windows, but I need atleast 6 gb of ram to run it. In my lab the only machine that has 6gb ram is running 64 bit windows, is there some way to run this code on here?
I am thinking of emulating a 32 bit windows and running it on that, will that work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
当您的 32 位应用程序在 Windows 64 位上作为 32 位进程运行时,它只能寻址 4 GB。为了寻址更多内存,您需要 64 位应用程序。
Your 32 bit application will only be able to address 4 GB when running as a 32 bit process on Windows 64 bit. In order to address more memory you need a 64 bit application.
我最近致力于将一些大型 Matlab 代码从 32 位 Windows XP 迁移到 64 位 Windows XP。与这里的一两个其他回答者不同,我认为 6GB 目前是一个完全合理的内存要求;我们这里使用的最大台式机具有双四核处理器和 32GB RAM。我的一些科学家同事想要更多,但他们总是想要更多。
我会进一步建议不要尝试重写您的应用程序以使用更少的 RAM;那将会走向错误的方向。如果将代码移植到 64 位机器上,它会更便宜、更快,并且产生的错误更少。对于那些主张重构以使用更少 RAM 的人,我会说在不久的将来,您会在什么时候面对市场的现实并认识到 64 位计算将继续存在,并且 RAM 是相当重要的?便宜,特别是与开发人员的时间成本相比?
忘记尝试在 32 位计算机上使用 6GB RAM;吧?正如其他人告诉你的那样,Matlab 和 Windows 不会这样做。但是,正如其他人所说,Matlab 对位数并不关心,因此适用于 32 位版本的纯 Matlab 代码也适用于同一版本的 64 位版本。如果您从较旧的 32 位版本迁移到较新的 64 位版本,您可能会发现一些 Matlab 函数已停用,但无论如何迁移到较新的 32 位版本也会遇到相同的问题。
如果您的代码只能在 32 位 Windows 上运行,那么我怀疑您正在使用 MEX 文件。这些必须重新编译才能在 64 位机器上执行。再次强调,如果您在移植时在 Matlab 版本之间移动,请小心留意已停用的功能。根据我的经验,另一个主要问题是您可能对某些基本数据类型的大小做出错误的假设。 Fortran 和 C 标准(没有 C++ 经验可言)实际上都没有指定默认 INTEGER(对于 Fortran)或 int(对于 C——我认为,C 程序员不多)的字节大小。指针大小可能也只是模糊地指定。这意味着您可能必须 (a) 更改代码中的大量变量声明或 (b) 使用编译器指令/标志来指定 INTEGERS、REALS、int 和其他可能的默认大小。 (b) 更容易,(a) 可能更适合将来的可维护性。
I've recently been engaged in moving several of our large Matlab codes from 32-bit Windows XP to 64-bit Windows XP. Unlike one or two of the other answerers here, I think 6GB is a perfectly reasonable memory requirement these days; the largest desktop we use here has dual quad-core processors and 32GB RAM. Some of my scientist colleagues want more, but then they always want more.
I'd go further and advise against trying to rewrite your application to use less RAM; that would be heading in the wrong direction. It will be cheaper and quicker and generate fewer errors if you port your code to the 64-bit machine. To those who would argue for refactoring to use less RAM I would say At what point in the near future will you face up to the realities of the market and recognise that 64-bit computing is here to stay and that RAM is quite cheap, especially compared to the expense of developers time ?
Forget trying to use 6GB RAM on a 32-bit machine; as others have told you, Matlab and Windows won't do it. But, as others have remarked, Matlab is indifferent to the number of bits, so a pure Matlab code which works on a 32-bit release will work on the 64-bit version of the same release. If you move from an older 32-bit release to a newer 64-bit release you may find some Matlab functions have been retired, but you'd have the same issues moving to the newer 32-bit release anyway.
If you have a code which will only run on 32-bit Windows then I suspect you are using MEX files. These will have to be recompiled for execution on a 64-bit machine. Again, be careful to watch out for functionality which has been retired if you are moving between Matlab releases as you port. The other chief gotcha, in my experience, is false assumptions that you might make about the sizes of certain fundamental data types. Neither the Fortran nor the C standards (no C++ experience to speak of) actually specify the size in bytes of default INTEGER (for Fortran) or int (for C -- I think, not much of a C programmer). Pointer sizes are probably only vaguely specified too. What this means is that you may have to either (a) change a lot of variable declarations in your code or (b) use compiler directives/flags to specify default sizes for INTEGERS, REALS, ints and possibly others. (b) is easier, (a) is probably preferable for future maintainability.
您无法从 32 位应用程序访问 6GB RAM。这给您留下了两个选择:
要么优化代码以使用更少的 RAM,要么使您的 Matlab 程序兼容 64 位。
对于第一个选项,stackoverflow 的优秀人员可以为您提供帮助。
对于第二个选项:据我所知,Matlab 的任何部分都不是 32 位的 - 除非您有 32 位 Matlab 版本。但是,如果您有有效的维护合同,则可以下载并安装 64 位版本的 Matlab。
如果您的代码调用为 32 位 Windows 编译的 mex 函数,您可以尝试为 64 位 Windows 重新编译它们。
You cannot access 6GB of RAM from a 32-bit application. This leaves you two options:
Either you optimize your code to use less RAM, or you make your Matlab program 64-bit compatible.
For the first option, the fine folks at stackoverflow can help you.
For the second option: No part of Matlab that I'm aware of is 32-bit only - unless you have a 32-bit Matlab version. However, if you have an active maintenance contract, you can download and install the 64-bit version of Matlab.
If your code calls mex-functions that are compiled for 32-bit Windows, you can try and recompile them for 64-bit Windows.
64 位 Windows 可以正常运行 32 位 Windows 程序。但 32 位程序将无法访问 6 GB 或内存,所以我不确定这对您有帮助。
64 bit Windows will run 32 bit Windows programs just fine. But the 32 bit programs won't be able to access 6 Gb or memory, so I'm not sure that help you.
我很确定 32 位 Windows 的大多数版本(例如,除服务器版本之外的所有版本)默认情况下将单个进程限制为 2GB,并通过更改设置将单个进程限制为 3GB...尽管从技术上讲,可以从计算机访问 16G RAM Pentium Pro(及更高版本)CPU 在 32 位模式下,我认为除了 Windows Server 之外没有任何东西可以利用它
,并且为了让您的 Matlab 程序利用它,您必须手动执行一些有趣的多进程工作3G内存条之间的页面
I'm pretty sure most versions of 32 bit Windows(as in, everything but Server editions) limit a single process to 2GB by default and to 3GB by changing a setting... though it is technically possible to access 16G of RAM from a Pentium Pro(and higher) CPU in 32 bit mode, I don't think anything but Windows Server takes advantage of it
and for your Matlab program to take advantage of it, you'd have to do some interesting multi-process work to manually page between 3G memory banks
您不能将 6 GB 与 32 位地址一起使用。 32 位地址只能包含来自 的值。
此类地址由每个 32 位程序使用并且对于每个 32 位程序都是必需的,无论您是否显式使用指针。
(尽管有一些非常奇特的例外情况 - 但这些并不适用于此)。
You can not use 6 GB with 32Bit addresses. A 32 Bit address can only contain values from
Such addresses are used by and are essential for every 32 Bit program, regardless if you explicitly use pointers or not.
(Although there were/are some very exotic exceptions - but those dont apply here).