Commit 43b2f030 authored by mjg226's avatar mjg226
Browse files

Adapted the cmake, and common files/folders, to separate out the different device common files.

parent 7c31be67
...@@ -112,13 +112,16 @@ set(CAAPI_SOURCES) ...@@ -112,13 +112,16 @@ set(CAAPI_SOURCES)
set(CAAPI_CACOMMON) set(CAAPI_CACOMMON)
set(CAAPI_CAHEADERS) set(CAAPI_CAHEADERS)
set(CAAPI_COMMON_FOLDER "/impls/common/")
# From common directory # From common directory
CAAPI_add_source_dir(impls\\\\common "${CMAKE_CURRENT_SOURCE_DIR}/impls/common/*.hpp" CAAPI_HEADERS) CAAPI_add_source_dir(impls\\\\common "${CMAKE_CURRENT_SOURCE_DIR}${CAAPI_COMMON_FOLDER}*.hpp" CAAPI_HEADERS)
CAAPI_add_source_dir(impls\\\\common "${CMAKE_CURRENT_SOURCE_DIR}/impls/common/*.cpp" CAAPI_SOURCES) CAAPI_add_source_dir(impls\\\\common "${CMAKE_CURRENT_SOURCE_DIR}${CAAPI_COMMON_FOLDER}*.cpp" CAAPI_SOURCES)
CAAPI_add_source_dir(impls\\\\common "${CMAKE_CURRENT_SOURCE_DIR}/impls/common/*.ca" CAAPI_CACOMMON) CAAPI_add_source_dir(impls\\\\common "${CMAKE_CURRENT_SOURCE_DIR}${CAAPI_COMMON_FOLDER}*.ca" CAAPI_CACOMMON)
# Add the needed directories into the compilation # Add the needed directories into the compilation
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/impls/common/") include_directories("${CMAKE_CURRENT_SOURCE_DIR}${CAAPI_COMMON_FOLDER}")
########################## INSTALL ########################## ########################## INSTALL ##########################
...@@ -283,6 +286,33 @@ add_custom_target(caapi_do_impl_headers ALL DEPENDS ${CAAPI_CAHEADERS} ${CAAPI_H ...@@ -283,6 +286,33 @@ add_custom_target(caapi_do_impl_headers ALL DEPENDS ${CAAPI_CAHEADERS} ${CAAPI_H
# Add the needed directories into the compilation # Add the needed directories into the compilation
include_directories(${CAAPI_IMPL_INCLUDE_DIRS}) include_directories(${CAAPI_IMPL_INCLUDE_DIRS})
########################## CAPI DEVICE common files ##########################
#message(STATUS "${CAAPI_DEVICE}")
if(NOT DEFINED CAAPI_DEVICE)
message(STATUS "Device: CPU")
set(CAAPI_DEVICE_COMMON_FOLDER "${CAAPI_COMMON_FOLDER}CPU/")
elseif(CAAPI_DEVICE STREQUAL "GPU")
set(CAAPI_DEVICE_COMMON_FOLDER "${CAAPI_COMMON_FOLDER}GPU/")
message(STATUS "Device: GPU")
else()
message(STATUS "Device: UNKNOWN")
endif()
if(DEFINED CAAPI_DEVICE_COMMON_FOLDER)
CAAPI_add_source_dir(impls\\\\common "${CMAKE_CURRENT_SOURCE_DIR}${CAAPI_DEVICE_COMMON_FOLDER}*.hpp" CAAPI_HEADERS)
CAAPI_add_source_dir(impls\\\\common "${CMAKE_CURRENT_SOURCE_DIR}${CAAPI_DEVICE_COMMON_FOLDER}*.cpp" CAAPI_SOURCES)
CAAPI_add_source_dir(impls\\\\common "${CMAKE_CURRENT_SOURCE_DIR}${CAAPI_DEVICE_COMMON_FOLDER}*.ca" CAAPI_CACOMMON)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}${CAAPI_DEVICE_COMMON_FOLDER}")
endif()
########################## CAPI APPS ########################## ########################## CAPI APPS ##########################
......
/* /*
Copyright (c) 2013 Centre for Water Systems, Copyright (c) 2013 Centre for Water Systems,
University of Exeter University of Exeter
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#ifndef _CA_OPTIONS_HPP_ #ifndef _CA_OPTIONS_HPP_
#define _CA_OPTIONS_HPP_ #define _CA_OPTIONS_HPP_
//! \file Options.hpp //! \file Options.hpp
//! Contains the list of implementation specific Options //! Contains the list of implementation specific Options
//! \author Michele Guidolin, University of Exeter, //! \author Michele Guidolin, University of Exeter,
//! contact: m.guidolin [at] exeter.ac.uk //! contact: m.guidolin [at] exeter.ac.uk
//! \date 2012-07 //! \date 2012-07
#include"Common.hpp" #include"Common.hpp"
namespace CA { namespace CA {
//! Return a list of implementation specific Options //! Return a list of implementation specific Options
inline Options options() inline Options options()
{ {
return Options(); return Options();
} }
} }
#endif// _CA_BASETYPES_HPP_ #endif// _CA_BASETYPES_HPP_
/* /*
Copyright (c) 2013 Centre for Water Systems, Copyright (c) 2013 Centre for Water Systems,
University of Exeter University of Exeter
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#ifndef _CA_OPTIONS_HPP_ #ifndef _CA_OPTIONS_HPP_
#define _CA_OPTIONS_HPP_ #define _CA_OPTIONS_HPP_
//! \file Options.hpp //! \file Options.hpp
//! Contains the list of implementation specific Options //! Contains the list of implementation specific Options
//! \author Michele Guidolin, University of Exeter, //! \author Michele Guidolin, University of Exeter,
//! contact: m.guidolin [at] exeter.ac.uk //! contact: m.guidolin [at] exeter.ac.uk
//! \date 2012-07 //! \date 2012-07
#include"Common.hpp" #include"Common.hpp"
namespace CA { namespace CA {
//! Return a list of implementation specific Options //! Return a list of implementation specific Options
inline Options options() inline Options options()
{ {
Options options; Options options;
// Add the optional arguments. The tag start from 1000 for safety // Add the optional arguments. The tag start from 1000 for safety
// reason. // reason.
CA::Unsigned na = 1000; CA::Unsigned na = 1000;
options.push_back(new Arguments::Arg(na++,"config-file", options.push_back(new Arguments::Arg(na++,"config-file",
"Select the OpenCL config CSV file.","",true, true, false)); "Select the OpenCL config CSV file.","",true, true, false));
options.push_back(new Arguments::Arg(na++,"device-type", options.push_back(new Arguments::Arg(na++,"device-type",
"Select the OpenCL device type (CPU/GPU).","GPU",true, true, false)); "Select the OpenCL device type (CPU/GPU).","GPU",true, true, false));
options.push_back(new Arguments::Arg(na++,"device-number", options.push_back(new Arguments::Arg(na++,"device-number",
"Select the OpenCL device from many available.","0",true, true, false)); "Select the OpenCL device from many available.","0",true, true, false));
options.push_back(new Arguments::Arg(na++,"platform-name", options.push_back(new Arguments::Arg(na++,"platform-name",
"Select the OpenCL specific platform","",true, true, false)); "Select the OpenCL specific platform","",true, true, false));
options.push_back(new Arguments::Arg(na++,"warp-size", options.push_back(new Arguments::Arg(na++,"warp-size",
"Select the OpenCL warp size (32).","",true, true, false)); "Select the OpenCL warp size (32).","",true, true, false));
options.push_back(new Arguments::Arg(na++,"out-of-order", options.push_back(new Arguments::Arg(na++,"out-of-order",
"Uses an out of order execution.","",true, false, false)); "Uses an out of order execution.","",true, false, false));
options.push_back(new Arguments::Arg(na++,"build-info", options.push_back(new Arguments::Arg(na++,"build-info",
"Show in standard error the OpenCl buidl info","",true, false, false)); "Show in standard error the OpenCl buidl info","",true, false, false));
return options; return options;
} }
} }
#endif// _CA_BASETYPES_HPP_ #endif// _CA_BASETYPES_HPP_
...@@ -85,6 +85,7 @@ endif() ...@@ -85,6 +85,7 @@ endif()
# Definitions, which are used to take advantage of different code segments, # Definitions, which are used to take advantage of different code segments,
# in order to make this GPU compatible # in order to make this GPU compatible
set(CAAPI_DEVICE "GPU")
add_definitions(-DCA2D_GPU) add_definitions(-DCA2D_GPU)
# Chose between to use event or not to use event (event has tendency # Chose between to use event or not to use event (event has tendency
......
/*
Copyright (c) 2016 EAWAG - Swiss Federal Institute of Water Science
and Technology
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
//! \file ca.hpp
//! Contains the classes and methods to make CA functions.
//! \author Luís de Sousa, EAWAG,
//! contact: luis.desousa [at] eawag.ch
//! \date 2016-03
#include "../../../../common/Functions.hpp"
/*
Copyright (c) 2016 EAWAG - Swiss Federal Institute of Water Science
and Technology
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef _CA_OPTIONS_HPP_
#define _CA_OPTIONS_HPP_
//! \file Options.hpp
//! Contains the list of implementation specific Options
//! \author Luís de Sousa, EAWAG,
//! contact: luis.desousa [at] eawag.ch
//! \date 2016-03
#include"../../../common/Options.hpp"
/*
Copyright (c) 2016 EAWAG - Swiss Federal Institute of Water Science
and Technology
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
//! \file ca.hpp
//! Contains the classes and methods to make CA functions.
//! \author Luís de Sousa, EAWAG,
//! contact: luis.desousa [at] eawag.ch
//! \date 2016-03
#include "../../../../common/Functions.hpp"
/*
Copyright (c) 2016 EAWAG - Swiss Federal Institute of Water Science
and Technology
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef _CA_OPTIONS_HPP_
#define _CA_OPTIONS_HPP_
//! \file Options.hpp
//! Contains the list of implementation specific Options
//! \author Luís de Sousa, EAWAG,
//! contact: luis.desousa [at] eawag.ch
//! \date 2016-03
#include"../../../common/Options.hpp"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment