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

« back to all changes in this revision

Viewing changes to src/tools/ga-5-1/armci/testing/timer.h

  • 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
 
#ifndef ARMCI_TESTING_TIMER_H_
2
 
#define ARMCI_TESTING_TIMER_H_
3
 
 
4
 
#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__)
5
 
#   define HAVE_RDTSC 1
6
 
#   if defined(__i386__)
7
 
static __inline__ unsigned long long rdtsc(void)
8
 
{
9
 
  unsigned long long int x;
10
 
  __asm__ volatile(".byte 0x0f, 0x31" : "=A"(x));
11
 
  return x;
12
 
}
13
 
#   elif defined(__x86_64__)
14
 
static __inline__ unsigned long long rdtsc(void)
15
 
{
16
 
  unsigned hi, lo;
17
 
  __asm__ __volatile__("rdtsc" : "=a"(lo), "=d"(hi));
18
 
  return ((unsigned long long)lo) | (((unsigned long long)hi) << 32);
19
 
}
20
 
#   elif defined(__powerpc__)
21
 
static __inline__ unsigned long long rdtsc(void)
22
 
{
23
 
  unsigned long long int result = 0;
24
 
  unsigned long int upper, lower, tmp;
25
 
  __asm__ volatile(
26
 
    "0:                  \n"
27
 
    "\tmftbu   %0        \n"
28
 
    "\tmftb    %1        \n"
29
 
    "\tmftbu   %2        \n"
30
 
    "\tcmpw    %2,%0     \n"
31
 
    "\tbne     0b        \n"
32
 
    : "=r"(upper), "=r"(lower), "=r"(tmp)
33
 
  );
34
 
  result = upper;
35
 
  result = result << 32;
36
 
  result = result | lower;
37
 
 
38
 
  return(result);
39
 
}
40
 
#   endif
41
 
#elif HAVE_SYS_TIME_H
42
 
#   include <sys/time.h>
43
 
#elif HAVE_WINDOWS_H
44
 
#   include <windows.h>
45
 
static LARGE_INTEGER frequency;
46
 
#endif
47
 
 
48
 
static unsigned long long timer_start()
49
 
{
50
 
#if HAVE_RDTSC
51
 
  return rdtsc();
52
 
#elif HAVE_SYS_TIME_H
53
 
  struct timeval timer;
54
 
  (void)gettimeofday(&timer, NULL);
55
 
  return timer.tv_sec * 1000000 + timer.tv_usec;
56
 
#elif HAVE_WINDOWS_H
57
 
  LARGE_INTEGER timer;
58
 
  QueryPerformanceCounter(&timer);
59
 
  return timer.QuadPart * 1000 / frequency.QuadPart;
60
 
#else
61
 
  return 0;
62
 
#endif
63
 
}
64
 
 
65
 
static unsigned long long timer_end(unsigned long long begin)
66
 
{
67
 
  return timer_start() - begin;
68
 
}
69
 
 
70
 
static void timer_init()
71
 
{
72
 
#if HAVE_RDTSC
73
 
#elif HAVE_SYS_TIME_H
74
 
#elif HAVE_WINDOWS_H
75
 
  QueryPerformanceFrequency(&frequency);
76
 
#else
77
 
#endif
78
 
}
79
 
 
80
 
static const char *timer_name()
81
 
{
82
 
#if HAVE_RDTSC
83
 
  return "rdtsc";
84
 
#elif HAVE_SYS_TIME_H
85
 
  return "gettimeofday";
86
 
#elif HAVE_WINDOWS_H
87
 
  return "windows QueryPerformanceCounter";
88
 
#else
89
 
  return "no timers";
90
 
#endif
91
 
}
92
 
 
93
 
#endif /* ARMCI_TESTING_TIMER_H_ */