Answered Calling AMP from within C# Metro app.

  • 18 กันยายน 2554 14:57
     
     

    Hello all.

     

    I saw Daniel Moth's talk at BUILD and was very impressed. I was delighted to learn that I can use AMP from a Metro app. However, it's been many years since I've done any C++ coding and I think the path of least resistance for me would be to code my Metro app in C#/XAML and make calls to AMP via P/Invoke. Traditionally I believe this is done via a C++ DLL that contains the functionality and then a P/Invoke call into that DLL from your C# code. Is this the same approach for Metro apps? I will be passing only 1D arrays of primitive types from C# (Bytes, Floats, Bools).

    Lastly, could someone point me to a little tutorial that illustrates this P/Invoke approach? Thank you in advance.

ตอบทั้งหมด

  • 18 กันยายน 2554 15:38
     
     
    You still need to write some C++ code: C++ AMP algorithm itself and a thin wrapper to get your data in and out. There is a new better way than P/Invoke of interop between C++ and C# - use WinRT types. See "Using the Windows Runtime from C++" TOOL-532T_Sutter BUILD presentation for an overview.

    • แก้ไขโดย pauljurczak 18 กันยายน 2554 16:08
    • แก้ไขโดย pauljurczak 18 กันยายน 2554 16:09
    •  
  • 21 กันยายน 2554 22:31
     
     คำตอบที่เสนอ

    Hi LKeene,

    We just posted a tutorial and a sample on how to use C++ AMP from C# using P/Invoke: http://blogs.msdn.com/b/pfxteam/archive/2011/09/21/10214538.aspx

    In the upcoming days, we also plan to post an article on how to use the new WinRT approach to invoke C++ AMP code from C#.

    Igor

  • 23 กันยายน 2554 14:37
     
     

    Thank you for both replys. This is great Igor! I'm particularly interested in calling C++ amp from C# + WinRT, so I'll definately be on the lookout for that article.

    LKeene

  • 18 พฤศจิกายน 2554 16:41
     
     

    Hi,

    was the article on the WinRT approach to invoking C++ AMP code from C# ever posted? Thanks.

     

    -L

  • 2 ธันวาคม 2554 3:39
    เจ้าของ
     
     คำตอบ

    Yes it was:

    http://blogs.msdn.com/b/pfxteam/archive/2011/11/12/10236375.aspx

     

    Cheers

    Daniel

    PS. Please mark responses as answers if you think they are.


    http://www.danielmoth.com/Blog/
    • ทำเครื่องหมายเป็นคำตอบโดย LKeene 7 ธันวาคม 2554 21:22
    •  
  • 7 ธันวาคม 2554 21:22
     
     
    Great! Thank you for this, guys. -L