我试图在Mac OS 10.8.2上使用自编译的GCC-4.7.1编译程序.该程序使用openMP,编译成功; 但是,当我尝试运行程序时,动态链接器会抱怨
dyld: lazy symbol binding failed: Symbol not found: ___emutls_get_address
Referenced from: /usr/local/gcc-4.7.1/lib/libgomp.1.dylib
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: ___emutls_get_address
Referenced from: /usr/local/gcc-4.7.1/lib/libgomp.1.dylib
Expected in: /usr/lib/libSystem.B.dylib
Run Code Online (Sandbox Code Playgroud)
在使用-fopenmp编译的任何程序中都会出现此问题,包括MWE
#include <stdio.h>
int main() {
#pragma omp parallel
printf("Hallo!\n");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
请注意,解决方案建议在什么是"___emutls_get_address"符号?,即-lgcc_eh在链接阶段添加,不起作用(我仍然得到相同的dyld错误消息).
我想设计一个cdef类,其方法可以并行运行,因此我需要将它们设置为nogil.我看到我可以为cdef方法做到这一点,但由于某种原因我无法理解我不允许对cpdef方法做同样的事情.这特别是失败了
cdef class Test:
cdef int i
def __init__(self):
self.i = 0
cpdef int incr(self) nogil:
self.i += 1;
return self.i
Run Code Online (Sandbox Code Playgroud)
虽然同样cdef int incr会有效.这有点令人惊讶,因为在正常cpdef函数nogil中允许属性:
cpdef int testfunc(int x) nogil:
return x + 1
Run Code Online (Sandbox Code Playgroud)
我在这里错过了什么或做错了吗?
有没有办法通过 Visual Studio Code 的 Python 扩展指示 Jupiter 交互窗口使用 Retina 显示屏?例如,这个最小的代码
#%%
import numpy as np
from matplotlib import pyplot as plt
x = np.linspace(-10, 10, 1000)
plt.plot(x, np.sin(x))
Run Code Online (Sandbox Code Playgroud)
生成清晰显示图像像素的输出(请注意文本“matplotlib.lines.Line2D...”和绘图标记之间的分辨率差异):
使用标准线
%config InlineBackend.figure_format = 'retina'
Run Code Online (Sandbox Code Playgroud)
不幸的是,似乎并没有解决问题:它使图像放大两倍,但仍然没有准备好视网膜显示。