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
tianlh
LightGBM-DCU
Commits
d8a6b887
Unverified
Commit
d8a6b887
authored
Nov 02, 2022
by
James Lamb
Committed by
GitHub
Nov 02, 2022
Browse files
[ci] fix R-package CI jobs and compatibility with OpenMP 15+ (fixes #5549, #5562) (#5563)
parent
0c0eb2a6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
4 deletions
+61
-4
.ci/test_r_package_windows.ps1
.ci/test_r_package_windows.ps1
+3
-3
CMakeLists.txt
CMakeLists.txt
+18
-1
R-package/configure
R-package/configure
+21
-0
R-package/configure.ac
R-package/configure.ac
+19
-0
No files found.
.ci/test_r_package_windows.ps1
View file @
d8a6b887
...
@@ -132,13 +132,13 @@ Run-R-Code-Redirect-Stderr "options(install.packages.check.source = 'no'); insta
...
@@ -132,13 +132,13 @@ Run-R-Code-Redirect-Stderr "options(install.packages.check.source = 'no'); insta
#
#
# MiKTeX always needs to be built to test a CRAN package.
# MiKTeX always needs to be built to test a CRAN package.
if
((
$
env
:
COMPILER
-eq
"MINGW"
)
-or
(
$
env
:
R_BUILD_TYPE
-eq
"cran"
))
{
if
((
$
env
:
COMPILER
-eq
"MINGW"
)
-or
(
$
env
:
R_BUILD_TYPE
-eq
"cran"
))
{
Download-File-With-Retries
"https://github.com/microsoft/LightGBM/releases/download/v2.0.12/miktexsetup-
4
.0-x64.zip"
-destfile
"miktexsetup-x64.zip"
Download-File-With-Retries
"https://github.com/microsoft/LightGBM/releases/download/v2.0.12/miktexsetup-
5.2
.0-x64.zip"
-destfile
"miktexsetup-x64.zip"
Add-Type
-AssemblyName
System.IO.Compression.FileSystem
Add-Type
-AssemblyName
System.IO.Compression.FileSystem
[
System.IO.Compression.ZipFile
]::
ExtractToDirectory
(
"miktexsetup-x64.zip"
,
"miktex"
)
[
System.IO.Compression.ZipFile
]::
ExtractToDirectory
(
"miktexsetup-x64.zip"
,
"miktex"
)
Write-Output
"Setting up MiKTeX"
Write-Output
"Setting up MiKTeX"
.
\miktex\miktexsetup.exe
--remote-package-repository
=
"
$
env
:
CTAN_PACKAGE_ARCHIVE
"
--local-package-repository
=.
/miktex/download
--package-set
=
essential
--quiet
download
;
Check-Output
$?
.
\miktex\miktexsetup
_standalone
.exe
--remote-package-repository
=
"
$
env
:
CTAN_PACKAGE_ARCHIVE
"
--local-package-repository
=.
/miktex/download
--package-set
=
essential
--quiet
download
;
Check-Output
$?
Write-Output
"Installing MiKTeX"
Write-Output
"Installing MiKTeX"
.
\miktex\download\miktexsetup.exe
--remote-package-repository
=
"
$
env
:
CTAN_PACKAGE_ARCHIVE
"
--portable
=
"
$
env
:
R_LIB_PATH
/miktex"
--quiet
install
;
Check-Output
$?
.
\miktex\download\miktexsetup
_standalone
.exe
--remote-package-repository
=
"
$
env
:
CTAN_PACKAGE_ARCHIVE
"
--portable
=
"
$
env
:
R_LIB_PATH
/miktex"
--quiet
install
;
Check-Output
$?
Write-Output
"Done installing MiKTeX"
Write-Output
"Done installing MiKTeX"
Run-R-Code-Redirect-Stderr
"result <- processx::run(command = 'initexmf', args = c('--set-config-value', '[MPM]AutoInstall=1'), echo = TRUE, windows_verbatim_args = TRUE, error_on_status = TRUE)"
;
Check-Output
$?
Run-R-Code-Redirect-Stderr
"result <- processx::run(command = 'initexmf', args = c('--set-config-value', '[MPM]AutoInstall=1'), echo = TRUE, windows_verbatim_args = TRUE, error_on_status = TRUE)"
;
Check-Output
$?
...
...
CMakeLists.txt
View file @
d8a6b887
...
@@ -142,7 +142,24 @@ if(USE_CUDA OR USE_CUDA_EXP)
...
@@ -142,7 +142,24 @@ if(USE_CUDA OR USE_CUDA_EXP)
endif
()
endif
()
if
(
USE_OPENMP
)
if
(
USE_OPENMP
)
find_package
(
OpenMP REQUIRED
)
if
(
APPLE
)
find_package
(
OpenMP
)
if
(
NOT OpenMP_FOUND
)
# libomp 15.0+ from brew is keg-only, so have to search in other locations.
# See https://github.com/Homebrew/homebrew-core/issues/112107#issuecomment-1278042927.
execute_process
(
COMMAND brew --prefix libomp
OUTPUT_VARIABLE HOMEBREW_LIBOMP_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set
(
OpenMP_C_FLAGS
"-Xpreprocessor -fopenmp -I
${
HOMEBREW_LIBOMP_PREFIX
}
/include"
)
set
(
OpenMP_CXX_FLAGS
"-Xpreprocessor -fopenmp -I
${
HOMEBREW_LIBOMP_PREFIX
}
/include"
)
set
(
OpenMP_C_LIB_NAMES omp
)
set
(
OpenMP_CXX_LIB_NAMES omp
)
set
(
OpenMP_omp_LIBRARY
${
HOMEBREW_LIBOMP_PREFIX
}
/lib/libomp.dylib
)
find_package
(
OpenMP REQUIRED
)
endif
()
else
()
find_package
(
OpenMP REQUIRED
)
endif
()
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
OpenMP_CXX_FLAGS
}
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
OpenMP_CXX_FLAGS
}
"
)
endif
()
endif
()
...
...
R-package/configure
View file @
d8a6b887
...
@@ -1800,6 +1800,27 @@ if test `uname -s` = "Darwin"
...
@@ -1800,6 +1800,27 @@ if test `uname -s` = "Darwin"
then
then
OPENMP_CXXFLAGS
=
'-Xclang -fopenmp'
OPENMP_CXXFLAGS
=
'-Xclang -fopenmp'
OPENMP_LIB
=
'-lomp'
OPENMP_LIB
=
'-lomp'
# libomp 15.0+ from brew is keg-only (i.e. not symlinked into the standard paths search by the linker),
# so need to search in other locations.
# See https://github.com/Homebrew/homebrew-core/issues/112107#issuecomment-1278042927.
#
# If Homebrew is found and libomp was installed with it, this code adds the necessary
# flags for the compiler to find libomp headers and for the linker to find libomp.dylib.
HOMEBREW_LIBOMP_PREFIX
=
""
if
command
-v
brew &> /dev/null
;
then
ac_brew_openmp
=
no
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking whether OpenMP was installed via Homebrew"
>
&5
$as_echo_n
"checking whether OpenMP was installed via Homebrew... "
>
&6
;
}
brew
--prefix
libomp &>/dev/null
&&
ac_brew_openmp
=
yes
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
${
ac_brew_openmp
}
"
>
&5
$as_echo
"
${
ac_brew_openmp
}
"
>
&6
;
}
if
test
"
${
ac_brew_openmp
}
"
=
yes
;
then
HOMEBREW_LIBOMP_PREFIX
=
`
brew
--prefix
libomp
`
OPENMP_CXXFLAGS
=
"
${
OPENMP_CXXFLAGS
}
-I
${
HOMEBREW_LIBOMP_PREFIX
}
/include"
OPENMP_LIB
=
"
${
OPENMP_LIB
}
-L
${
HOMEBREW_LIBOMP_PREFIX
}
/lib"
fi
fi
ac_pkg_openmp
=
no
ac_pkg_openmp
=
no
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking whether OpenMP will work in a package"
>
&5
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking whether OpenMP will work in a package"
>
&5
$as_echo_n
"checking whether OpenMP will work in a package... "
>
&6
;
}
$as_echo_n
"checking whether OpenMP will work in a package... "
>
&6
;
}
...
...
R-package/configure.ac
View file @
d8a6b887
...
@@ -104,6 +104,25 @@ if test `uname -s` = "Darwin"
...
@@ -104,6 +104,25 @@ if test `uname -s` = "Darwin"
then
then
OPENMP_CXXFLAGS='-Xclang -fopenmp'
OPENMP_CXXFLAGS='-Xclang -fopenmp'
OPENMP_LIB='-lomp'
OPENMP_LIB='-lomp'
# libomp 15.0+ from brew is keg-only (i.e. not symlinked into the standard paths search by the linker),
# so need to search in other locations.
# See https://github.com/Homebrew/homebrew-core/issues/112107#issuecomment-1278042927.
#
# If Homebrew is found and libomp was installed with it, this code adds the necessary
# flags for the compiler to find libomp headers and for the linker to find libomp.dylib.
HOMEBREW_LIBOMP_PREFIX=""
if command -v brew &> /dev/null; then
ac_brew_openmp=no
AC_MSG_CHECKING([whether OpenMP was installed via Homebrew])
brew --prefix libomp &>/dev/null && ac_brew_openmp=yes
AC_MSG_RESULT([${ac_brew_openmp}])
if test "${ac_brew_openmp}" = yes; then
HOMEBREW_LIBOMP_PREFIX=`brew --prefix libomp`
OPENMP_CXXFLAGS="${OPENMP_CXXFLAGS} -I${HOMEBREW_LIBOMP_PREFIX}/include"
OPENMP_LIB="${OPENMP_LIB} -L${HOMEBREW_LIBOMP_PREFIX}/lib"
fi
fi
ac_pkg_openmp=no
ac_pkg_openmp=no
AC_MSG_CHECKING([whether OpenMP will work in a package])
AC_MSG_CHECKING([whether OpenMP will work in a package])
AC_LANG_CONFTEST(
AC_LANG_CONFTEST(
...
...
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