Tag: parallel processing

MPI_Isend和MPI_Irecv似乎导致死锁

我在MPI中使用非阻塞通信在进程之间发送各种消息。 但是,我似乎陷入了僵局。 我使用PADB( 请参阅此处 )查看消息队列并获得以下输出: 1:msg12: Operation 1 (pending_receive) status 0 (pending) 1:msg12: Rank local 4 global 4 1:msg12: Size desired 4 1:msg12: tag_wild 0 1:msg12: Tag desired 16 1:msg12: system_buffer 0 1:msg12: Buffer 0xcaad32c 1:msg12: ‘Receive: 0xcac3c80’ 1:msg12: ‘Data: 4 * MPI_FLOAT’ — 1:msg32: Operation 0 (pending_send) status 2 (complete) 1:msg32: Rank local 4 […]

使用MPI_Type_create_subarray发送时可以转置数组吗?

我试图在C中使用MPI转置矩阵。每个进程都有一个方形子矩阵,我想将它发送到正确的进程(网格上的“对面”),将其转换为通信的一部分。 我正在使用MPI_Type_create_subarray ,它有一个订单参数,分别是行主要和列主要的MPI_ORDER_C或MPI_ORDER_FORTRAN 。 我认为,如果我作为其中一个发送,并作为另一个接收,那么我的矩阵将被转换为通信的一部分。 然而,这似乎并没有发生 – 它只是保持非转置。 代码的重要部分如下所示,整个代码文件都可以在这个要点中找到 。 有没有人有任何想法为什么这不起作用? 这种方法是否应该进行转置工作? 我已经想过,在阅读了MPI_ORDER_C和MPI_ORDER_FORTRAN的描述MPI_ORDER_FORTRAN ,但也许没有。 /* ———– DO TRANSPOSE ———– */ /* Find the opposite co-ordinates (as we know it’s a square) */ coords2[0] = coords[1]; coords2[1] = coords[0]; /* Get the rank for this process */ MPI_Cart_rank(cart_comm, coords2, &rank2); /* Send to these new coordinates […]

CUDA – Eratosthenes筛分为部分

我在GPU上编写了Eratosthenes的Sieve( https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes )的实现。 但不是这样的 – http://developer-resource.blogspot.com/2008/07/cuda-sieve-of-eratosthenes.html 方法: 创建具有默认值0/1(0 – prime,1 – no)的n元素数组并将其传递给GPU(我知道它可以直接在内核中完成,但在这一刻它不是问题)。 块中的每个线程检查单个数字的倍数。 每个块检查总sqrt(n)的可能性。 每个块==不同的间隔。 将倍数标记为1并将数据传递回主机。 码: #include #include #define THREADS 1024 __global__ void kernel(int *global, int threads) { extern __shared__ int cache[]; int tid = threadIdx.x + 1; int offset = blockIdx.x * blockDim.x; int number = offset + tid; cache[tid – 1] = […]

并行合并使用线程排序/比Seq更多/更慢。 合并排序。 救命

http://pastebin.com/YMS4ehRj 这是我对并行合并排序的实现。 基本上我所做的是,对于每一次拆分,前半部分由一个线程处理,而后半部分是顺序的(即)说我们有一个包含9个元素的数组,[0..4]由线程1处理,[0 ..1]处理线程2,[5..6]由线程3处理(查看源代码以便澄清)。 其他一切都保持不变,比如合并。 但问题是,这比合并排序慢得多,甚至比正常的冒泡排序慢! 我的意思是一个25000 int的数组。 我不确定瓶颈在哪里:它是互斥锁吗? 是合并吗? 关于如何加快速度的任何想法?