viernes, 12 de febrero de 2010

Good evening Mr Baxter

Tal vez esta sea otra de esas muchas veces que escribo algo y se queda ahí. Como una mancha en un mantel. Algo que se espera encontrar en él, pero que aún así molesta.
Tal vez vuelva a repetir viejas ideas, pero qué sería de nosotros si no cayésemos una y otra vez en los mismos errores. La gente no podría mostrárnoslos y sentirse mejores consigo mismos. Eso sería terrible.
Tengo la extraña sensación de que me pierdo en tercero. No es que vaya del todo mal, es sólo que es el ecuador, y no hay una salida fácil. No es una cuerda floja, es una plataforma aislada, y rodeada de vacío.
Son los años que pasan, son los chicos que vienen detrás de mi, que tienen menos años que yo y les queda más camino por delante. Es otra vez el amanecer que le sigue a una noche de empalmada.
Esta ciudad se me queda grande y pequeña. Lo grande es un reto distante. Lo pequeño un aliciente para preparar la huída.
No todo es tan negro. Al fin y al cabo mi vida marcha. Los dolores de cabeza remiten, y supero traumas y miedos. No pienso llamarlo madurar. Me gusta más evolución.
Cultura se ha convertido en una palabra deforme. Pero propia.
Los sentimientos son. Confusos.

3 comentarios:

(?) dijo...
Este comentario ha sido eliminado por el autor.
(?) dijo...

Pues a mi me gusta lo que escribes =)

Joselib dijo...

#include
#include

#include

int main() {
char buf[]="Ya tienes mi programa.";
char build_c[4096];
size_t srcsize, worksize=strlen(buf);

cl_int error = CL_SUCCESS;
cl_platform_id platform;
cl_device_id device;
cl_uint platforms, devices;

/* Fetch the Platforms, we only want one. */
clGetPlatformIDs(1, &platform, &platforms);

/* Fetch the Devices for this platform */
clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 1, &device, &devices);

/* Create a memory context for the device we want to use */
cl_context_properties properties[]={CL_CONTEXT_PLATFORM, (cl_context_properties)platform,0};
/* Note that nVidia's OpenCL requires the platform property */
cl_context context = clCreateContext(properties, 1, &device, NULL, NULL, &error);

/* Create a command queue to communicate with the device */
cl_command_queue cq = clCreateCommandQueue(context, device, 0, &error);


/* Read the source kernel code in exmaple.cl as an array of char's */
char src[8192];
FILE *fil=fopen("example.cl","r");
srcsize=fread(src, sizeof src, 1, fil);
fclose(fil);

const char *srcptr[]={src};
/* Submit the source code of the kernel to OpenCL, and create a program object with it */
cl_program prog=clCreateProgramWithSource(context,
1, srcptr, &srcsize, &error);


/* Compile the kernel code (after this we could extract the compiled version) */
clBuildProgram(prog, 0, NULL, "", NULL, NULL);
if ( error != CL_SUCCESS ) {
printf( "Error on buildProgram " );
printf("\n Error number %d", error);
fprintf( stdout, "\nRequestingInfo\n" );
clGetProgramBuildInfo( prog, devices, CL_PROGRAM_BUILD_LOG, 4096, build_c, NULL );
printf( "Build Log for %s_program:\n%s\n", "example", build_c );
}

/* Create memory buffers in the Context where the desired Device is. These will be the pointer
parameters on the kernel. */
cl_mem mem1, mem2;
mem1=clCreateBuffer(context, CL_MEM_READ_ONLY, worksize, NULL, &error);

mem2=clCreateBuffer(context, CL_MEM_WRITE_ONLY, worksize, NULL, &error);

/* Create a kernel object with the compiled program */
cl_kernel k_example=clCreateKernel(prog, "example", &error);


/* Set the kernel parameters */
clSetKernelArg(k_example, 0, sizeof(mem1), &mem1);

clSetKernelArg(k_example, 1, sizeof(mem2), &mem2);
/* Create a char array in where to store the results of the Kernel */
char buf2[sizeof buf];
buf2[0]='?';
buf2[worksize]=0;

/* Send input data to OpenCL (async, don't alter the buffer!) */
clEnqueueWriteBuffer(cq, mem1, CL_FALSE, 0, worksize, buf, 0, NULL, NULL);
/* Tell the Device, through the command queue, to execute que Kernel */
clEnqueueNDRangeKernel(cq, k_example, 1, NULL, &worksize, &worksize, 0, NULL, NULL);
/* Read the result back into buf2 */
clEnqueueReadBuffer(cq, mem2, CL_FALSE, 0, worksize, buf2, 0, NULL, NULL);
/* Await completion of all the above */
clFinish(cq);
/* Finally, output the result */
puts(buf2);
}