l GPU硬件特性
n 存储层次
u Global memory:
l 大小一般为几GB
l chip-off的DRAM介质存储器
l 访问速度慢(是shared memory的上百倍)
l 对于是否对齐和连续访问敏感(由DRAM的性质决定)
l 可以被所有的线程访问
u Shared memory:
l 每个SM中一般几十KB
l chip-on的SRAM介质存储器
l 访问速度快(与register相当)
l 对于是否对其和连续访问不敏感,但是对bank conflict敏感(由bank设计决定)
l 只对自身block中的线程可见
u Register
l 每个SM中一般为几千个(约30K)
l Chip-on的寄存器
l 访问速度最快
l 只对每个thread本......
阅读全文
'''<summary>
'''从excel把数据导入datagridveiw中,Sheet代表excel中的工作表名称
'''</summary>
'''<param name="Sheet">Sheet代表excel中的工作表名称</param>
'''<param name="datagridview">datagridview代表数据要导入的datagridview名称</param>
Private Sub importexceltodatagridview(ByVal Sheet, ByVal datagridview)
Dim fileDialog As OpenFileDialog = New OpenFileDialog()
Dim FileName As String
'fileDialog.Filter = "Mi......
阅读全文
Sum Root to Leaf Numbers
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.
An example is the root-to-leaf path 1->2->3 which represents the number
123.
Find the total sum of all root-to-leaf numbers.
For example,
1
/ \
2 3
The root-to-leaf path 1->2 represents the number 12.
The root-to-leaf path 1->3 represents the number 13.
Return the sum = 12 + 13 = 25.
思路:
对二叉树进行递归搜索,同时记录迄今为止得到的值,......
阅读全文
目录
1、编号48 Rotate Image
2、编号54 Spiral Matrix
3、编号59 Spiral Matrix II
4、编号73 Set Matrix Zeroes
5、编号74 Search a 2D Matrix
1、编号48 Rotate Image
You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Follow up: Could you do this in-place?
可以硬算转了九十度后的目标矩阵和原矩阵各元素的对应关系。但是更简单的是先求原矩阵的转置矩阵,然后取反...
class Solution {
public:
void rotate(vector<vector<int> > &matrix) {
......
阅读全文
当你在计算机上想启动一个服务,计算机却提示"port already in use",此时,可以使用lsof命令来查看那个进程占用了该端口(lsof -i:port). lsof是LiSt Open Files的缩写,在linux环境下,任何事物都以文件的形式存在,通过文件不仅仅可以访问常规数据,还可以访问网络连接和硬件。
lsof的使用方法如下:
qsun@qsun-VirtualBox:~$ sudo lsof | head -5
[sudo] password for qsun:
lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /home/qsun/.gvfs
Output information may be incomplete.
COMMAND P......
阅读全文