//=================================================================== void IppLoader::initializeIpp(){ bool bVerbose = true; IppStatus status = ippStaticInitCpu(ippGetCpuType()); if (bVerbose) cout << status << " " << ippStsNoErr << " " << ippStsCpuMismatch << " " << ippStsNoOperationInDll << endl; /* ippStsNoErr - required target cpu library code is successfully set // ippStsCpuMismatch - required target cpu library can't be set, the previous set is used // ippStsNoOperationInDll */ const IppLibraryVersion* lib = ippiGetLibVersion(); if (bVerbose) printf("%s %s %d.%d.%d.%d\n", lib->Name, lib->Version,lib->major, lib->minor, lib->majorBuild, lib->build); IppCpuType cpuType; IppStatus pStatus; Ipp64u pFeatureMask; Ipp32u pCpuidInfoRegs[4]; cpuType=ippGetCpuType(); pStatus=ippGetCpuFeatures(&pFeatureMask, pCpuidInfoRegs); if (bVerbose) printCpuType(cpuType); if (bVerbose) printCpuCapability(pFeatureMask); }
//초기화 부분 BOOL CIPPDlg::OnInitDialog() { CDialog::OnInitDialog(); const IppLibraryVersion* lib = ippiGetLibVersion(); if (lib) { CString strVersion; strVersion.Format("%d.%d.%d.%d [%s], %s, %s, %s", lib->major, lib->minor, lib->majorBuild, lib->build, lib->targetCpu, lib->Name, lib->Version, lib->BuildDate); CString strText; strText.Format("Version:\r\n%s", strVersion); GetDlgItem(IDC_VERSION)->SetWindowText(strText); } const IppCpuType cpu = ippGetCpuType(); if (cpu) { CString strCPU; switch (cpu) { case ippCpuUnknown: strCPU = "Unknown"; break; case ippCpuPP: strCPU = "Intel(R) Pentium(R) processor"; break; case ippCpuPMX: strCPU = "Pentium(R) processor with MMX(TM) technology"; break; case ippCpuPPR: strCPU = "Pentium(R) Pro processor"; break; case ippCpuPII: strCPU = "Pentium(R) II processor"; break; case ippCpuPIII: strCPU = "Pentium(R) III processor and Pentium(R) III Xeon(R) processor"; break; case ippCpuP4: strCPU = "Pentium(R) 4 processor and Intel(R) Xeon(R) processor"; break; case ippCpuP4HT: strCPU = "Pentium(R) 4 Processor with HT Technology"; break; case ippCpuP4HT2: strCPU = "Pentium(R) 4 processor with Streaming SIMD Extensions 3"; break; case ippCpuCentrino: strCPU = "Intel(R) Centrino(TM) mobile technology"; break; case ippCpuDS: strCPU = "Intel(R) Core(TM) Duo processor or Intel(R) Core(TM) Solo processor"; break; case ippCpuITP: strCPU = "Intel(R) Itanium(R) processor"; break; case ippCpuITP2: strCPU = "Intel(R) Itanium(R) 2 processor"; break; // case ippCpuEM64T: //strCPU="Intel(R) Extended Memory 64 Technology (Intel(R) EM64T) */ // case ippCpuNext, // case ippCpuSSE = 0x40, /* Processor supports Pentium(R) III processor instruction set */ // case ippCpuSSE2, /* Processor supports Streaming SIMD Extensions 2 instruction set */ // case ippCpuSSE3, /* Processor supports Streaming SIMD Extensions 3 instruction set */ // case ippCpuX8664 /* Processor supports 64 bit extension } int NumCores = ippGetNumCoresOnDie(); CString strText; strText.Format("CPU:\r\n%d Core(s)\r\n%s", NumCores, strCPU); GetDlgItem(IDC_CPU)->SetWindowText(strText); } return TRUE; // return TRUE unless you set the focus to a control }
int main(int argc, char* argv[]) { const IppLibraryVersion *lib; Ipp64u fm; IppStatus status; status = ippInit(); //IPP initialization with the best optimization layer if (status != ippStsNoErr) { printf("IppInit() Error:\n"); printf("%s\n", ippGetStatusString(status)); return -1; } //Get version info lib = ippiGetLibVersion(); printf("%s %s\n", lib->Name, lib->Version); //Get CPU features enabled with selected library level fm = ippGetEnabledCpuFeatures(); printf("SSE :%c\n", (fm >> 1) & 1 ? 'Y' : 'N'); printf("SSE2 :%c\n", (fm >> 2) & 1 ? 'Y' : 'N'); printf("SSE3 :%c\n", (fm >> 3) & 1 ? 'Y' : 'N'); printf("SSSE3 :%c\n", (fm >> 4) & 1 ? 'Y' : 'N'); printf("SSE41 :%c\n", (fm >> 6) & 1 ? 'Y' : 'N'); printf("SSE42 :%c\n", (fm >> 7) & 1 ? 'Y' : 'N'); printf("AVX :%c\n", (fm >> 8) & 1 ? 'Y' : 'N'); printf("AVX2 :%c\n", (fm >> 15) & 1 ? 'Y' : 'N'); printf("----------\n"); printf("OS Enabled AVX :%c\n", (fm >> 9) & 1 ? 'Y' : 'N'); printf("AES :%c\n", (fm >> 10) & 1 ? 'Y' : 'N'); printf("CLMUL :%c\n", (fm >> 11) & 1 ? 'Y' : 'N'); printf("RDRAND :%c\n", (fm >> 13) & 1 ? 'Y' : 'N'); printf("F16C :%c\n", (fm >> 14) & 1 ? 'Y' : 'N'); ln32f(); //LN函数性能测试 srand(0); GenerateSrcData(); int t = 0; //t = StdLn(); //printf("StdLn Time = %d\n",t); //t = PPL_StdLn(); //printf("PPL_StdLn Time = %d\n", t); //t = TBB_StdLn(); //printf("TBB_StdLn Time = %d\n", t); //t = StdLn_I(); //printf("StdLn_I Time = %d\n", t); //t = IppLn(); //printf("IppLn Time = %d\n", t); //t = IppLn_I(); //printf("IppLn_I Time = %d\n", t); t = PPL_IppLn_I(); printf("PPL_IppLn_I Time = %d\n", t); //t = TBB_IppLn_I(); //printf("TBB_IppLn_I Time = %d\n", t); //for (int i = 0; i < sizeof(DstData) / sizeof(DstData[0]); i++) //{ // if (fabs(DstData[i] - DstData2[i]) > 1e-6) // { // printf("Error: %d, %f, %f\n", i, DstData[i], DstData2[i]); // } //} return 0; }