none
Do simultaneous AMP calls need locks? RRS feed

  • Question

  • I'm P/Invoking into AMP from a C# project and I have a question regarding multiple simultaneous calls to AMP kernels. If I have more than 1 thread making calls into AMP at a time, do I need to put in place a locking mechanism to ensure that the threads invoke the AMP kernels exclusively? Thank you in advance.

    -L



    • Edited by LKeene Monday, November 5, 2012 4:25 PM
    Monday, November 5, 2012 4:24 PM

Answers

  • L,

    It depends a bit on your use case. C++ AMP will serialize kernel invocations but I don't think it offers any guarentees regarding the ordering of data read/writes and kernel invocations so you need to make sure that your kernels are not sharing data/state.

    There are several examples of using C++ AMP from threads in the samples for our book.

    http://ampbook.codeplex.com/

    Both the Cartoonizer and NBody case studies support multi-GPUs and use the PPL to orchestrate execution of kernels. The samples for Chapter 9 also show examples of this.

    Ade


    Ade

    • Marked as answer by LKeene Monday, November 5, 2012 9:10 PM
    Monday, November 5, 2012 8:52 PM