摘要: 1 #include <stdio.h> 2 #include <cuda_runtime.h> 3 #include <device_launch_parameters.h> 4 #include "book.h" 5 #include "gputimer.h" 6 7 __global__ vo 阅读全文
posted @ 2017-07-31 17:31 Jason&Hymer 阅读(347) 评论(0) 推荐(0)
摘要: 1 #include 2 #include "gputimer.h" 3 #include "cuda_runtime.h" 4 #include "device_launch_parameters.h" 5 #include 6 7 const int N = 1024; 8 const int K = 32; 9 10 void fill_matrix(float ... 阅读全文
posted @ 2017-07-31 16:00 Jason&Hymer 阅读(2559) 评论(0) 推荐(0)
摘要: 题目:在长方形布局的方式中,每个线程块的X轴方向上开启了32个线程,Y轴方向上开启了4个线程。在线程网格上,X轴方向上有1个线程块,Y轴方向有4个线程块。计算在X轴方向和Y轴方向上的线程块索引与线程索引等一些信息。 阅读全文
posted @ 2017-07-24 16:57 Jason&Hymer 阅读(1139) 评论(0) 推荐(0)
摘要: 在学习用CUDA做并行计算,过程中遇到了一些坑,在此记录一下。 1. Visual Studio Community 2013试用到期后,页面一直提示试用到期,关闭后就直接退出Visual Studio。遇到这种问题的解决办法就是点击【Sign In】,用微软账号登陆(没有的话可以注册),之后就可以 阅读全文
posted @ 2017-07-22 12:08 Jason&Hymer 阅读(1502) 评论(0) 推荐(0)
摘要: 题目:多项式f(x)=x + x^2 + x^3 + ···+x^n求和。 阅读全文
posted @ 2017-07-11 22:51 Jason&Hymer 阅读(598) 评论(0) 推荐(0)
摘要: 题目:将1000000个线程写入到10个数组。 编译环境:visual studio 2013 阅读全文
posted @ 2017-07-10 14:29 Jason&Hymer 阅读(2272) 评论(0) 推荐(0)
摘要: #ifndef __GPU_TIMER_H__ #define __GPU_TIMER_H__ struct GpuTimer { cudaEvent_t start; cudaEvent_t stop; GpuTimer() { cudaEventCreate(&start); cudaEvent 阅读全文
posted @ 2017-07-09 23:03 Jason&Hymer 阅读(1157) 评论(0) 推荐(0)
摘要: (1) 把BHP数据分别加载到收盘价和成交量的数组中:c, v=np.loadtxt('BHP.csv', delimiter=',', usecols=(6, 7), unpack=True)为了判断计算中成交量前的正负号,我们先使用diff函数计算收盘价的变化量。diff函数可以计算数组中两个连 阅读全文
posted @ 2017-06-15 12:49 Jason&Hymer 阅读(1966) 评论(0) 推荐(0)
摘要: 参考资料:《Numpy学习指南》 阅读全文
posted @ 2017-06-15 10:52 Jason&Hymer 阅读(876) 评论(0) 推荐(0)
摘要: (1) clip方法返回一个修剪过的数组,也就是将所有比给定最大值还大的元素全部设为给定的最大值,而所有比给定最小值还小的元素全部设为给定的最小值。 (2) compress方法返回一个根据给定条件筛选后的数组。 阅读全文
posted @ 2017-06-15 09:34 Jason&Hymer 阅读(175) 评论(0) 推荐(0)