shared-memory

When is padding for shared memory really required?

北战南征 提交于 2019-11-30 10:49:02
I am confused by 2 documents from NVidia. "CUDA Best Practices" describes that shared memory is organized in banks, and in general in 32-bit mode each 4 bytes is a bank (that is how I understood it). However "Parallel Prefix Sum (Scan) with CUDA" (available here: http://http.developer.nvidia.com/GPUGems3/gpugems3_ch39.html ) goes into details how padding should be added to scan algorithm because of bank conflicts. The problem for me is, the basic type for this algorithm as presented is float and its size is 4 bytes. Thus each float is a bank and there is no bank conflict. So is my

When to use Pipes vs When to use Shared Memory

谁都会走 提交于 2019-11-30 10:18:06
问题 I am reading about various IPC mechanism. I am trying to figure out the scenarios, where we use Shared Memory and where we use named Pipes(FIFO). Pipes: Multiple process can Write, however only one process can read. Write operation is atomic. Shared Memory: Multiple process can read and write. And also user needs to provide mutual exclusion for read & write. Is this the only difference of application of shared memory and pipe ? 回答1: Essentially, pipes - whether named or anonymous - are used

Making my NumPy array shared across processes

断了今生、忘了曾经 提交于 2019-11-30 08:51:30
I have read quite a few of the questions on SO about sharing arrays and it seems simple enough for simple arrays but I am stuck trying to get it working for the array I have. import numpy as np data=np.zeros(250,dtype='float32, (250000,2)float32') I have tried converting this to a shared array by trying to somehow make mp.Array accept the data , I have also tried creating the array as using ctypes as such: import multiprocessing as mp data=mp.Array('c_float, (250000)c_float',250) The only way I have managed to get my code working is not passing data to the function but passing an encoded

How to share a string amongst multiple processes using Managers() in Python?

£可爱£侵袭症+ 提交于 2019-11-30 08:36:59
I need to read strings written by multiprocessing.Process instances from the main process. I already use Managers and queues to pass arguments to processes, so using the Managers seems obvious, but Managers do not support strings : A manager returned by Manager() will support types list, dict, Namespace, Lock, RLock, Semaphore, BoundedSemaphore, Condition, Event, Queue, Value and Array. How do I share state represented by a string using Managers from the multiprocessing module? Bengt multiprocessing's Managers can hold Values which in turn can hold instances of the type c_char_p from the

System V shared memory in Python?

穿精又带淫゛_ 提交于 2019-11-30 05:21:35
How can I make use of the shmat() , shmdt() , shmctl() , shmget() calls from Python? Are they hidden somewhere in the standard library? Update0 I'm after System V bindings that can be found in the Ubuntu repositories, or Python standard libraries (now or in future releases). Google finds sysv_ipc . If you don't want to use any non-standard Python libraries, perhaps you could wrap the functions you need yourself using ctypes ? This page offers a feature matrix to help you choose between the posix_ipc , sysv_ipc , and shm modules. The processing package also supports shared memory objects, and

Distributed shared memory library for C++?

£可爱£侵袭症+ 提交于 2019-11-30 04:37:27
问题 I am writing a distributed application framework in C++. One of the requirements is the provision of distributed shared memory. Rather than write my own from scratch (and potentially re-invent the wheel), I thought I would see if there were any pre-existing Open source libraries - a quick google search did not yield anything to useful. Does anyone on here have any experience of a good C++ DSM library that they can recommend? Ideally, the library will support MRMW (Multiple readers/multiple

what does it mean configuring MPI for shared memory?

老子叫甜甜 提交于 2019-11-30 03:56:13
I have a bit of research related question. Currently I have finished implementation of structure skeleton frame work based on MPI (specifically using openmpi 6.3 ). the frame work is supposed to be used on single machine. now, I am comparing it with other previous skeleton implementations (such as scandium , fast-flow , ..) One thing I have noticed is that the performance of my implementation is not as good as the other implementations. I think this is because, my implementation is based on MPI (thus a two sided communication that require the match of send and receive operation) while the

Is it possible to store pointers in shared memory without using offsets?

只谈情不闲聊 提交于 2019-11-30 03:48:42
问题 When using shared memory, each process may mmap the shared region into a different area of its respective address space. This means that when storing pointers within the shared region, you need to store them as offsets of the start of the shared region. Unfortunately, this complicates use of atomic instructions (e.g. if you're trying to write a lock free algorithm). For example, say you have a bunch of reference counted nodes in shared memory, created by a single writer. The writer

C++ boost libraries shared_memory_object undefined reference to 'shm_open'

╄→гoц情女王★ 提交于 2019-11-30 00:49:42
问题 I tried to compile the following code on ubuntu 11.04: #include <boost/interprocess/shared_memory_object.hpp> #include <iostream> int main() { boost::interprocess::shared_memory_object shdmem(boost::interprocess::open_or_create, "Highscore", boost::interprocess::read_write); shdmem.truncate(1024); std::cout << shdmem.get_name() << std::endl; boost::interprocess::offset_t size; if (shdmem.get_size(size)) std::cout << size << std::endl; } only to get the following errors: /tmp/cc786obC.o: In

/tmp vs. /dev/shm for temp file storage on Linux?

☆樱花仙子☆ 提交于 2019-11-30 00:24:23
问题 I have scripts that make hundreds of quick succession, small, temp files needing to be created and very soon read back in, then unlinked. My testing shows little if any performance difference by putting said files in /tmp (to disk) or into /dev/shm (filesystem-level shared memory) on Linux even under moderate load. I attribute this to the filesystem cache. Granted the disk will eventually get hit with the fileystem actions, but on multiple small write-read temp files, why would you (not)