diff --git a/AppDebug.md b/AppDebug.md index 45a63a3..3acfa76 100644 --- a/AppDebug.md +++ b/AppDebug.md @@ -10,7 +10,8 @@ When you have built your application and linked it with the BOINC libraries, you can run it in **standalone mode** (without a BOINC client present). To do this, put instances of all input files in the same directory (with the proper logical, not physical, names). -The application should run, produce output files (also with their logical names), +The application should run, produce output files +(also with their logical names), and exit with 0 status. You can run the program under a debugger. @@ -19,8 +20,7 @@ so your application will never checkpoint. ## Testing without a BOINC client, part 2 -The next step is to make sure that suspend, resume, and abort work. -To do this: +To make sure that suspend, resume, and abort work: * Edit boinc/api/boinc_api.cpp; uncomment the #defines of MSGS_FROM_FILE and (if you want) VERBOSE. @@ -41,38 +41,51 @@ Once your application works in standalone mode, you can test it under the BOINC client, but without a project server. This will exercise the interaction with the client. -### Simple way (no XML files) +There are two ways to do this. +Both of them require describing your app's +input and output files, and its other attributes. +In the first way you describe these in C++; +in the second, you use XML. -* Put a copy of the BOINC client and your application in a directory. -* Create a subdirectory ```slots/app_test```. Put your app's input files there (logical names). -* Run ```boinc --app_test foo``` where ```foo``` is the application filename. -* The client will run your application. - When it's done, the output files (and stderr.txt) will be in ```slots/app_test```. +### Using C++ -Note: if you want, the directory can be a BOINC data directory. -In that case your application will coexist with existing jobs -(it might not run right away). +In the BOINC source tree, open +[client/app_test.cpp](https://github.com/BOINC/boinc/blob/master/client/app_test.cpp) and read the instructions there. +In summary: -### Less simple way +* Edit ```app_test.cpp``` to specify your app's files and attributes. +* Build the BOINC client. +* Create a test directory, with a subdirectory ```slots/app_test```. +* Put your application's executable in the test directory. +* Put the job's input files in the test directory (with logical names). +* Run ```boinc --app_test foo``` where ```foo``` is the name of the executable. -This example assumes that your executable name is **test.exe**, -and that it has an input file with logical name **in** and physical name **input.txt**, -and an output file with logical name **out** and physical name **output.txt**. +The client will run the job. +When it's done, the output files (physical names) will be in the test +directory, and stderr.txt will be in ```slots/app_test```. -* Make a directory and put the BOINC client there. You'll need a 6.10.14 or later client. +### Using XML + +This example assumes that your executable name is ```test.exe```, +and that it has an input file with logical name ```in``` and physical name ```input.txt```, +and an output file with logical name ```out``` +and physical name ```output.txt```. + +* Make a directory and put the BOINC client there. * Put the file - [samples/client_state_save.xml](https://boinc.berkeley.edu/gitweb/?p=boinc-v2.git;a=blob_plain;f=samples/client_state_save.xml;hb=HEAD) - in it. - Modify this file as needed to reflect the input and output files of your application - (add **\** and **\** elements). -* Create a file **account_test.xml** containing +[samples/client_state_save.xml](https://github.com/BOINC/boinc/blob/master/samples/client_state_save.xml) +in it. +Modify this file as needed to reflect the +input and output files of your application +(add ```\``` and ```\``` elements). +* Create a file ```account_test.xml``` containing ```xml http://test.test test_project ``` -* Create a file **cc_config.xml** containing +* Create a file ```cc_config.xml``` containing ```xml @@ -81,7 +94,7 @@ and an output file with logical name **out** and physical name **output.txt**. ``` -* Make a subdirectory **projects/test.test**; put **test.exe** and **input.txt** there. +* Make a subdirectory ```projects/test.test```; put ```test.exe``` and ```input.txt``` there. * To run the BOINC client (and your app) type ``` cp client_state_save.xml client_state.xml ; boinc @@ -94,12 +107,12 @@ are working. The client will run your app and then sleep. When the job is done, -check **projects/test.test/output.txt** to verify that it worked. -Your app's stderr output will be somewhere in client_state.xml. +check ```projects/test.test/output.txt``` to verify that it worked. +Your app's stderr output will be somewhere in ```client_state.xml```. ### Running under a debugger -If your app isn't working, there are two ways to debug it. +If your app is crashing, there are two ways to debug it. First, if you put ```xml @@ -113,8 +126,10 @@ and run the app manually (perhaps under a debugger) by typing ``` ../../projects/test.test/test.exe ``` -In this approach the app runs in standalone mode, since the BOINC client is not running. -When it's done, its output files and stderr output file will be in the slot directory. +In this approach the app runs in standalone mode, +since the BOINC client is not running. +When it's done, its output files and stderr output file +will be in the slot directory. The second approach is to put ```xml diff --git a/notes b/notes index ad70584..b43755d 100644 --- a/notes +++ b/notes @@ -139,3 +139,22 @@ https://devblogs.microsoft.com/commandline/install-wsl-with-a-single-command-now (Craig Loewen can help?) https://learn.microsoft.com/en-us/windows/wsl/basic-commands +=============== + +building native apps + +1) CPU app + C++ app, e.g. worker + add BOINC calls: boinc_init(), boinc_resolve() etc. + build on + Linux: gcc/make + Win: visual studio + Mac: xcode + +2) GPU app + C++ app that e.g. adds 2 matrices + versions: + CUDA + OpenCL + Metal + build on above platforms