~ubuntu-branches/ubuntu/trusty/nwchem/trusty-proposed

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Michael Banck, Daniel Leidert, Andreas Tille, Michael Banck
  • Date: 2013-07-04 12:14:55 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130704121455-5tvsx2qabor3nrui
Tags: 6.3-1
* New upstream release.
* Fixes anisotropic properties (Closes: #696361).
* New features include:
  + Multi-reference coupled cluster (MRCC) approaches
  + Hybrid DFT calculations with short-range HF 
  + New density-functionals including Minnesota (M08, M11) and HSE hybrid
    functionals
  + X-ray absorption spectroscopy (XAS) with TDDFT
  + Analytical gradients for the COSMO solvation model
  + Transition densities from TDDFT 
  + DFT+U and Electron-Transfer (ET) methods for plane wave calculations
  + Exploitation of space group symmetry in plane wave geometry optimizations
  + Local density of states (LDOS) collective variable added to Metadynamics
  + Various new XC functionals added for plane wave calculations, including
    hybrid and range-corrected ones
  + Electric field gradients with relativistic corrections 
  + Nudged Elastic Band optimization method
  + Updated basis sets and ECPs 

[ Daniel Leidert ]
* debian/watch: Fixed.

[ Andreas Tille ]
* debian/upstream: References

[ Michael Banck ]
* debian/upstream (Name): New field.
* debian/patches/02_makefile_flags.patch: Refreshed.
* debian/patches/06_statfs_kfreebsd.patch: Likewise.
* debian/patches/07_ga_target_force_linux.patch: Likewise.
* debian/patches/05_avoid_inline_assembler.patch: Removed, no longer needed.
* debian/patches/09_backported_6.1.1_fixes.patch: Likewise.
* debian/control (Build-Depends): Added gfortran-4.7 and gcc-4.7.
* debian/patches/10_force_gcc-4.7.patch: New patch, explicitly sets
  gfortran-4.7 and gcc-4.7, fixes test suite hang with gcc-4.8 (Closes:
  #701328, #713262).
* debian/testsuite: Added tests for COSMO analytical gradients and MRCC.
* debian/rules (MRCC_METHODS): New variable, required to enable MRCC methods.

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