我在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) 我在 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)。
我想检查是否存在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)
有没有办法检查环境是否已定义?或者这是一个本质上错误的事情?谢谢!
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)