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

Fix AppleClang warnings #2453

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -812,20 +812,33 @@ endif (LBANN_HAS_CUDA)

# Fix the -g issue with Clang on OSX
if (APPLE)
message("** CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")
message("** CMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG}")

# Remove -g from the options
string(REPLACE "-g" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "-g" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REGEX REPLACE
" ?-g[gdb0-9]*"
""
CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE
" ?-g[gdb0-9]*"
""
CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG}")

# Get all the sources and add "-g" to all of them.
get_target_property(_LBANN_SRCS lbann SOURCES)
set_source_files_properties(${_LBANN_SRCS}
PROPERTIES COMPILE_OPTIONS "-g")

# Cleanup source files
foreach (bad_file IN LISTS _LBANN_SRCS)
get_source_file_property(
_SRC_COMPILE_OPTS "${bad_file}" COMPILE_OPTIONS)
string(REPLACE "-g" "" _SRC_COMPILE_OPTS "${COMPILE_OPTIONS}")
string(REGEX REPLACE
" ?-g[gdb0-9]*"
""
_SRC_COMPILE_OPTS
"${COMPILE_OPTIONS}")
set_source_files_properties(
"${bad_file}" PROPERTIES COMPILE_OPTIONS "${_SRC_COMPILE_OPTS}")
endforeach ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ inline void sample_list_open_files<sample_name_t, file_handle_t>::reorder()
{
// Interleaving was done over files (all samples in a file are consecutive
if (this->m_stride > 1ul) { // undo interleaving
samples_t tmp_sample_list[this->m_stride];
std::vector<samples_t> tmp_sample_list(this->m_stride);
sample_file_id_t last_index = 0;
size_t interleave_idx = 0;
for (const auto& s : this->m_sample_list) {
Expand Down
6 changes: 3 additions & 3 deletions src/data_ingestion/readers/data_reader_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ std::string mesh_reader::construct_filename(std::string channel,
uint64_t data_id)
{
std::string filename = get_file_dir() + channel + m_suffix + "/" + channel;
char idx[m_index_length + 1];
std::snprintf(idx, m_index_length + 1, m_index_format_str.c_str(), data_id);
return filename + std::string(idx) + ".bin";
std::vector<char> idx(m_index_length + 1, '\0');
std::snprintf(idx.data(), m_index_length + 1, m_index_format_str.c_str(), data_id);
return filename + std::string(idx.data()) + ".bin";
}

void mesh_reader::horizontal_flip(CPUMat& mat)
Expand Down
8 changes: 4 additions & 4 deletions src/layers/image/bilinear_resize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ void bilinear_resize_layer<TensorDataType, Layout, Device>::fp_compute()

// Find input pixels near interpolation point
const auto input_col = static_cast<El::Int>(std::floor(x - half));
const auto& input_col0 = std::max(input_col, El::Int(0));
const auto& input_col1 = std::min(input_col + 1, input_width - 1);
const auto input_col0 = std::max(input_col, El::Int(0));
const auto input_col1 = std::min(input_col + 1, input_width - 1);
const auto input_row = static_cast<El::Int>(std::floor(y - half));
const auto& input_row0 = std::max(input_row, El::Int(0));
const auto& input_row1 = std::min(input_row + 1, input_height - 1);
const auto input_row0 = std::max(input_row, El::Int(0));
const auto input_row1 = std::min(input_row + 1, input_height - 1);

// Interpolation point relative to input pixel centers
const auto& unit_x = x - (input_col + half);
Expand Down
Loading