我有一个使用Yeppp的应用程序!SIMD库.该应用程序是用C#编写的.它在Windows x86-32和x86-64上运行完美.但是,当我在带有Mono的Raspberry Pi上运行应用程序时,我得到以下异常(不确定它是ARM问题,Mono问题还是其他问题).我试过以root身份运行只是为了检查,也是同样的异常.我注意到堆栈跟踪的"UnixLibraryLoader"部分,所以我确保Yeppp DLL(Yeppp.CLR.Bundle.dll)与可执行文件位于同一目录中.这是我的代码,编译方式或库的问题吗?
Stacktrace:
at <unknown> <0xffffffff>
at (wrapper managed-to-native) Yeppp.UnixLibraryLoader.dlopen (string,int) <0xffffffff>
at Yeppp.UnixLibraryLoader.Yeppp.INativeLibraryLoader.LoadLibrary (string) <0x0002f>
at Yeppp.NativeLibrary..ctor (string,Yeppp.INativeLibraryLoader) <0x0006b>
at Yeppp.Loader.LoadNativeLibrary () <0x000db>
at Yeppp.Library.Init () <0x00027>
at <Module>..cctor () <0x0000b>
at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) <0xffffffff>
at <unknown> <0xffffffff>
at SimdSpeedTest.Program.DisplayCpuFeatures () <0x00033>
at SimdSpeedTest.Program.Main (string[]) <0x000c7>
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>
Native stacktrace:
Debug info from gdb:
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
[New Thread 0xb5b7b430 (LWP 2272)]
0xb6eabaac in …Run Code Online (Sandbox Code Playgroud) 说实话,这是我第一次使用像Yeppp!这样的任何类型的库,我的意思是SIMD库具有动态运行时选择,或者他们会说出来.最终结果是库应该选择最佳的SIMD汇编代码,以便在运行的任何平台和硬件上运行.
这似乎是在我的项目中使用的一个很好的工具,但是,正如标题所述,我不能称之为任何Yeppp!功能没有发生分段故障.我能够获得的调试信息也没有帮助.
我的系统配置是:
Xubuntu 13.04 'raring' with Linux 3.8.0-31-generic x86_64
GCC 4.8.1 --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu .... etc, there were many more, but I chose the important ones
Code::Blocks IDE and GDB 7.5.91.20130417-cvs-ubuntu debugger through Code::Blocks
Intel Pentium(R) Dual-Core CPU T4400 @ 2.20GHz with SIMD instruction sets MMX, SSE, SSE2, SSSE3
Run Code Online (Sandbox Code Playgroud)
我列出了CPU等等,因为它对Yeppp来说可能很重要!选择正确的运行时,这可能是问题.
下面是我正在使用的简单测试代码,虽然我尝试了其他的Yeppp!具有各种数据类型的函数,都是相同的分段错误.我也尝试了各种对齐方式,如32和64,但我怀疑这是问题所在.
YEP_ALIGN(16) int32_t a[100], b[100], c[100];
//just test values
for( int x = 0; x < 100; x++ ) {
a[x] = x + …Run Code Online (Sandbox Code Playgroud) 我之前从未需要在C#中使用指针,但是,我正在使用的库要求方法参数作为指针传递.该库允许使用SIMD指令集.
为了测试如何使用该库,我试图编写一种方法,该方法使用SIMD一次性计算数组中所有元素的余弦值.
这就是我所拥有的:
double[] ValuesToCalculate = new double[MAX_SIZE];
double[] CalculatedCosines = new double[MAX_SIZE];
long Result;
Result = CalculateCosineArray(ValuesToCalculate, CalculatedCosines);
public static long CalculateCosineArraySIMD(double[] array, double[] result)
{
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
for (int i = 0; i < array.Length; i++)
{
Yeppp.Math.Cos_V64f_V64f(*array, result, MAX_SIZE);
}
stopwatch.Stop();
return stopwatch.ElapsedMilliseconds;
}
Run Code Online (Sandbox Code Playgroud)
但是,我收到这些错误:
The best overloaded method match for 'Yeppp.Math.Cos_V64f_V64f(double*, double*, int)' has some invalid arguments
Argument 1: cannot convert from 'double[]' to 'double*'
The * or -> operator must be …Run Code Online (Sandbox Code Playgroud) 嗨我正在尝试使用Yeppp在我的代码中提高向量代数的性能!然而,性能实际上变得越来越差......这是一个Vector类代码:
#include "Vector3.h"
#include <cmath>
#include "yepCore.h"
Vector3::Vector3()
{
//ctor
}
Vector3::~Vector3()
{
//dtor
}
Vector3::Vector3(float X, float Y, float Z)
{
x = X;
y = Y;
z = Z;
}
float& Vector3::operator[](int idx)
{
return (&x)[idx];
}
Vector3& Vector3::normalize()
{
#if USE_YEPPP
float inf;
yepCore_SumSquares_V32f_S32f(&x, &inf, 3);
yepCore_Multiply_IV32fS32f_IV32f(&x, 1.0f / sqrt(inf), 3);
#else
float inf = 1.0f / sqrt((x * x) + (y * y) + (z * z));
x *= inf;
y *= inf;
z *= inf; …Run Code Online (Sandbox Code Playgroud)