~ubuntu-branches/ubuntu/vivid/slurm-llnl/vivid

« back to all changes in this revision

Viewing changes to src/sattach/sattach.c

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2009-09-24 23:28:15 UTC
  • mfrom: (1.1.11 upstream) (3.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090924232815-enh65jn32q1ebg07
Tags: 2.0.5-1
* New upstream release 
* Changed dependecy from lib-mysqlclient15 to lib-mysqlclient 
* Added Default-Start for runlevel 2 and 4 and $remote_fs requirement in
  init.d scripts (Closes: #541252)
* Postinst checks for wrong runlevels 2 and 4 links
* Upgraded to standard version 3.8.3
* Add lintian overrides for missing slurm-llnl-configurator.html in doc
  base registration
* modified postrm scripts to ignore pkill return value in order to avoid
  postrm failure when no slurm process is running
* Checking for slurmctld.pid before cancelling running and pending
  jobs during package removal 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************\
2
2
 *  sattach.c - Attach to a running job step.
3
 
 *
4
 
 *  $Id: sattach.c 8447 2006-06-26 22:29:29Z morrone $
5
3
 *****************************************************************************
6
 
 *  Copyright (C) 2006 The Regents of the University of California.
 
4
 *  Copyright (C) 2006-2007 The Regents of the University of California.
 
5
 *  Copyright (C) 2008 Lawrence Livermore National Security.
7
6
 *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
8
7
 *  Written by Christopher J. Morrone <morrone2@llnl.gov>
9
 
 *  LLNL-CODE-402394.
 
8
 *  CODE-OCEC-09-009. All rights reserved.
10
9
 *  
11
10
 *  This file is part of SLURM, a resource management program.
12
 
 *  For details, see <http://www.llnl.gov/linux/slurm/>.
 
11
 *  For details, see <https://computing.llnl.gov/linux/slurm/>.
 
12
 *  Please also read the included file: DISCLAIMER.
13
13
 *  
14
14
 *  SLURM is free software; you can redistribute it and/or modify it under
15
15
 *  the terms of the GNU General Public License as published by the Free
67
67
static void _mpir_dump_proctable(void);
68
68
static void print_layout_info(slurm_step_layout_t *layout);
69
69
static slurm_cred_t _generate_fake_cred(uint32_t jobid, uint32_t stepid,
70
 
                                        uid_t uid, char *nodelist);
 
70
                                        uid_t uid, char *nodelist, 
 
71
                                        uint32_t node_cnt);
71
72
static uint32_t _nodeid_from_layout(slurm_step_layout_t *layout,
72
73
                                    uint32_t taskid);
73
74
static int _attach_to_tasks(uint32_t jobid,
146
147
        }
147
148
 
148
149
        fake_cred = _generate_fake_cred(opt.jobid, opt.stepid,
149
 
                                        opt.uid, layout->node_list);
 
150
                                        opt.uid, layout->node_list,
 
151
                                        layout->node_cnt);
150
152
        
151
153
        mts = _msg_thr_create(layout->node_cnt, layout->task_cnt);
152
154
 
217
219
 
218
220
/* return a faked job credential */
219
221
static slurm_cred_t _generate_fake_cred(uint32_t jobid, uint32_t stepid,
220
 
                                        uid_t uid, char *nodelist)
 
222
                                        uid_t uid, char *nodelist,
 
223
                                        uint32_t node_cnt)
221
224
{
222
225
        slurm_cred_arg_t arg;
223
226
        slurm_cred_t cred;
226
229
        arg.stepid   = stepid;
227
230
        arg.uid      = uid;
228
231
        arg.hostlist = nodelist;
229
 
        arg.alloc_lps_cnt = 0;    
230
 
        arg.alloc_lps =  NULL; 
 
232
 
 
233
        arg.core_bitmap   = bit_alloc(node_cnt);
 
234
        bit_nset(arg.core_bitmap, 0, node_cnt-1);
 
235
        arg.cores_per_socket = xmalloc(sizeof(uint16_t));
 
236
        arg.cores_per_socket[0] = 1;
 
237
        arg.sockets_per_node = xmalloc(sizeof(uint16_t));
 
238
        arg.sockets_per_node[0] = 1;
 
239
        arg.sock_core_rep_count = xmalloc(sizeof(uint32_t));
 
240
        arg.sock_core_rep_count[0] = node_cnt;
 
241
        arg.job_nhosts    = node_cnt;
 
242
        arg.job_hostlist  = nodelist;
 
243
 
231
244
        cred = slurm_cred_faker(&arg);
232
245
 
 
246
        bit_free(arg.core_bitmap);
 
247
        xfree(arg.cores_per_socket);
 
248
        xfree(arg.sockets_per_node);
 
249
        xfree(arg.sock_core_rep_count);
233
250
        return cred;
234
251
}
235
252