diff --git a/ATTRIBUTIONS.md b/ATTRIBUTIONS.md index f21622264963b584102069065971789bd036a161..8deed7969e6eab2d5b8f2cf5a33356b2ad163a82 100644 --- a/ATTRIBUTIONS.md +++ b/ATTRIBUTIONS.md @@ -4,7 +4,8 @@ This file contains all attributions and other notices that are required by law. The following are the list of all recognized copyright notices added by contributors to this project: -Copyright (c) 2016 - 2017, Syncleus, Inc. All rights reserved. +Copyright (c) 2016 - 2018, Syncleus, Inc. All rights reserved. + Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. ## Licenses diff --git a/src/cpp/CLException.h b/src/cpp/CLException.h index 68b05237360ca6a7a4812d7bc9b3cfa439597bf9..73b113d22c402414be34f3785b7ad08743da20eb 100644 --- a/src/cpp/CLException.h +++ b/src/cpp/CLException.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef CL_EXCEPTION_H #define CL_EXCEPTION_H diff --git a/src/cpp/CLHelper.cpp b/src/cpp/CLHelper.cpp index d7afc8feb64d2cde3c8a4ae6471beb785103667d..37348102bea831c4aadc56a64357b5e42ceffa74 100644 --- a/src/cpp/CLHelper.cpp +++ b/src/cpp/CLHelper.cpp @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. @@ -6,34 +21,34 @@ following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following - disclaimer. + disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the distribution. + disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export - laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 + laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through 774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, you hereby certify that, except pursuant to a license granted by the United States Department of Commerce - Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export - Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in - Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) + Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export + Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in + Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced - direct product is subject to national security controls as identified on the Commerce Control List (currently - found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional + direct product is subject to national security controls as identified on the Commerce Control List (currently + found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry - and Security’s website at http://www.bis.doc.gov/. + and Security�s website at http://www.bis.doc.gov/. */ #define CLHELPER_SOURCE @@ -127,7 +142,7 @@ void CLHelper::getBuildErr(JNIEnv *jenv, cl_device_id deviceId, cl_program prog fprintf(stderr, "%s", buildLog); fprintf(stderr, "\n************************************************\n\n\n"); if (log != NULL){ - *log = jenv->NewStringUTF(buildLog); + *log = jenv->NewStringUTF(buildLog); } delete []buildLog; } @@ -206,5 +221,3 @@ jstring CLHelper::getExtensions(JNIEnv *jenv, cl_device_id deviceId, cl_int *sta } return jextensions; } - - diff --git a/src/cpp/CLHelper.h b/src/cpp/CLHelper.h index 71f761efe26dfc38163c71c1e07ef69afb923680..d4dd9b596f631cd99c2075d4e07cf009b07cb535 100644 --- a/src/cpp/CLHelper.h +++ b/src/cpp/CLHelper.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. @@ -6,34 +21,34 @@ following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following - disclaimer. + disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the distribution. + disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export - laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 + laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through 774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, you hereby certify that, except pursuant to a license granted by the United States Department of Commerce - Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export - Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in - Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) + Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export + Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in + Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced - direct product is subject to national security controls as identified on the Commerce Control List (currently - found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional + direct product is subject to national security controls as identified on the Commerce Control List (currently + found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry - and Security�s website at http://www.bis.doc.gov/. + and Security�s website at http://www.bis.doc.gov/. */ #ifndef CLHELPER_H @@ -50,4 +65,3 @@ class CLHelper{ }; #endif // CLHELPER_H - diff --git a/src/cpp/Common.h b/src/cpp/Common.h index 7e34ed21a3f43cafb27ffc418c7836e3b11cc969..bbbd3033a8e45e71c95070b60474d7d0350c99dc 100644 --- a/src/cpp/Common.h +++ b/src/cpp/Common.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. @@ -6,34 +21,34 @@ following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following - disclaimer. + disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the distribution. + disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export - laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 + laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through 774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, you hereby certify that, except pursuant to a license granted by the United States Department of Commerce - Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export - Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in - Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) + Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export + Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in + Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced - direct product is subject to national security controls as identified on the Commerce Control List (currently - found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional + direct product is subject to national security controls as identified on the Commerce Control List (currently + found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry - and Security’s website at http://www.bis.doc.gov/. + and Security�s website at http://www.bis.doc.gov/. */ #ifndef COMMON_H diff --git a/src/cpp/JNIHelper.cpp b/src/cpp/JNIHelper.cpp index c4d9f59eb2b0a574d17701a31264274d71c35320..470282eaaa3b15dcb373d70dd24930efca695e04 100644 --- a/src/cpp/JNIHelper.cpp +++ b/src/cpp/JNIHelper.cpp @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. @@ -6,34 +21,34 @@ following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following - disclaimer. + disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the distribution. + disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export - laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 + laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through 774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, you hereby certify that, except pursuant to a license granted by the United States Department of Commerce - Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export - Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in - Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) + Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export + Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in + Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced - direct product is subject to national security controls as identified on the Commerce Control List (currently - found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional + direct product is subject to national security controls as identified on the Commerce Control List (currently + found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry - and Security’s website at http://www.bis.doc.gov/. + and Security�s website at http://www.bis.doc.gov/. */ #include "Common.h" @@ -138,7 +153,7 @@ jobject JNIHelper::getStaticFieldObject(JNIEnv *jenv, const char *className, con throw std::string("bummer getting static field value '") + fieldName + "' from '" + className + "' with signature! '" + signature; } catch(std::string& s) { - jenv->ExceptionDescribe(); + jenv->ExceptionDescribe(); jenv->ExceptionClear(); fprintf(stderr, "%s\n", s.c_str()); return(NULL); @@ -173,4 +188,4 @@ jobject JNIHelper::createInstance(JNIEnv *jenv, const char* className, const cha return(NULL); } return(instance); -} +} diff --git a/src/cpp/JNIHelper.h b/src/cpp/JNIHelper.h index 6e2ca32a29737c0a33dce30477e14dbc82fc71b0..d8253c193b9d44908630f376288a700341def1b7 100644 --- a/src/cpp/JNIHelper.h +++ b/src/cpp/JNIHelper.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. @@ -6,34 +21,34 @@ following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following - disclaimer. + disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the distribution. + disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export - laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 + laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through 774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, you hereby certify that, except pursuant to a license granted by the United States Department of Commerce - Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export - Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in - Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) + Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export + Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in + Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced - direct product is subject to national security controls as identified on the Commerce Control List (currently - found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional + direct product is subject to national security controls as identified on the Commerce Control List (currently + found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry - and Security�s website at http://www.bis.doc.gov/. + and Security�s website at http://www.bis.doc.gov/. */ #ifndef JNIHELPER_H @@ -206,7 +221,7 @@ class JNIHelper { if (jenv->ExceptionCheck()) throw std::string("bummer setting ") + getType(value) + " field '" + fieldName + "'\n"; } catch(std::string& se) { - jenv->ExceptionDescribe(); + jenv->ExceptionDescribe(); jenv->ExceptionClear(); fprintf(stderr,"%s",se.c_str()); } @@ -222,7 +237,7 @@ class JNIHelper { jT value = (jT)0; try { jclass theClass = jenv->GetObjectClass(instance); - if (theClass == NULL || jenv->ExceptionCheck()) + if (theClass == NULL || jenv->ExceptionCheck()) throw "bummer! getting class from instance\n"; jfieldID fieldId = jenv->GetFieldID(theClass,fieldName, signature); if (fieldId == NULL || jenv->ExceptionCheck()) @@ -231,7 +246,7 @@ class JNIHelper { if (jenv->ExceptionCheck()) throw std::string("bummer getting ") + getType(value) + "field '" + fieldName + "' \n"; } catch(std::string& se) { - jenv->ExceptionDescribe(); + jenv->ExceptionDescribe(); jenv->ExceptionClear(); fprintf(stderr,"%s",se.c_str()); return (jT)NULL; @@ -251,4 +266,3 @@ class JNIHelper { }; #endif // JNIHELPER_H - diff --git a/src/cpp/agent.cpp b/src/cpp/agent.cpp index 66d692dc54b4ece6abaacd130a32368c06d35178..73f91831f634865c0d576e9bc07af24e297f1f77 100644 --- a/src/cpp/agent.cpp +++ b/src/cpp/agent.cpp @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -75,7 +90,7 @@ extern "C" { fprintf(stdout, "inside getBytes(\"%s\")\n", nameChars); for (NameToBytes *ptr = head; ptr != NULL; ptr=(NameToBytes *)ptr->getNext()){ if (isKernel((char *)ptr->getName(), ptr->getByteBuffer())){ - fprintf(stdout, "%s is a kernel!\n", ptr->getName()); + fprintf(stdout, "%s is a kernel!\n", ptr->getName()); } //fprintf(stdout, "testing \"%s\"==\"%s\"\n", nameChars, ptr->getName()); if (!strcmp(ptr->getName(), nameChars)){ @@ -113,7 +128,7 @@ static void JNICALL cbClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv* jni_env, // fprintf(stdout, "from agent classFileLoadHook(%s)\n", name); ByteBuffer *byteBuffer = new ByteBuffer((byte_t *)class_data, (size_t)class_data_len); head = new NameToBytes(head, (char *)name, byteBuffer); - //fprintf(stdout, "class \"%s\" ", name); + //fprintf(stdout, "class \"%s\" ", name); } @@ -134,7 +149,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) { fprintf(stderr, "ERROR: Unable to create jvmtiEnv, GetEnv failed, error=%d\n", rc); returnValue = -1; }else{ - /* Get/Add JVMTI capabilities */ + /* Get/Add JVMTI capabilities */ if ((err = jvmti->GetCapabilities(&capabilities) ) != JVMTI_ERROR_NONE) { fprintf(stderr, "ERROR: GetCapabilities failed, error=%d\n", err); returnValue = -1; @@ -163,4 +178,3 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) { JNIEXPORT void JNICALL Agent_OnUnload(JavaVM *vm) { fprintf(stdout, "Agent_OnUnload()\n"); } - diff --git a/src/cpp/classtools.cpp b/src/cpp/classtools.cpp index 8035a8b173f6ef7c8aa2f2e8572547b107c793f8..305b3771955c8c326b944ad798e7104f9a56289c 100644 --- a/src/cpp/classtools.cpp +++ b/src/cpp/classtools.cpp @@ -1,4 +1,18 @@ - +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #define CLASSTOOLS_CPP #include "classtools.h" @@ -105,7 +119,7 @@ byte_t *ByteBuffer::getBytes(int _len){ } memcpy((void*)buf, (void*)ptr, _len); ptr+=_len; - return(buf); + return(buf); } @@ -125,7 +139,7 @@ EmptyConstantPoolEntry::EmptyConstantPoolEntry(ByteBuffer *_byteBuffer, u4_t _sl : ConstantPoolEntry(_byteBuffer, _slot, EMPTY) { } -UTF8ConstantPoolEntry::UTF8ConstantPoolEntry(ByteBuffer *_byteBuffer, u4_t _slot) +UTF8ConstantPoolEntry::UTF8ConstantPoolEntry(ByteBuffer *_byteBuffer, u4_t _slot) : ConstantPoolEntry(_byteBuffer, _slot, UTF8) { len = (size_t)_byteBuffer->u2(); utf8Bytes = _byteBuffer->getBytes(len); @@ -529,13 +543,13 @@ bool isKernel(char *_className, ByteBuffer *_byteBuffer){ #endif slot+=1; break; - default: + default: fprintf(stdout, "ERROR found UNKNOWN! %02x/%0d in slot %d\n", constantPoolType, constantPoolType, slot ); exit (1); } } - // we have the constant pool + // we have the constant pool u2_t accessFlags = _byteBuffer->u2(); #ifdef SHOW @@ -596,4 +610,3 @@ bool isKernel(char *_className, ByteBuffer *_byteBuffer){ } return(isAKernel); } - diff --git a/src/cpp/classtools.h b/src/cpp/classtools.h index f0d4518ccf30f803c3aaee71259206c57840a4b1..b672889161626db3e0cd2c0b7da45dfd07b8668e 100644 --- a/src/cpp/classtools.h +++ b/src/cpp/classtools.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef CLASSTOOLS_H #define CLASSTOOLS_H @@ -94,7 +109,7 @@ class EmptyConstantPoolEntry : public ConstantPoolEntry{ class UTF8ConstantPoolEntry: public ConstantPoolEntry{ private: - size_t len; + size_t len; byte_t *utf8Bytes; public: UTF8ConstantPoolEntry(ByteBuffer *_byteBuffer, u4_t _slot) ; @@ -229,7 +244,7 @@ class LineNumberTableAttribute{ class LineNumberTableEntry{ private: u2_t start_pc; - u2_t line_number; + u2_t line_number; public: LineNumberTableEntry(ByteBuffer *_byteBuffer, ConstantPoolEntry **_constantPool); }; @@ -244,10 +259,10 @@ class LocalVariableTableAttribute{ class LocalVariableTableEntry{ private: u2_t start_pc; - u2_t length; - u2_t name_index; - u2_t descriptor_index; - u2_t index; + u2_t length; + u2_t name_index; + u2_t descriptor_index; + u2_t index; public: LocalVariableTableEntry(ByteBuffer *_byteBuffer, ConstantPoolEntry **_constantPool); }; @@ -335,4 +350,3 @@ class MethodInfo{ extern bool isKernel(char *_className, ByteBuffer *_byteBuffer); #endif #endif - diff --git a/src/cpp/classtoolstest.cpp b/src/cpp/classtoolstest.cpp index de95541e1af60fd4d07a4edf5eb70d3019d407d2..0bb6ee951ed729bc20be7116033e1fb4e7ff9a65 100644 --- a/src/cpp/classtoolstest.cpp +++ b/src/cpp/classtoolstest.cpp @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include <stdio.h> #include <stdlib.h> diff --git a/src/cpp/cltest.cpp b/src/cpp/cltest.cpp index 9e7c90b8ef7cc9346ca16049a683c7bcd8f6a04c..1072732a830a13ae71294408ed16ea78f696428b 100644 --- a/src/cpp/cltest.cpp +++ b/src/cpp/cltest.cpp @@ -1,4 +1,18 @@ - +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -118,13 +132,13 @@ int main(int argc, char **argv){ char platformVersionName[512]; status = clGetPlatformInfo(platformIds[platformIdx], CL_PLATFORM_VERSION, sizeof(platformVersionName), platformVersionName, NULL); - char platformVendorName[512]; - char platformName[512]; + char platformVendorName[512]; + char platformName[512]; status = clGetPlatformInfo(platformIds[platformIdx], CL_PLATFORM_VENDOR, sizeof(platformVendorName), platformVendorName, NULL); status = clGetPlatformInfo(platformIds[platformIdx], CL_PLATFORM_NAME, sizeof(platformName), platformName, NULL); - fprintf(stderr, " CL_PLATFORM_VENDOR..\"%s\"\n", platformVendorName); - fprintf(stderr, " CL_PLATFORM_VERSION.\"%s\"\n", platformVersionName); - fprintf(stderr, " CL_PLATFORM_NAME....\"%s\"\n", platformName); + fprintf(stderr, " CL_PLATFORM_VENDOR..\"%s\"\n", platformVendorName); + fprintf(stderr, " CL_PLATFORM_VERSION.\"%s\"\n", platformVersionName); + fprintf(stderr, " CL_PLATFORM_NAME....\"%s\"\n", platformName); cl_uint deviceIdc; cl_device_type requestedDeviceType =CL_DEVICE_TYPE_CPU |CL_DEVICE_TYPE_GPU | CL_DEVICE_TYPE_ACCELERATOR; status = clGetDeviceIDs(platformIds[platformIdx], requestedDeviceType, 0, NULL, &deviceIdc); diff --git a/src/cpp/invoke/JavaArgs.h b/src/cpp/invoke/JavaArgs.h index dc8329b6f380d7a6c5eb1b0cc654b07fa4391f6c..5b4a2ebc2db25454d8695b39c5655b1771896eac 100644 --- a/src/cpp/invoke/JavaArgs.h +++ b/src/cpp/invoke/JavaArgs.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef JAVA_ARGS_H #define JAVA_ARGS_H diff --git a/src/cpp/invoke/OpenCLArgDescriptor.cpp b/src/cpp/invoke/OpenCLArgDescriptor.cpp index b9d7750f5f86673c909529413c0df841a3c5e7d7..5bd39984bd10004096515bbe4c95e5c5c90c4444 100644 --- a/src/cpp/invoke/OpenCLArgDescriptor.cpp +++ b/src/cpp/invoke/OpenCLArgDescriptor.cpp @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "OpenCLArgDescriptor.h" #include "JavaArgs.h" @@ -46,5 +61,3 @@ void OpenCLArgDescriptor::describeBits(JNIEnv *jenv, jlong bits){ fprintf(stderr, "isarg "); } } - - diff --git a/src/cpp/invoke/OpenCLArgDescriptor.h b/src/cpp/invoke/OpenCLArgDescriptor.h index e1ecfc530f28b50277a5e69feffc3371d83d08e4..b80ff400861d6cc1ea227d7aad3b9bb584906253 100644 --- a/src/cpp/invoke/OpenCLArgDescriptor.h +++ b/src/cpp/invoke/OpenCLArgDescriptor.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef OPEN_CL_ARG_DESCRIPTOR_H #define OPEN_CL_ARG_DESCRIPTOR_H diff --git a/src/cpp/invoke/OpenCLJNI.cpp b/src/cpp/invoke/OpenCLJNI.cpp index 3bac88119db378a638b2b4f260cdf8f5a16757f6..d72794ac0a37a7ee08421f260b8cf4703816425b 100644 --- a/src/cpp/invoke/OpenCLJNI.cpp +++ b/src/cpp/invoke/OpenCLJNI.cpp @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. diff --git a/src/cpp/invoke/OpenCLJNI.h b/src/cpp/invoke/OpenCLJNI.h index 64de9350f54c585c0e6b5e29b47f09a23ffede88..2d24a6e0e53ad13ae522f95a64c89210895e1b42 100644 --- a/src/cpp/invoke/OpenCLJNI.h +++ b/src/cpp/invoke/OpenCLJNI.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. @@ -6,34 +21,34 @@ following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following - disclaimer. + disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the distribution. + disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export - laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 + laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through 774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, you hereby certify that, except pursuant to a license granted by the United States Department of Commerce - Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export - Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in - Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) + Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export + Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in + Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced - direct product is subject to national security controls as identified on the Commerce Control List (currently - found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional + direct product is subject to national security controls as identified on the Commerce Control List (currently + found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry - and Security�s website at http://www.bis.doc.gov/. + and Security�s website at http://www.bis.doc.gov/. */ #ifndef OPENCLJNI_H diff --git a/src/cpp/invoke/OpenCLKernel.h b/src/cpp/invoke/OpenCLKernel.h index ed8eac78b0dbc405a3412b868f99c18a585e1bd3..129fbdf25f4a0480857a16e4f4705d0521614ede 100644 --- a/src/cpp/invoke/OpenCLKernel.h +++ b/src/cpp/invoke/OpenCLKernel.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef OPEN_CL_KERNEL_H #define OPEN_CL_KERNEL_H @@ -8,8 +23,8 @@ class OpenCLKernel{ public: static jobject create(JNIEnv *jenv, cl_kernel kernel, jobject programInstance, jstring name, jobjectArray args){ - return(JNIHelper::createInstance(jenv, OpenCLKernelClass, - ArgsVoidReturn( LongArg OpenCLProgramClassArg StringClassArg ArrayArg(OpenCLArgDescriptorClass)), + return(JNIHelper::createInstance(jenv, OpenCLKernelClass, + ArgsVoidReturn( LongArg OpenCLProgramClassArg StringClassArg ArrayArg(OpenCLArgDescriptorClass)), (jlong)kernel, programInstance, name, args)); } @@ -23,8 +38,8 @@ class OpenCLKernel{ } static jobjectArray getArgsArray(JNIEnv *jenv, jobject kernelInstance){ - return(reinterpret_cast<jobjectArray> - (JNIHelper::getInstanceField<jobject>(jenv, kernelInstance, "args", + return(reinterpret_cast<jobjectArray> + (JNIHelper::getInstanceField<jobject>(jenv, kernelInstance, "args", ArrayArg(OpenCLArgDescriptorClass) ))); } }; diff --git a/src/cpp/invoke/OpenCLMem.cpp b/src/cpp/invoke/OpenCLMem.cpp index 02eb0bcd8db29b4e1ff1e684106ad89d3607a93d..2259a3239fa64f13827244cf50f3cec4f5ae7370 100644 --- a/src/cpp/invoke/OpenCLMem.cpp +++ b/src/cpp/invoke/OpenCLMem.cpp @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "OpenCLMem.h" #include "JavaArgs.h" @@ -7,7 +22,7 @@ jobject OpenCLMem::create(JNIEnv *jenv, cl_context context, jlong argBits, jarra jlong memBits = 0; cl_int status = CL_SUCCESS; - void *ptr = OpenCLMem::pin(jenv, array, &memBits); + void *ptr = OpenCLMem::pin(jenv, array, &memBits); cl_mem mem = clCreateBuffer(context, bitsToOpenCLMask(argBits), sizeInBytes, ptr, &status); if (status != CL_SUCCESS){ fprintf(stderr, "buffer creation failed!\n"); @@ -65,7 +80,7 @@ jsize OpenCLMem::getPrimitiveSizeInBytes(JNIEnv *jenv, jlong argBits){ void* OpenCLMem::pin(JNIEnv *jenv, jarray array, jlong *memBits){ jboolean isCopy; - void *ptr = jenv->GetPrimitiveArrayCritical(array, &isCopy); + void *ptr = jenv->GetPrimitiveArrayCritical(array, &isCopy); if (memBits != NULL){ if (isCopy) { memadd(*memBits, COPY); @@ -84,4 +99,3 @@ void OpenCLMem::unpin(JNIEnv *jenv, jarray array, void *ptr, jlong *memBits){ jenv->ReleasePrimitiveArrayCritical(array, ptr, 0); } } - diff --git a/src/cpp/invoke/OpenCLMem.h b/src/cpp/invoke/OpenCLMem.h index 9b4ead418f0a32276213f8fc7f1719533e4f2963..f58f00f26949640a3bbebdf264d1762266241e72 100644 --- a/src/cpp/invoke/OpenCLMem.h +++ b/src/cpp/invoke/OpenCLMem.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef OPEN_CL_MEM_H #define OPEN_CL_MEM_H diff --git a/src/cpp/invoke/OpenCLProgram.h b/src/cpp/invoke/OpenCLProgram.h index 35a5ccaf2e2472611d4118c81deaa85e0860c2f7..cd11ed6912df72a26283fd30e0ef7f5d4596f3f6 100644 --- a/src/cpp/invoke/OpenCLProgram.h +++ b/src/cpp/invoke/OpenCLProgram.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef OPEN_CL_PROGRAM_H #define OPEN_CL_PROGRAM_H @@ -7,26 +22,26 @@ class OpenCLProgram{ public: - static jobject create(JNIEnv *jenv, cl_program program, cl_command_queue queue, - cl_context context, jobject deviceInstance, jstring source, + static jobject create(JNIEnv *jenv, cl_program program, cl_command_queue queue, + cl_context context, jobject deviceInstance, jstring source, jstring log) { - return(JNIHelper::createInstance(jenv, OpenCLProgramClass, - ArgsVoidReturn( LongArg LongArg LongArg - OpenCLDeviceClassArg StringClassArg) , + return(JNIHelper::createInstance(jenv, OpenCLProgramClass, + ArgsVoidReturn( LongArg LongArg LongArg + OpenCLDeviceClassArg StringClassArg) , (jlong)program, (jlong)queue, (jlong)context, deviceInstance, source)); } static cl_context getContext(JNIEnv *jenv, jobject programInstance){ - return((cl_context) JNIHelper::getInstanceField<jlong>(jenv, programInstance, "contextId")); + return((cl_context) JNIHelper::getInstanceField<jlong>(jenv, programInstance, "contextId")); } static cl_program getProgram(JNIEnv *jenv, jobject programInstance){ - return((cl_program) JNIHelper::getInstanceField<jlong>(jenv, programInstance, "programId")); + return((cl_program) JNIHelper::getInstanceField<jlong>(jenv, programInstance, "programId")); } static ProfileInfo** getProfileInfo(JNIEnv *jenv, jobject programInstance){ - return((ProfileInfo**) JNIHelper::getInstanceField<jlong>(jenv, programInstance, "profileInfo")); + return((ProfileInfo**) JNIHelper::getInstanceField<jlong>(jenv, programInstance, "profileInfo")); } static void setProfileInfo(JNIEnv *jenv, jobject programInstance, ProfileInfo **profileInfo){ - JNIHelper::setInstanceField<jlong>(jenv, programInstance, "profileInfo", (jlong)profileInfo); + JNIHelper::setInstanceField<jlong>(jenv, programInstance, "profileInfo", (jlong)profileInfo); } static cl_command_queue getCommandQueue(JNIEnv *jenv, jobject programInstance){ return((cl_command_queue)JNIHelper::getInstanceField<jlong>(jenv, programInstance, "queueId")); diff --git a/src/cpp/runKernel/Aparapi.cpp b/src/cpp/runKernel/Aparapi.cpp index 85ae3a2edad5af5d39c56a2c2af1afacba3fcc68..fe6139acabf0afc2164e655ccfaf2beec43ed1e1 100644 --- a/src/cpp/runKernel/Aparapi.cpp +++ b/src/cpp/runKernel/Aparapi.cpp @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. @@ -6,34 +21,34 @@ following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following - disclaimer. + disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the distribution. + disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export - laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 + laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through 774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, you hereby certify that, except pursuant to a license granted by the United States Department of Commerce - Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export - Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in - Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) + Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export + Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in + Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced - direct product is subject to national security controls as identified on the Commerce Control List (currently - found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional + direct product is subject to national security controls as identified on the Commerce Control List (currently + found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry - and Security?s website at http://www.bis.doc.gov/. + and Security?s website at http://www.bis.doc.gov/. */ #define APARAPI_SOURCE @@ -60,14 +75,14 @@ static const int CANCEL_STATUS_TRUE = 1; //compiler dependant code /** - * calls either clEnqueueMarker or clEnqueueMarkerWithWaitList + * calls either clEnqueueMarker or clEnqueueMarkerWithWaitList * depending on the version of OpenCL installed. * convenience function so we don't have to have #ifdefs all over the code * * Actually I backed this out (Gary) when issue #123 was reported. This involved - * a build on a 1.2 compatible platform which failed on a platform with a 1.1 runtime. - * Failed to link. - * The answer is to set -DCL_USE_DEPRECATED_OPENCL_1_1_APIS at compile time and *not* use + * a build on a 1.2 compatible platform which failed on a platform with a 1.1 runtime. + * Failed to link. + * The answer is to set -DCL_USE_DEPRECATED_OPENCL_1_1_APIS at compile time and *not* use * the CL_VERSION_1_2 ifdef. */ int enqueueMarker(cl_command_queue commandQueue, cl_event* firstEvent) { @@ -130,7 +145,7 @@ jint writeProfileInfo(JNIContext* jniContext){ if (jniContext->firstRun) { fprintf(jniContext->profileFile, "# PROFILE Name, queued, submit, start, end (microseconds)\n"); - } + } // A read by a user kernel means the OpenCL layer wrote to the kernel and vice versa for (int i=0; i< jniContext->argc; i++){ @@ -140,10 +155,10 @@ jint writeProfileInfo(JNIContext* jniContext){ // Initialize the base time for this sample if (currSampleBaseTime == -1) { currSampleBaseTime = arg->arrayBuffer->write.queued; - } + } fprintf(jniContext->profileFile, "%d write %s,", pos++, arg->name); - fprintf(jniContext->profileFile, "%lu,%lu,%lu,%lu,", + fprintf(jniContext->profileFile, "%lu,%lu,%lu,%lu,", (unsigned long)(arg->arrayBuffer->write.queued - currSampleBaseTime)/1000, (unsigned long)(arg->arrayBuffer->write.submit - currSampleBaseTime)/1000, (unsigned long)(arg->arrayBuffer->write.start - currSampleBaseTime)/1000, @@ -156,22 +171,22 @@ jint writeProfileInfo(JNIContext* jniContext){ // Initialize the base time for this sample if necessary if (currSampleBaseTime == -1) { currSampleBaseTime = jniContext->exec[pass].queued; - } + } - // exec + // exec fprintf(jniContext->profileFile, "%d exec[%d],", pos++, pass); - fprintf(jniContext->profileFile, "%lu,%lu,%lu,%lu,", + fprintf(jniContext->profileFile, "%lu,%lu,%lu,%lu,", (unsigned long)(jniContext->exec[pass].queued - currSampleBaseTime)/1000, (unsigned long)(jniContext->exec[pass].submit - currSampleBaseTime)/1000, (unsigned long)(jniContext->exec[pass].start - currSampleBaseTime)/1000, (unsigned long)(jniContext->exec[pass].end - currSampleBaseTime)/1000); } - // + // if ( jniContext->argc == 0 ) { fprintf(jniContext->profileFile, "\n"); - } else { + } else { for (int i=0; i< jniContext->argc; i++){ KernelArg *arg=jniContext->args[i]; if (arg->isBackedByArray() && arg->isMutableByKernel()){ @@ -183,7 +198,7 @@ jint writeProfileInfo(JNIContext* jniContext){ fprintf(jniContext->profileFile, "%d read %s,", pos++, arg->name); - fprintf(jniContext->profileFile, "%lu,%lu,%lu,%lu,", + fprintf(jniContext->profileFile, "%lu,%lu,%lu,%lu,", (unsigned long)(arg->arrayBuffer->read.queued - currSampleBaseTime)/1000, (unsigned long)(arg->arrayBuffer->read.submit - currSampleBaseTime)/1000, (unsigned long)(arg->arrayBuffer->read.start - currSampleBaseTime)/1000, @@ -233,9 +248,9 @@ cl_int profile(ProfileInfo *profileInfo, cl_event *event, jint type, char* name, /** * Step through all non-primitive (arrays) args * and determine if the field has changed - * The field may have been re-assigned by the Java code to NULL or another instance. + * The field may have been re-assigned by the Java code to NULL or another instance. * If we detect a change then we discard the previous cl_mem buffer, - * the caller will detect that the buffers are null and will create new cl_mem buffers. + * the caller will detect that the buffers are null and will create new cl_mem buffers. * @param jenv the java environment * @param jobj the object we might be updating * @param jniContext the context we're working in @@ -245,7 +260,7 @@ cl_int profile(ProfileInfo *profileInfo, cl_event *event, jint type, char* name, jint updateNonPrimitiveReferences(JNIEnv *jenv, jobject jobj, JNIContext* jniContext) { cl_int status = CL_SUCCESS; if (jniContext != NULL){ - for (jint i = 0; i < jniContext->argc; i++){ + for (jint i = 0; i < jniContext->argc; i++){ KernelArg *arg = jniContext->args[i]; // make sure that the JNI arg reflects the latest type info from the instance. @@ -262,18 +277,18 @@ jint updateNonPrimitiveReferences(JNIEnv *jenv, jobject jobj, JNIContext* jniCon // Following used for all primitive arrays, object arrays and nio Buffers jarray newRef = (jarray)jenv->GetObjectField(arg->javaArg, KernelArg::javaArrayFieldID); if (config->isVerbose()){ - fprintf(stderr, "testing for Resync javaArray %s: old=%p, new=%p\n", arg->name, arg->arrayBuffer->javaArray, newRef); + fprintf(stderr, "testing for Resync javaArray %s: old=%p, new=%p\n", arg->name, arg->arrayBuffer->javaArray, newRef); } if (!jenv->IsSameObject(newRef, arg->arrayBuffer->javaArray)) { if (config->isVerbose()){ - fprintf(stderr, "Resync javaArray for %s: %p %p\n", arg->name, newRef, arg->arrayBuffer->javaArray); + fprintf(stderr, "Resync javaArray for %s: %p %p\n", arg->name, newRef, arg->arrayBuffer->javaArray); } // Free previous ref if any if (arg->arrayBuffer->javaArray != NULL) { jenv->DeleteWeakGlobalRef((jweak) arg->arrayBuffer->javaArray); if (config->isVerbose()){ - fprintf(stderr, "DeleteWeakGlobalRef for %s: %p\n", arg->name, arg->arrayBuffer->javaArray); + fprintf(stderr, "DeleteWeakGlobalRef for %s: %p\n", arg->name, arg->arrayBuffer->javaArray); } } @@ -297,7 +312,7 @@ jint updateNonPrimitiveReferences(JNIEnv *jenv, jobject jobj, JNIContext* jniCon arg->arrayBuffer->javaArray = (jarray)jenv->NewWeakGlobalRef((jarray)newRef); if (config->isVerbose()){ fprintf(stderr, "NewWeakGlobalRef for %s, set to %p\n", arg->name, - arg->arrayBuffer->javaArray); + arg->arrayBuffer->javaArray); } } else { arg->arrayBuffer->javaArray = NULL; @@ -362,11 +377,11 @@ void updateArray(JNIEnv* jenv, JNIContext* jniContext, KernelArg* arg, int& argP if (mask & CL_MEM_READ_ONLY) strcat(arg->arrayBuffer->memSpec,"|CL_MEM_READ_ONLY"); if (mask & CL_MEM_WRITE_ONLY) strcat(arg->arrayBuffer->memSpec,"|CL_MEM_WRITE_ONLY"); - fprintf(stderr, "%s %d clCreateBuffer(context, %s, size=%08lx bytes, address=%p, &status)\n", arg->name, + fprintf(stderr, "%s %d clCreateBuffer(context, %s, size=%08lx bytes, address=%p, &status)\n", arg->name, argIdx, arg->arrayBuffer->memSpec, (unsigned long)arg->arrayBuffer->lengthInBytes, arg->arrayBuffer->addr); } - arg->arrayBuffer->mem = clCreateBuffer(jniContext->context, arg->arrayBuffer->memMask, + arg->arrayBuffer->mem = clCreateBuffer(jniContext->context, arg->arrayBuffer->memMask, arg->arrayBuffer->lengthInBytes, arg->arrayBuffer->addr, &status); if(status != CL_SUCCESS) throw CLException(status,"clCreateBuffer"); @@ -402,7 +417,7 @@ void updateBuffer(JNIEnv* jenv, JNIContext* jniContext, KernelArg* arg, int& arg else if (arg->isMutableByKernel()) mask |= CL_MEM_WRITE_ONLY; buffer->memMask = mask; - buffer->mem = clCreateBuffer(jniContext->context, buffer->memMask, + buffer->mem = clCreateBuffer(jniContext->context, buffer->memMask, buffer->lengthInBytes, buffer->data, &status); if(status != CL_SUCCESS) throw CLException(status,"clCreateBuffer"); @@ -473,7 +488,7 @@ void processArray(JNIEnv* jenv, JNIContext* jniContext, KernelArg* arg, int& arg if (config->isVerbose()) { fprintf(stderr, "runKernel: array ref %p, oldAddr=%p, newAddr=%p, ref.mem=%p isCopy=%s\n", - arg->arrayBuffer->javaArray, + arg->arrayBuffer->javaArray, prevAddr, arg->arrayBuffer->addr, arg->arrayBuffer->mem, @@ -486,7 +501,7 @@ void processArray(JNIEnv* jenv, JNIContext* jniContext, KernelArg* arg, int& arg fprintf(stderr, "\n" ); } - // record whether object moved + // record whether object moved // if we see that isCopy was returned by getPrimitiveArrayCritical, treat that as a move bool objectMoved = (arg->arrayBuffer->addr != prevAddr) || arg->arrayBuffer->isCopy; @@ -498,7 +513,7 @@ void processArray(JNIEnv* jenv, JNIContext* jniContext, KernelArg* arg, int& arg if (jniContext->firstRun || (arg->arrayBuffer->mem == 0) || objectMoved ){ if (arg->arrayBuffer->mem != 0 && objectMoved) { - // we need to release the old buffer + // we need to release the old buffer if (config->isTrackingOpenCLResources()) { memList.remove((cl_mem)arg->arrayBuffer->mem, __LINE__, __FILE__); } @@ -585,7 +600,7 @@ void updateWriteEvents(JNIEnv* jenv, JNIContext* jniContext, KernelArg* arg, int cl_int status = CL_SUCCESS; - // we only enqueue a write if we know the kernel actually reads the buffer + // we only enqueue a write if we know the kernel actually reads the buffer // or if there is an explicit write pending // the default behavior for Constant buffers is also that there is no write enqueued unless explicit @@ -594,10 +609,10 @@ void updateWriteEvents(JNIEnv* jenv, JNIContext* jniContext, KernelArg* arg, int } if(arg->isArray()) { - status = clEnqueueWriteBuffer(jniContext->commandQueue, arg->arrayBuffer->mem, CL_FALSE, 0, + status = clEnqueueWriteBuffer(jniContext->commandQueue, arg->arrayBuffer->mem, CL_FALSE, 0, arg->arrayBuffer->lengthInBytes, arg->arrayBuffer->addr, 0, NULL, &(jniContext->writeEvents[writeEventCount])); } else if(arg->isAparapiBuffer()) { - status = clEnqueueWriteBuffer(jniContext->commandQueue, arg->aparapiBuffer->mem, CL_FALSE, 0, + status = clEnqueueWriteBuffer(jniContext->commandQueue, arg->aparapiBuffer->mem, CL_FALSE, 0, arg->aparapiBuffer->lengthInBytes, arg->aparapiBuffer->data, 0, NULL, &(jniContext->writeEvents[writeEventCount])); } if(status != CL_SUCCESS) throw CLException(status,"clEnqueueWriteBuffer"); @@ -749,7 +764,7 @@ int processArgs(JNIEnv* jenv, JNIContext* jniContext, int& argPos, int& writeEve cl_int status = CL_SUCCESS; - // argPos is used to keep track of the kernel arg position, it can + // argPos is used to keep track of the kernel arg position, it can // differ from "argIdx" due to insertion of javaArrayLength args which are not // fields read from the kernel object. for (int argIdx = 0; argIdx < jniContext->argc; argIdx++, argPos++) { @@ -769,10 +784,10 @@ int processArgs(JNIEnv* jenv, JNIContext* jniContext, int& argPos, int& writeEve if (arg->needToEnqueueWrite() && (!arg->isConstant() || arg->isExplicitWrite())) { if (config->isVerbose()) { - fprintf(stderr, "%swriting %s%sbuffer argIndex=%d argPos=%d %s\n", - (arg->isExplicit() ? "explicitly " : ""), - (arg->isConstant() ? "constant " : ""), - (arg->isLocal() ? "local " : ""), + fprintf(stderr, "%swriting %s%sbuffer argIndex=%d argPos=%d %s\n", + (arg->isExplicit() ? "explicitly " : ""), + (arg->isConstant() ? "constant " : ""), + (arg->isLocal() ? "local " : ""), argIdx, argPos, arg->name); @@ -802,7 +817,7 @@ int processArgs(JNIEnv* jenv, JNIContext* jniContext, int& argPos, int& writeEve * @throws CLException */ void enqueueKernel(JNIContext* jniContext, Range& range, int passes, int argPos, int writeEventCount){ - // We will need to revisit the execution of multiple devices. + // We will need to revisit the execution of multiple devices. // POssibly cloning the range per device and mutating each to handle a unique subrange (of global) and // maybe even pushing the offset into the range class. @@ -816,7 +831,7 @@ void enqueueKernel(JNIContext* jniContext, Range& range, int passes, int argPos, if (jniContext->exec) { delete jniContext->exec; jniContext->exec = NULL; - } + } jniContext->passes = passes; jniContext->exec = new ProfileInfo[passes]; @@ -828,7 +843,7 @@ void enqueueKernel(JNIContext* jniContext, Range& range, int passes, int argPos, cl_int status = CL_SUCCESS; for (int passid=0; passid < passes; passid++) { - + int cancelCode = kernelInBytesAsInts[0]; kernelOutBytesAsInts[0] = passid; @@ -850,7 +865,7 @@ void enqueueKernel(JNIContext* jniContext, Range& range, int passes, int argPos, // ----------- - // fix for Mac OSX CPU driver (and possibly others) + // fix for Mac OSX CPU driver (and possibly others) // which fail to give correct maximum work group info // while using clGetDeviceInfo // see: http://www.openwall.com/lists/john-dev/2012/04/10/4 @@ -860,7 +875,7 @@ void enqueueKernel(JNIContext* jniContext, Range& range, int passes, int argPos, CL_KERNEL_WORK_GROUP_SIZE, sizeof(max_group_size), &max_group_size, NULL); - + if (status != CL_SUCCESS) { CLException(status, "clGetKernelWorkGroupInfo()").printError(); } else { @@ -868,10 +883,10 @@ void enqueueKernel(JNIContext* jniContext, Range& range, int passes, int argPos, } // ------ end fix - + // two options here due to passid // there may be 1 or more passes - // enqueue depends on write enqueues + // enqueue depends on write enqueues // we don't block but and we populate the executeEvents if (passid == 0) { @@ -880,13 +895,13 @@ void enqueueKernel(JNIContext* jniContext, Range& range, int passes, int argPos, writeEvents = jniContext->writeEvents; } - // we are in some passid > 0 pass + // we are in some passid > 0 pass // maybe middle or last! // we don't depend on write enqueues - // we block and do supply executeEvents + // we block and do supply executeEvents } else { //fprintf(stderr, "setting passid to %d of %d not first not last\n", passid, passes); - + status = clWaitForEvents(1, &jniContext->executeEvents[0]); if (status != CL_SUCCESS) throw CLException(status, "clWaitForEvents() execute event"); @@ -900,7 +915,7 @@ void enqueueKernel(JNIContext* jniContext, Range& range, int passes, int argPos, // We must capture any profile info for passid-1 so we must wait for the last execution to complete if (passid == 1 && config->isProfilingEnabled()) { - // Now we can profile info for passid-1 + // Now we can profile info for passid-1 status = profile(&jniContext->exec[passid-1], &jniContext->executeEvents[0], 1, NULL, jniContext->profileBaseTime); if (status != CL_SUCCESS) throw CLException(status,""); } @@ -930,7 +945,7 @@ void enqueueKernel(JNIContext* jniContext, Range& range, int passes, int argPos, if(config->isTrackingOpenCLResources()){ executeEventList.add(jniContext->executeEvents[0],__LINE__, __FILE__); } - + } kernelOutBytesAsInts[0] = PASS_ID_COMPLETED_EXECUTION; } @@ -938,7 +953,7 @@ void enqueueKernel(JNIContext* jniContext, Range& range, int passes, int argPos, /** * set readEvents and readArgEvents - * readEvents[] will be populated with the event's that we will wait on below. + * readEvents[] will be populated with the event's that we will wait on below. * readArgEvents[] will map the readEvent to the arg that originated it * So if we had * arg[0] read_write array @@ -957,14 +972,14 @@ void enqueueKernel(JNIContext* jniContext, Range& range, int passes, int argPos, * * @param jniContext the context we got from Java * - * @return number of reads. + * @return number of reads. * It will never be > jniContext->argc which is the size of readEvents[] and readEventArgs[] * * @throws CLException */ int getReadEvents(JNIEnv* jenv, JNIContext* jniContext) { - int readEventCount = 0; + int readEventCount = 0; cl_int status = CL_SUCCESS; for (int i=0; i< jniContext->argc; i++) { @@ -990,12 +1005,12 @@ int getReadEvents(JNIEnv* jenv, JNIContext* jniContext) { } if(arg->isArray()) { - status = clEnqueueReadBuffer(jniContext->commandQueue, arg->arrayBuffer->mem, - CL_FALSE, 0, arg->arrayBuffer->lengthInBytes, arg->arrayBuffer->addr, 1, + status = clEnqueueReadBuffer(jniContext->commandQueue, arg->arrayBuffer->mem, + CL_FALSE, 0, arg->arrayBuffer->lengthInBytes, arg->arrayBuffer->addr, 1, jniContext->executeEvents, &(jniContext->readEvents[readEventCount])); } else if(arg->isAparapiBuffer()) { - status = clEnqueueReadBuffer(jniContext->commandQueue, arg->aparapiBuffer->mem, - CL_TRUE, 0, arg->aparapiBuffer->lengthInBytes, arg->aparapiBuffer->data, 1, + status = clEnqueueReadBuffer(jniContext->commandQueue, arg->aparapiBuffer->mem, + CL_TRUE, 0, arg->aparapiBuffer->lengthInBytes, arg->aparapiBuffer->data, 1, jniContext->executeEvents, &(jniContext->readEvents[readEventCount])); arg->aparapiBuffer->inflate(jenv, arg); } @@ -1025,7 +1040,7 @@ void waitForReadEvents(JNIContext* jniContext, int readEventCount, int passes) { // don't change the order here // We wait for the reads which each depend on the execution, which depends on the writes ;) // So after the reads have completed, we can release the execute and writes. - + cl_int status = CL_SUCCESS; if (readEventCount > 0){ @@ -1106,10 +1121,10 @@ void checkEvents(JNIEnv* jenv, JNIContext* jniContext, int writeEventCount) { if (config->isTrackingOpenCLResources()){ fprintf(stderr, "following execution of kernel{\n"); commandQueueList.report(stderr); - memList.report(stderr); - readEventList.report(stderr); - executeEventList.report(stderr); - writeEventList.report(stderr); + memList.report(stderr); + readEventList.report(stderr); + executeEventList.report(stderr); + writeEventList.report(stderr); fprintf(stderr, "}\n"); } @@ -1183,7 +1198,7 @@ JNI_JAVA(jint, KernelRunnerJNI, runKernelJNI) } -// we return the JNIContext from here +// we return the JNIContext from here JNI_JAVA(jlong, KernelRunnerJNI, initJNI) (JNIEnv *jenv, jobject jobj, jobject kernelObject, jobject openCLDeviceObject, jint flags) { if (openCLDeviceObject == NULL){ @@ -1210,7 +1225,7 @@ void writeProfile(JNIEnv* jenv, JNIContext* jniContext) { // timestamp // kernel name - jclass classMethodAccess = jenv->FindClass("java/lang/Class"); + jclass classMethodAccess = jenv->FindClass("java/lang/Class"); jmethodID getNameID = jenv->GetMethodID(classMethodAccess,"getName","()Ljava/lang/String;"); jstring className = (jstring)jenv->CallObjectMethod(jniContext->kernelClass, getNameID); const char *classNameChars = jenv->GetStringUTFChars(className, NULL); @@ -1280,7 +1295,7 @@ JNI_JAVA(jlong, KernelRunnerJNI, buildProgramJNI) cle.printError(); return 0; } - + return((jlong)jniContext); } @@ -1294,13 +1309,13 @@ JNI_JAVA(jint, KernelRunnerJNI, setArgsJNI) } JNIContext* jniContext = JNIContext::getJNIContext(jniContextHandle); cl_int status = CL_SUCCESS; - if (jniContext != NULL){ + if (jniContext != NULL){ jniContext->argc = argc; jniContext->args = new KernelArg*[jniContext->argc]; jniContext->firstRun = true; // Step through the array of KernelArg's to capture the type data for the Kernel's data members. - for (jint i = 0; i < jniContext->argc; i++){ + for (jint i = 0; i < jniContext->argc; i++){ jobject argObj = jenv->GetObjectArrayElement(argArray, i); KernelArg* arg = jniContext->args[i] = new KernelArg(jenv, jniContext, argObj); if (config->isVerbose()){ @@ -1375,7 +1390,7 @@ KernelArg* getArgForBuffer(JNIEnv* jenv, JNIContext* jniContext, jobject buffer) KernelArg *returnArg = NULL; if (jniContext != NULL){ - for (jint i = 0; returnArg == NULL && i < jniContext->argc; i++){ + for (jint i = 0; returnArg == NULL && i < jniContext->argc; i++){ KernelArg *arg = jniContext->args[i]; if (arg->isArray()) { jboolean isSame = jenv->IsSameObject(buffer, arg->arrayBuffer->javaArray); @@ -1430,14 +1445,14 @@ JNI_JAVA(jint, KernelRunnerJNI, getJNI) arg->pin(jenv); try { - status = clEnqueueReadBuffer(jniContext->commandQueue, arg->arrayBuffer->mem, - CL_FALSE, 0, + status = clEnqueueReadBuffer(jniContext->commandQueue, arg->arrayBuffer->mem, + CL_FALSE, 0, arg->arrayBuffer->lengthInBytes, - arg->arrayBuffer->addr , 0, NULL, + arg->arrayBuffer->addr , 0, NULL, &jniContext->readEvents[0]); if (config->isVerbose()){ - fprintf(stderr, "explicitly read %s ptr=%p len=%d\n", - arg->name, arg->arrayBuffer->addr, + fprintf(stderr, "explicitly read %s ptr=%p len=%d\n", + arg->name, arg->arrayBuffer->addr, arg->arrayBuffer->lengthInBytes ); } if (status != CL_SUCCESS) throw CLException(status, "clEnqueueReadBuffer()"); @@ -1454,7 +1469,7 @@ JNI_JAVA(jint, KernelRunnerJNI, getJNI) status = clReleaseEvent(jniContext->readEvents[0]); if (status != CL_SUCCESS) throw CLException(status, "clReleaseEvent() read event"); - // since this is an explicit buffer get, + // since this is an explicit buffer get, // we expect the buffer to have changed so we commit arg->unpin(jenv); // was unpinCommit @@ -1466,14 +1481,14 @@ JNI_JAVA(jint, KernelRunnerJNI, getJNI) } else if(arg->isAparapiBuffer()) { try { - status = clEnqueueReadBuffer(jniContext->commandQueue, arg->aparapiBuffer->mem, - CL_FALSE, 0, + status = clEnqueueReadBuffer(jniContext->commandQueue, arg->aparapiBuffer->mem, + CL_FALSE, 0, arg->aparapiBuffer->lengthInBytes, - arg->aparapiBuffer->data, 0, NULL, + arg->aparapiBuffer->data, 0, NULL, &jniContext->readEvents[0]); if (config->isVerbose()){ - fprintf(stderr, "explicitly read %s ptr=%p len=%d\n", - arg->name, arg->aparapiBuffer->data, + fprintf(stderr, "explicitly read %s ptr=%p len=%d\n", + arg->name, arg->aparapiBuffer->data, arg->aparapiBuffer->lengthInBytes ); } if (status != CL_SUCCESS) throw CLException(status, "clEnqueueReadBuffer()"); @@ -1484,7 +1499,7 @@ JNI_JAVA(jint, KernelRunnerJNI, getJNI) if (config->isProfilingEnabled()) { status = profile(&arg->aparapiBuffer->read, &jniContext->readEvents[0], 0, arg->name, jniContext->profileBaseTime); - if (status != CL_SUCCESS) throw CLException(status, "profile "); + if (status != CL_SUCCESS) throw CLException(status, "profile "); } status = clReleaseEvent(jniContext->readEvents[0]); @@ -1519,7 +1534,7 @@ JNI_JAVA(jobject, KernelRunnerJNI, getProfileInfoJNI) returnList = JNIHelper::createInstance(jenv, ArrayListClass, VoidReturn ); if (config->isProfilingEnabled()){ - for (jint i = 0; i < jniContext->argc; i++){ + for (jint i = 0; i < jniContext->argc; i++){ KernelArg *arg = jniContext->args[i]; if (arg->isArray()){ if (arg->isMutableByKernel() && arg->arrayBuffer->write.valid){ @@ -1534,7 +1549,7 @@ JNI_JAVA(jobject, KernelRunnerJNI, getProfileInfoJNI) JNIHelper::callVoid(jenv, returnList, "add", ArgsBooleanReturn(ObjectClassArg), executeProfileInfo); } - for (jint i = 0; i < jniContext->argc; i++){ + for (jint i = 0; i < jniContext->argc; i++){ KernelArg *arg = jniContext->args[i]; if (arg->isArray()){ if (arg->isReadByKernel() && arg->arrayBuffer->read.valid){ @@ -1547,4 +1562,3 @@ JNI_JAVA(jobject, KernelRunnerJNI, getProfileInfoJNI) } return returnList; } - diff --git a/src/cpp/runKernel/Aparapi.h b/src/cpp/runKernel/Aparapi.h index e85bd77d340f644251d65751508d115b3e4a3743..68b82bb1b55ce706b08a007933d7525bcaf9e24d 100644 --- a/src/cpp/runKernel/Aparapi.h +++ b/src/cpp/runKernel/Aparapi.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. @@ -6,34 +21,34 @@ following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following - disclaimer. + disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the distribution. + disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export - laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 + laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through 774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, you hereby certify that, except pursuant to a license granted by the United States Department of Commerce - Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export - Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in - Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) + Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export + Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in + Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced - direct product is subject to national security controls as identified on the Commerce Control List (currently - found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional + direct product is subject to national security controls as identified on the Commerce Control List (currently + found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry - and Security�s website at http://www.bis.doc.gov/. + and Security�s website at http://www.bis.doc.gov/. */ #ifndef APARAPI_H diff --git a/src/cpp/runKernel/AparapiBuffer.cpp b/src/cpp/runKernel/AparapiBuffer.cpp index a6c29c784b601742c03f7ac2c81fd6c9adcd41d4..1776a8aa0b644f1ededce69fd637ab738f074dff 100644 --- a/src/cpp/runKernel/AparapiBuffer.cpp +++ b/src/cpp/runKernel/AparapiBuffer.cpp @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. @@ -6,34 +21,34 @@ following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following - disclaimer. + disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the distribution. + disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export - laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 + laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through 774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, you hereby certify that, except pursuant to a license granted by the United States Department of Commerce - Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export - Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in - Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) + Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export + Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in + Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced - direct product is subject to national security controls as identified on the Commerce Control List (currently - found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional + direct product is subject to national security controls as identified on the Commerce Control List (currently + found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry - and Security?s website at http://www.bis.doc.gov/. + and Security?s website at http://www.bis.doc.gov/. */ #define APARAPIBUFFER_SOURCE #include "AparapiBuffer.h" @@ -168,7 +183,7 @@ void AparapiBuffer::flattenBoolean2D(JNIEnv* env, KernelArg* arg) { // Does DeleteLocalRef required? // env->DeleteLocalRef(jArray); } - + buildBuffer((void*)array, (cl_uint*)dims, 2, bitSize, javaBuffer); } @@ -214,7 +229,7 @@ void AparapiBuffer::flattenByte2D(JNIEnv* env, KernelArg* arg) { } env->ReleaseByteArrayElements(jArray, elems, 0); } - + buildBuffer((void*)array, (cl_uint*)dims, 2, bitSize, javaBuffer); } @@ -260,7 +275,7 @@ void AparapiBuffer::flattenShort2D(JNIEnv* env, KernelArg* arg) { } env->ReleaseShortArrayElements(jArray, elems, 0); } - + buildBuffer((void*)array, (cl_uint*)dims, 2, bitSize, javaBuffer); } @@ -306,7 +321,7 @@ void AparapiBuffer::flattenInt2D(JNIEnv* env, KernelArg* arg) { } env->ReleaseIntArrayElements(jArray, elems, 0); } - + buildBuffer((void*)array, (cl_uint*)dims, 2, bitSize, javaBuffer); } @@ -352,7 +367,7 @@ void AparapiBuffer::flattenLong2D(JNIEnv* env, KernelArg* arg) { } env->ReleaseLongArrayElements(jArray, elems, 0); } - + buildBuffer((void*)array, (cl_uint*)dims, 2, bitSize, javaBuffer); } @@ -398,7 +413,7 @@ void AparapiBuffer::flattenFloat2D(JNIEnv* env, KernelArg* arg) { } env->ReleaseFloatArrayElements(jArray, elems, 0); } - + buildBuffer((void*)array, (cl_uint*)dims, 2, bitSize, javaBuffer); } @@ -444,7 +459,7 @@ void AparapiBuffer::flattenDouble2D(JNIEnv* env, KernelArg* arg) { } env->ReleaseDoubleArrayElements(jArray, elems, 0); } - + buildBuffer((void*)array, (cl_uint*)dims, 2, bitSize, javaBuffer); } @@ -509,7 +524,7 @@ void AparapiBuffer::flattenBoolean3D(JNIEnv* env, KernelArg* arg) { env->ReleaseBooleanArrayElements(jArray, elems, 0); } } - + buildBuffer((void*)array, (cl_uint*)dims, 3, bitSize, javaBuffer); } @@ -573,7 +588,7 @@ void AparapiBuffer::flattenByte3D(JNIEnv* env, KernelArg* arg) { env->ReleaseByteArrayElements(jArray, elems, 0); } } - + buildBuffer((void*)array, (cl_uint*)dims, 3, bitSize, javaBuffer); } @@ -637,7 +652,7 @@ void AparapiBuffer::flattenShort3D(JNIEnv* env, KernelArg* arg) { env->ReleaseShortArrayElements(jArray, elems, 0); } } - + buildBuffer((void*)array, (cl_uint*)dims, 3, bitSize, javaBuffer); } @@ -701,7 +716,7 @@ void AparapiBuffer::flattenInt3D(JNIEnv* env, KernelArg* arg) { env->ReleaseIntArrayElements(jArray, elems, 0); } } - + buildBuffer((void*)array, (cl_uint*)dims, 3, bitSize, javaBuffer); } @@ -765,7 +780,7 @@ void AparapiBuffer::flattenLong3D(JNIEnv* env, KernelArg* arg) { env->ReleaseLongArrayElements(jArray, elems, 0); } } - + buildBuffer((void*)array, (cl_uint*)dims, 3, bitSize, javaBuffer); } @@ -829,7 +844,7 @@ void AparapiBuffer::flattenFloat3D(JNIEnv* env, KernelArg* arg) { env->ReleaseFloatArrayElements(jArray, elems, 0); } } - + buildBuffer((void*)array, (cl_uint*)dims, 3, bitSize, javaBuffer); } @@ -893,7 +908,7 @@ void AparapiBuffer::flattenDouble3D(JNIEnv* env, KernelArg* arg) { env->ReleaseDoubleArrayElements(jArray, elems, 0); } } - + buildBuffer((void*)array, (cl_uint*)dims, 3, bitSize, javaBuffer); } @@ -938,7 +953,7 @@ void AparapiBuffer::inflate(JNIEnv* env, KernelArg* arg) { void AparapiBuffer::inflateBoolean2D(JNIEnv *env, KernelArg* arg) { - + jobjectArray buffer = (jobjectArray)javaObject; jboolean* array = (jboolean*)data; /* @@ -975,7 +990,7 @@ void AparapiBuffer::inflateBoolean2D(JNIEnv *env, KernelArg* arg) { } void AparapiBuffer::inflateByte2D(JNIEnv *env, KernelArg* arg) { - + jobjectArray buffer = (jobjectArray)javaObject; jbyte* array = (jbyte*)data; /* @@ -1012,7 +1027,7 @@ void AparapiBuffer::inflateByte2D(JNIEnv *env, KernelArg* arg) { } void AparapiBuffer::inflateShort2D(JNIEnv *env, KernelArg* arg) { - + jobjectArray buffer = (jobjectArray)javaObject; jshort* array = (jshort*)data; /* @@ -1049,7 +1064,7 @@ void AparapiBuffer::inflateShort2D(JNIEnv *env, KernelArg* arg) { } void AparapiBuffer::inflateInt2D(JNIEnv *env, KernelArg* arg) { - + jobjectArray buffer = (jobjectArray)javaObject; jint* array = (jint*)data; /* @@ -1086,7 +1101,7 @@ void AparapiBuffer::inflateInt2D(JNIEnv *env, KernelArg* arg) { } void AparapiBuffer::inflateLong2D(JNIEnv *env, KernelArg* arg) { - + jobjectArray buffer = (jobjectArray)javaObject; jlong* array = (jlong*)data; /* @@ -1123,7 +1138,7 @@ void AparapiBuffer::inflateLong2D(JNIEnv *env, KernelArg* arg) { } void AparapiBuffer::inflateFloat2D(JNIEnv *env, KernelArg* arg) { - + jobjectArray buffer = (jobjectArray)javaObject; jfloat* array = (jfloat*)data; /* @@ -1160,7 +1175,7 @@ void AparapiBuffer::inflateFloat2D(JNIEnv *env, KernelArg* arg) { } void AparapiBuffer::inflateDouble2D(JNIEnv *env, KernelArg* arg) { - + jobjectArray buffer = (jobjectArray)javaObject; jdouble* array = (jdouble*)data; /* @@ -1198,7 +1213,7 @@ void AparapiBuffer::inflateDouble2D(JNIEnv *env, KernelArg* arg) { void AparapiBuffer::inflateBoolean3D(JNIEnv *env, KernelArg* arg) { - + jobjectArray buffer = (jobjectArray)javaObject; jboolean* array = (jboolean*)data; /* @@ -1249,7 +1264,7 @@ void AparapiBuffer::inflateBoolean3D(JNIEnv *env, KernelArg* arg) { } void AparapiBuffer::inflateByte3D(JNIEnv *env, KernelArg* arg) { - + jobjectArray buffer = (jobjectArray)javaObject; jbyte* array = (jbyte*)data; /* @@ -1300,7 +1315,7 @@ void AparapiBuffer::inflateByte3D(JNIEnv *env, KernelArg* arg) { } void AparapiBuffer::inflateShort3D(JNIEnv *env, KernelArg* arg) { - + jobjectArray buffer = (jobjectArray)javaObject; jshort* array = (jshort*)data; /* @@ -1351,7 +1366,7 @@ void AparapiBuffer::inflateShort3D(JNIEnv *env, KernelArg* arg) { } void AparapiBuffer::inflateInt3D(JNIEnv *env, KernelArg* arg) { - + jobjectArray buffer = (jobjectArray)javaObject; jint* array = (jint*)data; /* @@ -1402,7 +1417,7 @@ void AparapiBuffer::inflateInt3D(JNIEnv *env, KernelArg* arg) { } void AparapiBuffer::inflateLong3D(JNIEnv *env, KernelArg* arg) { - + jobjectArray buffer = (jobjectArray)javaObject; jlong* array = (jlong*)data; /* @@ -1453,7 +1468,7 @@ void AparapiBuffer::inflateLong3D(JNIEnv *env, KernelArg* arg) { } void AparapiBuffer::inflateFloat3D(JNIEnv *env, KernelArg* arg) { - + jobjectArray buffer = (jobjectArray)javaObject; jfloat* array = (jfloat*)data; /* @@ -1504,7 +1519,7 @@ void AparapiBuffer::inflateFloat3D(JNIEnv *env, KernelArg* arg) { } void AparapiBuffer::inflateDouble3D(JNIEnv *env, KernelArg* arg) { - + jobjectArray buffer = (jobjectArray)javaObject; jdouble* array = (jdouble*)data; /* diff --git a/src/cpp/runKernel/AparapiBuffer.h b/src/cpp/runKernel/AparapiBuffer.h index 272cccffe0360bf3951d62b8a44ce583f59f5d4f..bb11fbada8dd509196512f2e2988b1636c573efb 100644 --- a/src/cpp/runKernel/AparapiBuffer.h +++ b/src/cpp/runKernel/AparapiBuffer.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. @@ -6,34 +21,34 @@ following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following - disclaimer. + disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the distribution. + disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export - laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 + laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through 774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, you hereby certify that, except pursuant to a license granted by the United States Department of Commerce - Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export - Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in - Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) + Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export + Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in + Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced - direct product is subject to national security controls as identified on the Commerce Control List (currently - found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional + direct product is subject to national security controls as identified on the Commerce Control List (currently + found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry - and Security?s website at http://www.bis.doc.gov/. + and Security?s website at http://www.bis.doc.gov/. */ #ifndef APARAPIBUFFER_H @@ -73,12 +88,12 @@ private: void buildBuffer(void* _data, cl_uint* _dims, cl_uint _numDims, long _lengthInBytes, jobject _javaObject); public: - jobject javaObject; // The java array that this arg is mapped to + jobject javaObject; // The java array that this arg is mapped to cl_uint numDims; // number of dimensions of the object (array lengths for ND arrays) cl_uint* offsets; // offsets of the next element in ND arrays) cl_uint* lens; // sizes of dimensions of the object (array lengths for ND arrays) jint lengthInBytes; // bytes in the array or directBuf - cl_mem mem; // the opencl buffer + cl_mem mem; // the opencl buffer void *data; // a copy of the object itself (this is what we pass to OpenCL) cl_uint memMask; // the mask used for createBuffer ProfileInfo read; diff --git a/src/cpp/runKernel/ArrayBuffer.cpp b/src/cpp/runKernel/ArrayBuffer.cpp index b3947681371e6d756a35dadd94d09b223d215b03..91b4b8e5f021b03fb763ffaf2bc8235de2d69450 100644 --- a/src/cpp/runKernel/ArrayBuffer.cpp +++ b/src/cpp/runKernel/ArrayBuffer.cpp @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. @@ -6,34 +21,34 @@ following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following - disclaimer. + disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the distribution. + disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export - laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 + laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through 774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, you hereby certify that, except pursuant to a license granted by the United States Department of Commerce - Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export - Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in - Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) + Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export + Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in + Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced - direct product is subject to national security controls as identified on the Commerce Control List (currently - found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional + direct product is subject to national security controls as identified on the Commerce Control List (currently + found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry - and Security?s website at http://www.bis.doc.gov/. + and Security?s website at http://www.bis.doc.gov/. */ #define ARRAYBUFFER_SOURCE #include "ArrayBuffer.h" diff --git a/src/cpp/runKernel/ArrayBuffer.h b/src/cpp/runKernel/ArrayBuffer.h index 26f702c80f6819e0d544d8a6d831685f917490ba..6b057f9d73d12ad35f478b5154adaadcf40d3771 100644 --- a/src/cpp/runKernel/ArrayBuffer.h +++ b/src/cpp/runKernel/ArrayBuffer.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. @@ -6,34 +21,34 @@ following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following - disclaimer. + disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the distribution. + disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export - laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 + laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through 774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, you hereby certify that, except pursuant to a license granted by the United States Department of Commerce - Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export - Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in - Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) + Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export + Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in + Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced - direct product is subject to national security controls as identified on the Commerce Control List (currently - found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional + direct product is subject to national security controls as identified on the Commerce Control List (currently + found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry - and Security?s website at http://www.bis.doc.gov/. + and Security?s website at http://www.bis.doc.gov/. */ #ifndef ARRAYBUFFER_H @@ -43,10 +58,10 @@ class ArrayBuffer{ public: - jobject javaArray; // The java array that this arg is mapped to + jobject javaArray; // The java array that this arg is mapped to cl_uint length; // the number of elements for arrays (used only when ARRAYLENGTH bit is set for this arg) jint lengthInBytes; // bytes in the array or directBuf - cl_mem mem; // the opencl buffer + cl_mem mem; // the opencl buffer void *addr; // the last address where we saw this java array object cl_uint memMask; // the mask used for createBuffer jboolean isCopy; diff --git a/src/cpp/runKernel/Config.cpp b/src/cpp/runKernel/Config.cpp index f3b72b6d5ed698b3890bb138ec6be1cc9e7afbf2..f29952a4207a2c7f9d35f7d5ea98a481a9ccc417 100644 --- a/src/cpp/runKernel/Config.cpp +++ b/src/cpp/runKernel/Config.cpp @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. @@ -6,34 +21,34 @@ following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following - disclaimer. + disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the distribution. + disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export - laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 + laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through 774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, you hereby certify that, except pursuant to a license granted by the United States Department of Commerce - Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export - Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in - Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) + Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export + Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in + Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced - direct product is subject to national security controls as identified on the Commerce Control List (currently - found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional + direct product is subject to national security controls as identified on the Commerce Control List (currently + found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry - and Security?s website at http://www.bis.doc.gov/. + and Security?s website at http://www.bis.doc.gov/. */ #define CONFIG_SOURCE #include "Config.h" @@ -47,7 +62,7 @@ Config::Config(JNIEnv *jenv){ enableVerboseJNI = false; configClass = jenv->FindClass("com/aparapi/internal/jni/ConfigJNI"); if (configClass == NULL || jenv->ExceptionCheck()) { - jenv->ExceptionDescribe(); + jenv->ExceptionDescribe(); jenv->ExceptionClear(); fprintf(stderr, "bummer! getting Config from instance\n"); }else{ diff --git a/src/cpp/runKernel/Config.h b/src/cpp/runKernel/Config.h index 8ac19f951c3ecddebc15c880884fc0658ba90834..9cf55685abc959a4ef1aa60d701c7c4274b3a5d2 100644 --- a/src/cpp/runKernel/Config.h +++ b/src/cpp/runKernel/Config.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. @@ -6,41 +21,41 @@ following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following - disclaimer. + disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the distribution. + disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export - laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 + laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through 774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, you hereby certify that, except pursuant to a license granted by the United States Department of Commerce - Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export - Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in - Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) + Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export + Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in + Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced - direct product is subject to national security controls as identified on the Commerce Control List (currently - found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional + direct product is subject to national security controls as identified on the Commerce Control List (currently + found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry - and Security?s website at http://www.bis.doc.gov/. + and Security?s website at http://www.bis.doc.gov/. */ #ifndef CONFIG_H #define CONFIG_H #include "Common.h" class Config{ - public: + public: jboolean configured; jclass configClass; jboolean enableVerboseJNI; @@ -61,4 +76,4 @@ Config *config=NULL; #else extern Config *config; #endif -#endif +#endif diff --git a/src/cpp/runKernel/JNIContext.cpp b/src/cpp/runKernel/JNIContext.cpp index e1083717ca1480d6e2e11b0c89e728dd67b4b2f9..ff9f875cfa2a8784c36f467feb173d47defd2dd4 100644 --- a/src/cpp/runKernel/JNIContext.cpp +++ b/src/cpp/runKernel/JNIContext.cpp @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "JNIContext.h" #include "OpenCLJNI.h" #include "List.h" diff --git a/src/cpp/runKernel/JNIContext.h b/src/cpp/runKernel/JNIContext.h index 9771741e8133901c28240a8707a1f2dacb192f4d..c76e864ef99cab54b0b8b30dee13690bdd39239b 100644 --- a/src/cpp/runKernel/JNIContext.h +++ b/src/cpp/runKernel/JNIContext.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef JNI_CONTEXT_H #define JNI_CONTEXT_H @@ -9,7 +24,7 @@ #include "Config.h" class JNIContext { -private: +private: jint flags; jboolean valid; public: @@ -39,7 +54,7 @@ public: FILE* profileFile; JNIContext(JNIEnv *jenv, jobject _kernelObject, jobject _openCLDeviceObject, jint _flags); - + static JNIContext* getJNIContext(jlong jniContextHandle){ return((JNIContext*)jniContextHandle); } diff --git a/src/cpp/runKernel/KernelArg.cpp b/src/cpp/runKernel/KernelArg.cpp index da77e9e151cd306fb5060e2fb6eefedb8b9e6b13..154ed84c91a7c0d018d4de9effaffa1c8c1a158f 100644 --- a/src/cpp/runKernel/KernelArg.cpp +++ b/src/cpp/runKernel/KernelArg.cpp @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "KernelArg.h" #include "JNIContext.h" #include <string> @@ -9,17 +24,17 @@ using std::endl; jclass KernelArg::argClazz=(jclass)0; jfieldID KernelArg::nameFieldID=0; -jfieldID KernelArg::typeFieldID=0; -jfieldID KernelArg::javaArrayFieldID=0; +jfieldID KernelArg::typeFieldID=0; +jfieldID KernelArg::javaArrayFieldID=0; jfieldID KernelArg::sizeInBytesFieldID=0; -jfieldID KernelArg::numElementsFieldID=0; +jfieldID KernelArg::numElementsFieldID=0; KernelArg::KernelArg(JNIEnv *jenv, JNIContext *jniContext, jobject argObj): jniContext(jniContext), argObj(argObj){ javaArg = jenv->NewGlobalRef(argObj); // save a global ref to the java Arg Object if (argClazz == 0){ - jclass c = jenv->GetObjectClass(argObj); + jclass c = jenv->GetObjectClass(argObj); nameFieldID = JNIHelper::GetFieldID(jenv, c, "name", "Ljava/lang/String;"); typeFieldID = JNIHelper::GetFieldID(jenv, c, "type", "I"); javaArrayFieldID = JNIHelper::GetFieldID(jenv, c, "javaArray", "Ljava/lang/Object;"); @@ -163,5 +178,3 @@ cl_int KernelArg::setPrimitiveArg(JNIEnv *jenv, int argIdx, int argPos, bool ver } return status; } - - diff --git a/src/cpp/runKernel/KernelArg.h b/src/cpp/runKernel/KernelArg.h index 9b0e433ea35087d982d2597af84da454583d792b..64f95bdad989e9a0121e25d34cc68081c9078ded 100644 --- a/src/cpp/runKernel/KernelArg.h +++ b/src/cpp/runKernel/KernelArg.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef KERNEL_ARG_H #define KERNEL_ARG_H @@ -20,7 +35,7 @@ class KernelArg{ private: static jclass argClazz; static jfieldID nameFieldID; - static jfieldID typeFieldID; + static jfieldID typeFieldID; static jfieldID sizeInBytesFieldID; static jfieldID numElementsFieldID; @@ -44,7 +59,7 @@ class KernelArg{ void getStaticPrimitiveValue(JNIEnv *jenv, jlong *value); void getStaticPrimitiveValue(JNIEnv *jenv, jdouble *value); - template<typename T> + template<typename T> void getPrimitive(JNIEnv *jenv, int argIdx, int argPos, bool verbose, T* value) { if(isStatic()) { getStaticPrimitiveValue(jenv, value); @@ -54,16 +69,16 @@ class KernelArg{ } if (verbose) { std::cerr << "clSetKernelArg " << getTypeName() << " '" << name - << " ' index=" << argIdx << " pos=" << argPos + << " ' index=" << argIdx << " pos=" << argPos << " value=" << *value << std::endl; } } public: - static jfieldID javaArrayFieldID; + static jfieldID javaArrayFieldID; public: - JNIContext *jniContext; + JNIContext *jniContext; jobject argObj; // the Java KernelRunner.KernelArg object that we are mirroring. Do not use it outside constructor due to GC. Use javaArg instead. jobject javaArg; // global reference to the corresponding java KernelArg object we grabbed our own global reference so that the object won't be collected until we dispose! char *name; // used for debugging printfs @@ -85,7 +100,7 @@ class KernelArg{ arrayBuffer->unpinCommit(jenv); } void unpin(JNIEnv *jenv){ - //if (value.ref.isPinned == JNI_FALSE){ + //if (value.ref.isPinned == JNI_FALSE){ // fprintf(stdout, "why are we unpinning buffer %s! isPinned = JNI_TRUE\n", name); //} if (isMutableByKernel()){ @@ -185,13 +200,13 @@ class KernelArg{ jenv->SetIntField(javaArg, typeFieldID,type ); } - // Uses JNIContext so can't inline here we below. + // Uses JNIContext so can't inline here we below. void syncValue(JNIEnv *jenv); - // Uses JNIContext so can't inline here we below. + // Uses JNIContext so can't inline here we below. cl_int setLocalBufferArg(JNIEnv *jenv, int argIdx, int argPos, bool verbose); cl_int setLocalAparapiBufferArg(JNIEnv *jenv, int argIdx, int argPos, bool verbose); - // Uses JNIContext so can't inline here we below. + // Uses JNIContext so can't inline here we below. cl_int setPrimitiveArg(JNIEnv *jenv, int argIdx, int argPos, bool verbose); }; diff --git a/src/cpp/runKernel/List.h b/src/cpp/runKernel/List.h index cd2d44e61be9077401ec970a9676a6f558f3ca19..47df75f394ae73f12aa61f943c60ac284bf97eca 100644 --- a/src/cpp/runKernel/List.h +++ b/src/cpp/runKernel/List.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. @@ -6,34 +21,34 @@ following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following - disclaimer. + disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the distribution. + disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export - laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 + laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through 774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, you hereby certify that, except pursuant to a license granted by the United States Department of Commerce - Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export - Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in - Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) + Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export + Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in + Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced - direct product is subject to national security controls as identified on the Commerce Control List (currently - found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional + direct product is subject to national security controls as identified on the Commerce Control List (currently + found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry - and Security�s website at http://www.bis.doc.gov/. + and Security�s website at http://www.bis.doc.gov/. */ #ifndef APARAPI_LIST_H @@ -71,7 +86,7 @@ template <typename T> Ref<T>::Ref(T _value, int _line, const char* _fileName): next(NULL){ } -template <typename T> List<T>::List(const char *_name): +template <typename T> List<T>::List(const char *_name): head(NULL), count(0), name(_name){ @@ -79,7 +94,7 @@ template <typename T> List<T>::List(const char *_name): template <typename T> void List<T>::add(T _value, int _line, const char *_fileName){ Ref<T> *handle = new Ref<T>(_value, _line, _fileName); - handle->next = head; + handle->next = head; head = handle; count++; } @@ -87,7 +102,7 @@ template <typename T> void List<T>::add(T _value, int _line, const char *_fileN template <typename T> void List<T>::remove(T _value, int _line, const char *_fileName){ for (Ref<T> *ptr = head, *last=NULL; ptr != NULL; last=ptr, ptr = ptr->next){ if (ptr->value == _value){ - if (last == NULL){ // head + if (last == NULL){ // head head = ptr->next; }else{ // !head last->next = ptr->next; @@ -126,4 +141,3 @@ extern List<cl_event> writeEventList; #endif #endif // APARAPI_LIST_H - diff --git a/src/cpp/runKernel/ProfileInfo.cpp b/src/cpp/runKernel/ProfileInfo.cpp index 11c77eae9fc335731dfd50c05e10af5159a9fda5..a3ad90bd9b772f88962109eb8845d79948f6bd59 100644 --- a/src/cpp/runKernel/ProfileInfo.cpp +++ b/src/cpp/runKernel/ProfileInfo.cpp @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. @@ -6,34 +21,34 @@ following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following - disclaimer. + disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the distribution. + disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export - laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 + laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through 774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, you hereby certify that, except pursuant to a license granted by the United States Department of Commerce - Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export - Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in - Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) + Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export + Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in + Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced - direct product is subject to national security controls as identified on the Commerce Control List (currently - found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional + direct product is subject to national security controls as identified on the Commerce Control List (currently + found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry - and Security?s website at http://www.bis.doc.gov/. + and Security?s website at http://www.bis.doc.gov/. */ #define PROFILEINFO_SOURCE #include "ProfileInfo.h" @@ -49,13 +64,12 @@ ProfileInfo::ProfileInfo(): } jobject ProfileInfo::createProfileInfoInstance(JNIEnv *jenv){ - jobject profileInstance = JNIHelper::createInstance(jenv, ProfileInfoClass , ArgsVoidReturn(StringClassArg IntArg LongArg LongArg LongArg LongArg), + jobject profileInstance = JNIHelper::createInstance(jenv, ProfileInfoClass , ArgsVoidReturn(StringClassArg IntArg LongArg LongArg LongArg LongArg), ((jstring)(name==NULL?NULL:jenv->NewStringUTF(name))), - ((jint)type), + ((jint)type), ((jlong)start), ((jlong)end), ((jlong)queued), ((jlong)submit)); return(profileInstance); } - diff --git a/src/cpp/runKernel/ProfileInfo.h b/src/cpp/runKernel/ProfileInfo.h index 7b58267f80325d7c58bad8f615b930434ef9f132..447cefdb110a3534e01f24535e83ef27e6cb075e 100644 --- a/src/cpp/runKernel/ProfileInfo.h +++ b/src/cpp/runKernel/ProfileInfo.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* Copyright (c) 2010-2011, Advanced Micro Devices, Inc. All rights reserved. @@ -6,34 +21,34 @@ following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following - disclaimer. + disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the distribution. + disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export - laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 + laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through 774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, you hereby certify that, except pursuant to a license granted by the United States Department of Commerce - Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export - Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in - Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) + Bureau of Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export + Administration Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in + Country Groups D:1, E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced - direct product is subject to national security controls as identified on the Commerce Control List (currently - found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional + direct product is subject to national security controls as identified on the Commerce Control List (currently + found in Supplement 1 to Part 774 of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations under those regulations, please refer to the U.S. Bureau of Industry - and Security?s website at http://www.bis.doc.gov/. + and Security?s website at http://www.bis.doc.gov/. */ #ifndef PROFILEINFO_H #define PROFILEINFO_H diff --git a/src/cpp/runKernel/Range.cpp b/src/cpp/runKernel/Range.cpp index 24974fac7dd7f8fa70c3f3e1f8cc10cb3276706c..4d2e72e2c125326d06acb0d738f21ef4d74ad6eb 100644 --- a/src/cpp/runKernel/Range.cpp +++ b/src/cpp/runKernel/Range.cpp @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "Range.h" @@ -9,7 +24,7 @@ jfieldID Range::localSize_0_FieldID=0; jfieldID Range::localSize_1_FieldID=0; jfieldID Range::localSize_2_FieldID=0; jfieldID Range::dimsFieldID=0; -jfieldID Range::localIsDerivedFieldID=0; +jfieldID Range::localIsDerivedFieldID=0; Range::Range(JNIEnv *jenv, jobject range): range(range), @@ -18,7 +33,7 @@ Range::Range(JNIEnv *jenv, jobject range): globalDims(NULL), localDims(NULL){ if (rangeClazz ==NULL){ - jclass rangeClazz = jenv->GetObjectClass(range); + jclass rangeClazz = jenv->GetObjectClass(range); globalSize_0_FieldID = JNIHelper::GetFieldID(jenv, rangeClazz, "globalSize_0", "I"); globalSize_1_FieldID = JNIHelper::GetFieldID(jenv, rangeClazz, "globalSize_1", "I"); globalSize_2_FieldID = JNIHelper::GetFieldID(jenv, rangeClazz, "globalSize_2", "I"); @@ -70,5 +85,3 @@ Range::~Range(){ delete localDims; } } - - diff --git a/src/cpp/runKernel/Range.h b/src/cpp/runKernel/Range.h index 548549b89f65cdfe72b006de17936967b79d24ac..36756cacf5d203e158584d2e70b30d946c643947 100644 --- a/src/cpp/runKernel/Range.h +++ b/src/cpp/runKernel/Range.h @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef RANGE_H #define RANGE_H @@ -14,7 +29,7 @@ class Range{ static jfieldID localSize_1_FieldID; static jfieldID localSize_2_FieldID; static jfieldID dimsFieldID; - static jfieldID localIsDerivedFieldID; + static jfieldID localIsDerivedFieldID; jobject range; cl_int dims; size_t *offsets; diff --git a/src/cpp/runKernel/Util.h b/src/cpp/runKernel/Util.h index 1b1916f279e0d7dee2348c39687afdd49bce9fc2..ad84410b0e359a94a6b84a21e4d4aec615f81d02 100644 --- a/src/cpp/runKernel/Util.h +++ b/src/cpp/runKernel/Util.h @@ -1,10 +1,20 @@ -/* - * Util.h +/** + * Copyright (c) 2016 - 2018 Syncleus, Inc. * - * Created on: 24/04/2018 - * Author: lpnm + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ + #ifndef SRC_CPP_RUNKERNEL_UTIL_H_ #define SRC_CPP_RUNKERNEL_UTIL_H_