Revision 1647

trunk/src/linad99/adcomm1.cpp (revision 1647)
1
/*
2
 * $Id$
3
 *
4
 * Author: David Fournier
5
 * Copyright (c) 2008-2012 Regents of the University of California
6
 */
7
/**
8
 * \file
9
 * Description not yet available.
10
 */
11
#if defined(USE_ADPVM)
12
#include "adpvm2.h"
13

  
14
//adstring ad_comm::subdir;
15

  
16
  // dvar_vector get_x_from_master(void)
17
  // {
18
  //   dvar_vector x;
19
  //   int ptid=pvm_parent();
20
  //   // ***************  begin variable receive block *********************
21
  //   adpvm_slave_vrecv(ptid);
22
  //   adpvm_unpack(x);
23
  //   adpvm_slave_end_vreceive();
24
  //   // ***************  end receive block ***********************************
25
  //   return x;
26
  // }
27
  //
28
  //
29
  // void send_f_to_master(const dvariable& f)
30
  // {
31
  //   // ***************  begin send block ***********************************
32
  //   int ptid=pvm_parent();
33
  //   adpvm_slave_vinitsend(PvmDataDefault);/* allocate message buffer */
34
  //   adpvm_pack(f);
35
  //   adpvm_slave_vsend(ptid);/* send buffer to master */
36
  //   // ***************  end send block ***********************************
37
  // }
38
  //
39
int adpvm_slave_args::get_num_args(void){return num_args;}
40

  
41
/**
42
 * Description not yet available.
43
 * \param
44
 */
45
void ad_comm::get_slave_assignments(void)
46
{
47
  // default slave assignment function
48
  // starts 1 slave on each host
49
  int nhost=pvm_manager->nhost;
50
  ivector & num_per_host=pvm_manager->num_per_host;
51
  if (allocated(num_per_host))
52
  {
53
    num_per_host.deallocate();
54
  }
55
  num_per_host.allocate(1,nhost);
56
  int i;
57
  pvm_manager->num_slave_processes=0;
58
  for (i=1;i<=nhost;i++)
59
  {
60
    int speed=pvm_manager->hostp[i-1].hi_speed;
61
    int nsprocs=speed%10;
62
    if (i>1) nsprocs+=1;
63
    cout << nsprocs << endl;
64
    num_per_host(i)=nsprocs;
65
    pvm_manager->num_slave_processes+=nsprocs;
66
  }
67
  imatrix & slave_assignments=pvm_manager->slave_assignments;
68
  if (allocated(slave_assignments))
69
  {
70
    slave_assignments.deallocate();
71
  }
72
  slave_assignments.allocate(1,nhost,1,num_per_host);
73

  
74
  slave_assignments.fill_seqadd(1,1);
75
}
76

  
77
/**
78
 * Description not yet available.
79
 * \param
80
 */
81
void adpvm_slave_args::operator -- (void)
82
{
83
  if (counter>0)
84
  {
85
    if (argv[counter])
86
    {
87
      delete [] argv[counter];
88
      argv[counter]=NULL;
89
    }
90
    counter--;
91
    strcpy(argv[0],(char*)str(counter));
92
  }
93
}
94

  
95
/**
96
 * Description not yet available.
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff