我已经用 g++ 编写和调试了一些 AVX 代码,现在我正试图让它与 MSVC 一起工作,但我不断得到
error LNK2019: unresolved external symbol __mm256_setr_epi64x referenced in function "private: union __m256i __thiscall avx_matrix::avx_bit_mask(unsigned int)const " (?avx_bit_mask@avx_matrix@@ABE?AT__m256i@@I@Z)
引用的代码是
...
#include <immintrin.h>
...
/* All zeros except for pos-th position (0..255) */
__m256i avx_matrix::avx_bit_mask(const std::size_t pos) const
{
int64_t a = (pos >= 0 && pos < 64) ? 1LL << (pos - 0) : 0;
int64_t b = (pos >= 64 && pos < 128) ? 1LL << (pos - 64) : 0;
int64_t c = (pos >= 128 && pos < 192) ? 1LL << (pos - 128) : 0;
int64_t d = (pos >= 192 && pos < 256) ? 1LL << (pos - 256) : 0;
return _mm256_setr_epi64x(a, b, c, d);
}
...
/arch:AVX,但没有任何区别。_mm256_setr_epi64x。如有任何帮助,我们将不胜感激。
最佳答案
看起来这可能实际上是一个 known bug - 某些 AVX 内在函数显然在 32 位模式下不可用。尝试针对 64 位构建和/或升级到 Visual Studio 2013 Update 2,据推测,该问题现已得到修复。
或者,如果您只有上面的一个实例,您正在使用这个内在函数,那么您可以将您的函数更改为:
__m256i avx_matrix::avx_bit_mask(const std::size_t pos) const
{
int64_t a[4] = { (pos >= 0 && pos < 64) ? 1LL << (pos - 0) : 0,
(pos >= 64 && pos < 128) ? 1LL << (pos - 64) : 0,
(pos >= 128 && pos < 192) ? 1LL << (pos - 128) : 0,
(pos >= 192 && pos < 256) ? 1LL << (pos - 256) : 0 };
return _mm256_loadu_si256((__m256i *)a);
}
或者甚至:
__m256i avx_matrix::avx_bit_mask(const std::size_t pos) const
{
int64_t a[4] = { 0 };
a[pos >> 6] = 1LL << (pos & 63ULL);
return _mm256_loadu_si256((__m256i *)a);
}
哪个可能更有效率。
关于c++ - 未解析的外部符号 __mm256_setr_epi64x,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27258261/
我想为Heroku构建一个Rails3应用程序。他们使用Postgres作为他们的数据库,所以我通过MacPorts安装了postgres9.0。现在我需要一个postgresgem并且共识是出于性能原因你想要pggem。但是我对我得到的错误感到非常困惑当我尝试在rvm下通过geminstall安装pg时。我已经非常明确地指定了所有postgres目录的位置可以找到但仍然无法完成安装:$envARCHFLAGS='-archx86_64'geminstallpg--\--with-pg-config=/opt/local/var/db/postgresql90/defaultdb/po
我正在使用的第三方API的文档状态:"[O]urAPIonlyacceptspaddedBase64encodedstrings."什么是“填充的Base64编码字符串”以及如何在Ruby中生成它们。下面的代码是我第一次尝试创建转换为Base64的JSON格式数据。xa=Base64.encode64(a.to_json) 最佳答案 他们说的padding其实就是Base64本身的一部分。它是末尾的“=”和“==”。Base64将3个字节的数据包编码为4个编码字符。所以如果你的输入数据有长度n和n%3=1=>"=="末尾用于填充n%
我的瘦服务器配置了nginx,我的ROR应用程序正在它们上运行。在我发布代码更新时运行thinrestart会给我的应用程序带来一些停机时间。我试图弄清楚如何优雅地重启正在运行的Thin实例,但找不到好的解决方案。有没有人能做到这一点? 最佳答案 #Restartjustthethinserverdescribedbythatconfigsudothin-C/etc/thin/mysite.ymlrestartNginx将继续运行并代理请求。如果您将Nginx设置为使用多个上游服务器,例如server{listen80;server
这个问题在这里已经有了答案:Railsformattingdate(4个答案)关闭4年前。我想格式化Time.Now函数以显示YYYY-MM-DDHH:MM:SS而不是:“2018-03-0909:47:19+0000”该函数需要放在时间中.现在功能。require‘roo’require‘roo-xls’require‘byebug’file_name=ARGV.first||“Template.xlsx”excel_file=Roo::Spreadsheet.open(“./#{file_name}“,extension::xlsx)xml=Nokogiri::XML::Build
我正在尝试在Ruby中复制Convert.ToBase64String()行为。这是我的C#代码:varsha1=newSHA1CryptoServiceProvider();varpasswordBytes=Encoding.UTF8.GetBytes("password");varpasswordHash=sha1.ComputeHash(passwordBytes);returnConvert.ToBase64String(passwordHash);//returns"W6ph5Mm5Pz8GgiULbPgzG37mj9g="当我在Ruby中尝试同样的事情时,我得到了相同sha
如何将send与+=一起使用?a=20;a.send"+=",10undefinedmethod`+='for20:Fixnuma=20;a+=10=>30 最佳答案 恐怕你不能。+=不是方法,而是语法糖。参见http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_expressions.html它说Incommonwithmanyotherlanguages,Rubyhasasyntacticshortcut:a=a+2maybewrittenasa+=2.你能做的最好的事情是:
我对如何计算通过{%assignvar=0%}赋值的变量加一完全感到困惑。这应该是最简单的任务。到目前为止,这是我尝试过的:{%assignamount=0%}{%forvariantinproduct.variants%}{%assignamount=amount+1%}{%endfor%}Amount:{{amount}}结果总是0。也许我忽略了一些明显的东西。也许有更好的方法。我想要存档的只是获取运行的迭代次数。 最佳答案 因为{{incrementamount}}将输出您的变量值并且不会影响{%assign%}定义的变量,我
我有一个数组数组,想将元素附加到子数组。+=做我想做的,但我想了解为什么push不做。我期望的行为(并与+=一起工作):b=Array.new(3,[])b[0]+=["apple"]b[1]+=["orange"]b[2]+=["frog"]b=>[["苹果"],["橙子"],["Frog"]]通过推送,我将推送的元素附加到每个子数组(为什么?):a=Array.new(3,[])a[0].push("apple")a[1].push("orange")a[2].push("frog")a=>[[“苹果”、“橙子”、“Frog”]、[“苹果”、“橙子”、“Frog”]、[“苹果”、“
有没有办法让Ruby能够做这样的事情?classPlane@moved=0@x=0defx+=(v)#thisiserror@x+=v@moved+=1enddefto_s"moved#{@moved}times,currentxis#{@x}"endendplane=Plane.newplane.x+=5plane.x+=10putsplane.to_s#moved2times,currentxis15 最佳答案 您不能在Ruby中覆盖复合赋值运算符。任务在内部处理。您应该覆盖+,而不是+=。plane.a+=b与plane.a=
我正在尝试复制此GETcurl请求:curl-D--XGET-H"Authorization:BasicdGVzdEB0YXByZXNlYXJjaC5jb206NGMzMTg2Mjg4YWUyM2ZkOTY2MWNiNWRmY2NlMTkzMGU="-H"Content-Type:application/json"http://staging.example.com/api/v1/campaigns在Ruby中,通过电子邮件+apikey生成身份验证:auth="Basic"+Base64::encode64("test@example.com:4c3186288ae23fd9661c