Giter Site home page Giter Site logo

Comments (8)

James-Thorson avatar James-Thorson commented on August 15, 2024

@taylori, are you willing to poke around to see how to disable these messages during compilation?

from vast.

iantaylor-NOAA avatar iantaylor-NOAA commented on August 15, 2024

Warnings remain after updating to VAST_v4_4_0 and R 3.4.1 (other settings versions remain as noted in original post).

A bit of research leads me to see for 4 possible options for dealing with the warnings during the compiling step. So far, I've only figured out how to implement the first option.

  1. Ignore the warnings (likely best if I'm the only one seeing them)
  2. Add a flags or ... input to Build_TMB_Fn that would be passed to the flags input in TMB's compile function that might allow the user to suppresses warnings based on commands here: https://gcc.gnu.org/onlinedocs/gcc-3.4.4/gcc/Warning-Options.html
  3. Change my Makevars file (or some Windows equivalent), based on this comment by @kaskr: kaskr/adcomp#169 (comment). But I'm not sure where this file would be located (in directory for R?, TMB?, VAST?)
  4. Change the syntax of the VAST code being compiled so that these warnings aren't created. They all are related to the following categories [-Wparentheses], [-Wunused-variable], [-Wmaybe-uninitialized].

from vast.

James-Thorson avatar James-Thorson commented on August 15, 2024

from vast.

kaskr avatar kaskr commented on August 15, 2024

@taylori
I see these warnings too. Better to fix the code - it's easy:

  • Update - use next suggestion instead ! All occurences like this
    if( Options_vec(7)==0 & Options_vec(0)==0 ){
    should be changed to
    if( (Options_vec(7)==0) & (Options_vec(0)==0) ){
  • Search replace & (bitwise operator) by && (logical operator). Likewise change | to ||.
  • The unused variable ‘n_k’ [-Wunused-variable] is solved by removing DATA_INTEGER(n_k); as it is not needed.
  • Same with
    VAST_v4_0_0.cpp:321:9: warning: unused variable ‘j’ [-Wunused-variable]
    int i,j,v,t,s,c,y,z;
    
    Most of these temporaries aren't needed. Change to
    int i,t,c;

from vast.

iantaylor-NOAA avatar iantaylor-NOAA commented on August 15, 2024

Thanks @kaskr for your quick response. It certainly sounds more satisfying to fix the underlying cause of the warnings.
@James-Thorson, if you choose to go forward with the suggestion from @kaskr to fix the code (option 4 in my list), let me know if you want help. I'm can make a first attempt and create a pull request for these changes, but you would want to make sure to review the changes and do some testing to make sure nothing broke in the process.

Also, I'm not sure what your workflow is for the VAST .cpp files. Would you change just the most recent, some range of files, or create a new file in the series? This shouldn't change any functionality, so probably just changing the most recent would be adequate.

from vast.

James-Thorson avatar James-Thorson commented on August 15, 2024

from vast.

iantaylor-NOAA avatar iantaylor-NOAA commented on August 15, 2024

All but 1 of the warnings go away after addition of changes suggested by @kaskr in commit 4334903.
The remaining warning is

VAST_v4_1_0.cpp: In function 'tmbutils::matrix<Type> gmrf_by_category_nll(int, int, int, int, Type, tmbutils::array<Type>, tmbutils::array<Type>, tmbutils::vector<Type>, density::GMRF_t<scalartype>, Type&) [with Type = double]':
VAST_v4_1_0.cpp:126:71: warning: 'logtau' may be used uninitialized in this function [-Wmaybe-uninitialized]
     gmrf_sc = (gmrf_input_sf.matrix() * L_cf.transpose()) / exp(logtau);
                                                                       ^

It's easier to ignore 1 warning than 83, so I have no problem with it remaining, but it's also likely an easy fix for someone with more C++ experience.

Code seems to work fine though I didn't do a before/after comparison. Initial rows of index produced by single species example are as follows:

> pander::pandoc.table( Index$Table[,c("Year","Fleet","Estimate_metric_tons","SD_log","SD_mt")] ) 

--------------------------------------------------------
 Year   Fleet   Estimate_metric_tons   SD_log    SD_mt  
------ ------- ---------------------- --------- --------
 1982     1           2850224          0.08607   191971 

 1983     1           6748152          0.08629   447873 

Will now create a pull request.

from vast.

James-Thorson avatar James-Thorson commented on August 15, 2024

This is now fixed in the development branch using VAST_v4_1_0 and higher version numbers.

from vast.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.