摘要: cython调用C代码的一个错误 expected 'int' but got 'long',原因不复杂,C code的int为32bit, 而pandas df缺省为np.int64 (64bit),有个参数传递了数组,指针类型就不符了。 两个解决方案 C代码里面所有相关的int改为long lo 阅读全文
posted @ 2023-04-07 20:26 daidau 阅读(74) 评论(0) 推荐(0) 编辑
摘要: 先说结论,在Linux系统,如果python multiprocessing要调用的cython的方法中包含了多线程,比如openmp C code,必须手动设定spawn方式产生多进程。 更多的细节在 https://pythonspeed.com/articles/python-multipro 阅读全文
posted @ 2022-07-22 18:42 daidau 阅读(398) 评论(0) 推荐(0) 编辑
摘要: 配置VS code在C语言中调用gsl库文件 gsl安装 sudo apt-get install libgsl0-dev 先确认gsl库,gcc都已正确安装,命令行 gcc -L/usr/local/lib hello.c -o hello -lgsl -lgslcblas -lm 没有错误则可以 阅读全文
posted @ 2020-10-31 19:46 daidau 阅读(1205) 评论(0) 推荐(0) 编辑
摘要: cython通过编译为C程序提高性能有很多例子,通过OpenMP并行的性能没那么多。 今天尝试了一下似乎gcc对parallelism reduction优化的很厉害,加上OpenMP并行可以提高20倍性能(相对于pandas rolling),这不是简单的2 core带来的性能提高。 滚动求和 r 阅读全文
posted @ 2020-10-14 12:56 daidau 阅读(526) 评论(0) 推荐(0) 编辑
摘要: ubuntu下没有tortoiseSVN,用svn+ssh方式每次都提示要输入密码 通过配置~/.ssh/config文件让系统记住ssh密匙(private key)文件就不用输入密码了。 在config文件中加入: Host YOUR_SERVER_IP IdentityFile FULLPAT 阅读全文
posted @ 2020-09-24 11:08 daidau 阅读(946) 评论(0) 推荐(0) 编辑
摘要: ubuntu下修改配置文件(路径如下),解除root登录地址绑定 /etc/mysql/my.cnf 或者 /etc/mysql/mysql.conf.d/mysqld.cnf file. 用符号#把如下行注释掉 bind-address = 127.0.0.1 修改后变成 #bind-addres 阅读全文
posted @ 2020-08-30 12:17 daidau 阅读(166) 评论(0) 推荐(0) 编辑
摘要: draw.io免费好用,完全可以取代Visio. 唯独缺省选择都是英文字体。但要选择中文字体也可以自行添加,步骤: 确保系统里已经安装了相应中文字体。ubuntu下Google思源字体在/usr/share/fonts/opentype/noto/目录下。 在draw.io中选中文字,右侧选择文字( 阅读全文
posted @ 2020-08-06 09:23 daidau 阅读(6168) 评论(1) 推荐(1) 编辑
摘要: 使用pandoc转换Markdown文件(.md)生成pdf pandoc --latex-engine=xelatex -V CJKmainfont="Noto Sans CJK SC" -s --toc --toc-depth=2 --highlight-style zenburn --temp 阅读全文
posted @ 2020-07-01 13:08 daidau 阅读(1053) 评论(0) 推荐(0) 编辑
摘要: Ubuntu 18.04 LTS系统下,spyder4编辑器无法使用搜狗输入中文。系统输入法为fcitx+搜狗拼音,chrome浏览器无此问题。网上答案: Spyder (以及其他PyQt程序) 无法使用 fcitx 输入法输入中文的解决办法 由于spyder4界面基于PyQt5,而本机上pytho 阅读全文
posted @ 2020-06-26 10:57 daidau 阅读(885) 评论(0) 推荐(0) 编辑