在python3

编程入门 行业动态 更新时间:2024-10-19 15:36:58
在python3-gdb输出上运行cython时出现分段错误(segmentation fault while running cython on python3— gdb output)

我一直试图在我继承的cython程序中追踪段错误的来源。 我已经通过执行gdb python3在python3下实现了gdb,然后run my_file.py并得到了这个:

Program received signal SIGSEGV, Segmentation fault. __pyx_f_7sklearn_5utils_25graph_shortest_path_leftmost_sibling (__pyx_v_node=<optimised out>) at /home/my_name/.pyxbld/temp.linux-x86_64-3.4/pyrex/sklearn/utils/graph_shortest_path_strat.c:3195 3195 __pyx_t_1 = (__pyx_v_temp->left_sibling != 0);

谢谢@Veedrac电话会议如下:

landmark_points=[random.randint(0,kng.shape[0]) for r in range(self.number_landmark_points)] self.dist_matrix_=graph_shortest_path_strat(kng,landmark_points,method=self.path_method,directed=F‌​alse).

基本上不是计算图中每个点之间的距离,而是想要计算所有点之间的距离和数组中定义的有限数量的点。 其中landmark_points是整数数组,kng是最近邻居的图表

kng = kneighbors_graph(self.nbrs_, self.n_neighbors,mode='distance')

graph_shortest_path是一个.pyx代码。 我使用的版本是0.15.1

I have been trying to trace the source of a segfault in a cython program that I inherited. I have implemented gdb under python3 by executing gdb python3 then run my_file.py and got this:

Program received signal SIGSEGV, Segmentation fault. __pyx_f_7sklearn_5utils_25graph_shortest_path_leftmost_sibling (__pyx_v_node=<optimised out>) at /home/my_name/.pyxbld/temp.linux-x86_64-3.4/pyrex/sklearn/utils/graph_shortest_path_strat.c:3195 3195 __pyx_t_1 = (__pyx_v_temp->left_sibling != 0);

Thanks @Veedrac The call appears as follows:

landmark_points=[random.randint(0,kng.shape[0]) for r in range(self.number_landmark_points)] self.dist_matrix_=graph_shortest_path_strat(kng,landmark_points,method=self.path_method,directed=F‌​alse).

Basically instead of calculating the distances between every single point in a graph I want to calculate the distance between all points and a limited number of points defined in an array. where landmark_points is an array of integers kng is a graph of nearest neighbors

kng = kneighbors_graph(self.nbrs_, self.n_neighbors,mode='distance')

the graph_shortest_path is a .pyx code. And I am using version is 0.15.1

最满意答案

@Veedrac感谢您的帮助。 我实际上追溯到我使用random.randint的事实,当我应该用random.sample生成唯一的随机整数时。

@Veedrac thanks for your help. I actually traced the error to the fact that I was using random.randint, when I should have been generating unique random integers with random.sample.

更多推荐

本文发布于:2023-08-04 23:09:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1423352.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!