svn path=/trunk/boinc/; revision=23647

This commit is contained in:
Eric J. Korpela 2011-06-07 01:50:09 +00:00
parent e9ecb9c04a
commit abbbd7a55b
1 changed files with 37 additions and 0 deletions

View File

@ -3326,3 +3326,40 @@ David 5 Jun 2011
lib/
filesys.cpp
Eric K 6 Jun 2011
- Added safe exit capabilities for Windows CUDA applications.
- checking in the app can be added as below.
#ifdef _WIN32
//Jason: Safe exit check macro to play nicer with Cuda & MS-CRT
#ifdef USE_CUDA
#define SAFE_EXIT_CHECK do { \
if (worker_thread_exit_request) { \
fprintf(stderr,"-> Worker received exit request, syncing Cuda...");
cudaThreadSynchronize(); fprintf(stderr,"Done.\n"); \
fprintf(stderr," Worker Freeing Cuda data..."); cudaAcc_free();
fprintf(stderr,"Done.\n"); \
fprintf(stderr," Worker Acknowledging exit request, spinning->\n");
worker_thread_exit_ack = true; \
while (1) Sleep(10); \
} \
} while (0);
#else
#define SAFE_EXIT_CHECK do { \
if (worker_thread_exit_request) { \
fprintf(stderr," Worker Acknowledging exit request, spinning-> ");
worker_thread_exit_ack = true; \
while (1) Sleep(10); \
} \
} while (0);
#endif
#else // Linux or other probably have their own safe exit handling, defined as
blank, do nothing
#define SAFE_EXIT_CHECK
#endif
and install at the top of the cffft loop, and more locations if desired:
SAFE_EXIT_CHECK;
I'd like to implement these as BOINC API functions, but have not yet done so.