applog fixes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
diff --git a/cpu-miner.c b/cpu-miner.c
index 0968160..5c91d0b 100644
--- a/cpu-miner.c
+++ b/cpu-miner.c
@@ -851,7 +851,7 @@ static void *gpuminer_thread(void *userdata)
work->blk.nonce = 0;
status = queue_kernel_parameters(&work->blk, kernel, clState->outputBuffer);
if (unlikely(status != CL_SUCCESS))
- { applog(LOG_ERR, "Error: clSetKernelArg of all params failed."); exit (1); }
+ { applog(LOG_ERR, "Error: clSetKernelArg of all params failed."); goto out; }
work_restart[thr_id].restart = 0;
need_work = false;
diff --git a/ocl.c b/ocl.c
index 8f39b9f..db17de2 100644
--- a/ocl.c
+++ b/ocl.c
@@ -44,7 +44,7 @@ int clDevicesNum() {
status = clGetPlatformIDs(0, NULL, &numPlatforms);
if(status != CL_SUCCESS)
{
- printf("Error: Getting Platforms. (clGetPlatformsIDs)\n");
+ applog(LOG_ERR, "Error: Getting Platforms. (clGetPlatformsIDs)");
return -1;
}
@@ -54,7 +54,7 @@ int clDevicesNum() {
status = clGetPlatformIDs(numPlatforms, platforms, NULL);
if(status != CL_SUCCESS)
{
- printf("Error: Getting Platform Ids. (clGetPlatformsIDs)\n");
+ applog(LOG_ERR, "Error: Getting Platform Ids. (clGetPlatformsIDs)");
return -1;
}
@@ -65,7 +65,7 @@ int clDevicesNum() {
status = clGetPlatformInfo( platforms[i], CL_PLATFORM_VENDOR, sizeof(pbuff), pbuff, NULL);
if(status != CL_SUCCESS)
{
- printf("Error: Getting Platform Info. (clGetPlatformInfo)\n");
+ applog(LOG_ERR, "Error: Getting Platform Info. (clGetPlatformInfo)");
free(platforms);
return -1;
}
@@ -87,7 +87,7 @@ int clDevicesNum() {
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &numDevices);
if(status != CL_SUCCESS)
{
- printf("Error: Getting Device IDs (num)\n");
+ applog(LOG_ERR, "Error: Getting Device IDs (num)");
return -1;
}
@@ -165,7 +165,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
status = clGetPlatformIDs(0, NULL, &numPlatforms);
if(status != CL_SUCCESS)
{
- printf("Error: Getting Platforms. (clGetPlatformsIDs)\n");
+ applog(LOG_ERR, "Error: Getting Platforms. (clGetPlatformsIDs)");
return NULL;
}
@@ -175,7 +175,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
status = clGetPlatformIDs(numPlatforms, platforms, NULL);
if(status != CL_SUCCESS)
{
- printf("Error: Getting Platform Ids. (clGetPlatformsIDs)\n");
+ applog(LOG_ERR, "Error: Getting Platform Ids. (clGetPlatformsIDs)");
return NULL;
}
@@ -185,7 +185,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
status = clGetPlatformInfo( platforms[i], CL_PLATFORM_VENDOR, sizeof(pbuff), pbuff, NULL);
if(status != CL_SUCCESS)
{
- printf("Error: Getting Platform Info. (clGetPlatformInfo)\n");
+ applog(LOG_ERR, "Error: Getting Platform Info. (clGetPlatformInfo)");
free(platforms);
return NULL;
}
@@ -207,7 +207,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &numDevices);
if(status != CL_SUCCESS)
{
- printf("Error: Getting Device IDs (num)\n");
+ applog(LOG_ERR, "Error: Getting Device IDs (num)");
return NULL;
}
@@ -220,7 +220,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numDevices, devices, NULL);
if(status != CL_SUCCESS)
{
- printf("Error: Getting Device IDs (list)\n");
+ applog(LOG_ERR, "Error: Getting Device IDs (list)");
return NULL;
}
@@ -232,7 +232,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
status = clGetDeviceInfo(devices[i], CL_DEVICE_NAME, sizeof(pbuff), pbuff, NULL);
if(status != CL_SUCCESS)
{
- printf("Error: Getting Device Info\n");
+ applog(LOG_ERR, "Error: Getting Device Info");
return NULL;
}
@@ -244,14 +244,14 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
status = clGetDeviceInfo(devices[gpu], CL_DEVICE_NAME, sizeof(pbuff), pbuff, NULL);
if(status != CL_SUCCESS)
{
- printf("Error: Getting Device Info\n");
+ applog(LOG_ERR, "Error: Getting Device Info");
return NULL;
}
applog(LOG_INFO, "Selected %i: %s", gpu, pbuff);
strncpy(name, pbuff, nameSize);
} else {
- printf("Invalid GPU %i\n", gpu);
+ applog(LOG_ERR, "Invalid GPU %i", gpu);
return NULL;
}
@@ -262,7 +262,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
clState->context = clCreateContextFromType(cps, CL_DEVICE_TYPE_GPU, NULL, NULL, &status);
if(status != CL_SUCCESS)
{
- printf("Error: Creating Context. (clCreateContextFromType)\n");
+ applog(LOG_ERR, "Error: Creating Context. (clCreateContextFromType)");
return NULL;
}
@@ -346,7 +346,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
clState->program = clCreateProgramWithSource(clState->context, 1, (const char **)&source, sourceSize, &status);
if(status != CL_SUCCESS)
{
- printf("Error: Loading Binary into cl_program (clCreateProgramWithSource)\n");
+ applog(LOG_ERR, "Error: Loading Binary into cl_program (clCreateProgramWithSource)");
return NULL;
}
@@ -354,13 +354,13 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
status = clBuildProgram(clState->program, 1, &devices[gpu], NULL, NULL, NULL);
if(status != CL_SUCCESS)
{
- printf("Error: Building Program (clBuildProgram)\n");
+ applog(LOG_ERR, "Error: Building Program (clBuildProgram)");
size_t logSize;
status = clGetProgramBuildInfo(clState->program, devices[gpu], CL_PROGRAM_BUILD_LOG, 0, NULL, &logSize);
char *log = malloc(logSize);
status = clGetProgramBuildInfo(clState->program, devices[gpu], CL_PROGRAM_BUILD_LOG, logSize, log, NULL);
- printf("%s\n", log);
+ applog(LOG_INFO, "%s", log);
return NULL;
}
@@ -380,7 +380,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
binaries = (char **)malloc( sizeof(char *)*nDevices );
for( i = 0; i < nDevices; i++ ) {
if (opt_debug)
- applog(LOG_DEBUG, "binary size %d : %d\n", i, binary_sizes[i]);
+ applog(LOG_DEBUG, "binary size %d : %d", i, binary_sizes[i]);
if( binary_sizes[i] != 0 )
binaries[i] = (char *)malloc( sizeof(char)*binary_sizes[i] );
else
@@ -412,21 +412,21 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
w--; remaining++;
w += start; remaining -= start;
if (opt_debug)
- printf("At %p (%u rem. bytes), to begin patching\n",
+ applog(LOG_DEBUG, "At %p (%u rem. bytes), to begin patching",
w, remaining);
patch_opcodes(w, length);
}
status = clReleaseProgram(clState->program);
if(status != CL_SUCCESS)
{
- printf("Error: Releasing program. (clReleaseProgram)\n");
+ applog(LOG_ERR, "Error: Releasing program. (clReleaseProgram)");
return NULL;
}
clState->program = clCreateProgramWithBinary(clState->context, numDevices, &devices[gpu], binary_sizes, (const unsigned char **)binaries, &status, NULL);
if(status != CL_SUCCESS)
{
- printf("Error: Loading Binary into cl_program (clCreateProgramWithBinary)\n");
+ applog(LOG_ERR, "Error: Loading Binary into cl_program (clCreateProgramWithBinary)");
return NULL;
}
}
@@ -435,13 +435,13 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
status = clBuildProgram(clState->program, 1, &devices[gpu], NULL, NULL, NULL);
if(status != CL_SUCCESS)
{
- printf("Error: Building Program (clBuildProgram)\n");
+ applog(LOG_ERR, "Error: Building Program (clBuildProgram)");
size_t logSize;
status = clGetProgramBuildInfo(clState->program, devices[gpu], CL_PROGRAM_BUILD_LOG, 0, NULL, &logSize);
char *log = malloc(logSize);
status = clGetProgramBuildInfo(clState->program, devices[gpu], CL_PROGRAM_BUILD_LOG, logSize, log, NULL);
- printf("%s\n", log);
+ applog(LOG_INFO, "%s", log);
return NULL;
}
@@ -449,7 +449,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
clState->kernel = clCreateKernel(clState->program, "search", &status);
if(status != CL_SUCCESS)
{
- printf("Error: Creating Kernel from program. (clCreateKernel)\n");
+ applog(LOG_ERR, "Error: Creating Kernel from program. (clCreateKernel)");
return NULL;
}
@@ -459,13 +459,13 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
clState->commandQueue = clCreateCommandQueue( clState->context, devices[gpu], 0, &status);
if(status != CL_SUCCESS)
{
- printf("Creating Command Queue. (clCreateCommandQueue)\n");
+ applog(LOG_ERR, "Creating Command Queue. (clCreateCommandQueue)");
return NULL;
}
clState->outputBuffer = clCreateBuffer(clState->context, CL_MEM_READ_WRITE, sizeof(uint32_t) * 128, NULL, &status);
if(status != CL_SUCCESS) {
- printf("Error: clCreateBuffer (outputBuffer)\n");
+ applog(LOG_ERR, "Error: clCreateBuffer (outputBuffer)");
return NULL;
}