none
defining an accelerator_view variable interfers with fprintf RRS feed

  • Question

  • When an accelerator_view variable is defined, it prevents fprintf from working properly. In the code block below, I print into a file nz pairs of numbers. After the code is executed, the file does not contain all the numbers. It appears that writing into the file aborts at some random location. However, when I move the definition of myAv below the for loop, writing into the file works correctly. Does anybody know what is happening here and how can I write into a file correctly when my for loop is after myAv is defined?

    Thanks,

    Alexander

    accelerator_view myAv = accelerator().create_view(queuing_mode_immediate); for (int iz = 0; iz < nz; ++iz) { fprintf(auxFile, " %f %f \n", zi[iz], pow(zi[iz], 2)); }


    Thursday, June 26, 2014 2:56 PM

Answers

  • Does it occur even if you call fclose(auxFile) after the loop?

    • Marked as answer by Sasha-K Friday, June 27, 2014 7:44 AM
    Thursday, June 26, 2014 6:58 PM

All replies

  • Does it occur even if you call fclose(auxFile) after the loop?

    • Marked as answer by Sasha-K Friday, June 27, 2014 7:44 AM
    Thursday, June 26, 2014 6:58 PM
  • Dear Viorel,

    Thank you. Adding 'fclose' solved the problem!

    Alexander

    Friday, June 27, 2014 7:45 AM