gpu-hello.cpp (11308:7d8836fd043d) | gpu-hello.cpp (11321:02e930db812d) |
---|---|
1/* 2 * Copyright (c) 2015 Advanced Micro Devices, Inc. 3 * All rights reserved. 4 * 5 * For use for simulation and test purposes only 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are met: --- 56 unchanged lines hidden (view full) --- 65 66/* 67 Setup data structures for application/algorithm 68*/ 69int 70setupDataStructs() 71{ 72 msg = (char *)memalign(CACHE_LINE_SIZE, (grid_size + 1) * sizeof(char)); | 1/* 2 * Copyright (c) 2015 Advanced Micro Devices, Inc. 3 * All rights reserved. 4 * 5 * For use for simulation and test purposes only 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are met: --- 56 unchanged lines hidden (view full) --- 65 66/* 67 Setup data structures for application/algorithm 68*/ 69int 70setupDataStructs() 71{ 72 msg = (char *)memalign(CACHE_LINE_SIZE, (grid_size + 1) * sizeof(char)); |
73 if(msg == NULL) { | 73 if (msg == NULL) { |
74 printf("%s:%d: error: %s\n", __FILE__, __LINE__, 75 "could not allocate host buffers\n"); 76 exit(-1); 77 } 78 msg[grid_size] = '\0'; 79 80 keys = (int *)memalign(CACHE_LINE_SIZE, code_size * sizeof(int)); 81 keys[0] = 23; --- 39 unchanged lines hidden (view full) --- 121 platform = platforms[i]; 122 if (!strcmp(pbuff, "Advanced Micro Devices, Inc.")) { 123 break; 124 } 125 } 126 delete platforms; 127 } 128 | 74 printf("%s:%d: error: %s\n", __FILE__, __LINE__, 75 "could not allocate host buffers\n"); 76 exit(-1); 77 } 78 msg[grid_size] = '\0'; 79 80 keys = (int *)memalign(CACHE_LINE_SIZE, code_size * sizeof(int)); 81 keys[0] = 23; --- 39 unchanged lines hidden (view full) --- 121 platform = platforms[i]; 122 if (!strcmp(pbuff, "Advanced Micro Devices, Inc.")) { 123 break; 124 } 125 } 126 delete platforms; 127 } 128 |
129 if(NULL == platform) { | 129 if (NULL == platform) { |
130 printf("NULL platform found so Exiting Application.\n"); 131 return FAILURE; 132 } 133 134 // 2. create context from platform 135 cl_context_properties cps[3] = 136 {CL_CONTEXT_PLATFORM, (cl_context_properties)platform, 0}; 137 context = clCreateContextFromType(cps, CL_DEVICE_TYPE_GPU, NULL, NULL, --- 195 unchanged lines hidden --- | 130 printf("NULL platform found so Exiting Application.\n"); 131 return FAILURE; 132 } 133 134 // 2. create context from platform 135 cl_context_properties cps[3] = 136 {CL_CONTEXT_PLATFORM, (cl_context_properties)platform, 0}; 137 context = clCreateContextFromType(cps, CL_DEVICE_TYPE_GPU, NULL, NULL, --- 195 unchanged lines hidden --- |