LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Parallel programming with ncurses problem (https://www.linuxquestions.org/questions/programming-9/parallel-programming-with-ncurses-problem-150689/)

StressedLemming 02-26-2004 07:26 AM

Parallel programming with ncurses problem
 
I've written a parallel program using C++ and MPI. I'm now trying to improve how output is displayed by using ncurses. Previously, the master and slave computers displayed messages on the same monitor via cout statements. Is there anyway to have master and slaves display things on the same monitor using ncurses?

Thanks

doraiashok 02-26-2004 07:49 AM

I haven't worked with MPIs but in general if two or more processes have to share the same output when using curses then create a WINDOW pointer which can be shared among the processes.

I would use one of the types of IPC to acheive the sharing in case of processes.

StressedLemming 02-26-2004 08:36 AM

Could you define IPC for me please. I'm quite new to programming.

I've tried creating a window in main() and passed the point for it to slave() but the slaves are unable to use it... when the slaves get to

wprintw(monitor,"hello");
refresh();

the program exits with a nonzero exit code

sarin 02-26-2004 10:19 AM

IPC is Inter Process Communication. There are many ways of doing it. But I think your problem can be solved in a much simpler way. Add a network interface to the programs that writes the o/p to stdout on your master and slave. Now you can run a simple server from the network to capture both the o/ps and then display it in different windows. Since you are new to programming, I don't know how useful this solution will be. But I feel network programming is much simpler compared to IPC. Also, I believe that since you run these two programs on two different computers, you will have to use some network programming to get the messages on one side. (Ok, I too am ignorant about MPI. May be you can do all these with MPI by itself! IPC also makes use of some message passing most of the time)

--Sarin

doraiashok 02-26-2004 11:54 AM

I totally accept what sarin says, ie., in case your slaves and master run on different systems then you need to use network programming to get this work done.

Also in case you have decided that your master and slaves run on a single system then Inter Process Communication can be used. In the beginning it might be a bit difficult to learn but it will be very comfortable once you know it. "Shared Memory" concept can be used in this case. In short about shared memory: the shared memory is allocated in the kernel region so that any process in the system can access to the address.


All times are GMT -5. The time now is 04:07 AM.