32位应用的特征最大矩阵大小 [英] Eigen max matrix size for 32 bit applications

查看:120
本文介绍了32位应用的特征最大矩阵大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我发现 Eigen 包崩溃,当我尝试声明大于10000x10000的矩阵。我需要声明一个矩阵像这样..约13000x13000元素可靠。我做了一个测试,如:

  for(int tortureEigen = 1; tortureEigen <50000; tortureEigen ++)
{
printf(Torturing Eigen with%dx%d..\\\
,tortureEigen,tortureEigen);
Eigen :: MatrixXd m(tortureEigen,tortureEigen);
}

在我的机器(6 GB RAM) >

我很失望!我认为Eigen就像MATLAB或八度音阶,不应该崩溃使用较大的数组,即使它确实击中磁盘或某物。



还有更多的是当我运行这个测试并保持TaskMan打开,创建这些矩阵的进程甚至不使用那么多的内存。

解决方案

使用Eigen 2.0.15稳定版本



$ b <

这里的所有答案都很有帮助!



结果是编译时 32位应用程序,Eigen将崩溃,如果你尝试并声明一个密集的MatrixXd ,因为我是,大于14000个元素左右。崩溃发生在 _aligned_malloc 在Eigen alloc代码(MatrixXd :: resize())中返回0,意味着1.5GB的连续,对齐的RAM不能在32位下分配,这是有道理的,因为这是得到接近最大可寻址存储器的一半。找到超过1.5 GB连续的4.0变得真的不可能,我想!



解决方案#1



OK然后,所以我编译64位,在我的6GB机器上,程序运行成功,与密集的MatrixXd分配和解决方案工作很好。



解决方案#2



另一个解决方案是使用 DynamicSparseMatrix< double> 。稀疏不会崩溃在巨大的大小分配,即使作为32位的应用程序,但API支持解决是另一个故事(API似乎想转换为MatrixXd密集类型为了解决,这让我们有相同的原始问题。)


So, I'm finding the Eigen package crashes when I try to declare a matrix larger than 10000x10000. I need to declare a matrix like this.. about 13000x13000 elements reliably. I ran a test like:

for( int tortureEigen = 1 ; tortureEigen < 50000 ; tortureEigen++ )
{
  printf( "Torturing Eigen with %dx%d..\n", tortureEigen, tortureEigen ) ;
  Eigen::MatrixXd m( tortureEigen, tortureEigen ) ;
}

Crashes on my machine (6 GB RAM) at 14008 elements.

I'm kind of disappointed! I thought Eigen was like MATLAB or octave and should not crash using larger arrays, even if it does hit the disk or something..

And what's more is when I run this test and keep TaskMan open, the process that is creating these matrices doesn't even use that much memory. TaskMan reports under 2k usage.

Using Eigen 2.0.15 stable release

解决方案

All the answers here are helpful!

It turns out that when compiled as a 32-bit app, Eigen will crash if you try and declare a dense MatrixXd, as I was, larger than 14000 elements or so. The crash happens with _aligned_malloc returning 0 in the Eigen alloc code (MatrixXd::resize()), meaning 1.5GB of contiguous, aligned RAM couldn't be allocated under 32-bit, which makes sense, since this is getting close to half the maximum addressable memory loc. Finding more than 1.5 GB contiguous out of 4.0 becomes really unlikely, I suppose! Upgrading to Eigen 3.0 unfortunately does not solve the problem.

Solution #1

Ok then, so I compiled in 64-bit, and on my 6GB machine, the program runs successfully, with the dense MatrixXd allocation and solution working just fine.

Solution #2

Another solution is using a DynamicSparseMatrix<double>. Sparse does not crash on huge size alloc, even as 32 bit app, but API support for solving is another story (API seems to want to convert to MatrixXd dense type in order to solve, which leaves us with the same original problem.)

这篇关于32位应用的特征最大矩阵大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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