fixes #1032:
- remove left-overs from OpenMP - replace omp_* calls with TBB equivalents
This commit is contained in:
		
							parent
							
								
									20cbfd95d6
								
							
						
					
					
						commit
						6a03f13d55
					
				| @ -35,7 +35,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
| #include "../DataStructures/Percent.h" | #include "../DataStructures/Percent.h" | ||||||
| #include "../DataStructures/XORFastHash.h" | #include "../DataStructures/XORFastHash.h" | ||||||
| #include "../DataStructures/XORFastHashStorage.h" | #include "../DataStructures/XORFastHashStorage.h" | ||||||
| #include "../Util/OpenMPWrapper.h" |  | ||||||
| #include "../Util/SimpleLogger.h" | #include "../Util/SimpleLogger.h" | ||||||
| #include "../Util/StringUtil.h" | #include "../Util/StringUtil.h" | ||||||
| #include "../Util/TimingUtil.h" | #include "../Util/TimingUtil.h" | ||||||
|  | |||||||
| @ -28,7 +28,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
| #ifndef PERCENT_H | #ifndef PERCENT_H | ||||||
| #define PERCENT_H | #define PERCENT_H | ||||||
| 
 | 
 | ||||||
| #include "../Util/OpenMPWrapper.h" |  | ||||||
| #include <iostream> | #include <iostream> | ||||||
| #include <atomic> | #include <atomic> | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -35,7 +35,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
| #include "../DataStructures/ImportNode.h" | #include "../DataStructures/ImportNode.h" | ||||||
| #include "../DataStructures/Restriction.h" | #include "../DataStructures/Restriction.h" | ||||||
| #include "../Util/MachineInfo.h" | #include "../Util/MachineInfo.h" | ||||||
| #include "../Util/OpenMPWrapper.h" |  | ||||||
| #include "../Util/OSRMException.h" | #include "../Util/OSRMException.h" | ||||||
| #include "../Util/SimpleLogger.h" | #include "../Util/SimpleLogger.h" | ||||||
| #include "../typedefs.h" | #include "../typedefs.h" | ||||||
|  | |||||||
| @ -31,7 +31,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
| #include "ExtractionWay.h" | #include "ExtractionWay.h" | ||||||
| #include "../DataStructures/ImportNode.h" | #include "../DataStructures/ImportNode.h" | ||||||
| #include "../Util/LuaUtil.h" | #include "../Util/LuaUtil.h" | ||||||
| #include "../Util/OpenMPWrapper.h" |  | ||||||
| #include "../Util/OSRMException.h" | #include "../Util/OSRMException.h" | ||||||
| #include "../Util/SimpleLogger.h" | #include "../Util/SimpleLogger.h" | ||||||
| #include "../typedefs.h" | #include "../typedefs.h" | ||||||
|  | |||||||
| @ -29,7 +29,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
| #define SERVER_FACTORY_H | #define SERVER_FACTORY_H | ||||||
| 
 | 
 | ||||||
| #include "Server.h" | #include "Server.h" | ||||||
| #include "../Util/OpenMPWrapper.h" |  | ||||||
| #include "../Util/SimpleLogger.h" | #include "../Util/SimpleLogger.h" | ||||||
| #include "../Util/StringUtil.h" | #include "../Util/StringUtil.h" | ||||||
| 
 | 
 | ||||||
| @ -39,11 +38,13 @@ struct ServerFactory | |||||||
| { | { | ||||||
|     ServerFactory() = delete; |     ServerFactory() = delete; | ||||||
|     ServerFactory(const ServerFactory &) = delete; |     ServerFactory(const ServerFactory &) = delete; | ||||||
|     static Server *CreateServer(std::string &ip_address, int ip_port, int threads) |     static Server *CreateServer(std::string &ip_address, int ip_port, unsigned requested_num_threads) | ||||||
|     { |     { | ||||||
|         SimpleLogger().Write() << "http 1.1 compression handled by zlib version " << zlibVersion(); |         SimpleLogger().Write() << "http 1.1 compression handled by zlib version " << zlibVersion(); | ||||||
|         std::string port_stream = IntToString(ip_port); |         std::string port_stream = IntToString(ip_port); | ||||||
|         return new Server(ip_address, port_stream, std::min(omp_get_num_procs(), threads)); |         unsigned hardware_threads = std::max(1u, std::thread::hardware_concurrency()); | ||||||
|  |         unsigned real_num_threads = std::min(hardware_threads, requested_num_threads); | ||||||
|  |         return new Server(ip_address, port_stream, real_num_threads); | ||||||
|     } |     } | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,41 +0,0 @@ | |||||||
| /*
 |  | ||||||
| 
 |  | ||||||
| Copyright (c) 2013, Project OSRM, Dennis Luxen, others |  | ||||||
| All rights reserved. |  | ||||||
| 
 |  | ||||||
| Redistribution and use in source and binary forms, with or without modification, |  | ||||||
| are permitted provided that the following conditions are met: |  | ||||||
| 
 |  | ||||||
| Redistributions of source code must retain the above copyright notice, this list |  | ||||||
| of conditions and the following 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. |  | ||||||
| 
 |  | ||||||
| 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 OF THIS |  | ||||||
| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |  | ||||||
| 
 |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef OPENMP_WRAPPER_H |  | ||||||
| #define OPENMP_WRAPPER_H |  | ||||||
| 
 |  | ||||||
| #ifdef _OPENMP |  | ||||||
| extern "C" { |  | ||||||
| #include <omp.h> |  | ||||||
| } |  | ||||||
| #else |  | ||||||
| inline int omp_get_num_procs() { return 1; } |  | ||||||
| inline int omp_get_max_threads() { return 1; } |  | ||||||
| inline int omp_get_thread_num() { return 0; } |  | ||||||
| inline void omp_set_num_threads(int i) {} |  | ||||||
| #endif // _OPENMP
 |  | ||||||
| #endif // OPENMP_WRAPPER_H
 |  | ||||||
| @ -32,7 +32,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
| #include "Extractor/XMLParser.h" | #include "Extractor/XMLParser.h" | ||||||
| #include "Util/GitDescription.h" | #include "Util/GitDescription.h" | ||||||
| #include "Util/MachineInfo.h" | #include "Util/MachineInfo.h" | ||||||
| #include "Util/OpenMPWrapper.h" |  | ||||||
| #include "Util/OSRMException.h" | #include "Util/OSRMException.h" | ||||||
| #include "Util/ProgramOptions.h" | #include "Util/ProgramOptions.h" | ||||||
| #include "Util/SimpleLogger.h" | #include "Util/SimpleLogger.h" | ||||||
| @ -63,7 +62,7 @@ int main(int argc, char *argv[]) | |||||||
|             std::chrono::steady_clock::now(); |             std::chrono::steady_clock::now(); | ||||||
| 
 | 
 | ||||||
|         boost::filesystem::path config_file_path, input_path, profile_path; |         boost::filesystem::path config_file_path, input_path, profile_path; | ||||||
|         unsigned int requested_num_threads; |         unsigned requested_num_threads; | ||||||
| 
 | 
 | ||||||
|         // declare a group of options that will be allowed only on command line
 |         // declare a group of options that will be allowed only on command line
 | ||||||
|         boost::program_options::options_description generic_options("Options"); |         boost::program_options::options_description generic_options("Options"); | ||||||
| @ -166,8 +165,8 @@ int main(int argc, char *argv[]) | |||||||
|             return 1; |             return 1; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         unsigned int hardware_threads = std::max((unsigned int) 1, std::thread::hardware_concurrency()); |         unsigned hardware_threads = std::max(1u, std::thread::hardware_concurrency()); | ||||||
|         unsigned int real_num_threads = std::min(hardware_threads, requested_num_threads); |         unsigned real_num_threads = std::min(hardware_threads, requested_num_threads); | ||||||
| 
 | 
 | ||||||
|         SimpleLogger().Write() << "Input file: " << input_path.filename().string(); |         SimpleLogger().Write() << "Input file: " << input_path.filename().string(); | ||||||
|         SimpleLogger().Write() << "Profile: " << profile_path.filename().string(); |         SimpleLogger().Write() << "Profile: " << profile_path.filename().string(); | ||||||
|  | |||||||
| @ -37,7 +37,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
| #include "Util/GitDescription.h" | #include "Util/GitDescription.h" | ||||||
| #include "Util/GraphLoader.h" | #include "Util/GraphLoader.h" | ||||||
| #include "Util/LuaUtil.h" | #include "Util/LuaUtil.h" | ||||||
| #include "Util/OpenMPWrapper.h" |  | ||||||
| #include "Util/OSRMException.h" | #include "Util/OSRMException.h" | ||||||
| 
 | 
 | ||||||
| #include "Util/SimpleLogger.h" | #include "Util/SimpleLogger.h" | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user