~ubuntu-branches/ubuntu/saucy/nwchem/saucy

« back to all changes in this revision

Viewing changes to src/tools/ga-5-1/armci/src-portals/locks.c

  • Committer: Package Import Robot
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2012-02-09 20:02:41 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120209200241-jgk03qfsphal4ug2
Tags: 6.1-1
* New upstream release.

[ Michael Banck ]
* debian/patches/02_makefile_flags.patch: Updated.
* debian/patches/02_makefile_flags.patch: Use internal blas and lapack code.
* debian/patches/02_makefile_flags.patch: Define GCC4 for LINUX and LINUX64
  (Closes: #632611 and LP: #791308).
* debian/control (Build-Depends): Added openssh-client.
* debian/rules (USE_SCALAPACK, SCALAPACK): Removed variables (Closes:
  #654658).
* debian/rules (LIBDIR, USE_MPIF4, ARMCI_NETWORK): New variables.
* debian/TODO: New file.
* debian/control (Build-Depends): Removed libblas-dev, liblapack-dev and
  libscalapack-mpi-dev.
* debian/patches/04_show_testsuite_diff_output.patch: New patch, shows the
  diff output for failed tests.
* debian/patches/series: Adjusted.
* debian/testsuite: Optionally run all tests if "all" is passed as option.
* debian/rules: Run debian/testsuite with "all" if DEB_BUILD_OPTIONS
  contains "checkall".

[ Daniel Leidert ]
* debian/control: Used wrap-and-sort. Added Vcs-Svn and Vcs-Browser fields.
  (Priority): Moved to extra according to policy section 2.5.
  (Standards-Version): Bumped to 3.9.2.
  (Description): Fixed a typo.
* debian/watch: Added.
* debian/patches/03_hurd-i386_define_path_max.patch: Added.
  - Define MAX_PATH if not defines to fix FTBFS on hurd.
* debian/patches/series: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#if HAVE_CONFIG_H
 
2
#   include "config.h"
 
3
#endif
 
4
 
 
5
/* $Id: locks.c,v 1.15.6.1 2006-12-14 13:24:36 manoj Exp $ */
 
6
#define _LOCKS_C_
 
7
#include "armcip.h"
 
8
#include "locks.h"
 
9
#ifndef WIN32
 
10
#   include <unistd.h>
 
11
#endif
 
12
#include <stdio.h>
 
13
 
 
14
 
 
15
extern void armci_die(char*,int);
 
16
 
 
17
#if defined(SPINLOCK) || defined(PMUTEXES)
 
18
 
 
19
void **ptr_arr;
 
20
 
 
21
void CreateInitLocks(int num_locks, lockset_t *plockid)
 
22
{
 
23
int locks_per_proc, size;
 
24
extern void armci_set_serv_mutex_arr(void *);
 
25
    ARMCI_PR_DBG("enter",0);
 
26
  ptr_arr = (void**)malloc(armci_nproc*sizeof(void*));
 
27
  locks_per_proc = (num_locks*armci_nclus)/armci_nproc + 1;
 
28
  size=locks_per_proc*sizeof(PAD_LOCK_T);
 
29
  PARMCI_Malloc(ptr_arr, size);
 
30
  _armci_int_mutexes = (PAD_LOCK_T*) ptr_arr[armci_master];
 
31
# ifdef PORTALS_SPECIFIC_QUESTION
 
32
  if(armci_me==armci_master)armci_set_serv_mutex_arr(_armci_int_mutexes);
 
33
# endif
 
34
 
 
35
  if(!_armci_int_mutexes) armci_die("Failed to create spinlocks",size);
 
36
 
 
37
#ifdef PMUTEXES
 
38
  if(armci_me == armci_master) {
 
39
       int i;
 
40
       pthread_mutexattr_t pshared;
 
41
       if(pthread_mutexattr_init(&pshared))
 
42
            armci_die("armci_allocate_locks: could not init mutex attr",0);
 
43
#      ifndef LINUX
 
44
         if(pthread_mutexattr_setpshared(&pshared,PTHREAD_PROCESS_SHARED))
 
45
            armci_die("armci_allocate_locks: could not set PROCESS_SHARED",0);
 
46
#      endif
 
47
 
 
48
       for(i=0; i< locks_per_proc*armci_clus_info[armci_clus_me].nslave; i++){
 
49
             if(pthread_mutex_init(_armci_int_mutexes+i,&pshared))
 
50
                armci_die("armci_allocate_locks: could not init mutex",i);
 
51
       }
 
52
  }
 
53
#else
 
54
 
 
55
  bzero((char*)ptr_arr[armci_me],size);
 
56
    ARMCI_PR_DBG("exit",0);
 
57
#endif
 
58
 
59
 
 
60
void InitLocks(int num_locks, lockset_t lockid)
 
61
{
 
62
    /* what are you doing here ? 
 
63
       All processes should've called CreateInitLocks().
 
64
       Check preprocessor directtives and see lock allocation in armci_init */
 
65
    armci_die("InitLocks(): what are you doing here ?",armci_me);
 
66
}
 
67
 
 
68
 
 
69
void DeleteLocks(lockset_t lockid)
 
70
{
 
71
  _armci_int_mutexes = (PAD_LOCK_T*)0;
 
72
}
 
73
 
 
74
#else
 
75
/*********************** every thing else *************************/
 
76
 
 
77
void CreateInitLocks(int num_locks, lockset_t  *lockid)
 
78
{}
 
79
 
 
80
void InitLocks(int num_locks, lockset_t lockid)
 
81
{
 
82
}
 
83
 
 
84
 
 
85
void DeleteLocks(lockset_t lockid)
 
86
{
 
87
}
 
88
 
 
89
#endif
 
90