Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis12-cl/src/compiler/cl-target/fragments/c-run-nobsp.in
ViewVC logotype

Diff of /branches/vis12-cl/src/compiler/cl-target/fragments/c-run-nobsp.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3225, Thu Jul 23 11:25:15 2015 UTC revision 3226, Thu Jul 23 11:33:34 2015 UTC
# Line 1  Line 1 
1  //! Run the Diderot program (OpenCL version)  //! Run the Diderot program (OpenCL version)
2  //! \param wrld the world-state of the Diderot program  //! \param wrld the world-state of the Diderot program
3  //! \param maxNSteps the limit on the number of super steps; 0 means unlimited  //! \param maxNSteps the limit on the number of super steps; 0 means unlimited
4  //! \return the number of steps taken.  //! \return the number of steps taken, or -1 on error.
5  uint32_t @PREFIX@Run (@PREFIX@World_t *wrld, uint32_t maxNSteps)  uint32_t @PREFIX@Run (@PREFIX@World_t *wrld, uint32_t maxNSteps)
6  {  {
7      cl_int sts;      cl_int sts;
# Line 28  Line 28 
28      ||  ((sts = clSetKernelArg (wrld->UpdateKern, 2, sizeof(cl_int), &maxNSteps)) != CL_SUCCESS)      ||  ((sts = clSetKernelArg (wrld->UpdateKern, 2, sizeof(cl_int), &maxNSteps)) != CL_SUCCESS)
29      ||  ((sts = clEnqueueNDRangeKernel(wrld->cmdQ, wrld->UpdateKern, 2, NULL, globalWorkSize, localWorkSize, 0, NULL, NULL)) != CL_SUCCESS)) {      ||  ((sts = clEnqueueNDRangeKernel(wrld->cmdQ, wrld->UpdateKern, 2, NULL, globalWorkSize, localWorkSize, 0, NULL, NULL)) != CL_SUCCESS)) {
30          ReportOCLError (wrld, sts, "error enqueuing UpdateKern kernel");          ReportOCLError (wrld, sts, "error enqueuing UpdateKern kernel");
31          return 0;          return -1;
32      }      }
33    
34      if ((sts = clFinish (wrld->cmdQ)) != CL_SUCCESS) {      if ((sts = clFinish (wrld->cmdQ)) != CL_SUCCESS) {
35          ReportOCLError (wrld, sts, "error finishing UpdateKern kernel");          ReportOCLError (wrld, sts, "error finishing UpdateKern kernel");
36          return 0;          return -1;
37      }      }
38    
39      t0 = airTime() - t0;      t0 = airTime() - t0;
# Line 57  Line 57 
57    
58      if ((sts = clEnqueueReadBuffer(wrld->cmdQ, wrld->schedBuf, CL_TRUE, 0, sizeof(schedInfo), &schedInfo, 0, 0, 0)) != CL_SUCCESS) {      if ((sts = clEnqueueReadBuffer(wrld->cmdQ, wrld->schedBuf, CL_TRUE, 0, sizeof(schedInfo), &schedInfo, 0, 0, 0)) != CL_SUCCESS) {
59          ReportOCLError (wrld, sts, "error getting scheduler info");          ReportOCLError (wrld, sts, "error getting scheduler info");
60          exit(1);          return -1;
61      }      }
62    
63      if (schedInfo.nActive > 0) {      if (schedInfo.nActive > 0) {
64        // there are still active strands, so reset the nextStrand field in the GPU-side scheduler        // there are still active strands, so reset the nextStrand field in the GPU-side scheduler
65          schedInfo.nextStrand = 0;          schedInfo.nextStrand = 0;
66          if ((sts = clEnqueueWriteBuffer(wrld->cmdQ, wrld->schedBuf, CL_TRUE, 0, sizeof(cl_int), &schedInfo, 0, 0, 0)) != CL_SUCCESS) {          if ((sts = clEnqueueWriteBuffer(wrld->cmdQ, wrld->schedBuf, CL_TRUE, 0, sizeof(cl_int), &schedInfo, 0, 0, 0)) != CL_SUCCESS) {
67              ReportOCLError (wrld, sts, "error reseting nextStrand field");              ReportOCLError (wrld, sts, "error resetting nextStrand field");
68              exit(1);              return -1;
69          }          }
70      }      }
71    

Legend:
Removed from v.3225  
changed lines
  Added in v.3226

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0