LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-26-2004, 07:26 AM   #1
StressedLemming
LQ Newbie
 
Registered: Oct 2003
Posts: 26

Rep: Reputation: 15
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
 
Old 02-26-2004, 07:49 AM   #2
doraiashok
LQ Newbie
 
Registered: Nov 2003
Posts: 19

Rep: Reputation: 0
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.
 
Old 02-26-2004, 08:36 AM   #3
StressedLemming
LQ Newbie
 
Registered: Oct 2003
Posts: 26

Original Poster
Rep: Reputation: 15
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
 
Old 02-26-2004, 10:19 AM   #4
sarin
Member
 
Registered: May 2001
Location: India, Kerala, Thrissur
Distribution: FC 7-10
Posts: 354
Blog Entries: 2

Rep: Reputation: 34
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
 
Old 02-26-2004, 11:54 AM   #5
doraiashok
LQ Newbie
 
Registered: Nov 2003
Posts: 19

Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
parallel programming 2395 Programming 1 10-08-2005 06:44 PM
Parallel Programming in Linux serhosseini Programming 3 07-09-2005 08:46 PM
C programming HELP, ncurses window functions naomi Programming 3 02-06-2005 05:54 AM
Programming the parallel port via /dev/lp0 Nerox Programming 3 01-09-2005 05:25 AM
ncurses-5.2-28 conflicts with file from package ncurses-5.2-12 tubby Linux - Software 4 06-16-2002 12:00 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration