如何在%%cython中指定-march=native

huangapple go评论66阅读模式
英文:

How to specify -march=native with %%cython

问题

In ipython,我可以执行以下操作:

%%cython --compile-args=-Ofast
def f(x):
    return 2.0*x

但如何添加 -march=native

英文:

In ipython I can do the following:

%%cython --compile-args=-Ofast
def f(x):
    return 2.0*x

But how can I add -march=native as well?

答案1

得分: 1

--compile-args 标志可以多次传递,如在笔记本单元格中运行 %%cython? 时所示:

-c COMPILE_ARGS, --compile-args COMPILE_ARGS
                    通过`extra_compile_args`扩展标志传递给编译器的额外标志可以多次指定)。

因此,最终答案将是:

%%cython --compile-args=-Ofast --compile-args=-march=native

def f(x):
    return 2.0*x
英文:

The --compile-args flag can be passed several times, as can be seen in the help by running %%cython? in a notebook cell:

-c COMPILE_ARGS, --compile-args COMPILE_ARGS
                    Extra flags to pass to compiler via the
                    `extra_compile_args` Extension flag (can be specified
                    multiple times).

The final answer would therefore be:

%%cython --compile-args=-Ofast --compile-args=-march=native

def f(x):
    return 2.0*x

huangapple
  • 本文由 发表于 2023年5月31日 23:06:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76374927.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定