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

Clean up transducer build #1159

Merged
merged 2 commits into from
Jan 9, 2021
Merged

Clean up transducer build #1159

merged 2 commits into from
Jan 9, 2021

Conversation

mthrok
Copy link
Collaborator

@mthrok mthrok commented Jan 6, 2021

This PR cleans up build process by

  • Decoupling the registration of sox and transducer, using TORCH_LIBRARY_FRAGMENT macro.
  • Instead of linking libwarprnnt.a from the build directory use the install directory, where other libsox related libraries are found.

When BUILD_TRANSDUCER is false-y value

  • Do not build the external transducer
  • Do not build the transducer binding (exclude it from the list of sources)

Remaining tweak for build (not in this PR)

@mthrok mthrok marked this pull request as ready for review January 6, 2021 22:22
@mthrok mthrok changed the title Clean up build Clean up transducer build Jan 7, 2021

PROJECT(rnnt_release)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removing this as I do not see this reflected in build logs. -O3 is used.


INCLUDE_DIRECTORIES(submodule/include)

SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

PIC argument has to be consistent across all the libraries. The current configuration works without this explicit line, but I moved this to the top level CMakeLitst.txt

cwd=build_dir,
check=True,
)
command = ['cmake', '--build', '.']
if _BUILD_TRANSDUCER:
command += ['--target', 'install']
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

instrall target is only defined when building transducer.

@mthrok mthrok requested a review from vincentqb January 7, 2021 17:00
Copy link
Contributor

@vincentqb vincentqb left a comment

Choose a reason for hiding this comment

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

LGTM

third_party/CMakeLists.txt Outdated Show resolved Hide resolved
third_party/CMakeLists.txt Outdated Show resolved Hide resolved
Comment on lines +20 to +21
target_include_directories(warprnnt PUBLIC submodule/include)
set_target_properties(warprnnt PROPERTIES PUBLIC_HEADER submodule/include/rnnt.h)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the commands are capitablized in this file :)

Suggested change
target_include_directories(warprnnt PUBLIC submodule/include)
set_target_properties(warprnnt PROPERTIES PUBLIC_HEADER submodule/include/rnnt.h)
TARGET_INCLUDE_DIRECTORIES(warprnnt PUBLIC submodule/include)
SET_TARGET_PROPERTIES(warprnnt PROPERTIES PUBLIC_HEADER submodule/include/rnnt.h)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is intended. only ancient CMake should use all capitals. I could have lowercased others but I left them untouched.

https://stackoverflow.com/a/32783814

}

#endif
TORCH_LIBRARY_FRAGMENT(torchaudio, m) {
Copy link
Contributor

Choose a reason for hiding this comment

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

TORCH_LIBRARY_FRAGMENT is neat :)

@mthrok mthrok merged commit 9690e8e into pytorch:master Jan 9, 2021
@mthrok mthrok deleted the clean-up-cmake branch January 9, 2021 00:28
@vincentqb vincentqb mentioned this pull request Feb 4, 2021
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants