↓ Skip to main content
  1. Categories/

工程

2018

cuda error checking 学习笔记

·283 words·1 min
由于发现cuda c++ 的 debug方式和c++ 差别很大,因此打算再开一篇,专门记录一些和error checking 以及debug有关的内容. Error checks in CUDA code can help catch CUDA errors at their source. There are 2 sources of errors in CUDA source code:

cuda 学习笔记

·2297 words·5 mins
update:有毒吧,kernel 中出问题原来不会报错。 请教了组里的 hust 学长 orz.. 学到了 cuda-memcheck 命令和 cudaGetLastError 来查看问题,可以参考What is the canonical way to check for errors using the CUDA runtime API? 先放一波资料。 An Even Easier Introduction to CUDA CUDA C/C++ Basics nvidia-thrust 官方文档 how-access-global-memory-efficiently-cuda-c-kernels efficient-matrix-transpose-cuda-cc 很强大的warp内shuffle cuda-GDB官方文档 cuda-c-best-practices-guide cuda 提出的目的是能够让程序员透明地使用GPU来高效地进行并行运算。

2017

unicode 汉字表示不唯一的问题 (cjk字符集)

·181 words·1 min
update: 遇到的汉字: 丹:63838 李:63969 昨天写的正则发现死活识别不了 “年"字… 放到unicode编码转化公式 查了下发现竟然是不同的字orz.. 其实猜想到也许是日文的"年”…结果查询了下发现是韩文的锅?

正则匹配中文及常用正则表达式 (转载)

·1078 words·3 mins
先放一个同事安利给我的网站:regex101 查询匹配的中文字符unicode编码 正则表达式用于字符串处理、表单验证、日志数据分析等场合,实用高效。现将自己走网上搜索并总结的常用方法收集了一下: 匹配中文字符的正则表达式: [\u4e00-\u9fa5] 注:匹配中文还真是个头疼的事,有了这个表达式就好办了

基础 Haskell 学习笔记

·1463 words·3 mins
出于对函数式编程语言这一技能点的缺失…以及退役之后闲得蛋疼 打算浅尝辄止地学一下 haskell 这篇笔记不会写成文档那样详尽..毕竟函数式编程语言也是编程语言,有很多和其他编程语言(命令式?)相似的地方。

在wordpress 中输入数学公式

·302 words·1 min
查了一些资料。。发现不是要装各种插件(还不一定能用,比如和crayon冲突。。就是讲得很不清楚orz。。 又下一个win下的公式编辑器之类的软件是什么鬼啊? 干脆记录一下必要步骤。只有一步。

MPI 学习笔记

·592 words·2 mins
参考资料: 消息传递接口(MPI)维基百科 MPI_TUTORIAL MPI 在大规模机器学习领域的前景如何? 因为要和平台组对接工作以及写我们自己的BN同步…所以来了解一下MPI相关…感谢平台组@gyz 菊苣提供指导。

python只获取当前目录下的文件夹及文件名

·237 words·1 min
list = os.listdir(rootdir)#列出目录下的所有文件和目录 1for line in list: 2 filepath = os.path.join(rootdir,line) 3 if os.path.isdir(filepath):#如果filepath是目录 4 print "dir:" + filepath 5 else: 6 print "file:" + filepath 如果需要遍历文件夹下的所以文件,可以使用os.walk()方法。

manjaro(archlinux) 安装 YouCompleteMe

·285 words·1 min
来来回回折腾了好多次,aur直接安装或者手动编译,安装后都无法补全 ycm的log文件是在/tmp目录下的。 发现问题是缺少libtinfo.so.5 12017-07-28 17:02:12,667 - ERROR - Error occurred while loading global extra conf /home/coder/.ycm_extra_conf.py 2Traceback (most recent call last): 3 File "/home/coder/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/extra_conf_store.py", line 94, in _CallGlobalExtraConfMethod 4 module = Load( global_ycm_extra_conf, force = True ) 5 File "/home/coder/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/extra_conf_store.py", line 173, in Load 6 module = LoadPythonSource( _RandomName(), module_file ) 7 File "/home/coder/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/utils.py", line 400, in LoadPythonSource 8 return imp.load_source( name, pathname ) 9 File "/home/coder/.ycm_extra_conf.py", line 32, in <module> 10 import ycm_core 11ImportError: libtinfo.so.5: cannot open shared object file: No such file or directory 122017-07-28 17:02:12,667 - ERROR - libtinfo.so.5: cannot open shared object file: No such file or directory 13Traceback (most recent call last): 14 File "/home/coder/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/server_utils.py", line 96, in CompatibleWithCurrentCore 15 ycm_core = ImportCore() 16 File "/home/coder/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/server_utils.py", line 88, in ImportCore 17 import ycm_core as ycm_core 18ImportError: libtinfo.so.5: cannot open shared object file: No such file or directory 解决办法:

python numpy 用法 简明手册

·8276 words·17 mins
原文链接 感谢stanford,感谢原作者的翻译,我调整了一下代码格式,可以当做手册来用了,毕竟之前没怎么写过py 23333 译者注:本文智能单元首发,翻译自斯坦福CS231n课程笔记Python Numpy Tutorial,由课程教师Andrej Karpathy授权进行翻译。本篇教程由杜客翻译完成,Flood Sung、SunisDown、巩子嘉和一位不愿透露ID的知友对本翻译亦有贡献。

archlinux/manjaro 下 安装 qq/tim

·580 words·2 mins
参考资料:install qq/tim on linux with wine wine运行qq不能输入账号 This tutorial introduces how to install QQ/TIM in Linux with Wine, which had been tested on ArchLinux with Wine 2.4. Prerequisites # Before start, you need to get the latest Wine. I’m not sure whether QQ/TIM can run on lower version of Wine. In ArchLinux, you can easily get the latest Wine using following command: 1pacman -S wine However, in Debian, you need to install Wine with some more steps. You can see this tutorial.

libgfortran.so.4 missing under archlinux

·919 words·2 mins
。。。哭了哦,终于解决了这个 bug 参考资料: libgfortran broken? libgfortran=3.0 should not be install with numpy <= 1.9 [SOLVED] libgfortran.so.3:cannot open shared object file: No such file [Replacing gcc-libs-libs with gcc-multilib arch conflict with gcc-libs and gcc-libs-multilib on latest update 一开始以为是 anaconda 相关,搞了半天。 然后又按照第一个资料里说的,试图把 libgfortran 用 libgcc 替代。

manjaro installation guide

·2918 words·6 mins
20180214 update: 第一个版本已经比较久了,于是更新一下,顺便写了个脚本orz 1pacman-mirrors -c China 2echo " [archlinuxcn] " >> /etc/pacman.conf 3echo " SigLevel = Optional TrustedOnly " >> /etc/pacman.conf 4echo " Server = https://mirrors.ustc.edu.cn/archlinuxcn/\$arch" >> /etc/pacman.conf 5 6 7echo "[arch4edu]" >> /etc/pacman.conf 8echo "SigLevel = Never" >> /etc/pacman.conf 9echo "Server = http://mirrors.tuna.tsinghua.edu.cn/arch4edu/\$arch " >> /etc/pacman.conf 10pacman -Syyu 11pacman -S archlinuxcn-keyring 12 13pacman -S yakuake fish gvim 14pacman -S google-chrome chromium 15pacman -S wget aria2 remarkable netease-cloud-music 16pacman -S fcitx fcitx-configtool fcitx-sogoupinyin fcitx-im kcm-fcitx 17pacman -S shadowsocks-qt5 18pacman -S wqy-microhei wqy-microhei-lite wqy-bitmapfont wqy-zenhei ttf-arphic-ukai ttf-arphic-uming adobe-source-han-sans-cn-fonts 19 20cat >> ~/.xprofile <<EOF 21export GTK_IM_MODULE=fcitx 22export QT_IM_MODULE=fcitx 23export XMODIFIERS="@im=fcitx" 24EOF 出于目前对manjaro的依赖,以及没有找到很简单易行的备份系统的方案的原因,决定详细记录一下系统安装的过程,以防哪天系统挂掉了,可以快速恢复。

conda升级anaconda ValueError的解决办法

·121 words·1 min
conda update anaconda 后提示 1ValueError: unsupported format character ')' (0x29) at index 49 查到了这个:anaconda update issue I have narrowed this down to the following packages: package build psutil-1.2.1 py27_0 hard-link pycparser-2.10 py27_0 hard-link pykit-0.1.0 np18py27_2 hard-link pyparsing-2.0.1 py27_0 hard-link by calling "conda install anaconda" and then successfully installing everything else one at a time. These four packages consistently exhibit the described behaviour. (note: pykit depends on pycparser so may itself be ok - can't tell) 我先把psutil卸载掉,重新update了一下,成功。

vim下python 的配置

·817 words·2 mins
由于最近要做数字图像处理的大作业,以及之后一段时间,估计写python多一些,所以打算花些时间配置下vim. # 1. 一键执行 # 其实之前一直有的。。不过没有效果,就没有管。发现问题是,python对应的filetype为"python",而不是"py" # 1func! CompileRunGcc() 2 exec "w" 3 if &filetype == 'c' 4 exec "!g++ % -o %<" 5 exec "! ./%<" 6 elseif &filetype == 'cpp' 7 exec "!g++ % -std=gnu++11 -Wall -o %<" 8 exec "! ./%<" 9 elseif &filetype == 'java' 10 exec "!javac %" 11 exec "!java %<" 12 elseif &filetype == 'sh' 13 :!./% 14 elseif &filetype == 'python' 15 " exec "!python %" 16 " exec "!python %<" 17 exec "!python2.7 %" 18 endif 19endfunc 2.代码补全 # 不想折腾了。。既然ycm也支持python,就先用用看好了。。不行再换别的。 # 放一段ycm for python的配置文件 # 1"默认配置文件路径" 2let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py' 3"打开vim时不再询问是否加载ycm_extra_conf.py配置" 4let g:ycm_confirm_extra_conf=0 5set completeopt=longest,menu 6"python解释器路径" 7let g:ycm_path_to_python_interpreter='/usr/bin/python' 8"是否开启语义补全" 9let g:ycm_seed_identifiers_with_syntax=1 10"是否在注释中也开启补全" 11let g:ycm_complete_in_comments=1 12let g:ycm_collect_identifiers_from_comments_and_strings = 0 13"开始补全的字符数" 14let g:ycm_min_num_of_chars_for_completion=2 15"补全后自动关机预览窗口" 16let g:ycm_autoclose_preview_window_after_completion=1 17" 禁止缓存匹配项,每次都重新生成匹配项" 18let g:ycm_cache_omnifunc=0 19"字符串中也开启补全" 20let g:ycm_complete_in_strings = 1 3. 语法检查 # Syntastic大家都知道了。。。。看到了异步检测插件ALE,打算试一下。 # ale_github # 需要注意的是,这个插件需要vim 8.0+的特性。。。 # 放一波配置文件 # 1""""""""""""""""""for ale begin """""""""""""""" 2let g:ale_sign_column_always = 1 "保持侧边栏可见: 3 4let g:ale_sign_error = '>>' "改变错误和警告标识符 5let g:ale_sign_warning = '--' 6let g:ale_statusline_format = ['⨉ %d', '⚠ %d', '⬥ ok'] "改变状态栏信息格式 7 8"自定义跳转错误行快捷键: 9nmap <silent> <C-k> <Plug>(ale_previous_wrap) 10nmap <silent> <C-j> <Plug>(ale_next_wrap) 11"消除某excption not caught的警告 12let g:ale_emit_conflict_warnings = 0 4. 编程提示(jedi-vim) # 据说是vim写python的神器。。。装来看看。。。 # 据说默认配置就够了,先不折腾了 # # #

vundle error detected while processing function

·302 words·1 min
好久没装新插件了,最新要配下python,发现安装时候满屏的错误。。。 # 最后发现是shell的锅,因为我用的是fish,在.vimrc文件中添加 # 1set shell=/bin/bash 即可。 # 以及说下可能的其他原因,虽然我没遇到 # * 对于arch系,可能从aur中安装的版本out ot data * 可能没有把.vimrc中vundle的配置从set rtp+=~/.vim/bundle/vundle更新成set rtp+=~/.vim/bundle/vundle.vim * 可能项目名称用了" 而不是' 以及顺手查了下bundle和Plugin的区别。。。 # 简单来说。。Plugin是新写法,bundle是正在被淘汰的写法,不过由于兼容性的原因,仍然在使用。。。 # 以后使用plugin的写法就好。 # 参考资料

qt 5.x 初探 (5) 

·166 words·1 min
qt_5.9_ui_doc 还是比直接写代码方便点。。。所以不妨学习一个! 以及。。。qt在2017年6月1号发布了5.9。。。所以之前是5.8。。。现在变成5.9了。。。 遇到了修改了ui文件却没有生效的问题。。。