accelerator::get_all returns vector with NULL
-
Friday, June 29, 2012 4:49 PM
HI,
I did some experiments with APO.
I took the SwapAPO sample from WinDDK(C:\WinDDK\7600.16385.0\src\audio\sysfx) created a Visual studio 2012 DLL Project. Incorporated the CPP AMP chnages to it. Built the project for x86. it also requires propertypageextension dll(allso part of sample). installed this swapAPO for the HDAudio Codec using the INF file present in the sample. I took the Pick_accelerator function from the one of your presentation and invoked it from the APO Initialize function. Inside Pick_accelerator the count obtained was 3 but the vector had NULL. where as a stand alone application(Hello world) returned a vector of siz 3 and one of them was GPU. I was using windDBg as debugger and captured the data when the pick_accelerator returned. Attaching the watch window for your reference.
- Split by DanielMothMicrosoft Employee, Owner Friday, June 29, 2012 5:44 PM New question
- Edited by DanielMothMicrosoft Employee, Owner Friday, June 29, 2012 5:46 PM don't call out specific folks for questions, anyone can answer
All Replies
-
Friday, June 29, 2012 5:46 PMOwner
Hi sharsha
The screenshot did not come through; it is all black (or all white in another browser). I am afraid there isn’t much to go on with so little information, but I’ll throw some questions out shooting in the dark until you provide more info.
Did I understand you correctly that on the same machine you have two apps where one can enumerate all the devices and on the other there are none returned? What is your exact question with expected results and actual results?
Which pick_accelerator function did you use (we have various example versions around), can you share the actual code?
You said in one app you could see 3 devices, which leads me to believe you could see REF (only useful for debugging), CPU (not useful for executing code in this release), and the physical accelerator. What is the accelerator on your system? Do you have the latest drivers for it?
Is this on Windows 7 or on Windows 8? I suspect Windows 7, or you would have seen a 4th accelerator (WARP), but I am just checking.
Have you tried our samples on that machine and do they execute on the hardware?
http://blogs.msdn.com/b/nativeconcurrency/archive/2012/01/30/c-amp-sample-projects-for-download.aspxCheers
Danielhttp://www.danielmoth.com/Blog/
-
Saturday, June 30, 2012 3:32 AM
Hi Daniel,
Sorry for missing some basic informations
OS: Win7 32 bit
Accelerator: AMD Radeon 6xxx
Latest Graphics driver is installed.
Yes, both the applications were running on the same Machine. SwapAPO is a DLL(will be below Audio Engine and will be part of AudioDg process) and Hello world is a Amp Sample.
For both the apps I added Pick_accelerator function and invoked them during initialization.
Was Debugging SwapAPO in WInDBG, Where as Hello World in VS2012.
While debugging SwapAPO I remember seeing DefaultAcc + CPU + REF + WRAP. I will reheck and confirm.
On the Helloworld I was clearly getting as AMD Radeon 6xxx( Count was 3, I will recheck and confirm what are those devcies)
MY Pick_Accelerator function
accelerator CSwapAPOGFX::pick_accelerator()
{
//get all Accelerators known to the C++ AMP runtime
vector<accelerator> accs = accelerator::get_all();
//empty ctor returns the one picket by the runtime by default
accelerator chosen_one;
//Choose one
auto result = std::find_if(accs.begin(), accs.end(), [](const accelerator& acc)
{
return !acc.is_emulated;
});
if(result != accs.end())
chosen_one= *(result);
//else not shown
//output its description (tip: explore the other properties)
//std::wcout << chosen_one.description<< std::endl;
return chosen_one;
/*bool suc= accelerator::set_default(chosen_one.device_path);
std::wcout << chosen_one.description<< std::endl;*/
}
Thanks
-Harsha
-
Tuesday, July 03, 2012 2:10 PM
Hi Daniel,
Looks like it was an issue with debugging in Windbg. I used VS2012 for further debugging and it was showing proper results that the pick_accelerator function was able to get GPU as accelerator.
I tried offloading CPU by returning cpu_accelerator, but i was getting GPU instead.
tried returning acc.is_emulated, But I was getting Softwate Accelerator.
tried return direct3d_warp, was getting GPU.
Is there way I can get cpu_accelerator on WIn7?
-Harsha
- Proposed As Answer by DanielMothMicrosoft Employee, Owner Tuesday, July 03, 2012 9:23 PM
- Marked As Answer by DanielMothMicrosoft Employee, Owner Friday, July 13, 2012 6:05 AM
-
Tuesday, July 03, 2012 5:07 PM
Hi Harsha,
You can create a cpu_accelerator by:
accelerator acc(accelerator::cpu_accelerator);
However, for this release, cpu_accelerator does not support computation. The main purpose of it is for creating staging array. You can also create an concurrency::array that is accessible on host code, but that's probably not very meaningful.
Thanks,
Weirong
-
Tuesday, July 03, 2012 9:26 PMOwner
Hi Harsha
Sounds like you answered your own question.
Your new question is how to target the CPU isntead of a GPU from C++ AMP, and the answer is WARP on Windows 8, and we hope to have a solution for Windows 7 by the time we ship although that is not certain at this point. Regarding the CPU accelerator, please read our blog post (in addition to Weirong's response):
http://blogs.msdn.com/b/nativeconcurrency/archive/2012/03/10/cpu-accelerator-in-c-amp.aspx
Cheers
Daniel
http://www.danielmoth.com/Blog/
- Marked As Answer by DanielMothMicrosoft Employee, Owner Friday, July 13, 2012 6:05 AM

