in Education by
I have a severe problem in my project. I need to send an image data to another node in the cluster. I read the images with ImageMagick, as like: Image testImage; // read in the file testImage.read("image.png"); And i send it as: MPI_Send( &testImage, sizeof(Image), MPI_BYTE, i , 100, MPI_COMM_WORLD); the other nodes should receive it as: Image subimage_toModify; MPI_Recv( &subimage_toModify, sizeof(Image), MPI_BYTE, 0, 100, MPI_COMM_WORLD, &status); But i get a Segmentation Fault: Signal code: Address not mapped (1) can anyone be of any help? i am almost frustrated ! JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
The Image class is not a POD type, therefore you can not send it using MPI_Send The simplest way to do it is to send BLOB data, which you can get from the Image object, but it might not be optimal. So, do it like this : Image testImage; // read in the file testImage.read("image.png"); Blob blob; testImage.write( & blob ); int size = blob.length(); MPI_Send( &size, sizeof( size ), MPI_BYTE, i , 100, MPI_COMM_WORLD); MPI_Send( blob.data(), blob.length(), MPI_BYTE, i , 100, MPI_COMM_WORLD); To receive : int size = 0; MPI_Recv( &size, sizeof( size ), MPI_BYTE, 0, 100, MPI_COMM_WORLD, &status); std::vector< unsigned char > tempBuffer( size, 0 ); MPI_Recv( &tempBuffer[0], tempBuffer.size(), MPI_BYTE, 0, 100, MPI_COMM_WORLD, &status); Blob blob( &tempBuffer[0], tempBuffer.size());

Related questions

0 votes
    I have created a set of multi-platform C++ components to load and manage various types of digitally signed ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    I have a JSON File with database environment configuration called env-config.json like this: { "LATEST":{ ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    Having two thread, one product data, another one process data. The data is not just an int or float but a complex object. In ... = buffer; //mutex.unlock(); if(!tmp.data) std::cout...
asked Apr 9, 2022 in Education by JackTerrance
0 votes
    To get the current date, the _______ function will return a Date object which can be converted to a different ... of R Programming Select the correct answer from above options...
asked Feb 16, 2022 in Education by JackTerrance
0 votes
    You can check to see whether an R object is NULL with the _________ function. (a) is.null() (b) is. ... and Debugging of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    How is a Data object represented internally in R language? (a) unclass (as.time ( 2018-12-28″)) (b) ... and Debugging of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    _______________ returns TRUE then X can be termed as a matrix data object. (a) is. matrix(X ) (b) is ... and Debugging of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    ___________ are the most commonly documented object. (a) Interface (b) Class (c) Functions (d) Libraries This ... of R Programming Select the correct answer from above options...
asked Feb 10, 2022 in Education by JackTerrance
0 votes
    I am working on a C++ program, which uses cURL library, which is written in plain C. When I try ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Aug 1, 2022 in Education by JackTerrance
0 votes
    Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 30, 2022 in Education by JackTerrance
0 votes
    // merge.cpp // merges two containers into a third #include #include //for merge() using namespace std; int src1[] = { 2, 3, 4, ... , src1+5, src2, src2+3, dest); for(int j=0; j...
asked Jun 2, 2022 in Education by JackTerrance
0 votes
    Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    Tm trying to get the difference of 2 sets in linked list Example: Input: Set A: 1 - 2 - 3 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
0 votes
    I am currently working on a personal project in C++, and I'm having a lot of fun learning. I just learned some ... MainMenu::~MainMenu(){} void MainMenu::displayMenu() { std::cout...
asked May 3, 2022 in Education by JackTerrance
...