diff --git a/CMakeLists.txt b/CMakeLists.txt index 45814d200e6..ad0d43f548b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -819,20 +819,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 () diff --git a/include/lbann/data_ingestion/readers/sample_list_open_files_impl.hpp b/include/lbann/data_ingestion/readers/sample_list_open_files_impl.hpp index 670273fd0ce..2d5f97d535f 100644 --- a/include/lbann/data_ingestion/readers/sample_list_open_files_impl.hpp +++ b/include/lbann/data_ingestion/readers/sample_list_open_files_impl.hpp @@ -642,7 +642,7 @@ inline void sample_list_open_files::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 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) { diff --git a/src/data_ingestion/readers/data_reader_mesh.cpp b/src/data_ingestion/readers/data_reader_mesh.cpp index b9cd6512890..8fabd5f35e1 100644 --- a/src/data_ingestion/readers/data_reader_mesh.cpp +++ b/src/data_ingestion/readers/data_reader_mesh.cpp @@ -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 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) diff --git a/src/layers/image/bilinear_resize.cpp b/src/layers/image/bilinear_resize.cpp index d99f5c88b28..b6f339a6515 100644 --- a/src/layers/image/bilinear_resize.cpp +++ b/src/layers/image/bilinear_resize.cpp @@ -67,11 +67,11 @@ void bilinear_resize_layer::fp_compute() // Find input pixels near interpolation point const auto input_col = static_cast(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(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);