- Timestamp:
 - Aug 31, 2012, 2:22:08 PM (13 years ago)
 - Children:
 - fd6273
 - Parents:
 - 0d2f18
 - File:
 - 
      
- 1 edited
 
- 
          
  src/bin/mpqc/mpqc.cc (modified) (4 diffs)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
src/bin/mpqc/mpqc.cc
r0d2f18 rf137f7 1220 1220 } 1221 1221 1222 /** Finds the region index to a given timer region name. 1223 * 1224 * @param nregion number of regions 1225 * @param region_names array with name of each region 1226 * @param name name of desired region 1227 * @return index of desired region in array 1228 */ 1229 int findTimerRegion(const int &nregion, const char **®ion_names, const char *name) 1230 { 1231 size_t region=0; 1232 for (;region<nregion;++region) { 1233 //std::cout << "Comparing " << region_names[region] << " and " << name << "." << std::endl; 1234 if (strcmp(region_names[region], name) == 0) 1235 break; 1236 } 1237 if (region == nregion) 1238 region = 0; 1239 return region; 1240 } 1241 1222 1242 /** Performs the main work to calculate the ground state energies, gradients, etc. 1223 1243 * … … 1465 1485 } 1466 1486 if (parsedkv.nonnull()) print_unseen(parsedkv, input); 1467 1468 if (print_timings)1469 if (tim.nonnull()) tim->print(ExEnv::out0());1470 1487 1471 1488 // here, we may gather the results … … 1759 1776 } 1760 1777 scf = 0; 1761 if (tim.nonnull()) tim->exit("gather");1762 {1763 // times obtain from key "mpqc" which should be the first1764 const int nregion = tim->nregion();1765 std::cout << "There are " << nregion << " timed regions." << std::endl;1766 double *cpu_time = new double[nregion];1767 double *wall_time = new double[nregion];1768 double *flops = new double[nregion];1769 const char **region_names = new const char*[nregion];1770 tim->get_region_names(region_names);1771 // find "gather"1772 size_t gather_region=0;1773 for (;gather_region<nregion;++gather_region) {1774 std::cout << "Comparing " << region_names[gather_region] << " and 'gather'" << std::endl;1775 if (strcmp(region_names[gather_region], "gather") == 0)1776 break;1777 }1778 if (gather_region == nregion)1779 gather_region = nregion;1780 tim->get_cpu_times(cpu_time);1781 tim->get_wall_times(wall_time);1782 tim->get_flops(flops);1783 if (cpu_time != NULL) {1784 data.times.total_cputime = cpu_time[0];1785 data.times.gather_cputime = cpu_time[nregion];1786 }1787 if (wall_time != NULL) {1788 data.times.total_walltime = wall_time[0];1789 data.times.gather_walltime = wall_time[nregion];1790 }1791 if (flops != NULL) {1792 data.times.total_flops = flops[0];1793 data.times.gather_flops = flops[nregion];1794 }1795 delete[] cpu_time;1796 delete[] wall_time;1797 delete[] flops;1798 }1799 1778 1800 1779 // // GaussianShell is the actual orbital functions it seems ... … … 1830 1809 // delete[] b_val; 1831 1810 } 1811 if (tim.nonnull()) tim->exit("gather"); 1812 1813 if (print_timings) 1814 if (tim.nonnull()) tim->print(ExEnv::out0()); 1815 1816 1817 { 1818 // times obtain from key "mpqc" which should be the first 1819 const int nregion = tim->nregion(); 1820 //std::cout << "There are " << nregion << " timed regions." << std::endl; 1821 const char **region_names = new const char*[nregion]; 1822 tim->get_region_names(region_names); 1823 // find "gather" 1824 size_t gather_region = findTimerRegion(nregion, region_names, "gather"); 1825 size_t mpqc_region = findTimerRegion(nregion, region_names, "mpqc"); 1826 1827 // get timings 1828 double *cpu_time = new double[nregion]; 1829 double *wall_time = new double[nregion]; 1830 double *flops = new double[nregion]; 1831 tim->get_cpu_times(cpu_time); 1832 tim->get_wall_times(wall_time); 1833 tim->get_flops(flops); 1834 if (cpu_time != NULL) { 1835 data.times.total_cputime = cpu_time[mpqc_region]; 1836 data.times.gather_cputime = cpu_time[gather_region]; 1837 } 1838 if (wall_time != NULL) { 1839 data.times.total_walltime = wall_time[mpqc_region]; 1840 data.times.gather_walltime = wall_time[gather_region]; 1841 } 1842 if (flops != NULL) { 1843 data.times.total_flops = flops[mpqc_region]; 1844 data.times.gather_flops = flops[gather_region]; 1845 } 1846 delete[] cpu_time; 1847 delete[] wall_time; 1848 delete[] flops; 1849 } 1832 1850 1833 1851 delete[] molname;  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  