edits

David Anderson 2024-02-12 00:32:03 -08:00
parent f8192d78be
commit 001443494d
2 changed files with 63 additions and 29 deletions

@ -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). 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 To do this, put instances of all input files in the same directory
(with the proper logical, not physical, names). (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. and exit with 0 status.
You can run the program under a debugger. 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 ## Testing without a BOINC client, part 2
The next step is to make sure that suspend, resume, and abort work. To make sure that suspend, resume, and abort work:
To do this:
* Edit boinc/api/boinc_api.cpp; uncomment the #defines of * Edit boinc/api/boinc_api.cpp; uncomment the #defines of
MSGS_FROM_FILE and (if you want) VERBOSE. 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. you can test it under the BOINC client, but without a project server.
This will exercise the interaction with the client. 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. ### Using C++
* 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```.
Note: if you want, the directory can be a BOINC data directory. In the BOINC source tree, open
In that case your application will coexist with existing jobs [client/app_test.cpp](https://github.com/BOINC/boinc/blob/master/client/app_test.cpp) and read the instructions there.
(it might not run right away). 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**, The client will run the job.
and that it has an input file with logical name **in** and physical name **input.txt**, When it's done, the output files (physical names) will be in the test
and an output file with logical name **out** and physical name **output.txt**. 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 * 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) [samples/client_state_save.xml](https://github.com/BOINC/boinc/blob/master/samples/client_state_save.xml)
in it. in it.
Modify this file as needed to reflect the input and output files of your application Modify this file as needed to reflect the
(add **\<file_info>** and **\<file_ref>** elements). input and output files of your application
* Create a file **account_test.xml** containing (add ```\<file_info>``` and ```\<file_ref>``` elements).
* Create a file ```account_test.xml``` containing
```xml ```xml
<account> <account>
<master_url>http://test.test</master_url> <master_url>http://test.test</master_url>
<project_name>test_project</project_name> <project_name>test_project</project_name>
</account> </account>
``` ```
* Create a file **cc_config.xml** containing * Create a file ```cc_config.xml``` containing
```xml ```xml
<cc_config> <cc_config>
<options> <options>
@ -81,7 +94,7 @@ and an output file with logical name **out** and physical name **output.txt**.
</options> </options>
</cc_config> </cc_config>
``` ```
* 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 * To run the BOINC client (and your app) type
``` ```
cp client_state_save.xml client_state.xml ; boinc cp client_state_save.xml client_state.xml ; boinc
@ -94,12 +107,12 @@ are working.
The client will run your app and then sleep. The client will run your app and then sleep.
When the job is done, When the job is done,
check **projects/test.test/output.txt** to verify that it worked. check ```projects/test.test/output.txt``` to verify that it worked.
Your app's stderr output will be somewhere in client_state.xml. Your app's stderr output will be somewhere in ```client_state.xml```.
### Running under a debugger ### 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 First, if you put
```xml ```xml
<exit_before_start/> <exit_before_start/>
@ -113,8 +126,10 @@ and run the app manually (perhaps under a debugger) by typing
``` ```
../../projects/test.test/test.exe ../../projects/test.test/test.exe
``` ```
In this approach the app runs in standalone mode, since the BOINC client is not running. In this approach the app runs in standalone mode,
When it's done, its output files and stderr output file will be in the slot directory. 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 The second approach is to put
```xml ```xml

19
notes

@ -139,3 +139,22 @@ https://devblogs.microsoft.com/commandline/install-wsl-with-a-single-command-now
(Craig Loewen can help?) (Craig Loewen can help?)
https://learn.microsoft.com/en-us/windows/wsl/basic-commands 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