Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
e379e525
Unverified
Commit
e379e525
authored
Dec 17, 2020
by
Zihao Ye
Committed by
GitHub
Dec 17, 2020
Browse files
[hotfix] Make USE_AVX a flag in cmake to avoid compilation error for arm user (#2428)
* upd cmake * upd * format
parent
50f1f4ae
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
4 deletions
+20
-4
CMakeLists.txt
CMakeLists.txt
+5
-0
cmake/config.cmake
cmake/config.cmake
+3
-0
src/array/cpu/spmm.h
src/array/cpu/spmm.h
+9
-3
tests/cpp/test_spmm.cc
tests/cpp/test_spmm.cc
+3
-1
No files found.
CMakeLists.txt
View file @
e379e525
...
@@ -24,6 +24,7 @@ endif()
...
@@ -24,6 +24,7 @@ endif()
# Alernatively, use cmake -DOPTION=VALUE through command-line.
# Alernatively, use cmake -DOPTION=VALUE through command-line.
dgl_option
(
USE_CUDA
"Build with CUDA"
OFF
)
dgl_option
(
USE_CUDA
"Build with CUDA"
OFF
)
dgl_option
(
USE_OPENMP
"Build with OpenMP"
ON
)
dgl_option
(
USE_OPENMP
"Build with OpenMP"
ON
)
dgl_option
(
USE_AVX
"Build with AVX optimization"
OFF
)
dgl_option
(
BUILD_CPP_TEST
"Build cpp unittest executables"
OFF
)
dgl_option
(
BUILD_CPP_TEST
"Build cpp unittest executables"
OFF
)
dgl_option
(
LIBCXX_ENABLE_PARALLEL_ALGORITHMS
"Enable the parallel algorithms library. This requires the PSTL to be available."
OFF
)
dgl_option
(
LIBCXX_ENABLE_PARALLEL_ALGORITHMS
"Enable the parallel algorithms library. This requires the PSTL to be available."
OFF
)
dgl_option
(
USE_S3
"Build with S3 support"
OFF
)
dgl_option
(
USE_S3
"Build with S3 support"
OFF
)
...
@@ -108,6 +109,10 @@ if(USE_OPENMP)
...
@@ -108,6 +109,10 @@ if(USE_OPENMP)
endif
(
OPENMP_FOUND
)
endif
(
OPENMP_FOUND
)
endif
(
USE_OPENMP
)
endif
(
USE_OPENMP
)
if
(
USE_AVX
)
add_compile_definitions
(
USE_AVX
)
endif
(
USE_AVX
)
# To compile METIS correct for DGL.
# To compile METIS correct for DGL.
if
(
MSVC
)
if
(
MSVC
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
/DIDXTYPEWIDTH=64 /DREALTYPEWIDTH=32"
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
/DIDXTYPEWIDTH=64 /DREALTYPEWIDTH=32"
)
...
...
cmake/config.cmake
View file @
e379e525
...
@@ -39,3 +39,6 @@ set(BUILD_CPP_TEST OFF)
...
@@ -39,3 +39,6 @@ set(BUILD_CPP_TEST OFF)
# Whether to enable OpenMP
# Whether to enable OpenMP
set
(
USE_OPENMP ON
)
set
(
USE_OPENMP ON
)
# Whether to enable Intel's avx optimized kernel
set
(
USE_AVX OFF
)
src/array/cpu/spmm.h
View file @
e379e525
...
@@ -13,8 +13,10 @@
...
@@ -13,8 +13,10 @@
#include <memory>
#include <memory>
#include "spmm_binary_ops.h"
#include "spmm_binary_ops.h"
#if !defined(_WIN32)
#if !defined(_WIN32)
#ifdef USE_AVX
#include "intel/cpu_support.h"
#include "intel/cpu_support.h"
#endif
#endif // USE_AVX
#endif // _WIN32
namespace
dgl
{
namespace
dgl
{
namespace
aten
{
namespace
aten
{
namespace
cpu
{
namespace
cpu
{
...
@@ -41,6 +43,7 @@ void SpMMSumCsr(const BcastOff& bcast, const CSRMatrix& csr, NDArray ufeat,
...
@@ -41,6 +43,7 @@ void SpMMSumCsr(const BcastOff& bcast, const CSRMatrix& csr, NDArray ufeat,
int64_t
dim
=
bcast
.
out_len
,
lhs_dim
=
bcast
.
lhs_len
,
rhs_dim
=
bcast
.
rhs_len
;
int64_t
dim
=
bcast
.
out_len
,
lhs_dim
=
bcast
.
lhs_len
,
rhs_dim
=
bcast
.
rhs_len
;
DType
*
O
=
out
.
Ptr
<
DType
>
();
DType
*
O
=
out
.
Ptr
<
DType
>
();
#if !defined(_WIN32)
#if !defined(_WIN32)
#ifdef USE_AVX
typedef
dgl
::
ElemWiseAddUpdate
<
Op
>
ElemWiseUpd
;
typedef
dgl
::
ElemWiseAddUpdate
<
Op
>
ElemWiseUpd
;
/* Prepare an assembler kernel */
/* Prepare an assembler kernel */
static
std
::
unique_ptr
<
ElemWiseUpd
>
asm_kernel_ptr
(
static
std
::
unique_ptr
<
ElemWiseUpd
>
asm_kernel_ptr
(
...
@@ -62,7 +65,8 @@ void SpMMSumCsr(const BcastOff& bcast, const CSRMatrix& csr, NDArray ufeat,
...
@@ -62,7 +65,8 @@ void SpMMSumCsr(const BcastOff& bcast, const CSRMatrix& csr, NDArray ufeat,
}
}
}
}
}
else
{
}
else
{
#endif
#endif // USE_AVX
#endif // _WIN32
#pragma omp parallel for
#pragma omp parallel for
for
(
IdType
rid
=
0
;
rid
<
csr
.
num_rows
;
++
rid
)
{
for
(
IdType
rid
=
0
;
rid
<
csr
.
num_rows
;
++
rid
)
{
...
@@ -84,8 +88,10 @@ void SpMMSumCsr(const BcastOff& bcast, const CSRMatrix& csr, NDArray ufeat,
...
@@ -84,8 +88,10 @@ void SpMMSumCsr(const BcastOff& bcast, const CSRMatrix& csr, NDArray ufeat,
}
}
}
}
#if !defined(_WIN32)
#if !defined(_WIN32)
#ifdef USE_AVX
}
}
#endif
#endif // USE_AVX
#endif // _WIN32
}
}
/*!
/*!
...
...
tests/cpp/test_spmm.cc
View file @
e379e525
#if !defined(_WIN32)
#if !defined(_WIN32)
#ifdef USE_AVX
#include <../../src/array/cpu/spmm.h>
#include <../../src/array/cpu/spmm.h>
#include <dgl/array.h>
#include <dgl/array.h>
#include <gtest/gtest.h>
#include <gtest/gtest.h>
...
@@ -313,4 +314,5 @@ TEST(SpmmTest, TestSpmmDiv) {
...
@@ -313,4 +314,5 @@ TEST(SpmmTest, TestSpmmDiv) {
_TestSpmmDiv
<
float
>
();
_TestSpmmDiv
<
float
>
();
_TestSpmmDiv
<
double
>
();
_TestSpmmDiv
<
double
>
();
}
}
#endif
#endif // USE_AVX
#endif // _WIN32
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment