Commit Graph

84 Commits

Author SHA1 Message Date
David Anderson bb5a113fe4 client (Mac): use full path for system_profiler 2024-02-05 01:19:35 -08:00
David Anderson 5b70e5a605 remove a dangerous trailing space 2024-02-05 01:14:11 -08:00
David Anderson 195c6f26da client: system_profiler reports Metal Intel GPUs on Intel Macs; ignore them 2024-02-05 00:10:08 -08:00
David Anderson 3c1f189f38 client: build fix for non-Mac
Put #ifdef __APPLE__ around large chunks of Apple-specific code.
But not around single lines - too busy.
2024-02-04 23:48:30 -08:00
David Anderson 1597316b97 client: debug Apple Silicon GPU detection 2024-02-05 03:10:16 +01:00
David Anderson 61e2f05f17 client: detect Apple Silicon GPUs, and their Metal capabilities,
by means other than OpenCL.
Do this using the Mac 'system_profiler' program, as suggested by Charlie.
Also:
- improve the comments in GPU detection code.
    For something this complex, we need, at the minimum,
    a comment saying what each function does.
- avoid field names like 'version' and 'name'.
    Version of what?  name of what?
2024-02-04 16:09:38 -08:00
David Anderson ef6024bd4e add missing code 2024-01-28 14:59:22 -08:00
David Anderson 73fba33695 client/server/web: add 'Apple GPU' as an official GPU type.
For now, it's detected only via OpenCL (like Intel GPUs).
Eventually we'll detect via Metal as well.

Plan classes for Apple GPU must include 'apple_gpu' in their name.

The changes are mostly copy-and-paste of Intel GPU code.
I hate duplicate code but I don't know how to fix.
2024-01-28 01:41:12 -08:00
Vitalii Koshura 44742026e2
Remove trailing whitespaces. Add CI script to verify in on every commit
Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
2023-05-05 20:08:17 +02:00
David Anderson e08b75d44f Move run_program() etc. from proc_control.cpp back to util.cpp.
This required changing a bunch of project files,
and was turning into a rabbit hole.
2023-04-11 13:11:12 -07:00
David Anderson c3481b25ef
Merge branch 'master' into dpa_gpu_detect2 2023-04-10 10:59:34 -07:00
David Anderson 8444da6ef7 client: don't hang if detection processes hang
The client runs two "detection processes":
- GPU detection
- (Mac) check if in CPU emulation mode
The client was waiting indefinitely for these to exit.
If for some reason they don't exit, the client hangs.

Fix: wait no more than 10 sec for them to exit.
If still running, kill them and move on.

I took the opportunity to clean up the process-related code:

- add a time arg to get_exit_status().
    If zero, wait indefinitely for the child to exit.
    Else wait no more than that amount.
- get_exit_status() return an error code;
    the exit status is returned via a parameter.
- run_program() no longer takes a time argument.
    If you want to check for early exit, use get_exit_status()
- define PROCESS_ID as HANDLE (Win) or int (other)
    so we can unify the process interface
- remove process_exists().  It wasn't used anywhere,
    and get_exit_status(... 0) does the same thing.
- rename kill_program() to kill_process()
- don't use "prog" when you mean "pid"
2023-04-09 16:42:14 -07:00
David Anderson ce28e6792e Code cleanup in preparation for fixing GPU detect issue
lib/util.cpp had become a landfill of unrelated stuff
    - move the process-related code to lib/proc_control.cpp
    - move file-related code to lib/filesys.cpp
    - move client mutex code to client/main.cpp

The client has 2 unrelated types of mutual exclusion:
thread level (between the main and throttle threads)
and process level (prevent 2 clients from running on a host).
    - Rename "client_mutex" to "client_thread_mutex".

- parse.h: don't declare boinc_is_finite(); include the .h file
2023-04-09 14:53:59 -07:00
David Anderson f54437bc58 client: write GPU detection warnings to stderr 2023-04-07 14:20:05 -07:00
Vitalii Koshura 3328871e22
[Windows] Build using ARM64
Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
2021-09-10 12:34:20 +02:00
davidpanderson 8b852cb2c9 Win code cleanup; no functional changes
Platform-wide #defines belong in .h files, not .cpp
Also fixed a couple of compiler warnings.
2020-08-31 13:56:15 -07:00
David Anderson 758ff3e13a client: fix bug in GPU detection
PR #3364 changed the way we clear structures.
This introduced a bug: HOST_INFO::clear_host_info()
intentionally didn't clear HOST_INFO::coprocs.
But it was replaced with HOST_INFO::clear(), which did.
This caused the client to lose GPU info.

Fix: restore HOST_INFO::clear_host_info(), and add a comment
to avoid future errors like this.

Also add some comments in GPU detection,
which is woefully lacking in them.
2020-01-28 14:22:28 -08:00
davidpanderson e14cef28ac Fix more compiler warnings (snprintf, sigaction). No functional changes. 2019-11-05 23:25:06 -08:00
David Anderson 219a540550 client: get rid of the use of memset() to initialize structs to zero.
Instead: declare a static const instance (whose data members are zero)
and copy that.
This avoid the error-prone need to assign each member,
and it works even if there are virtual function tables.
2019-11-05 00:16:02 -08:00
Juha Sointusalo 11cfa26cc9 client: don't quote the path to client in GPU detection
Client path was quoted because on Windows run_program() concatenates
arguments to a single string. Without quoting any path with a space
would cause problems interpreting the command line.

What run_program() does with its parameters is really an implementation
detail of it and users of run_program() shouldn't need to know or care
about it.

Moving quoting into run_program() also removes the need to duplicate
quoting everywhere run_program() is used.

The program name or path to it needs to be valid filesystem name and
it's always the first in argv so quoting it in run_program() is trivial.
run_program() doesn't know which other arguments may contain paths and
quoting arbitrary arguments is harder so keep quoted_data_dir for now.
2018-10-09 22:18:00 +03:00
Juha Sointusalo e77dd4c690 client: reduce log spamming in GPU detection 2018-09-25 22:24:02 +03:00
Juha Sointusalo 1296c86f49 client: remove unnecessary chdir() calls in GPU detection
GPU detection code goes back and forth between program and data
directories but this is unnecessary because run_program() already takes
care of running the program in correct directory.

Fixes two "ignoring return value" warnings from GCC/GLIBC.
2018-09-22 18:28:43 +03:00
Juha Sointusalo 21070861ec client: decode error codes in detecting GPUs
On Unixes, if GPU detection fails the client logs an error message
containing a raw value from waitpid() call. This raw value generally
requires writing an external program to decode it before it is useful
for troubleshooting.

Decode the raw value to something more useful to humans. Make a similar
change to Windows code too.
2018-09-22 18:20:45 +03:00
Juha Sointusalo c4708d24de client: use full path to client executable in GPU detection
GPU detection tries to launch a copy of the client using argv[0] but
argv[0] doesn't always include path. If path is not included and current
directory is not the same as BOINC program directory then the GPU
detection fails.

Use full path to the client executable instead if possible. Quote the
path on Windows to handle paths with spaces.
2018-09-22 17:55:04 +03:00
David Anderson d7a38ca6fa Merge pull request #2036 from BOINC/win_exe
Client, Win: append .exe to service process program name if missing
2017-08-15 23:30:55 -07:00
David Anderson 12d13917cd client: hardware client executable name: boinc or boinc.exe
The GPU detection code was already doing this;
do for Win daemon process startup as well.
2017-08-15 15:13:50 -07:00
David Anderson a3b4191ca9 client: do coproc detect in a separate process even for debug
Better for the debug version to do the same thing as release.
There's a #define you can change if you want GPU detection to happen in the main process.
2017-08-14 14:54:31 -07:00
David Anderson 80562d230d code cleanup
In .cpp files, put "using std::" at the top and don't use std:: after that
2016-12-16 12:12:00 -08:00
Charlie Fenton 49275b0727 client: consolidate comments in GPU code 2016-10-28 19:55:24 -07:00
David Anderson ca3cb0c5c6 Client: add some comments to GPU code 2016-10-27 22:57:19 -07:00
Christian Beer 0b3a760924 initialize fields in constructors
fixes CID 27984 found by Coverity Scan
2015-10-20 15:58:34 +02:00
David Anderson e82e36e90e client: msg tweak 2015-04-30 00:16:01 -07:00
David Anderson 8adcd872f6 client: say whether coprocs are GPUs in event log 2014-12-11 16:18:33 -08:00
David Anderson 115894f1e3 client emulator: don't crash if > 64 coproc instances specified 2014-11-24 23:07:21 -08:00
David Anderson 7a4672e7d6 client: increase limit on coproc instances from 31 to 64
We were using an int bitmap to store flags for the instances of a coproc.
Furthermore, because of the use of 2^n-1 to generate a bitmap of 1s,
the limit on instances was 31.

Use a long long for the bitmap instead, and don't use 2^n-1.
This increases the limit to 64.
2014-11-24 00:14:23 -08:00
Charlie Fenton 6790085415 client: fix spaces in source code. 2014-11-05 02:17:13 -08:00
Charlie Fenton 408003dd71 client: Allow using NVIDIA GPUs with Compute Capability < 2.0 with CUDA driver 6.5 or later on non-Mac platforms. Future versions of CUDA will drop support for these GPUs on all platforms and presumably not report these GPUs, so we still explain that situation in the Event Log and Notices. 2014-11-05 02:12:41 -08:00
Charlie Fenton 6d1f6060d4 client: add some comments to clarify that the CUDA warning message and notice will appear only once for each relevant GPU. 2014-10-28 02:50:14 -07:00
Charlie Fenton 62e70a8e98 client: Handle future versions of CUDA which may not report NVIDIA GPUs with Compute Capability < 2.0 at all; prevent use of those GPUs for OpenCL and show explanation in Event Log and Notices. 2014-10-26 04:12:01 -07:00
Charlie Fenton 4726923ef8 client: If CUDA driver 6.5 or later is installed, prevent use of NVIDIA GPUs with Compute Capability < 2.0 and show explanation in Event Log and Notices. 2014-10-25 03:55:29 -07:00
David Anderson dcb72145e1 client: fix compile warnings 2014-07-23 09:51:34 -07:00
Charlie Fenton 512e8e2cfe client: continue adding support for OpenCL devices (GPUs and accelerators) other than AMD/ATI, NVIDIA or Intel GPUs.
For now, handle AMD/ATI, NVIDIA or Intel GPUs as before.  But for other, "new" vendors, we treat each device as a separate resource, creating an entry for each instance in the COPROCS::coprocs[] array and copying the device name COPROC::opencl_prop.name into the COPROC::type field (instead of the vendor name.)
For devices from "new" vendors, set <gpu_type> field in init_data.xml file to the vendor string supplied by OpenCL.  This should allow boinc_get_opencl_ids() to work correctly with these "new" devices without modification.
2014-07-23 05:18:51 -07:00
David Anderson 191c7347e2 client: make it compile. Charlie, please change the commented-out lines 2014-07-22 13:02:43 -07:00
Charlie Fenton 98f4c461d0 client: group new (non-NVIDIA, non-AMD, non-INTEL) OpenCL device types by vendor name string rather than by CL_DEVICE_VENDOR_ID. This assumes that OpenCL reports identical vendor name strings for all devices from the same vendor on a given host. I incorrectly thought CL_DEVICE_VENDOR_ID was a numeric ID of the vendor which would be the same for each device from that vendor, but it is actually a unique numeric ID assigned by a given vendor to each device on a particular host. 2014-07-18 04:25:45 -07:00
Charlie Fenton 7fb69fe924 client: generalize naming scheme for OpenCL devices, add more general have_rsrc() functions 2014-07-17 02:22:26 -07:00
Charlie Fenton 64d76198ea client: keep array subscripts in bounds. 2014-07-16 06:05:01 -07:00
Charlie Fenton b37cf4cd9a client: begin adding support for OpenCL devices other than AMD/ATI, NVIDIA or Intel 2014-07-16 04:33:26 -07:00
David Anderson 79906a8f1a Client: fix a few compile warnings 2014-05-08 15:38:30 -07:00
David Anderson 701e75c4da Client: post a notice if user settings (project prefs, config file, and/or account manager settings) prevent this host from ever getting work from a project 2014-02-10 11:22:35 -08:00
David Anderson 04e8f00221 client, Win: when running GPU detect, use "boinc.exe" rather than "boinc" on cmdline.
An alpha tester reported that this fixed an error; not sure why
2014-02-06 23:48:54 -08:00