我的第一个问题(耶!)是关于gnumake和并行构建的.这是一个快速示例文件:
.PHONY: tool_1 tool_2 tool_3 tool_4 all tools
all: | tools
tools: | tool_2 tool_3 tool_4
tool_1:
# commands for tool 1
tool_2: | tool_1
# commands for tool 2
tool_3: | tool_1
# commands for tool 3
tool_4: | tool_1
# commands for tool 4
Run Code Online (Sandbox Code Playgroud)
如果我make -j对这个人这么做,我在这里是否正确,以确保命令tool_1只执行一次,并在make尝试构建任何之前tool_[234]?
我正在寻找的是首先构建make -j原因tool_1,然后tool_[234]并行构建,但不执行命令tool_1三次.我希望这是有道理的.感谢您的任何建议或想法!
LLVM的哪些属性使其成为(并行,并发,分布式)语言的实现的良好选择,是什么让它变得糟糕?
compiler-construction parallel-processing llvm distributed-programming
我在多节点Linux集群上运行R. 我想使用脚本或批处理模式在R上运行我的分析,而不使用MPI或snow等并行计算软件.
我知道这可以通过划分输入数据来完成,使得每个节点运行不同的数据部分.
我的问题是我该如何解决这个问题呢?我不确定如何编写脚本代码.一个例子非常有用!
到目前为止,我一直在使用PBS运行我的脚本,但它似乎只在一个节点上运行,因为R是一个单线程程序.因此,我需要弄清楚如何调整我的代码,以便将人工分配给所有节点.
这是我到目前为止所做的事情:
1)命令行:
> qsub myjobs.pbs
Run Code Online (Sandbox Code Playgroud)
2)myjobs.pbs:
> #!/bin/sh
> #PBS -l nodes=6:ppn=2
> #PBS -l walltime=00:05:00
> #PBS -l arch=x86_64
>
> pbsdsh -v $PBS_O_WORKDIR/myscript.sh
Run Code Online (Sandbox Code Playgroud)
3)myscript.sh:
#!/bin/sh
cd $PBS_O_WORKDIR
R CMD BATCH --no-save my_script.R
Run Code Online (Sandbox Code Playgroud)
4)my_script.R:
> library(survival)
> ...
> write.table(test,"TESTER.csv",
> sep=",", row.names=F, quote=F)
Run Code Online (Sandbox Code Playgroud)
任何建议将不胜感激!谢谢!
-CC
我有一个方法,我用不同的参数调用8次.我用
AvailableYears.AsParallel()
.Select<Int32,DateUsedByThread>(x => GetDataForYearWorker(x,CIF))
.ToList();
Run Code Online (Sandbox Code Playgroud)
GetDataForYearWorker同步从Web服务获取响应.它在我的asp.net应用程序上使用非常少的计算能力,但是每个webservice响应都需要3-5秒.因为对web服务的调用是彼此独立的,所以我想同时进行所有操作.但看起来只有2个线程可以同时运行.为什么这样,我怎么能有8个线程同时工作?
我正在开发一个需要进行重线性代数计算的程序.
现在我正在使用LAPACK/BLAS例程,但我需要利用我的机器(24核Xeon X5690).
我发现像pblas和scalapack这样的项目,但它们似乎都专注于分布式计算和使用MPI.
我没有可用的集群,所有计算都将在一台服务器上完成,并且使用MPI看起来像是一种过度杀伤力.
有人对此有任何建议吗?
我有一个10米行的大桌子.我需要为每一行获得一些统计值.例如,我有生成此值的函数GetStatistic(uuid).这个函数运行速度很慢,结果值不经常更改,所以我Statistic在表中创建了列,每天执行一次这样的查询:
UPDATE MyTable SET Statistic = GetStatistic(ID);
Run Code Online (Sandbox Code Playgroud)
在选择查询中,我使用列Statistic而不调用GetStatistic函数.
问题是,我的生产服务器有64个CPU和大量内存,因此几乎所有数据库都可以缓存到RAM,但是这个查询只使用一个CPU,需要2或3个小时才能执行.
GetStatistic函数使用表,在所有UPDATE查询执行期间都是常量.我可以修改查询以获得postgre,使用所有可用的CPU同时计算不同行的并行中的GetStatistic吗?
我正在尝试使用Cython来并行化一个昂贵的操作,这涉及生成中间多维数组.
以下非常简化的代码说明了我正在尝试做的事情:
import numpy as np
cimport cython
cimport numpy as np
from cython.parallel cimport prange
from libc.stdlib cimport malloc, free
@cython.boundscheck(False)
@cython.wraparound(False)
def embarrasingly_parallel_example(char[:, :] A):
cdef unsigned int m = A.shape[0]
cdef unsigned int n = A.shape[1]
cdef np.ndarray[np.float64_t, ndim = 2] out = np.empty((m, m), np.float64)
cdef unsigned int ii, jj
cdef double[:, :] tmp
for ii in prange(m, nogil=True):
for jj in range(m):
# allocate a temporary array to hold the result of
# expensive_function_1
tmp_carray …Run Code Online (Sandbox Code Playgroud) python parallel-processing numpy cython thread-local-storage
我有一个tar.gz文件,我是由pigz(并行gzip)制作的.我想计算压缩文件中的文件数而不解压缩.
我用这个命令:
tar -tzf file.tar.gz
Run Code Online (Sandbox Code Playgroud)
但是我收到一个错误:
tar: This does not look like a tar archive
tar: Skipping to next header
Run Code Online (Sandbox Code Playgroud)
是因为我使用了pigz而不是gzip?如果是的话,我现在怎么算这些呢?
提前致谢.
我试图平行化在许多独立数据集上运行的蒙特卡罗模拟.我发现numba的并行guvectorize实现比numba jit实现快了不到30-40%.
我发现这些(1,2#2)相媲美的话题,但他们没有真正回答我的问题.在第一种情况下,实现通过回退到对象模式而减慢,而在第二种情况下,原始海报没有正确使用guvectorize - 这些问题都不适用于我的代码.
为了确保我的代码没有问题,我创建了这个非常简单的代码来比较jit和guvectorize:
import timeit
import numpy as np
from numba import jit, guvectorize
#both functions take an (m x n) array as input, compute the row sum, and return the row sums in a (m x 1) array
@guvectorize(["void(float64[:], float64[:])"], "(n) -> ()", target="parallel", nopython=True)
def row_sum_gu(input, output) :
output[0] = np.sum(input)
@jit(nopython=True)
def row_sum_jit(input_array, output_array) :
m, n = input_array.shape
for i in range(m) :
output_array[i] = np.sum(input_array[i,:])
rows = int(64) …Run Code Online (Sandbox Code Playgroud) 我有一种算法可以对给定长度的列表进行并行排序:
import Control.Parallel (par, pseq)
import Data.Time.Clock (diffUTCTime, getCurrentTime)
import System.Environment (getArgs)
import System.Random (StdGen, getStdGen, randoms)
parSort :: (Ord a) => [a] -> [a]
parSort (x:xs) = force greater `par` (force lesser `pseq`
(lesser ++ x:greater))
where lesser = parSort [y | y <- xs, y < x]
greater = parSort [y | y <- xs, y >= x]
parSort _ = []
sort :: (Ord a) => [a] -> [a]
sort (x:xs) = lesser ++ x:greater
where lesser …Run Code Online (Sandbox Code Playgroud) numpy ×2
python ×2
asp.net ×1
c# ×1
compression ×1
cython ×1
gnu-make ×1
gzip ×1
haskell ×1
lapack ×1
linux ×1
llvm ×1
makefile ×1
numba ×1
optimization ×1
pbs ×1
performance ×1
postgresql ×1
quicksort ×1
r ×1
sql-update ×1
tar ×1