- 博客(96)
- 资源 (1)
- 收藏
- 关注
原创 关于如何正常运行NCCL的example样例程序
根据上面的知识点,因为在nccl的样例代码中,程序的运行依赖于MPI,使用了“mpi.h”的头文件,所以在编译时需要加上-ccbin mpicc++官方文档给出的样例代码如下, 注意本文件的后缀是 .cu, 我之前一直尝试用.cpp 或者.c来完成编译,发现根本不行。-l nccl , 表示**寻找动态链接库文件**libnccl.so(也就是文件名去掉前缀和后缀所代表的库文件)首先给出最终的编译命令,如果有大佬知道更优雅的方式,还请赐教,只看文档但是跑不通程序真的很难受。
2023-03-13 10:33:33
988
3
原创 ubutnu 14.04 安装 codeblocks
sudo add-apt-repository ppa:damien-moore/codeblocks-stablesudo apt-get updatesudo apt-get install codeblocks
2016-08-10 11:01:30
469
原创 numpy Windows 64位
http://blog.youkuaiyun.com/yijichangkong/article/details/44278445
2016-01-10 19:54:06
477
原创 如何解决Windows下sublime text2不能运行python的问题
http://www.bubuko.com/infodetail-33011.html
2015-12-30 00:26:29
1373
原创 HDU 3336 一个next数组就解决了
这道题本来是用来练习KMP的 结果貌似一个next数组就可以解决 首先 对于每一个元字符串的前缀数组来说 至少会有一个与他匹配的 (其实就是他本身)那么 再看看next数组的含义 每一个不为0的next数就代表着有一个子串重复过一次 比如abab 的next数组为0001 b所在的1 就代表着长度为1 的原字符串的前缀数组重复过一个 即a重复了一次 这
2015-05-06 21:13:44
481
原创 HDU 1251 简单解法
这道题我是按照大白书(算法竞赛入门指南)的思想来的,经典的Trie树,不会用C++ 所以那C写的 定义了一个二维数组来存储node节点 然后又用了一个num[MAX]来存储各个前缀的数量一开始定义的MAX为10000; 果然RE了 他说只有一组测试 我以为随便写一个就好了 果然上当了 以为算法写错了 后来该到了1000000 过了 下面是AC代码 看到别的小
2015-05-06 20:17:17
633
原创 最大连续子序列和
1.O(n^2)基本思路 对所有的情况进行遍历 , 对其实地点i进行遍历 ,为N , 对终止地址j进行遍历 ,为N ,对i到j之间的内容进行累加求和 , 为N 所以能为O(n^3)的解法 ,但是在进行对i到j之间的累加的时候有 sum[i,j]=sum[i,j-1]+a[j]所以可以压缩到O(n^2)# include int n;int a[500];int ma
2015-05-04 15:14:50
462
原创 LIS的三种求解方法
1. O(n^2)传统的求解方法 ,思路为dp,状态转移方程为 dp[i]=max( dp[j]+1,1) 即到目前的i为止,对前面出现的a[j](ja[j]的情况 ,就使用状态转移方程。转移方程代表了两种可能 ,第一种为第i个元素自己成为一个上升的队列 ,或者是由于前面的a[j]dp[j]的基础之上形成了dp[i] = dp[j]+1 但前提是a[i]>a[j]# in
2015-05-02 17:28:53
2954
原创 列表 环 判定 初始位置
判定的方法比较简单 有两种方法 第一种是使用哈希表来存贮每一个节点 这样的话 当hashset[ ] 中出现两个相同的节点时就可以判断出来这是一样的了 然后他所在的那个位置就是环第一次出现的位置上第二种方法是用两个快慢指针来做 设定两个指针分别为p1 p2 , p1的移动速度为每次移动一个距离 ,而p2的移动速度为每次移动两个距离 ,这样 ,直到快指针到达链
2015-04-30 19:30:43
745
原创 OpenGL 房子
元旦上的图形学的外教Opengl编程 前几个实验挺简单的 实现一些基本的点 线 面 多年变形的绘制 颜色的变化 位置的改变 等最后一个实验 绝对的坑 到现在也没懂那是什么大作业为house 要有房子,树,太阳等我做出来的效果如下//#include //头文件 到时候需要改一下 此头文件在codeblocks环境下运行#include
2015-01-02 17:07:29
15656
22
原创 poj 3468
# include # define lson l,m,rt<<1# define rson m+1,r,rt<<1|1# define maxn 100009__int64 sum[maxn<<2],col[maxn<<2];void Pushup(int rt){ sum[rt]=sum[rt<<1]+sum[rt<<1|1];}void build(int l,int
2014-06-15 16:42:23
490
原创 hdu 2795
# include # define lson l,m,rt<<1# define rson m+1,r,rt<<1|1# define maxn 200005int sum[maxn<<2];int h,w,n;int max(int a,int b){ return a>b?a:b;}void Pushup(int rt){ sum[rt]=max(sum[rt
2014-06-14 17:19:01
574
原创 hdu 1394
# include # define lson l,m,rt<<1# define rson m+1,r,rt<<1|1# define maxn 5555using namespace std;int min(int a,int b){ return a<b?a:b;}int sum[maxn<<2];void Pushup(int rt){ sum[rt]=s
2014-06-13 15:39:28
498
原创 hdu 2689 线段树实现
# include # define lson l , m , rt<<1# define rson m+1,r , rt<<1|1# define maxn 1111int sum[maxn<<2];void build(int l,int r,int rt){ sum[rt]=0; if(l==r) {sum[rt]=0;return ;} int
2014-06-12 23:30:25
461
原创 zoj 2352
# include # include int maxn=32009;int lev[32009],a[32009];int low(int x){ return (-x)&x;}int get(int x){ int sum=0; while(x>0) { sum+=a[x]; x-=low(x); }
2014-06-05 10:06:01
662
原创 zoj 2010
# include # include double a,b,c,d;double pi=acos(-1.0);int solve (){ double e=0.0; while(e*2.0<pi) { double ans1=c*cos(e)+d*sin(e); double ans2=c*sin(e)+d*cos(e);
2014-05-27 16:07:57
537
原创 zoj2370
# include # include double eps=1e-12;double pi=acos(-1.0);int zero(double x,double y){ return fabs(x-y)<eps;}int main(){ //printf("%lf\n",pi); double a,a2,n,c; while(scanf("%lf
2014-05-27 11:05:44
623
原创 zoj 1974 1973
# include struct node{ double x,y;}vex[100000];int main (){ int n; while(scanf("%d",&n)!=EOF) { for(int i=0;i<n;i++) scanf("%lf%lf",&vex[i].x,&vex[i].y);
2014-05-25 15:45:35
551
原创 poj 1569
# include # include struct node{ int x,y;}vex[20];int cross(node a,node b,node c){ return (b.x-a.x)*(c.y-a.y)-(c.x-a.x)*(b.y-a.y);}int area(node a,node b,node c){ return abs(cross
2014-05-19 20:57:04
511
原创 poj 1118
# include # include using namespace std;const double inf=1e20;struct node{ int x,y;}vex[709];double kk[709];double kkkk(node a,node b){ if(a.x==b.x) return inf; return (1.0)*(a.y
2014-05-19 15:02:39
523
原创 poj 1468
# include struct node{ int x1,x2,y1,y2;}vex[5009];int solve(int i,int j){ if(vex[i].x1>=vex[j].x1&&vex[i].x2=vex[j].y1&&vex[i].y2<=vex[j].y2) return 1; return 0;}int main ()
2014-05-19 13:36:35
716
原创 poj 1654
# include # include # include # include # include using namespace std;char s[1000009];struct node{ int x,y;}vex[1000009];int cross(node a,node b,node c){ return (b.x-a.x)*(c.y-a.y)-
2014-05-19 13:08:37
489
原创 poj2954
# include # include # include struct node{ int x,y;}a,b,c;int gcd(int m,int n){ return n==0?m:gcd(n,m%n);}int solve(node a,node b){ int m=abs(a.x-b.x); int n=abs(a.y-b.y);
2014-05-18 23:58:51
587
原创 zoj1392
# include # include struct node{ double x,y;};node inser(node a,node b,node c,node d){ node f=a; double t=((a.x-c.x)*(c.y-d.y)-(a.y-c.y)*(c.x-d.x))/((a.x-b.x)*(c.y-d.y)-(a.y-b.y)*(c.
2014-05-18 16:30:36
591
原创 zoj2352
# include # include # include using namespace std;# define eps 1e-8int zero(double x){ if(x>eps) return 1; if(x<-eps) return -1; return 0;}struct node{ double x,y;}vex[109]
2014-05-14 11:25:59
551
原创 zoj 1996
# include # include # include using namespace std;# define eps 1e-8int n,m;struct node{ double x,y;};struct line{ node a,b;}vex[1009];int cmp(line a,line b){ if(a.a.x==b.a.x)
2014-05-13 23:51:08
501
原创 zoj 2551
# include # include # define eps 1e-8struct node{ double x,y;};struct line{ node a,b;}vex[100009];int w[100009];int zero(double x){ if(x>eps) return 1; if(x<-eps) return -1
2014-05-13 21:16:24
507
原创 zoj1280
# include # define eps 1e-8struct node{ double x,y;};node a,b,c,d;int zero(double x){ if(x-eps) return 1; return 0;}double cross(node a,node b,node c){ return (b.x-a
2014-05-13 09:11:15
533
原创 zoj 1010
# include # include # define eps 1e-6# include struct node{ double x,y;}vex[1009];int sign(double x){ if(x<-eps) return -1; if(x>eps) return 1; return 0;}int zero(double x)
2014-05-12 21:32:31
514
原创 zoj 1081
# include # include # include # define eps 1e-6using namespace std;struct node{ double x,y;}vex[109];int n,m;int zero(double x){ return ((x)>0?(x):(-x))<eps;}double max(double x,do
2014-05-07 18:30:57
537
原创 zoj2107
# include # include # include # define maxn 100009using namespace std;struct node{ double x,y;}vex[maxn],vex2[maxn];double min(double a,double b){ return a<b?a:b;}double dis(node a,
2014-05-01 16:26:51
560
原创 zoj 2381
# include # include int n,m,x1,x2,y1,y2;struct node{ int x,y;};struct li{ node a,b; int sum;}line[2509];int cross(node a,node b,node c){ return (b.x-a.x)*(c.y-a.y)-(c.x-a.x)*(
2014-04-29 22:23:18
603
原创 zoj 1041 水题
# include # include struct node{ double x,y;}vex[156];double x,y,r;double cross(node a,node b,node c){ return (b.x-a.x)*(c.y-a.y)-(c.x-a.x)*(b.y-a.y);}void solve(int n){ int sum=
2014-04-28 21:13:15
542
原创 zoj 1453
# include # include # include using namespace std;struct node { double x,y;}vex[109],ans[109];int cmp(node a ,node b){ if(a.x==b.x) return a.y<b.y; else return a.x<b
2014-04-27 11:18:54
491
原创 hdu 1027
# include # include # include using namespace std;int sequence[1010];int main (){ int n,m,i,j; while(cin>>n>>m) { for(i=0;i<n;i++) sequence[i]=i+1; for(i=
2014-03-08 14:57:13
585
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人