每当我在我的机器上安装软件时它就会显示出来
/bin/bash: texi2dvi: command not found
Run Code Online (Sandbox Code Playgroud)
我的操作系统是Ubuntu 12.04.我是否需要在其上安装任何软件包.
我曾经atomicMax()在CUDA内核中找到最大值:
__global__ void global_max(float* values, float* gl_max)
{
int i=threadIdx.x + blockDim.x * blockIdx.x;
float val=values[i];
atomicMax(gl_max, val);
}
Run Code Online (Sandbox Code Playgroud)
它抛出以下错误:
错误:没有重载函数"atomicMax"的实例与参数列表匹配
参数类型是:(float *, float).
我正在使用动态并行性来实现一个程序.每当我编译代码时,它都会抛出致命错误,如下所示:
ptxas fatal : Unresolved extern function 'cudaGetParameterBuffer'
编译如下:
nvcc -o dyn_par dyn_par.cu -arch=sm_35
怎么解决?
我想在Intel Xeon Phi协处理器上运行一个程序.我怎么知道我的机器是否有Intel Xeon Phi协处理器.
我尝试过以下程序将值导出到环境变量.我想将一个整数值导出到环境变量.程序下面的值是"a"而不是1.如何将整数值导出到该环境变量.
#include<stdio.h>
void chnge_env_var(int a)
{
char *name1="ENV_VAR";
char *val=NULL;
int status;
status = putenv("ENV_VAR=a");
printf("status %d\n",status);
val = getenv(name1);
printf("val %s\n",val);
}
int main()
{
int a=1;
chnge_env_var(a);
return 0;
}
Run Code Online (Sandbox Code Playgroud) 我有ac b.cpp文件.
/****** a.c ******/
fun1(...)
{
..........
fun2(...); /* function present in b.cpp */
..........
}
/******* b.cpp *******/
extern "C" int fun2(...);
int fun2(...)
{
..........
}
Run Code Online (Sandbox Code Playgroud)
我已编译代码如下:
a.o:a.c b.o
gcc -c -o a.o a.c b.o
b.o:b.cpp
g++ -c -o b.o b.cpp
Run Code Online (Sandbox Code Playgroud)
但我得到的错误是未定义的引用"fun2()".这是正确的编译方式还是我需要更改任何内容.
我使用atomicInc()尝试过以下程序.
__global__ void ker(int *count)
{
int n=1;
int x = atomicInc ((unsigned int *)&count[0],n);
CUPRINTF("In kernel count is %d\n",count[0]);
}
int main()
{
int hitCount[1];
int *hitCount_d;
hitCount[0]=1;
cudaMalloc((void **)&hitCount_d,1*sizeof(int));
cudaMemcpy(&hitCount_d[0],&hitCount[0],1*sizeof(int),cudaMemcpyHostToDevice);
ker<<<1,4>>>(hitCount_d);
cudaMemcpy(&hitCount[0],&hitCount_d[0],1*sizeof(int),cudaMemcpyDeviceToHost);
printf("count is %d\n",hitCount[0]);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
输出是:
In kernel count is 1
In kernel count is 1
In kernel count is 1
In kernel count is 1
count is 1
Run Code Online (Sandbox Code Playgroud)
我不明白为什么它没有递增.谁能帮忙
以下代码正在抛出
"警告:条件表达式中的指针/整数类型不匹配".
我该怎么解决这个问题?
#include<stdio.h>
int main()
{
char *str = "Error";
char *sch_str="pqrs";
int i=1;
if (i >= 0)
str = (sch_str[i] != NULL) ? sch_str[i] : "Unknown";
printf("%c\n",sch_str[i]);
printf("%s\n",str);
return 0;
}
Run Code Online (Sandbox Code Playgroud) c ×3
cuda ×3
nvidia ×2
c++ ×1
gpu-atomics ×1
intel ×1
intel-mic ×1
pointers ×1
texinfo ×1
ubuntu-12.04 ×1