Skip to content

Commit b3111c2

Browse files
committed
Update setup info and scripts
1 parent fb5707c commit b3111c2

File tree

5 files changed

+72
-29
lines changed

5 files changed

+72
-29
lines changed

Manifest.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is machine-generated - editing it directly is not advised
22

3-
julia_version = "1.11.2"
3+
julia_version = "1.11.3"
44
manifest_format = "2.0"
55
project_hash = "92713d8d40a9172e59b96f0da75d24fab6398141"
66

README.md

+67-20
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,18 @@ This repository is not complete at this time.
4949

5050
## Simple Setup
5151

52-
To set up this project to run some of the analysis scripts contained within, you
53-
can simply invoke
54-
55-
```console
56-
source setup_all.sh
57-
```
58-
59-
sourcing is necessary to make sure that the Julia project is set up correctly.
60-
You will need to have Julia, Cargo, and RStudio installed in order for this to run without
61-
errors. (Note: This script requires the use of a Unix based operating system, such as
62-
MacOS or Linux. Windows users may invoke this by setting up the subsystem for Linux)
63-
52+
Note: These instructions are intended for Mac and Linux users. Windows users
53+
may follow along by using the
54+
[Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install)
55+
and
56+
[Windows Terminal](https://apps.microsoft.com/detail/9n0dx20hk701?ocid=webpdpshare)
57+
which allow for the use of Linux commands within a Windows environment. Windows users
58+
will also need to install the appropriate subsystem, for which we recommend
59+
[Ubuntu 22.04.5 LTS](https://apps.microsoft.com/detail/9pn20msr04dw?ocid=webpdpshare)
60+
due to the ease-of-use and quantity of support documentation for Ubuntu users.
6461

62+
To set up this project to run some of the analysis scripts contained within, you
63+
must make sure that you have Cargo, Julia, and R (or RStudio) installed.
6564
To install Cargo, visit the
6665
[Rustup Download Page](https://doc.rust-lang.org/cargo/getting-started/installation.html)
6766
and follow the instructions for your operating system. Likewise, to install Julia,
@@ -78,9 +77,19 @@ than installing from the Julia website.)
7877
> :warning: There appears to be a memory leak bug that sometimes appears when running the `redist`
7978
> package. This memory leak appears to be an issue with the R interpreter not freeing memory
8079
> appropriately when the R base language and the relevant RCpp and Rarmadillo libraries
81-
> are compiled with an earler version of gcc. To avoid this bug, please make sure to have
82-
> R version >= 4.4.2 and a gcc released after 15 May 2024. Relevant gdal and fortran compilation
83-
> libraries should also be up-to-date.
80+
> are compiled with an earler version of gcc/gfortran. To avoid this bug, please make sure to have
81+
> R version >= 4.4.2 and a verson ofgcc released after 15 May 2024. Relevant gdal and fortran
82+
> compilation libraries should also be up-to-date.
83+
84+
85+
After making sure the appropriate programming languages are installed on your
86+
machine, you can simply invoke
87+
88+
```console
89+
source setup_all.sh
90+
```
91+
92+
sourcing is necessary to make sure that the Julia project is set up correctly.
8493

8594
## More Detailed Setup instructions in case the script fails
8695

@@ -116,11 +125,11 @@ To run the Sequential Monte Carlo (SMC) code for this repository, you will need
116125
appropriate version of R (you don't _need_ RStudio, but it is nice to have) installed, as
117126
well as the following packages:
118127

119-
- argparser
120-
- dplyr
121-
- ggplot2
122-
- remotes
123-
- sf
128+
- `argparser`
129+
- `dplyr`
130+
- `ggplot2`
131+
- `remotes`
132+
- `sf`
124133

125134
To install these packages, you can simply invoke the R terminal (or open RStudio)
126135
and call
@@ -183,12 +192,50 @@ If you are on mac, then the corresponding brew packages would be:
183192
brew update && brew install \
184193
gdal \
185194
geos \
195+
gfortran \
186196
proj \
187197
udunits \
188198
openssl \
189199
cairo
190200
```
191201

202+
In some versions of R, especially on newer Mac installations, there can be a slight issue
203+
during the installation of the `redist` package. Specifically, you might see something like
204+
205+
```console
206+
ld: warning: search path '/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0' not found
207+
ld: warning: search path '/opt/gfortran/lib' not found
208+
ld: library 'gfortran' not found
209+
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
210+
make: *** [redist.so] Error 1
211+
ERROR: compilation failed for package 'redist'
212+
* removing '/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/redist'
213+
Warning message:
214+
In i.p(...) :
215+
installation of package '/var/folders/r_/xjlnv23j48v1p28d0tq18wcc0000gn/T//RtmpxA09fJ/file130a75c9fcf76/redist_4.1.2.tar.gz' had non-zero exit status
216+
```
217+
218+
In this message, the key line is
219+
220+
```console
221+
ld: warning: search path '/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0' not found
222+
```
223+
224+
which indicates that R is trying to grab a gfortran library that was not installed with the
225+
brew package manager. The easiest way to try and fix this is to just adjust the compilation
226+
flags for R (i.e. edit the file `~/.R/Makevars/`). Most likely, you have never touched
227+
this file before, so the easiest way to fix this is to invoke the following from the console:
228+
229+
```console
230+
mkdir -p ~/.R && echo "CC = clang
231+
CXX = clang++
232+
FC = /opt/homebrew/bin/gfortran
233+
F77 = /opt/homebrew/bin/gfortran
234+
FLIBS = -L/opt/homebrew/opt/gcc/lib/gcc/current -lgfortran -lquadmath -lm" > ~/.R/Makevars
235+
```
236+
237+
238+
192239
### Other dependencies
193240

194241
In order to convert the "atlas" format that is output by the MSMS code to an assignment-vector

cli_files/smc_cli.R

-7
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ p <- add_argument(p,
122122
)
123123

124124
argv <- parse_args(p)
125-
options(redist.adjust_labels = FALSE)
126-
127125
vtds <- st_read(dsn = paste0(argv$shapefile))
128126

129127
population <- sum(vtds[[argv$pop_col]])
@@ -176,10 +174,5 @@ if (argv$print) {
176174
file_name <- argv$output_file
177175
dir.create(dirname(file_name), recursive = TRUE, showWarnings = FALSE)
178176
write.csv(plans, file_name)
179-
if (argv$resample) {
180-
write.csv(t(as.matrix(attr(plans, "old_plans"))), paste0(tools::file_path_sans_ext(file_name), "_assignments_before_resample.csv"))
181-
write.csv(t(as.matrix(attr(plans, "resample_indices"))), paste0(tools::file_path_sans_ext(file_name), "_parent_indices_for_reshuffle.csv"))
182-
write.csv(t(as.matrix(attr(plans, "resample_wgts"))), paste0(tools::file_path_sans_ext(file_name), "_parent_weights_for_reshuffle.csv"))
183-
}
184177
write.csv(t(as.matrix(plans)), paste0(tools::file_path_sans_ext(file_name), "_assignments.csv"))
185178
}

data_processing/other_processing_scripts/make_7_enum_ben.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
55
TOP_DIR=$(realpath "$SCRIPT_DIR/../..")
66

7-
# This makes the 4x4 -> 4 omino ensemble. The 7x7 takes a while. So this
7+
# This makes the 5x5 -> 5 omino ensemble. The 7x7 takes a while. So this
88
# is left in for testing purposes.
9+
echo "Running 5x5 to 5 enumeration"
910
julia "$TOP_DIR/data_processing/other_processing_scripts/gridenum.jl" 5 5 5 5 > "$TOP_DIR/other_data_files/processed_data_files/5x5_to_5_enumeration.jsonl"
1011
python "$TOP_DIR/data_processing/other_processing_scripts/tree_counter.py" "$TOP_DIR/other_data_files/processed_data_files/5x5_to_5_enumeration.jsonl" 5 5 5
1112
rm "$TOP_DIR/other_data_files/processed_data_files/5x5_to_5_enumeration.jsonl"
1213

14+
# echo "Running 7x7 to 7 enumeration"
1315
# julia "$TOP_DIR/data_processing/other_processing_scripts/gridenum.jl" 7 7 7 7 > "$TOP_DIR/other_data_files/processed_data_files/7x7_to_7_enumeration.jsonl"
1416
# python "$TOP_DIR/data_processing/other_processing_scripts/tree_counter.py" "$TOP_DIR/other_data_files/processed_data_files/7x7_to_7_enumeration.jsonl" 7 7 7
1517
# rm "$TOP_DIR/other_data_files/processed_data_files/7x7_to_7_enumeration.jsonl"

setup_all.sh

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ fi
2121

2222
cargo install binary-ensemble --version 0.2.0
2323
cargo install --git https://github.com/peterrrock2/msms_parser.git --rev 3c37fc5a57b1b9480b95d3d01cad9c37e6564f59
24+
cargo install --git https://github.com/peterrock2/smc_parser.git --rev 03edd583e40e6198045d62e9eeb8a3e543bb1551
2425
cargo install --git https://github.com/mggg/frcw.rs --rev b28260bc1eba425731b7ae6a194ab4a2cd4532b6
2526
cargo install --path ./data_processing/Ben_Tally
2627

0 commit comments

Comments
 (0)