//=================================================================== 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 }
SInt32 CAVectorUnit_Examine() { int result = kVecNone; #if TARGET_OS_WIN32 #if HAS_IPP // Initialize the static IPP library! This needs to be done before // any IPP function calls, otherwise we may have a performance penalty int status = ippStaticInit(); if ( status == ippStsNonIntelCpu ) { IppCpuType cpuType = ippGetCpuType(); if ( cpuType >= ippCpuSSE || cpuType <= ippCpuSSE42 ) ippStaticInitCpu( cpuType ); } #endif { // On Windows we use cpuid to detect the vector unit because it works on Intel and AMD. // The IPP library does not detect SSE on AMD processors. if (IsCpuidAvailable()) { if(IsSSE3Available()) { result = kVecSSE3; } else if(IsSSE2Available()) { result = kVecSSE2; } } } #elif TARGET_OS_MAC #if DEBUG if (getenv("CA_NoVector")) { fprintf(stderr, "CA_NoVector set; Vector unit optimized routines will be bypassed\n"); return result; } else #endif { #if (TARGET_CPU_PPC || TARGET_CPU_PPC64) int sels[2] = { CTL_HW, HW_VECTORUNIT }; int vType = 0; //0 == scalar only size_t length = sizeof(vType); int error = sysctl(sels, 2, &vType, &length, NULL, 0); if (!error && vType > 0) result = kVecAltivec; #elif (TARGET_CPU_X86 || TARGET_CPU_X86_64) int answer = 0; size_t length = sizeof(answer); int error = sysctlbyname("hw.optional.sse3", &answer, &length, NULL, 0); if (!error && answer) result = kVecSSE3; else { answer = 0; length = sizeof(answer); error = sysctlbyname("hw.optional.sse2", &answer, &length, NULL, 0); if (!error && answer) result = kVecSSE2; } #elif (TARGET_CPU_ARM) && defined(_ARM_ARCH_7) result = kVecNeon; #endif } #endif gCAVectorUnitType = result; return result; }