compatibility issue with openmp
This commit is contained in:
parent
e3b7abfb47
commit
2aa1978cb6
2
Makefile
2
Makefile
@ -1,6 +1,6 @@
|
|||||||
export CC = gcc
|
export CC = gcc
|
||||||
export CXX = g++
|
export CXX = g++
|
||||||
export CFLAGS = -Wall -O3 -msse2 -fopenmp
|
export CFLAGS = -Wall -O3 -msse2 -Wno-unknown-pragmas
|
||||||
|
|
||||||
# specify tensor path
|
# specify tensor path
|
||||||
BIN = xgboost
|
BIN = xgboost
|
||||||
|
|||||||
@ -7,9 +7,9 @@
|
|||||||
* \author Tianqi Chen: tianqi.tchen@gmail.com
|
* \author Tianqi Chen: tianqi.tchen@gmail.com
|
||||||
*/
|
*/
|
||||||
// use openmp
|
// use openmp
|
||||||
#include <omp.h>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "xgboost_tree_model.h"
|
#include "xgboost_tree_model.h"
|
||||||
|
#include "../../utils/xgboost_omp.h"
|
||||||
#include "../../utils/xgboost_random.h"
|
#include "../../utils/xgboost_random.h"
|
||||||
|
|
||||||
namespace xgboost{
|
namespace xgboost{
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
#ifndef XGBOOST_GBMBASE_H
|
#ifndef XGBOOST_GBMBASE_H
|
||||||
#define XGBOOST_GBMBASE_H
|
#define XGBOOST_GBMBASE_H
|
||||||
|
|
||||||
#include <omp.h>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "xgboost.h"
|
#include "xgboost.h"
|
||||||
|
#include "../utils/xgboost_omp.h"
|
||||||
#include "../utils/xgboost_config.h"
|
#include "../utils/xgboost_config.h"
|
||||||
/*!
|
/*!
|
||||||
* \file xgboost_gbmbase.h
|
* \file xgboost_gbmbase.h
|
||||||
|
|||||||
@ -8,9 +8,9 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <omp.h>
|
|
||||||
#include "xgboost_reg_data.h"
|
#include "xgboost_reg_data.h"
|
||||||
#include "xgboost_reg_eval.h"
|
#include "xgboost_reg_eval.h"
|
||||||
|
#include "../utils/xgboost_omp.h"
|
||||||
#include "../booster/xgboost_gbmbase.h"
|
#include "../booster/xgboost_gbmbase.h"
|
||||||
#include "../utils/xgboost_utils.h"
|
#include "../utils/xgboost_utils.h"
|
||||||
#include "../utils/xgboost_stream.h"
|
#include "../utils/xgboost_stream.h"
|
||||||
|
|||||||
@ -5,11 +5,12 @@
|
|||||||
* \brief evaluation metrics for regression and classification
|
* \brief evaluation metrics for regression and classification
|
||||||
* \author Kailong Chen: chenkl198812@gmail.com, Tianqi Chen: tianqi.tchen@gmail.com
|
* \author Kailong Chen: chenkl198812@gmail.com, Tianqi Chen: tianqi.tchen@gmail.com
|
||||||
*/
|
*/
|
||||||
#include <omp.h>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "../utils/xgboost_utils.h"
|
#include "../utils/xgboost_utils.h"
|
||||||
|
#include "../utils/xgboost_omp.h"
|
||||||
|
|
||||||
namespace xgboost{
|
namespace xgboost{
|
||||||
namespace regression{
|
namespace regression{
|
||||||
|
|||||||
18
utils/xgboost_omp.h
Normal file
18
utils/xgboost_omp.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef XGBOOST_OMP_H
|
||||||
|
#define XGBOOST_OMP_H
|
||||||
|
/*!
|
||||||
|
* \file xgboost_omp.h
|
||||||
|
* \brief header to handle OpenMP compatibility issues
|
||||||
|
*
|
||||||
|
* \author Tianqi Chen: tianqi.tchen@gmail.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(_OPENMP)
|
||||||
|
#include <omp.h>
|
||||||
|
#else
|
||||||
|
#warning "OpenMP is not available, compile to single thread code"
|
||||||
|
inline int omp_get_thread_num() { return 0; }
|
||||||
|
inline int omp_get_num_threads() { return 1; }
|
||||||
|
inline void omp_set_num_threads( int nthread ) {}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
Loading…
x
Reference in New Issue
Block a user