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

Add preload of jemalloc library to spectre script #4550

Merged
merged 1 commit into from
Jan 6, 2023

Conversation

kidder
Copy link
Member

@kidder kidder commented Jan 5, 2023

Proposed changes

Upgrade instructions

Code review checklist

  • The code is documented and the documentation renders correctly. Run
    make doc to generate the documentation locally into BUILD_DIR/docs/html.
    Then open index.html.
  • The code follows the stylistic and code quality guidelines listed in the
    code review guide.
  • The PR lists upgrade instructions and is labeled bugfix or
    new feature if appropriate.

Further comments

nilsdeppe
nilsdeppe previously approved these changes Jan 5, 2023
@@ -33,6 +33,10 @@ configure_or_symlink_py_file(
)
# Also link the main entry point to bin/
set(PYTHON_SCRIPT_LOCATION "spectre")
set(JEMALLOC_PRELOAD "")
if(BUILD_PYTHON_BINDINGS AND "${JEMALLOC_LIB_TYPE}" STREQUAL SHARED)
set(JEMALLOC_PRELOAD "LD_PRELOAD=${JEMALLOC_LIBRARIES}")
Copy link
Member

Choose a reason for hiding this comment

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

Not for this PR, but my general education... @wthrowe would there be issues here if someone did LD_PRELOAD=... ./bin/specter ... where either our or the user's LD_PRELOAD is overwritten/ignored?

Copy link
Member

Choose a reason for hiding this comment

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

This will overwrite any preexisting value, so if anyone is relying on that it could cause problems. Properly adding to these colon-separated values is annoying. I think the most correct thing would be LD_PRELOAD=${LD_PRELOAD}${LD_PRELOAD:+:}new_lib. That middle thing can be read as "Look at LD_PRELOAD, and, treating unset as empty (:), if it is not empty then substitute (+) the string :."

I'm not sure whether prepending or appending is correct here. The above appends, prepending can be done by reversing the order of the three sections.

Copy link
Member Author

Choose a reason for hiding this comment

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

squashed a change to append if LD_PRELOAD is defined

nilsvu
nilsvu previously approved these changes Jan 5, 2023
@kidder kidder dismissed stale reviews from nilsvu and nilsdeppe via 218e8e2 January 5, 2023 20:21
@@ -33,6 +33,14 @@ configure_or_symlink_py_file(
)
# Also link the main entry point to bin/
set(PYTHON_SCRIPT_LOCATION "spectre")
set(JEMALLOC_PRELOAD "")
if(BUILD_PYTHON_BINDINGS AND "${JEMALLOC_LIB_TYPE}" STREQUAL SHARED)
if(DEFINED ENV{LD_PRELOAD})
Copy link
Member

Choose a reason for hiding this comment

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

I'd be OK with the old version that didn't respect LD_PRELOAD at all, but if you are going to respect it you need to use the value in the script's environment, not cmake's environmment.

Copy link
Member Author

Choose a reason for hiding this comment

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

ah okay; squashed and pushed again...

Copy link
Member

@nilsdeppe nilsdeppe left a comment

Choose a reason for hiding this comment

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

@wthrowe just merge whenever you're happy! I don't think @nilsvu and I need to re-approve this PR... It's small enough :)

@wthrowe wthrowe merged commit f05a287 into sxs-collaboration:develop Jan 6, 2023
@kidder kidder deleted the python_preload branch January 9, 2023 22:30
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.

4 participants