Compile OpenCL Kernel into LLVM-IR or Nvidia PTX
I'm writing this post when LLVM is up to 3.7 as its latest release. And libclc supports upto OpenCL 1.1 standard.
Environment:
I'm writing this post when LLVM is up to 3.7 as its latest release. And libclc supports upto OpenCL 1.1 standard.
Environment:
Sometimes we might have the requirements that we need to grab some info on a website using Chrome Console. However, you might just come to realize that it doesn't have JQuery!
You might hope to use JQuery to do some tree traversals in the DOM or edit it, so how can we import an extra JS/CSS file to chrome console? Here's how we can do it.
Ref: http://www.emacswiki.org/emacs/MovingTheCtrlKey
Reproduced From: http://www.fpga-dev.com/altera-usb-blaster-with-ubuntu/
I was having the problem: unable to program the Altera FPGA board with USB-Blaster, and even failed to auto-detect.
Auto-detect gave me a message: "Unable to scan device chain. Please check the hardware setup."
Thanks to the fpga-dev.com
blogger so I got it solved, and here is the article.
With some work, I got Alteras on-board USB-Blaster working on my Ubuntu 14.04-64 installation with Quartus II 13.1.0 64-bit. I was connecting to a Terasic SocKit board. In this article, I'll describe how I got it working.
To facilitate working with the Altera software, I suggest adding the bin/
folder of the Quartus installation (/opt/altera/13.1/quartus/bin
on my system) to $PATH
. This gives command-line access to the commands jtagd
and jtagconfig
which I use in this post.
The most panicking error among all the make errors is the undefined reference
error, which is mostly cause by an unlinked library.
I have been fighting with these strange errors for some days, and finally I got it.
The core problem is that my C_INCLUDE_PATH
and CPLUS_INCLUDE_PATH
ends with a colon. Path ending with a colon will include current path, aka ./
which caused the error.
感謝本文的作者:http://my.oschina.net/u/736932/blog/84261
這樣可以不僅僅做源代碼的轉換,還可以做其他的編碼轉換。
经常把代码在 windows 下和 linux 下传来传去,苦于程序源代码文件的编码问题,windows 下是 cp936 格式,linux 下通用 utf-8 格式,发布源代码的时候也需要两种编码各一份,逐个文件的进行编码转换实在是一份让人痛苦不堪的活,好在 vim 有批量编辑文件的功能,这要用到 args
和 argdo
命令,可以查看 :help args
与 :help argdo
以获得详细的说明。
这里只说下这两个命令在对文件进行批量转换编码的用法:
一、设置文件集合,即要对哪些文件进行操作,可以使用通配符,比如我通常是对 C/C++ 源程序进行编码转换:
:args *.h *.cpp
二、给出要在每个文件上执行的命令,这里是转换编码:
:argdo set fenc=utf-8 | update
这样就 ok 了,一边偷着乐去吧。这里要注意的是如果要同时执行多个命令则需要用|
隔开,上面的 update 一定要写上,因为 vim 在一个文件被修改后尚未保存的情况下去编辑下一个文件会给出出错提示的,用上这个 update 就是更新文件了,这样就不会出这个问题了。
当然, args 和 argdo 能做的事情多的很,比如可以在多个文件中批量替换,这个应该也很实用吧,具体可以查看 vim 的帮助文件 :help args
和 :help argdo
.
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
false
最後修改時間:2013.03.19 -- 13:08
衆所周知,C++11的新特性中有一個非常重要的特性,那就是rvalue reference
,右值引用。
引入它的一個非常重要的原因是因爲在C++中,常常右值,通俗地講"在等號右邊的"臨時變量或者臨時對象, 我們是無法得到它的修改權限的。
由於類的構造和析構機制,往往產生的臨時變量或臨時對象的拷貝構造及析構,會帶來不少的時間、資源消耗。
也同樣由於這樣的限制,有不少C++程序員依然保有一部分C風格的寫法,例如將A = factory(B, C);
之中的A
,以函數引用參數的形式傳入等等。 但在C++11之後,我們可以完全保留C++的寫法, 將右值明顯指出,就可以完成"直接獲得臨時對象"的資源的權限,例如A = std::move(B);
或者 A = factory(B, C);
, 這時候就"幾乎完全"省去了拷貝的過程,通過直接獲取由factory(B, C)
造出的臨時對象中的資源, 達到省略拷貝的過程,最終析構的臨時對象,實際上只是一具空空的皮囊。