* Blazej Sawionek said: > I found myself too stupid to execute Python examples, so I decided to turn to PVM (I was told it could also do the task I need), but during installation of pvm and pvm-dev > I got the following warnings: > > ldconfig: warning: /usr/lib/libtcpwrapGK.so.1 is not a symlink > ldconfig: warning: /usr/lib/libomnithread.so.2 is not a symlink > ldconfig: warning: /usr/lib/libomniORB2.so.6 is not a symlink > ldconfig: warning: /usr/lib/libomniLC.so.2 is not a symlink > > Now I can't compile nor run PVM examples. Does it mean I have to gove up? Funny you asked about PVM :)). I don't know the answer for your problem, but I have one myself - pvm installs, pvmd runs just fine, but spawning a new process is a disaster... A stupid program which does NOTHING at all (attached) allocates as much memory as it can. I even ran it as root - just to test how it will behave. Within 1min from the startup it allocated 570MB of memory (on a 512MB RAM machine :) and kept doing it happily :). The loadavg jumped to 10 and was increasing. I killed pvmd and the process and everything came back to normal. Launching the program as a regular user allocated mere 140MB memory (which was the limit for that user). What gives? Can anybody explain to me what's wrong? I'm completely new to PVM. thanks, marek
#include <stdio.h>
#include <stdlib.h>
#include <pvm3.h>
#define GROUPNAME "ouzo"
#define OUZO_TAG 10
#define VERBOSE 1
#define MSG_NEW 1
void msg(char * text)
{
if (VERBOSE) fprintf(stdout, text);
}
int main(int argc, char **argv)
{
int mytid;
int myinstance;
int message[2];
int send_to;
int grpsize;
int max_instance;
int found=0;
int tid;
int i;
char text_message[100];
mytid=pvm_mytid();
msg("Joining to goup ouzo.\n");
pvm_joingroup(GROUPNAME);
msg("Checking if I am first.\n");
grpsize=pvm_gsize(GROUPNAME);
myinstance=pvm_getinst(GROUPNAME, mytid);
switch (grpsize)
{
case 1: msg("I am first so I initiate the ring.\n");
max_instance=myinstance;
send_to=myinstance;
break;
default:
msg("Ring is already set.\n");
msg("Trying to join the ring.\n");
msg("Searching for the process to connect to.\n");
for (i=0; (i==myinstance) || ((tid=pvm_gettid(GROUPNAME, i))<=0); i++);
//przygotuj wiadomosc
pvm_initsend( PvmDataDefault );
message[0]=MSG_NEW;
message[1]=myinstance;
pvm_pkint(message, 2, 1);
pvm_send(tid, OUZO_TAG);
break;
}
do
{
msg("Listening..\n");
pvm_recv(-1, OUZO_TAG);
//obsluga przychodzacych wiadomosci
//rodzaje przychodzacych wiadomosci
//MSG_STD - normalny broadcast - do wyswietlenia i do wyslania dalej
//MSG_NEW - poszukiwanie miejsca w ringu dla nowego procesu
//MSG_LAST_UPDATE - update numeru ostatniej instancji w ringu
// zakeszowac i przeslac dalej
//MSG_TERMINATE -- przeslac dalej i zakonczyc program.
} while (1);
/*
if (instance && argc==2 && !strcmp(argv[1], "terminate"))
{
printf("terminating ring\n");
pvm_initsend(PvmDataDefault);
message=-1;
pvm_pkint(&message, 1, 1);
pvm_send(0, MESSAGE_TAG);
pvm_exit();
}
if (!instance)
{
//i am the first one ... who the fuck is alice ?
//czekam na komunikat o nastepnym przylaczonym procesie
pvm_recv(-1,MESSAGE_TAG);
pvm_upkint(message,1 , 1);
switch (message)
{
case 1: //niech to bedzie przylaczenie nowego procesu
case -1: //to bedzie ring terminate
printf("terminating ring - instance %d", instance);
pvm_exit();
case 2: //to bedzie normalna wiadomosc;
pvm_upkstr(text_message);
break;
}
}*/
msg("Leaving the Group ouzo.\n");
pvm_lvgroup(GROUPNAME);
pvm_exit();
return 0;
}
Attachment:
pgpDCmRoxSZPd.pgp
Description: PGP signature