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

« back to all changes in this revision

Viewing changes to src/tools/ga-5-1/armci/src-gemini/shmalloc.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: shmalloc.c,v 1.10 2002-06-20 23:34:17 vinod Exp $ */
6
 
#include <stdio.h>
7
 
#include <string.h>
8
 
#include "armcip.h"
9
 
#include "message.h"
10
 
#include "kr_malloc.h"
11
 
 
12
 
static long *offset_arr;
13
 
 
14
 
void armci_shmalloc_exchange_offsets(context_t *ctx_local) 
15
 
{
16
 
    void **ptr_arr;
17
 
    void *ptr;
18
 
    armci_size_t bytes = 128;
19
 
    int i;    
20
 
    
21
 
    ptr_arr    = (void**)malloc(armci_nproc*sizeof(void*));
22
 
    offset_arr = (long*) malloc(armci_nproc*sizeof(long));
23
 
    if(!ptr_arr || !offset_arr) armci_die("armci_shmalloc_get_offsets: malloc failed", 0);
24
 
 
25
 
    /* get memory with same size on all procs */
26
 
    ptr = kr_malloc(bytes, ctx_local);
27
 
    if(!ptr) armci_die("armci_shmalloc_get_offsets: kr_malloc failed",bytes);
28
 
    
29
 
    bzero((char*)ptr_arr,armci_nproc*sizeof(void*));
30
 
    ptr_arr[armci_me] = ptr;
31
 
 
32
 
    /* now combine individual addresses into a single array */
33
 
    armci_exchange_address(ptr_arr, armci_nproc);
34
 
    
35
 
    /* identify offets */
36
 
    for (i=0; i<armci_nproc; i++) 
37
 
    {
38
 
       offset_arr[i] = (long) ((char*)ptr - (char*)ptr_arr[i]);
39
 
    }
40
 
       
41
 
    /* release memory */
42
 
    kr_free(ptr, ctx_local);
43
 
}
44
 
 
45
 
void armci_shmalloc_exchange_address(void **ptr_arr) 
46
 
{
47
 
    int i;
48
 
 
49
 
    /* now combine individual addresses into a single array */
50
 
    armci_exchange_address(ptr_arr, armci_nproc);
51
 
 
52
 
    /* since shmalloc may not give symmetric addresses (especially on Linux),
53
 
     * adjust addresses based on offset calculated during initialization */
54
 
    for (i=0; i<armci_nproc; i++) 
55
 
    {
56
 
       ptr_arr[i] = (char*)ptr_arr[i] + offset_arr[i];
57
 
    }
58
 
}
59
 
 
60
 
#ifdef MPI
61
 
 
62
 
extern int ARMCI_Absolute_id(ARMCI_Group *group,int group_rank);
63
 
 
64
 
/* group based exchange address */
65
 
void armci_shmalloc_exchange_address_grp(void **ptr_arr, ARMCI_Group *group) 
66
 
{
67
 
    int i, world_rank;
68
 
    int grp_nproc;
69
 
 
70
 
    ARMCI_Group_size(group, &grp_nproc);
71
 
    
72
 
    /* now combine individual addresses into a single array */
73
 
    armci_exchange_address_grp(ptr_arr, grp_nproc, group);
74
 
 
75
 
    /* since shmalloc may not give symmetric addresses (especially on Linux),
76
 
     * adjust addresses based on offset calculated during initialization */
77
 
    for (i=0; i<grp_nproc; i++) 
78
 
    {
79
 
       world_rank = ARMCI_Absolute_id(group,i);
80
 
       ptr_arr[i] = (char*)ptr_arr[i] + offset_arr[world_rank];
81
 
    }
82
 
}
83
 
#endif
84
 
 
85
 
/* get the remote process's pointer */
86
 
void* armci_shmalloc_remote_addr(void *ptr, int proc) 
87
 
{
88
 
    return (void*)((char*)ptr - offset_arr[proc]);
89
 
}