Ensure non-void functions return something
[charm.git] / src / langs / pvmc / pvmc_conv.c
blobd89de3eabf6c488cde2066e3e126260d4f0467a4
1 #include <stdio.h>
2 #include <stddef.h>
3 #include <converse.h>
4 #include "pvmc.h"
6 void pvmc_init(void)
8 pvmc_init_bufs();
9 pvmc_init_comm();
10 pvmc_init_groups();
13 int pvm_mytid(void)
16 #ifdef PVM_DEBUG
17 PRINTF("Pe(%d) tid=%d:pvm_mytid()\n",MYPE(),PE2TID(MYPE()+1));
18 #endif
20 return PE2TID(MYPE());
23 int pvm_exit(void)
25 int sleepval;
27 #ifdef PVM_DEBUG
28 PRINTF("Pe(%d) tid=%d:pvm_exit()\n",MYPE(),pvm_mytid());
29 #endif
31 ConverseExit();
33 return 0;
36 int pvm_spawn(char *task, char **argv, int flag,
37 char *where, int ntask, int *tids)
39 int i;
40 int numt;
42 #ifdef PVM_DEBUG
43 PRINTF("Pe(%d) tid=%d:pvm_spawn()\n",MYPE(),pvm_mytid());
44 #endif
46 numt = ntask;
47 if (numt > CmiNumPes())
48 numt = CmiNumPes();
49 #ifdef PVM_DEBUG
50 PRINTF("%s: preping %d tids (wanted to prep %d)\n",__FILE__,numt,ntask);
51 #endif
52 for(i=0; i<numt; i++)
54 tids[i]=PE2TID(i);
55 #ifdef PVM_DEBUG
56 PRINTF("Pe(%d) tids[%d]=%d (%d)\n",MYPE(),i,PE2TID(i),tids[i]);
57 #endif
60 return numt;
63 int pvm_parent(void)
65 #ifdef PVM_DEBUG
66 PRINTF("Pe(%d) tid=%d:pvm_parent()\n",MYPE(),pvm_mytid());
67 #endif
69 /*
70 * I think it would be better to return PvmNoParent, but
71 * this may make sense too, and it makes namd2/DPMTA work.
73 return 1;
76 int pvm_config(int *nhost, int *narch, struct pvmhostinfo **hostp)
78 int i, nh=0;
80 /* sleep(10); */
82 if (nhost)
84 #ifdef PVM_DEBUG
85 PRINTF("tid=%d:pvm_config(%x,%x,%x)\n",pvm_mytid(),nhost,narch,hostp);
86 #endif
87 printf("tid=%d:pvm_config(%x,%x,%x)\n",pvm_mytid(),nhost,narch,hostp);
88 printf("%d\n",*nhost);
89 *nhost=nh=CmiNumPes();
91 else
92 return -1;
94 if (narch)
95 *narch=1;
97 *hostp = (struct pvmhostinfo *)MALLOC(nh*sizeof(struct pvmhostinfo));
99 if (*hostp == (struct pvmhostinfo *)NULL)
100 return -1;
102 for(i=0; i<nh; i++) {
103 hostp[i]->hi_tid=PE2TID(i);
104 hostp[i]->hi_name="";
105 hostp[i]->hi_arch="CONVERSE";
106 hostp[i]->hi_speed=1000;
109 return 0;
112 int pvm_tasks(int which, int *ntask, struct pvmtaskinfo **taskp)
114 int i;
116 #ifdef PVM_DEBUG
117 PRINTF("tid=%d:pvm_tasks(%d,%x,%x)\n",pvm_mytid(),which,ntask,taskp);
118 #endif
120 if (which==0)
121 *ntask=CmiNumPes();
122 else
123 *ntask=1;
125 *taskp = (struct pvmtaskinfo *)MALLOC(*ntask * sizeof(struct pvmtaskinfo));
127 if (*taskp == (struct pvmtaskinfo *)NULL)
128 return -1;
130 for(i=0; i<*ntask; i++) {
131 taskp[i]->ti_tid=PE2TID(i);
132 taskp[i]->ti_ptid=PE2TID(0);
133 taskp[i]->ti_host=PE2TID(i);
134 taskp[i]->ti_flag=0;
135 taskp[i]->ti_a_out="";
138 return 0;
141 int pvm_setopt(int what, int val)
143 #ifdef PVM_DEBUG
144 PRINTF("tid=%d:pvm_setopt(%d,%d)\n",pvm_mytid(),what,val);
145 #endif
146 return val;
149 int pvm_gsize(char *group)
151 #ifdef PVM_DEBUG
152 PRINTF("tid=%d:pvm_gsize(%s)\n",pvm_mytid(),group);
153 #endif
154 return CmiNumPes();
157 int pvm_gettid(char *group, int inum)
159 #ifdef PVM_DEBUG
160 PRINTF("tid=%d:pvm_gettid(%s,%d)\n",pvm_mytid(),group,inum);
161 #endif
162 return inum;
165 int pvm_catchout(FILE *ff)
167 PRINTF("Warning: pvm_catchout not implemented\n");
168 return 0;