mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-23 04:54:26 +00:00
Fix the case where there are no GPUs, and exit if they give errors.
If there are no GPUs, set nDevs to 0 not -1 (status is set to an unhelpful -1001 here on my laptop, so we can't rely on a particular status value). Also, if nDevs is -1, exit rather than screwing up later.
This commit is contained in:
parent
8b68dc44d4
commit
efebee5ab8
3
main.c
3
main.c
@ -1458,6 +1458,9 @@ int main (int argc, char *argv[])
|
|||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
#ifdef HAVE_OPENCL
|
||||||
nDevs = clDevicesNum();
|
nDevs = clDevicesNum();
|
||||||
|
if (nDevs < 0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
if (nDevs)
|
if (nDevs)
|
||||||
opt_n_threads = 0;
|
opt_n_threads = 0;
|
||||||
|
5
ocl.c
5
ocl.c
@ -58,10 +58,11 @@ int clDevicesNum() {
|
|||||||
cl_uint numPlatforms;
|
cl_uint numPlatforms;
|
||||||
cl_platform_id platform = NULL;
|
cl_platform_id platform = NULL;
|
||||||
status = clGetPlatformIDs(0, NULL, &numPlatforms);
|
status = clGetPlatformIDs(0, NULL, &numPlatforms);
|
||||||
|
/* If this fails, assume no GPUs. */
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS)
|
||||||
{
|
{
|
||||||
applog(LOG_ERR, "Error: Getting Platforms. (clGetPlatformsIDs)");
|
applog(LOG_INFO, "clGetPlatformsIDs failed (no GPU?)");
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numPlatforms > 0)
|
if (numPlatforms > 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user