小编Mat*_*olo的帖子

我的R有内存泄漏?

我在Ubuntu 12.04(精确)64位上使用R 2.15.3.如果我在valgrind中运行R:

R -d"valgrind" - vanilla

然后我使用q()退出程序,我得到以下报告:

==7167== HEAP SUMMARY:
==7167==     in use at exit: 28,239,464 bytes in 12,512 blocks
==7167==   total heap usage: 28,780 allocs, 16,268 frees, 46,316,337 bytes allocated
==7167== 
==7167== LEAK SUMMARY:
==7167==    definitely lost: 120 bytes in 2 blocks
==7167==    indirectly lost: 480 bytes in 20 blocks
==7167==      possibly lost: 0 bytes in 0 blocks
==7167==    still reachable: 28,238,864 bytes in 12,490 blocks
==7167==         suppressed: 0 bytes in 0 blocks
==7167== Rerun with --leak-check=full to …
Run Code Online (Sandbox Code Playgroud)

memory-leaks r rcpp

10
推荐指数
1
解决办法
2615
查看次数

使用“L'Ecuyer-CMRG”RNG 时,R 不会重置种子?

我在 R 中进行了一些并行模拟,我注意到使用“L'Ecuyer-CMRG”rng 时种子没有改变。我正在阅读“Parallel R”一书,每次调用 mclapply() 时,选项 mc.set.seed = TRUE 应该给每个工人一个新种子。

这是我的代码:

library(parallel)
RNGkind("L'Ecuyer-CMRG")

mclapply(1:2, function(n) rnorm(n), mc.set.seed = TRUE)
[[1]]
[1] -0.7125037

[[2]]
[1] -0.9013552  0.3445190

mclapply(1:2, function(n) rnorm(n), mc.set.seed = TRUE)
[[1]]
[1] -0.7125037

[[2]]
[1] -0.9013552  0.3445190
Run Code Online (Sandbox Code Playgroud)

编辑:同样的事情发生在我的台式机和我的笔记本电脑上(都是 Ubuntu 12.04 LTS)。

parallel-processing r prng

8
推荐指数
1
解决办法
1994
查看次数

如何检查R环境是否存在

我想检查是否存在R环境,但标准exists()函数不接受环境作为参数:

storage <- new.env(parent = emptyenv())

storage
#<environment: 0xeb3195c>

exists(storage)
#Error in exists(storage) : invalid first argument
Run Code Online (Sandbox Code Playgroud)

有没有办法检查环境是否已定义?或者这是一个本质上错误的事情?谢谢!

r

5
推荐指数
2
解决办法
2565
查看次数

计算Cuda内核中的寄存器/线程

nSight分析器告诉我,以下内核每个线程使用52个寄存器:

 //Just the first lines of the kernel.
__global__ void voles_kernel(float *params, int *ctrl_params, 
                             float dt, float currTime,
                             float *dev_voles, float *dev_weasels, 
                             curandStateMtgp32 *state) 
{

 __shared__ float dev_params[9];

 __shared__ int BuYeSimStep[4];

 if(threadIdx.x < 4)
 {
   BuYeSimStep[threadIdx.x] = ctrl_params[threadIdx.x];
 }

 if(threadIdx.x < 9){
     dev_params[threadIdx.x] = params[threadIdx.x];
 }

 __syncthreads();

float currVole = curand_uniform(&state[blockIdx.x]) + 3.0;
float currWeas = curand_uniform(&state[blockIdx.x]) + 0.1;
float oldVole = currVole;
float oldWeas = currWeas;

int jj;

if (blockIdx.x * blockDim.x + threadIdx.x < BuYeSimStep[2])
{
int dayIndex …
Run Code Online (Sandbox Code Playgroud)

cuda gpu hpc cpu-registers

2
推荐指数
1
解决办法
2830
查看次数

标签 统计

r ×3

cpu-registers ×1

cuda ×1

gpu ×1

hpc ×1

memory-leaks ×1

parallel-processing ×1

prng ×1

rcpp ×1