内联调用 always_inline '__m256d _mm256_broadcast_sd(const double*)' 失败

2021-12-18 00:00:00 gcc c++ intrinsics avx x86

我正在尝试运行一个由我的朋友创建的 Visual Studio cpp 项目.我正在尝试在没有 VS 的情况下运行该文件.但是我得到了一个错误列表,格式都一样:

I'm trying to run a Visual Studio cpp project created by a friend of mine. I'm trying to run the file without VS. But I'm getting a list of errors, all in the same format:

inlining failed in call to always_inline '__m256d _mm256_broadcast_sd(const double*)': target specific option mismatch|

它在具有发布模式的 VS 中正确运行,并在调试模式下运行时中断.

It runs correctly in VS with release mode and breaks when run in debug mode.

include 如下:

#include "stdafx.h"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <vector>
# include <omp.h>
#include <chrono>
#include <fstream>
#include <algorithm>

#include <immintrin.h>

using namespace std::chrono;
using namespace std;

从这里调用错误:

double zero = 0;
__m256d acc = _mm256_broadcast_sd(&zero);

更新:

我正在使用这个命令来运行它:g++ -std=c++0x multip.cpp -o multip,是否有额外的参数可以将 -mavx 添加到编译器调用中?

I'm using the this command to run it: g++ -std=c++0x multip.cpp -o multip, is there an additional parameter to add -mavx to the compiler invocation?

推荐答案

目标特定选项不匹配" 意味着您缺少 GCC 调用中的功能标志.您可能需要将 -mavx 添加到编译器调用中.

"Target specific option mismatch" means that you're missing a feature flag from your GCC invocation. You probably need to add -mavx to your compiler invocation.

如果您只打算在您的计算机上运行它,-march=native 将打开您自己的机器支持的所有功能标志.

If you're intending to run this on your computer only, -march=native will turn on all the feature flags that your own machine supports.

相关文章