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

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

How to specify -march=native with %%cython

问题

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

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

但如何添加 -march=native

英文:

In ipython I can do the following:

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

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

答案1

得分: 1

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

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

因此,最终答案将是:

  1. %%cython --compile-args=-Ofast --compile-args=-march=native
  2. def f(x):
  3. 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:

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

The final answer would therefore be:

  1. %%cython --compile-args=-Ofast --compile-args=-march=native
  2. def f(x):
  3. 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:

确定