Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-3539: [CI/Packaging] Update scripts to build against vendored jemalloc #2779

Closed
wants to merge 2 commits into from

Conversation

kszucs
Copy link
Member

@kszucs kszucs commented Oct 17, 2018

Actually to not install jemalloc :)

@kszucs kszucs added the WIP PR is work in progress label Oct 17, 2018
Copy link
Member

@wesm wesm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, now I understand =) Thanks

@kszucs
Copy link
Member Author

kszucs commented Oct 17, 2018

on bionic the build fails with (regardless of this change)

-- extracting...
     src='/build/apache-arrow-0.12.0~dev20181017/cpp/thirdparty/jemalloc/17c897976c60b0e6e4f4a365c751027244dada7a.tar.gz'
     dst='/build/apache-arrow-0.12.0~dev20181017/cpp_build/jemalloc_ep-prefix/src/jemalloc_ep'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
read(): Is a directory
make[5]: warning: -jN forced in submake: disabling jobserver mode.
make[5]: *** INTERNAL: readdir: Bad file descriptor.  Stop.
make[5]: Entering directory '/build/apache-arrow-0.12.0~dev20181017/cpp_build/jemalloc_ep-prefix/src/jemalloc_ep'
make[5]: Leaving directory '/build/apache-arrow-0.12.0~dev20181017/cpp_build/jemalloc_ep-prefix/src/jemalloc_ep'

@kszucs
Copy link
Member Author

kszucs commented Oct 17, 2018

@wesm how can I disable parallel make for jemalloc_ep?

@wesm
Copy link
Member

wesm commented Oct 17, 2018

See 1c85e41

@kszucs
Copy link
Member Author

kszucs commented Oct 17, 2018

Thanks! If that resolves the buonic build should I introduce a cmake flag for that?

@kszucs
Copy link
Member Author

kszucs commented Oct 17, 2018

However that's another issue. I'm waiting for crossbow builds: https://github.com/kszucs/crossbow/branches/all?utf8=%E2%9C%93&query=build-335 (bionic will fail).

@wesm
Copy link
Member

wesm commented Oct 17, 2018

Hm, do we understand the root cause of the parallel build failure? That seems odd

@kszucs
Copy link
Member Author

kszucs commented Oct 17, 2018

Not yet, but there was a similar issue #2245

cc @kou

@kou
Copy link
Member

kou commented Oct 18, 2018

Using make -j in sub-make is fragile. And it's useless when we use -j in top-level make. So we should avoid it.

How about the following? We can use parallel build when we use Ninja CMake generator.

diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index 15ff5ec8..7540e782 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -309,6 +309,12 @@ if ("${MAKE}" STREQUAL "")
     endif()
 endif()
 
+if (${CMAKE_GENERATOR} MATCHES "Makefiles")
+  set(MAKE_BUILD_ARGS "")
+else()
+  set(MAKE_BUILD_ARGS "-j")
+endif()
+
 # ----------------------------------------------------------------------
 # Find pthreads
 
@@ -736,9 +742,9 @@ if (ARROW_JEMALLOC)
     CONFIGURE_COMMAND ./autogen.sh "--prefix=${JEMALLOC_PREFIX}" "--with-jemalloc-prefix=je_arrow_" "--with-private-namespace=je_arrow_private_" "--disable-tls"
     ${EP_LOG_OPTIONS}
     BUILD_IN_SOURCE 1
-    BUILD_COMMAND ${MAKE} -j
+    BUILD_COMMAND ${MAKE} ${MAKE_BUILD_ARGS}
     BUILD_BYPRODUCTS "${JEMALLOC_STATIC_LIB}" "${JEMALLOC_SHARED_LIB}"
-    INSTALL_COMMAND ${MAKE} -j1 install)
+    INSTALL_COMMAND ${MAKE} install)
 
   # Don't use the include directory directly so that we can point to a path
   # that is unique to our codebase.

@kszucs
Copy link
Member Author

kszucs commented Oct 18, 2018

@kou Doesn't jinja do parallel builds by default?

@kou
Copy link
Member

kou commented Oct 18, 2018

ninja? ninja does parallel builds by default.

@kszucs
Copy link
Member Author

kszucs commented Oct 18, 2018

Yes ninja :) Then do We need set(MAKE_BUILD_ARGS "-j")?
So I suppose just the removal of -j argument will work fine.

@kou
Copy link
Member

kou commented Oct 18, 2018

Then do We need set(MAKE_BUILD_ARGS "-j")?

Yes. Ninja users like fast build. So we should use -j for Ninja users. The patch enables -j all users except Make users.

@kszucs
Copy link
Member Author

kszucs commented Oct 18, 2018

I mean ninja -j fails unless We provide the threadnum e.g. ninja -j4, but I think it's not required due to ninja paralellizes by default. So I propose to just remove the -j flag. Do I miss something?

@kou
Copy link
Member

kou commented Oct 18, 2018

Yes. ninja requires the maximum number of jobs.

But make doesn't require the maximum number of jobs. If we omit the maximum number of jobs, make doesn't limit the concurrent number of jobs. It causes a problem when we have many source codes. If we process many source codes at once, system resources (normally, CPU and I/O) are conflicted. It reduces build performance. jemalloc only have 30 .c files. It's not very small but it will not use all system resources. It may be better that we use -j4 or -j8 for safety.

if (${CMAKE_GENERATOR} MATCHES "Makefiles")
set(MAKE_BUILD_ARGS "")
else()
# limit the maximum number of jobs for ninja
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may misunderstand. This argument is used by make not ninja.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, so the problem was using make -j instead make -jN, I'll update it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kou No, I don't fully understand :)
My conclusion from your reasoning and patch was to not parallelize make at all, and parallelize but limit the number of jobs for ninja -j4.

BTW The build is passing with the current changeset.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right.

@kou
Copy link
Member

kou commented Oct 19, 2018

The CI failure is unrelated.
I restarted the failed task.

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1
I'll merge this.

@kou
Copy link
Member

kou commented Oct 20, 2018

@kszucs This still have WIP label. Do you have more works for this?

@kszucs kszucs removed the WIP PR is work in progress label Oct 21, 2018
@kszucs
Copy link
Member Author

kszucs commented Oct 21, 2018

No, removed it.

Copy link
Member

@xhochy xhochy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM

@xhochy xhochy closed this in de5d7de Oct 21, 2018
kou pushed a commit that referenced this pull request Aug 19, 2020
On ARROW-6437 (#7928) we saw occasional "File exists" errors on `jemalloc_ep` on macOS. Googling the error message led back to ARROW-739 (#456), which fixed this before by forcing install with `-j1`. ARROW-3492 later made it so jemalloc would build (but not install) in parallel. Then ARROW-3539 (#2779) was addressing a problem with that change and, along with fixing the build parallelization issue, unfortunately reverted the original `make -j1 install` fix.

This patch restores the fix from ARROW-739.

Closes #7995 from nealrichardson/jemalloc-install

Authored-by: Neal Richardson <neal.p.richardson@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
emkornfield pushed a commit to emkornfield/arrow that referenced this pull request Sep 8, 2020
On ARROW-6437 (apache#7928) we saw occasional "File exists" errors on `jemalloc_ep` on macOS. Googling the error message led back to ARROW-739 (apache#456), which fixed this before by forcing install with `-j1`. ARROW-3492 later made it so jemalloc would build (but not install) in parallel. Then ARROW-3539 (apache#2779) was addressing a problem with that change and, along with fixing the build parallelization issue, unfortunately reverted the original `make -j1 install` fix.

This patch restores the fix from ARROW-739.

Closes apache#7995 from nealrichardson/jemalloc-install

Authored-by: Neal Richardson <neal.p.richardson@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
emkornfield pushed a commit to emkornfield/arrow that referenced this pull request Oct 16, 2020
On ARROW-6437 (apache#7928) we saw occasional "File exists" errors on `jemalloc_ep` on macOS. Googling the error message led back to ARROW-739 (apache#456), which fixed this before by forcing install with `-j1`. ARROW-3492 later made it so jemalloc would build (but not install) in parallel. Then ARROW-3539 (apache#2779) was addressing a problem with that change and, along with fixing the build parallelization issue, unfortunately reverted the original `make -j1 install` fix.

This patch restores the fix from ARROW-739.

Closes apache#7995 from nealrichardson/jemalloc-install

Authored-by: Neal Richardson <neal.p.richardson@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
GeorgeAp pushed a commit to sirensolutions/arrow that referenced this pull request Jun 7, 2021
On ARROW-6437 (apache#7928) we saw occasional "File exists" errors on `jemalloc_ep` on macOS. Googling the error message led back to ARROW-739 (apache#456), which fixed this before by forcing install with `-j1`. ARROW-3492 later made it so jemalloc would build (but not install) in parallel. Then ARROW-3539 (apache#2779) was addressing a problem with that change and, along with fixing the build parallelization issue, unfortunately reverted the original `make -j1 install` fix.

This patch restores the fix from ARROW-739.

Closes apache#7995 from nealrichardson/jemalloc-install

Authored-by: Neal Richardson <neal.p.richardson@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants