[meta-ti] [RFC PATCH 6/6] opencl-examples: OpenCL example applications.
Jacob Stiffler
j-stiffler at ti.com
Thu Feb 26 05:34:11 PST 2015
Signed-off-by: Jacob Stiffler <j-stiffler at ti.com>
---
...-larger-sets-and-display-size-information.patch | 74 ++++++++++++++++++++
recipes-ti/ocl/opencl-examples_git.bb | 66 +++++++++++++++++
2 files changed, 140 insertions(+)
create mode 100644 recipes-ti/ocl/ocl/0001-Add-larger-sets-and-display-size-information.patch
create mode 100644 recipes-ti/ocl/opencl-examples_git.bb
diff --git a/recipes-ti/ocl/ocl/0001-Add-larger-sets-and-display-size-information.patch b/recipes-ti/ocl/ocl/0001-Add-larger-sets-and-display-size-information.patch
new file mode 100644
index 0000000..b9987ad
--- /dev/null
+++ b/recipes-ti/ocl/ocl/0001-Add-larger-sets-and-display-size-information.patch
@@ -0,0 +1,74 @@
+From c182467a5a2ed347d04b5586c96d4d3c33082805 Mon Sep 17 00:00:00 2001
+From: Jacob Stiffler <j-stiffler at ti.com>
+Date: Thu, 4 Dec 2014 09:29:34 -0500
+Subject: [PATCH] Add larger sets and display size information.
+
+Signed-off-by: Jacob Stiffler <j-stiffler at ti.com>
+---
+ dsplib_fft/fft_ocl.cpp | 5 ++++-
+ vecadd/main.cpp | 5 ++++-
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/dsplib_fft/fft_ocl.cpp b/dsplib_fft/fft_ocl.cpp
+index 5f30532..044584a 100644
+--- a/dsplib_fft/fft_ocl.cpp
++++ b/dsplib_fft/fft_ocl.cpp
+@@ -29,6 +29,7 @@
+ #include <cmath>
+ #include <cstring>
+ #include <iostream>
++#include <stdio.h>
+ #include "ocl_util.h"
+
+ #define __CL_ENABLE_EXCEPTIONS
+@@ -53,7 +54,7 @@ const char * kernelStr =
+ /* ======================================================================== */
+ /* Initialized arrays with fixed test data. */
+ /* ======================================================================== */
+-#define FFTSZ (64*1024)
++#define FFTSZ (1*1024*1024)
+ #define PAD 0
+
+ float x[2*FFTSZ];
+@@ -88,6 +89,8 @@ int main ()
+ int d = 0;
+ int bufsize = sizeof(float) * (2*FFTSZ + PAD + PAD);
+
++ printf("Offloading FFT (SP,Complex) of %dK elements...\n\n", (FFTSZ / 1024)); fflush(stdout);
++
+ Buffer bufX(context, CL_MEM_READ_ONLY, bufsize);
+ Buffer bufY(context, CL_MEM_WRITE_ONLY, bufsize);
+ Buffer bufW(context, CL_MEM_READ_ONLY, bufsize);
+diff --git a/vecadd/main.cpp b/vecadd/main.cpp
+index be1aced..e2dceda 100644
+--- a/vecadd/main.cpp
++++ b/vecadd/main.cpp
+@@ -29,6 +29,7 @@
+ #include <CL/cl.hpp>
+ #include <iostream>
+ #include <cstdlib>
++#include <stdio.h>
+ #include "ocl_util.h"
+
+ using namespace cl;
+@@ -43,7 +44,7 @@ const char * kernelStr =
+ " c[id] = a[id] + b[id];\n"
+ "}\n";
+
+-const int NumElements = 8*1024;
++const int NumElements = 8*1024*1024;
+ const int NumWorkGroups = 256;
+ const int VectorElements = 4;
+ const int NumVecElements = NumElements / VectorElements;
+@@ -76,6 +77,8 @@ int main(int argc, char *argv[])
+ devices[d].getInfo(CL_DEVICE_NAME, &str);
+ cout << "DEVICE: " << str << endl << endl;
+
++ printf("Offloading vector addition of %dK elements...\n\n", (NumElements / 1024)); fflush(stdout);
++
+ Buffer bufA (context, CL_MEM_READ_ONLY, bufsize);
+ Buffer bufB (context, CL_MEM_READ_ONLY, bufsize);
+ Buffer bufDst (context, CL_MEM_WRITE_ONLY, bufsize);
+--
+1.7.9.5
+
diff --git a/recipes-ti/ocl/opencl-examples_git.bb b/recipes-ti/ocl/opencl-examples_git.bb
new file mode 100644
index 0000000..32af835
--- /dev/null
+++ b/recipes-ti/ocl/opencl-examples_git.bb
@@ -0,0 +1,66 @@
+DESCRIPTION = "TI OpenCL Examples"
+HOMEPAGE = "https://gitorious.design.ti.com/ocl"
+LICENSE = "BSD"
+
+include ocl.inc
+
+COMPATIBLE_MACHINE = "dra7xx"
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+DEPENDS = "opencl ti-cgt6x-native clocl-native"
+
+RDEPENDS_${PN} += " opencl-runtime"
+
+SRC_URI_append = " \
+ ${SRC_URI_EXAMPLES} \
+ ${EXAMPLES_PATCHES} \
+"
+
+
+S = "${WORKDIR}/git/opencl_example_src"
+B = "${S}"
+
+OCL_EXAMPLE_LIST = "dsplib_fft null ooo ooo_map platforms simple vecadd ccode buffer offline offline_embed"
+
+python do_unpack_append() {
+ import shutil
+
+ git_dir = d.expand("${WORKDIR}/git/opencl_examples")
+ s = d.getVar("S", True)
+
+ os.makedirs(s)
+ shutil.copy(os.path.join(git_dir,"Makefile"),s)
+ shutil.copy(os.path.join(git_dir,"make.inc"),s)
+ for example in d.getVar("OCL_EXAMPLE_LIST").split():
+ shutil.copytree(os.path.join(git_dir,example), os.path.join(s,example))
+}
+
+
+EXTRA_OEMAKE = " TARGET_ROOTDIR=${STAGING_DIR_HOST} TI_OCL_CGT_INSTALL=${STAGING_DIR_NATIVE}/usr/share/ti/cgt-c6x"
+
+do_compile() {
+ oe_runmake
+}
+
+do_install() {
+ install -d ${D}${datadir}/ti/examples/opencl
+
+ install ${B}/Makefile ${D}${datadir}/ti/examples/opencl
+ install ${B}/make.inc ${D}${datadir}/ti/examples/opencl
+
+ for ocl_example in ${OCL_EXAMPLE_LIST}; do
+ install -d ${D}${datadir}/ti/examples/opencl/${ocl_example}
+ cp -rv ${B}/${ocl_example}/* ${D}${datadir}/ti/examples/opencl/${ocl_example}
+ done
+}
+
+FILES_${PN} += "\
+ ${datadir}/ti/examples/opencl \
+"
+
+FILES_${PN}-dbg += "\
+ ${datadir}/ti/examples/opencl/*/.debug \
+"
+
+INSANE_SKIP_${PN} = "arch"
+
--
1.7.9.5
More information about the meta-ti
mailing list