GeoDaCenter / rgeoda

R library for spatial data analysis based on libgeoda and GeoDa
73 stars 14 forks source link

maxp crashing RStudio on Arch #27

Open thesixmax opened 2 years ago

thesixmax commented 2 years ago

Hello!

I have tried to run several version of maxp, but they fail with the following message (can only catch it when running R from console, RStudio crashes):

 *** caught segfault ***
address 0x2d0, cause 'memory not mapped'

Traceback:
 1: p_maxp_greedy(w$GetPointer(), df, n_vars, bound_values, min_bound, iterations, initial_regions, scale_method, distance_method, random_seed, cpu_threads)
 2: maxp_greedy(queen_w, data, bound_vals, min_bound)

I am by no means an expert, but this particular error is mentioned, for example, here, although it is an old issue. I have tried to reinstall Rccp as well, but that did not help. During compilation of rgeoda, several warnings are thrown in relation to the BH library, such as:

/home/thesixmax/R/x86_64-pc-linux-gnu-library/4.1/BH/include/boost/config/pragma_message.hpp:24:34: note: ‘#pragma message: This header is deprecated. Use <iterator> instead.’
   24 | # define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x)))

and

/home/thesixmax/R/x86_64-pc-linux-gnu-library/4.1/BH/include/boost/smart_ptr/shared_ptr.hpp: In member function ‘boost::shared_ptr<T>& boost::shared_ptr<T>::operator=(std::auto_ptr<_Up>&&)’:
/home/thesixmax/R/x86_64-pc-linux-gnu-library/4.1/BH/include/boost/smart_ptr/shared_ptr.hpp:572:38: warning: ‘template<class> class std::auto_ptr’ is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations]
  572 |         this_type( static_cast< std::auto_ptr<Y> && >( r ) ).swap( *this );
      |                                      ^~~~~~~~

It does not matter if I install from github or CRAN either. However, the guerry example provided on your webpage does run, which confuses me! So I am a bit lost on whether it is a compiling issue, package issue, linux issue or R issue. When I pull in the shapefile and run maxp in the Geoda desktop software, it runs without issues.

sessionInfo()

R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Manjaro Linux

Matrix products: default
BLAS/LAPACK: /opt/intel/mkl/lib/intel64/libmkl_gf_lp64.so

locale:
 [1] LC_CTYPE=en_DK.UTF-8       LC_NUMERIC=C               LC_TIME=en_DK.UTF-8        LC_COLLATE=en_DK.UTF-8     LC_MONETARY=en_DK.UTF-8    LC_MESSAGES=en_DK.UTF-8   
 [7] LC_PAPER=en_DK.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_DK.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rgeoda_0.0.8-6 digest_0.6.28  sf_1.0-3      

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7           compiler_4.1.1       pillar_1.6.4         later_1.3.0          class_7.3-19         tools_4.1.1          tibble_3.1.6         jsonlite_1.7.2      
 [9] lifecycle_1.0.1      pkgconfig_2.0.3      rlang_0.4.12         shiny_1.7.1          DBI_1.1.1            fastmap_1.1.0        e1071_1.7-9          dplyr_1.0.7         
[17] generics_0.1.1       htmlwidgets_1.5.4    vctrs_0.3.8          tidyselect_1.1.1     classInt_0.4-3       DT_0.19              shinydashboard_0.7.2 grid_4.1.1          
[25] glue_1.5.0           R6_2.5.1             fansi_0.5.0          purrr_0.3.4          magrittr_2.0.1       promises_1.2.0.1     ellipsis_0.3.2       htmltools_0.5.2     
[33] units_0.7-2          assertthat_0.2.1     mime_0.12            xtable_1.8-4         httpuv_1.6.3         utf8_1.2.2           bs4Dash_2.0.3        KernSmooth_2.23-20  
[41] proxy_0.4-26         crayon_1.4.2

Any pointers are much appreciated!

thesixmax commented 2 years ago

Update: maxp_greedy appears to run as intended when setting cpu_threads = 1. So the problem is maybe related to parallelisation?