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

Remove Unused Parameter Warnings #417

Merged
merged 3 commits into from
Dec 7, 2019
Merged

Remove Unused Parameter Warnings #417

merged 3 commits into from
Dec 7, 2019

Conversation

jmgate
Copy link
Contributor

@jmgate jmgate commented Apr 23, 2019

I've come across a number of unused parameter warnings in kokkos-kernels in Trilinos using gcc-7.3.0 and compiling with -Wall -Wextra -Wpedantic. Where possible, I've commented out parameter names in function definitions to avoid -Wunused-parameter warnings. If you'd prefer to have the parameter names removed entirely, feel free to do so. If the use of a given parameter is hidden behind an #ifdef, I've used an #else block and (void)parameterName; statements to avoid the warnings instead. If you don't like that, you might want something along these lines instead:

#ifdef SOMETHING
// insert real function definition with parameter names here
#else 
// insert fake function definition without parameter names here -- this will just throw an exception or something
#endif 

Essentially you can pull the #if outside the function rather than keeping it inside.

These changes build fine for me within Trilinos, but I haven't built/tested kokkos-kernels by itself. I don't expect any issues.

Comment out parameter names in function definitions to avoid
`-Wunused-parameter` warnings.  If their use is hidden behind an #ifdef,
use an #else block to avoid the warning appropriately.
@jmgate
Copy link
Contributor Author

jmgate commented Apr 24, 2019

BTW, I'm also seeing these warnings, but I can't manage to get rid of them. Hopefully you know what to do about them.

/workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_InnerTrsm_Decl.hpp:25:55: warning: unused parameter ‘A’ [-Wunused-parameter]
       int serial_invoke(const ValueType *__restrict__ A,
                                                       ^
/workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_InnerTrsm_Decl.hpp:26:14: warning: unused parameter ‘n’ [-Wunused-parameter]
    const int n,
              ^
/workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_InnerTrsm_Decl.hpp:27:34: warning: unused parameter ‘B’ [-Wunused-parameter]
    /**/  ValueType *__restrict__ B);
                                  ^
...
/workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_InnerTrsm_Decl.hpp:79:55: warning: unused parameter ‘A’ [-Wunused-parameter]
       int serial_invoke(const ValueType *__restrict__ A,
                                                       ^
/workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_InnerTrsm_Decl.hpp:80:14: warning: unused parameter ‘n’ [-Wunused-parameter]
    const int n,
              ^
/workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_InnerTrsm_Decl.hpp:81:34: warning: unused parameter ‘B’ [-Wunused-parameter]
    /**/  ValueType *__restrict__ B);
                                  ^

@srajama1
Copy link
Contributor

@jmgate
Copy link
Contributor Author

jmgate commented May 2, 2019

Ping.

@srajama1
Copy link
Contributor

srajama1 commented May 2, 2019

@jmgate : Last week was a blur with our user group meeting. We will take care of this.

@kyungjoo-kim
Copy link
Contributor

pong ~ let me see what happens. Give me a few days.

@jmgate
Copy link
Contributor Author

jmgate commented May 2, 2019

No worries. Just wanted to make sure the right person had seen it.

@srajama1
Copy link
Contributor

srajama1 commented May 2, 2019

@kyungjoo-kim is THE right person ... :)

@kyungjoo-kim
Copy link
Contributor

@jmgate It is a header file for function declaration. Can you give me the full stack of messages ? Which compiling file create that error ?

@jmgate
Copy link
Contributor Author

jmgate commented May 6, 2019

In file included from /workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_InnerTrsm_Serial_Impl.hpp:8:0,
                 from /workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_Trsm_Serial_Internal.hpp:13,
                 from /workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_Trsm_Serial_Impl.hpp:8,
                 from /workspace/Trilinos/packages/ifpack2/src/Ifpack2_BlockTriDiContainer_def.hpp:61,
                 from /workspace/build/trilinos/packages/ifpack2/src/Ifpack2_BlockTriDiContainer_Serial.cpp:50:
/workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_InnerTrsm_Serial_Impl.hpp: In instantiation of ‘int KokkosBatched::Exper
imental::InnerTrsmLeftLowerUnitDiag<bmn>::serial_invoke(const ValueType*, int, ValueType*) [with ValueType = KokkosBatched::Experimental::Vect
or<KokkosBatched::Experimental::SIMD<double>, 8>; int bmn = 1]’:
/workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_InnerTrsm_Serial_Impl.hpp:275:78:   required from ‘int KokkosBatched::Ex
perimental::InnerTrsmLeftLowerUnitDiag<bmn>::serial_invoke(const ValueType*, int, int, ValueType*) [with ValueType = KokkosBatched::Experiment
al::Vector<KokkosBatched::Experimental::SIMD<double>, 8>; int bmn = 4]’
/workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_Trsm_Serial_Internal.hpp:124:32:   required from ‘KokkosBatched::Experim
ental::SerialTrsmInternalLeftLower<AlgoType>::invoke(bool, int, int, ScalarType, const ValueType*, int, int, ValueType*, int, int) [with ScalarType = ScalarType; ValueType = ValueType; AlgoType = KokkosBatched::Experimental::Algo::Level3::Blocked]::<lambda(int, int, const ValueType*, ValueType*)> [with ScalarType = double; ValueType = KokkosBatched::Experimental::Vector<KokkosBatched::Experimental::SIMD<double>, 8>]’
/workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_Trsm_Serial_Internal.hpp:130:34:   required from ‘struct KokkosBatched::Experimental::SerialTrsmInternalLeftLower<AlgoType>::invoke(bool, int, int, ScalarType, const ValueType*, int, int, ValueType*, int, int) [with ScalarType = double; ValueType = KokkosBatched::Experimental::Vector<KokkosBatched::Experimental::SIMD<double>, 8>; AlgoType = KokkosBatched::Experimental::Algo::Level3::Blocked]::<lambda(int, int, const class KokkosBatched::Experimental::Vector<KokkosBatched::Experimental::SIMD<double>, 8>*, class KokkosBatched::Experimental::Vector<KokkosBatched::Experimental::SIMD<double>, 8>*)>’
/workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_Trsm_Serial_Internal.hpp:112:14:   required from ‘static int KokkosBatched::Experimental::SerialTrsmInternalLeftLower<AlgoType>::invoke(bool, int, int, ScalarType, const ValueType*, int, int, ValueType*, int, int) [with ScalarType = double; ValueType = KokkosBatched::Experimental::Vector<KokkosBatched::Experimental::SIMD<double>, 8>; AlgoType = KokkosBatched::Experimental::Algo::Level3::Blocked]’
/workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_Trsm_Serial_Impl.hpp:102:72:   required from ‘static int KokkosBatched::Experimental::SerialTrsm<KokkosBatched::Experimental::Side::Left, KokkosBatched::Experimental::Uplo::Lower, KokkosBatched::Experimental::Trans::NoTranspose, ArgDiag, KokkosBatched::Experimental::Algo::Level3::Blocked>::invoke(ScalarType, const AViewType&, const BViewType&) [with ScalarType = double; AViewType = Kokkos::View<KokkosBatched::Experimental::Vector<KokkosBatched::Experimental::SIMD<double>, 8>**, Kokkos::LayoutStride, Kokkos::Device<Kokkos::Serial, Kokkos::HostSpace>, Kokkos::MemoryTraits<1> >; BViewType = Kokkos::View<KokkosBatched::Experimental::Vector<KokkosBatched::Experimental::SIMD<double>, 8>**, Kokkos::LayoutStride, Kokkos::Device<Kokkos::Serial, Kokkos::HostSpace>, Kokkos::MemoryTraits<1> >; ArgDiag = KokkosBatched::Experimental::Diag::Unit]’
/workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_Trsm_Decl.hpp:69:79:   [ skipping 5 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/workspace/Trilinos/packages/kokkos/core/src/Kokkos_Parallel.hpp:191:4:   required from ‘void Kokkos::parallel_for(const ExecPolicy&, const FunctorType&, const string&, typename Kokkos::Impl::enable_if<Kokkos::is_execution_policy<ExecPolicy>::value>::type*) [with ExecPolicy = Kokkos::TeamPolicy<Kokkos::Serial, Ifpack2::BlockTriDiContainerDetails::ExtractAndFactorizeTridiags<Tpetra::RowMatrix<double, int, int, Kokkos::Compat::KokkosDeviceWrapperNode<Kokkos::Serial> > >::ExtractAndFactorizeTag>; FunctorType = Ifpack2::BlockTriDiContainerDetails::ExtractAndFactorizeTridiags<Tpetra::RowMatrix<double, int, int, Kokkos::Compat::KokkosDeviceWrapperNode<Kokkos::Serial> > >; std::__cxx11::string = std::__cxx11::basic_string<char>; typename Kokkos::Impl::enable_if<Kokkos::is_execution_policy<ExecPolicy>::value>::type = void]’
/workspace/Trilinos/packages/kokkos/core/src/Kokkos_Parallel.hpp:244:25:   required from ‘void Kokkos::parallel_for(const string&, const ExecPolicy&, const FunctorType&) [with ExecPolicy = Kokkos::TeamPolicy<Kokkos::Serial, Ifpack2::BlockTriDiContainerDetails::ExtractAndFactorizeTridiags<Tpetra::RowMatrix<double, int, int, Kokkos::Compat::KokkosDeviceWrapperNode<Kokkos::Serial> > >::ExtractAndFactorizeTag>; FunctorType = Ifpack2::BlockTriDiContainerDetails::ExtractAndFactorizeTridiags<Tpetra::RowMatrix<double, int, int, Kokkos::Compat::KokkosDeviceWrapperNode<Kokkos::Serial> > >; std::__cxx11::string = std::__cxx11::basic_string<char>]’
/workspace/Trilinos/packages/ifpack2/src/Ifpack2_BlockTriDiContainer_impl.hpp:1826:29:   required from ‘void Ifpack2::BlockTriDiContainerDetails::ExtractAndFactorizeTridiags<MatrixType>::run() [with MatrixType = Tpetra::RowMatrix<double, int, int, Kokkos::Compat::KokkosDeviceWrapperNode<Kokkos::Serial> >]’
/workspace/Trilinos/packages/ifpack2/src/Ifpack2_BlockTriDiContainer_impl.hpp:1849:7:   required from ‘void Ifpack2::BlockTriDiContainerDetails::performNumericPhase(const Teuchos::RCP<const typename Ifpack2::BlockTriDiContainerDetails::ImplType<MatrixType>::tpetra_block_crs_matrix_type>&, const Ifpack2::BlockTriDiContainerDetails::PartInterface<MatrixType>&, Ifpack2::BlockTriDiContainerDetails::BlockTridiags<MatrixType>&, typename Ifpack2::BlockTriDiContainerDetails::ImplType<MatrixType>::magnitude_type) [with MatrixType = Tpetra::RowMatrix<double, int, int, Kokkos::Compat::KokkosDeviceWrapperNode<Kokkos::Serial> >; typename Ifpack2::BlockTriDiContainerDetails::ImplType<MatrixType>::tpetra_block_crs_matrix_type = Tpetra::Experimental::BlockCrsMatrix<double, int, int, Kokkos::Compat::KokkosDeviceWrapperNode<Kokkos::Serial> >; typename Ifpack2::BlockTriDiContainerDetails::ImplType<MatrixType>::magnitude_type = double]’
/workspace/Trilinos/packages/ifpack2/src/Ifpack2_BlockTriDiContainer_def.hpp:235:9:   required from ‘void Ifpack2::BlockTriDiContainer<MatrixType, Ifpack2::BlockTriDiContainerDetails::ImplSimdTag>::compute() [with MatrixType = Tpetra::RowMatrix<double, int, int, Kokkos::Compat::KokkosDeviceWrapperNode<Kokkos::Serial> >]’
/workspace/build/trilinos/packages/ifpack2/src/Ifpack2_BlockTriDiContainer_Serial.cpp:61:1:   required from here
/workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_InnerTrsm_Decl.hpp:25:55: warning: unused parameter ‘A’ [-Wunused-parameter]
       int serial_invoke(const ValueType *__restrict__ A,
                                                       ^
/workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_InnerTrsm_Decl.hpp:26:14: warning: unused parameter ‘n’ [-Wunused-parameter]
    const int n,
              ^
/workspace/Trilinos/packages/kokkos-kernels/src/batched/KokkosBatched_InnerTrsm_Decl.hpp:27:34: warning: unused parameter ‘B’ [-Wunused-parameter]
    /**/  ValueType *__restrict__ B);
                                  ^

@kyungjoo-kim
Copy link
Contributor

@jmgate I figured out where the warning is from. Do I submit a separate PR or I can just work on in this PR ?

@jmgate
Copy link
Contributor Author

jmgate commented May 6, 2019

You should be able to push more commits to this branch on my fork. If you run into a permissions issue, let me know.

@kyungjoo-kim
Copy link
Contributor

@jmgate Done.

@jmgate
Copy link
Contributor Author

jmgate commented May 6, 2019

Thanks @kyungjoo-kim. You want to review and approve this PR then?

Copy link
Contributor

@mhoemmen mhoemmen left a comment

Choose a reason for hiding this comment

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

Looks legit.

@jmgate
Copy link
Contributor Author

jmgate commented May 13, 2019

Should I be doing anything else to help this get merged?

@ndellingwood
Copy link
Contributor

I merged develop back into this branch, fixed a conflict and updated the src/sparse/impl/KokkosSparse_spgemm_impl_compression.hpp for a variable that is no longer unused.

Spot-check run on kokkos-dev-2, all test pass:

Running on machine: kokkos-dev-2
Going to test compilers:  gcc/7.3.0 gcc/9.1 intel/18.0.5 clang/8.0 cuda/10.1
Testing compiler gcc/7.3.0
Testing compiler gcc/9.1
  Starting job gcc-7.3.0-Pthread-release
  Starting job gcc-7.3.0-OpenMP-release
  PASSED gcc-7.3.0-OpenMP-release
  Starting job gcc-9.1-OpenMP-release
  PASSED gcc-7.3.0-Pthread-release
Testing compiler intel/18.0.5
  Starting job gcc-9.1-Serial-release
  PASSED gcc-9.1-OpenMP-release
Testing compiler clang/8.0
  Starting job intel-18.0.5-OpenMP-release
  PASSED gcc-9.1-Serial-release
  Starting job clang-8.0-Cuda_OpenMP-release
  PASSED intel-18.0.5-OpenMP-release
Testing compiler cuda/10.1
  Starting job clang-8.0-Pthread_Serial-release
  PASSED clang-8.0-Cuda_OpenMP-release
  PASSED clang-8.0-Pthread_Serial-release
  Starting job cuda-10.1-Cuda_OpenMP-release
  PASSED cuda-10.1-Cuda_OpenMP-release
#######################################################
PASSED TESTS
#######################################################
clang-8.0-Cuda_OpenMP-release build_time=568 run_time=713
clang-8.0-Pthread_Serial-release build_time=346 run_time=868
cuda-10.1-Cuda_OpenMP-release build_time=626 run_time=655
gcc-7.3.0-OpenMP-release build_time=219 run_time=270
gcc-7.3.0-Pthread-release build_time=205 run_time=492
gcc-9.1-OpenMP-release build_time=185 run_time=249
gcc-9.1-Serial-release build_time=156 run_time=501
intel-18.0.5-OpenMP-release build_time=299 run_time=298
#######################################################

Merging this in, thanks @jmgate !

@ndellingwood ndellingwood merged commit c88e461 into kokkos:develop Dec 7, 2019
@jmgate jmgate deleted the remove-unused-parameter-warnings branch December 7, 2019 01:43
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.

5 participants