Loading src/TNL/Containers/Algorithms/VectorOperationsMIC_impl.h +11 −12 Original line number Diff line number Diff line /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: VectorOperationsMIC_impl.h * Author: hanouvit * * Created on 2. května 2016, 12:57 */ /*************************************************************************** VectorOperationsMIC_impl.h - description by hanouvit ------------------- begin : Nov 7, 2012 copyright : (C) 2012 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /* See Copyright Notice in tnl/Copyright */ #pragma once Loading src/TNL/Devices/MIC.cpp +1 −0 Original line number Diff line number Diff line /*************************************************************************** MIC.cpp - description ------------------- by hanouvit begin : Feb 10, 2017 copyright : (C) 2017 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz Loading src/TNL/Devices/MIC.h +22 −24 Original line number Diff line number Diff line /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: tnlMIC.h * Author: hanouvit * * Created on 18. dubna 2016, 12:38 */ /*************************************************************************** MIC.h - description by hanouvit ------------------- begin : Nov 7, 2012 copyright : (C) 2012 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /* See Copyright Notice in tnl/Copyright */ #ifndef TNLMIC_H #define TNLMIC_H Loading @@ -29,23 +27,27 @@ namespace TNL { namespace Devices { //makra oblíbená v příkladech v přednáškách Intelu #define ALLOC alloc_if(1) //naalokuj promenou na zacatku offload bloku -- default #define FREE free_if(1) // smaz promenou na konci offload bloku -- default #define RETAIN free_if(0) //nesmaz promenou na konci bloku #define REUSE alloc_if(0) //nealokuj proměnnou na zacatku //useful if you have an adress to MIC memory //struktura která dovoluje kopírovat raw pointer z paměti MICu do RAM a zpět -- obcházení mapování proměnných template< typename Type > struct MICHider{ Type *pointer; }; //nafukovací struktura -- struktury kopítrovat lze, objekty nikoliv //objekt se dá nakopírovat do takovéto strukury a poslat na MIC template <unsigned int VELIKOST> struct MICStruct{ uint8_t data[VELIKOST]; }; //Makra zpřehledňující pozdější kód //verze kdy se objekt nakopíruje do nově alokované nafukovací struktury #define TNLMICSTRUCT(bb,typ) Devices::MICStruct<sizeof(typ)> s ## bb; \ memcpy((void*)& s ## bb,(void*)& bb,sizeof(typ)); #define TNLMICSTRUCTOFF(bb,typ) s ## bb Loading @@ -53,7 +55,7 @@ struct MICStruct{ #define TNLMICSTRUCTALLOC(bb,typ) typ * kernel ## bb = (typ*) malloc (sizeof(typ)); \ memcpy((void*)kernel ## bb,(void*) & s ## bb, sizeof(typ)); //verze kdy se ukazatel na objekt reprezentuje jako ukazatel na pole uint_8 #define TNLMICHIDE(bb,typ) uint8_t * u ## bb=(uint8_t *)&bb; \ MICHider<typ> kernel ## bb; #define TNLMICHIDEALLOCOFF(bb,typ) in(u ## bb:length(sizeof(typ))) out(kernel ## bb) Loading @@ -69,18 +71,11 @@ class MIC { public: /*enum { DeviceType = tnlMICDevice };*/ static String getDeviceType() { return String( "MIC" ); } /*__cuda_callable__ static inline tnlDeviceEnum getDevice() { return tnlMICDevice; }*/ #ifdef HAVE_MIC //useful debuging -- but produce warning Loading @@ -93,6 +88,8 @@ class MIC #endif } //původní funkce kopírující na MIC -- nepoužíváse template <typename TYP> static TYP * passToDevice(TYP &objektCPU) Loading @@ -110,6 +107,7 @@ class MIC std::cout << "Někdo mně volá :-D" <<std::endl; } //původní funkce mazající z MIC -- nepoužíváse template <typename TYP> static void freeFromDevice(TYP *objektMIC) Loading tests/mic/tnlMICArrayTest.cpp +10 −3 Original line number Diff line number Diff line /** * Experimentalní test pro získání zkušeností s TNL a (a strarým dobrým MIC, intel offloadingem a podobně) */ /*************************************************************************** tnlMICArrayTest.cpp - application testing Array implemntation on MIC KNC by hanouvit ------------------- copyright : (C) 2004 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /* See Copyright Notice in tnl/Copyright */ #include <iostream> #include <TNL/Devices/MIC.h> Loading tests/mic/tnlMICVectorTest.cpp +9 −3 Original line number Diff line number Diff line /** * Test develop by hanouvit for implementation of Vector on MIC */ /*************************************************************************** tnlMICVectorTest.cpp - application testing Vector implemntation on MIC KNC by hanouvit ------------------- copyright : (C) 2004 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /* See Copyright Notice in tnl/Copyright */ #include <iostream> #include <omp.h> Loading Loading
src/TNL/Containers/Algorithms/VectorOperationsMIC_impl.h +11 −12 Original line number Diff line number Diff line /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: VectorOperationsMIC_impl.h * Author: hanouvit * * Created on 2. května 2016, 12:57 */ /*************************************************************************** VectorOperationsMIC_impl.h - description by hanouvit ------------------- begin : Nov 7, 2012 copyright : (C) 2012 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /* See Copyright Notice in tnl/Copyright */ #pragma once Loading
src/TNL/Devices/MIC.cpp +1 −0 Original line number Diff line number Diff line /*************************************************************************** MIC.cpp - description ------------------- by hanouvit begin : Feb 10, 2017 copyright : (C) 2017 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz Loading
src/TNL/Devices/MIC.h +22 −24 Original line number Diff line number Diff line /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: tnlMIC.h * Author: hanouvit * * Created on 18. dubna 2016, 12:38 */ /*************************************************************************** MIC.h - description by hanouvit ------------------- begin : Nov 7, 2012 copyright : (C) 2012 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /* See Copyright Notice in tnl/Copyright */ #ifndef TNLMIC_H #define TNLMIC_H Loading @@ -29,23 +27,27 @@ namespace TNL { namespace Devices { //makra oblíbená v příkladech v přednáškách Intelu #define ALLOC alloc_if(1) //naalokuj promenou na zacatku offload bloku -- default #define FREE free_if(1) // smaz promenou na konci offload bloku -- default #define RETAIN free_if(0) //nesmaz promenou na konci bloku #define REUSE alloc_if(0) //nealokuj proměnnou na zacatku //useful if you have an adress to MIC memory //struktura která dovoluje kopírovat raw pointer z paměti MICu do RAM a zpět -- obcházení mapování proměnných template< typename Type > struct MICHider{ Type *pointer; }; //nafukovací struktura -- struktury kopítrovat lze, objekty nikoliv //objekt se dá nakopírovat do takovéto strukury a poslat na MIC template <unsigned int VELIKOST> struct MICStruct{ uint8_t data[VELIKOST]; }; //Makra zpřehledňující pozdější kód //verze kdy se objekt nakopíruje do nově alokované nafukovací struktury #define TNLMICSTRUCT(bb,typ) Devices::MICStruct<sizeof(typ)> s ## bb; \ memcpy((void*)& s ## bb,(void*)& bb,sizeof(typ)); #define TNLMICSTRUCTOFF(bb,typ) s ## bb Loading @@ -53,7 +55,7 @@ struct MICStruct{ #define TNLMICSTRUCTALLOC(bb,typ) typ * kernel ## bb = (typ*) malloc (sizeof(typ)); \ memcpy((void*)kernel ## bb,(void*) & s ## bb, sizeof(typ)); //verze kdy se ukazatel na objekt reprezentuje jako ukazatel na pole uint_8 #define TNLMICHIDE(bb,typ) uint8_t * u ## bb=(uint8_t *)&bb; \ MICHider<typ> kernel ## bb; #define TNLMICHIDEALLOCOFF(bb,typ) in(u ## bb:length(sizeof(typ))) out(kernel ## bb) Loading @@ -69,18 +71,11 @@ class MIC { public: /*enum { DeviceType = tnlMICDevice };*/ static String getDeviceType() { return String( "MIC" ); } /*__cuda_callable__ static inline tnlDeviceEnum getDevice() { return tnlMICDevice; }*/ #ifdef HAVE_MIC //useful debuging -- but produce warning Loading @@ -93,6 +88,8 @@ class MIC #endif } //původní funkce kopírující na MIC -- nepoužíváse template <typename TYP> static TYP * passToDevice(TYP &objektCPU) Loading @@ -110,6 +107,7 @@ class MIC std::cout << "Někdo mně volá :-D" <<std::endl; } //původní funkce mazající z MIC -- nepoužíváse template <typename TYP> static void freeFromDevice(TYP *objektMIC) Loading
tests/mic/tnlMICArrayTest.cpp +10 −3 Original line number Diff line number Diff line /** * Experimentalní test pro získání zkušeností s TNL a (a strarým dobrým MIC, intel offloadingem a podobně) */ /*************************************************************************** tnlMICArrayTest.cpp - application testing Array implemntation on MIC KNC by hanouvit ------------------- copyright : (C) 2004 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /* See Copyright Notice in tnl/Copyright */ #include <iostream> #include <TNL/Devices/MIC.h> Loading
tests/mic/tnlMICVectorTest.cpp +9 −3 Original line number Diff line number Diff line /** * Test develop by hanouvit for implementation of Vector on MIC */ /*************************************************************************** tnlMICVectorTest.cpp - application testing Vector implemntation on MIC KNC by hanouvit ------------------- copyright : (C) 2004 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /* See Copyright Notice in tnl/Copyright */ #include <iostream> #include <omp.h> Loading