Skip to content

Commit b41d5d1

Browse files
committed
Updated post about installation of libraries.
1 parent 5e88872 commit b41d5d1

2 files changed

Lines changed: 33 additions & 388 deletions

File tree

_posts/2025-07-03-softwares.md

Lines changed: 33 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -5,96 +5,53 @@ date: 2025-07-03 15:09:00
55
description: instructions for setting up software packages and configuring systems for global simulations
66
tags: configuration newsystem code
77
categories: research
8-
featured: true
8+
featured: false
99
---
1010

11-
This theme implements a built-in Jekyll feature, the use of Rouge, for syntax highlighting.
12-
It supports more than 100 languages.
13-
This example is in C++.
14-
All you have to do is wrap your code in markdown code tags:
11+
Often when migrating to new systems, it can get difficult to setup all the necessary libraries and packages in the target system for
12+
continuing working on the mddelling. In this post I will try to summarize the libraries required for setting up some of the simulations codes e.g.,
13+
SWMF, MPI-AMRVAC, SFT-1D. Some of these codes require `hdf5`, `netcdf-c/fortran`, `zlib`, `curl`, `OPENMPI` and `GCC`.
1514

16-
````markdown
17-
```c++
18-
code code code
19-
```
20-
````
21-
22-
```c++
23-
int main(int argc, char const \*argv[])
24-
{
25-
string myString;
26-
27-
cout << "input a string: ";
28-
getline(cin, myString);
29-
int length = myString.length();
15+
**GCC**
16+
It is quite simple to build up on the existing system libraries (on Linux/Mac systems). The bash script file [`build_gcc_13.2.0.sh`](https://github.com/darrenjs/howto/blob/master/build_scripts/build_gcc_13.2.0.sh) is the best resource for this.
17+
Download the file and run it in a `bash` shell. **Add `fortran` language to the list of langiages inside the shell script.** At the end of the building, it will show the instructions to append the installed libraries to the system `$PATH`. The script downloads and installs the libraries on the system. A note of caution, the whole process may take about ~3 hrs., so be patient.
3018

31-
char charArray = new char * [length];
19+
After this, you can build the `OPENMPI` libraries. The installation version `openmpi-4.1.5` seem to work for me with the `GCC` installation versions. I prefer building the libraries with a local prefix.
3220

33-
charArray = myString;
34-
for(int i = 0; i < length; ++i){
35-
cout << charArray[i] << " ";
36-
}
21+
Inside the openmpi-4.1.5 directory run the following,
3722

38-
return 0;
39-
}
23+
```
24+
./configure --prefix=~/opt/openmpi-4.1.5
25+
make -j 4
26+
make install
4027
```
4128

42-
For displaying code in a list item, you have to be aware of the indentation, as stated in [this FAQ](https://github.com/planetjekyll/quickrefs/blob/master/FAQ.md#q-how-can-i-get-backtick-fenced-code-blocks-eg--working-inside-lists-with-kramdown). You must indent your code by **(3 \* bullet_indent_level)** spaces. This is because kramdown (the markdown engine used by Jekyll) indentation for the code block in lists is determined by the column number of the first non-space character after the list item marker. For example: [download the bash script.](assets/pdf/build_gcc_13.2.0.sh)
43-
44-
````markdown
45-
1. We can put fenced code blocks inside nested bullets, too.
46-
47-
1. Like this:
48-
49-
```c
50-
printf("Hello, World!");
51-
```
52-
53-
2. The key is to indent your fenced block in the same line as the first character of the line.
54-
````
55-
56-
Which displays:
57-
58-
1. We can put fenced code blocks inside nested bullets, too.
59-
60-
1. Like this:
61-
62-
```c
63-
printf("Hello, World!");
64-
```
65-
66-
2. The key is to indent your fenced block in the same line as the first character of the line.
67-
68-
By default, it does not display line numbers. If you want to display line numbers for every code block, you can set `kramdown.syntax_highlighter_opts.block.line_numbers` to true in your `_config.yml` file.
69-
70-
If you want to display line numbers for a specific code block, all you have to do is wrap your code in a liquid tag:
71-
72-
{% raw %}
73-
{% highlight c++ linenos %} <br/> code code code <br/> {% endhighlight %}
74-
{% endraw %}
29+
Here are a few lines that you can add to the `~/.bashrc` or `~/.zshrc` file after the `OPENMPI` installation.
7530

76-
The keyword `linenos` triggers display of line numbers.
77-
Produces something like this:
31+
```
32+
export PATH=~/openmpi-4.1.5/bin:~/opt/gcc-13.2.0/bin:$PATH
33+
export LD_LIBRARY_PATH=~/openmpi-4.1.5/lib:~/opt/gcc-13.2.0/lib:~/opt/gcc-13.2.0/lib64:$LD_LIBRARY_PATH
34+
export MANPATH=~/opt/gcc-13.2.0/share/man:$MANPATH
35+
export INFOPATH=~/opt/gcc-13.2.0/share/info:$INFOPATH
36+
```
7837

79-
{% highlight c++ linenos %}
38+
After the installation you can check the version of the `gcc` by typing `gcc -v`. Similarly for `fortran` as well. At the end of this the system should have all the `mpicc, mpif90, gcc, gfortran` executables in the default `$PATH` variable.
8039

81-
int main(int argc, char const \*argv[])
82-
{
83-
string myString;
40+
**netCDF**
41+
Installation of netcdf libraries is dependent on multiple other libraries e.g., `curl`, `zlib`, `hdf5`, `netcdf-c` and `netcdf-fortran`. Here is a shell script [install_netcdf.sh](https://github.com/sr-dash/SFT-1D/blob/main/install_netcdf.sh) for this. A few extra install flags and versions are suggested for a system-wide installation.
8442

85-
cout << "input a string: ";
86-
getline(cin, myString);
87-
int length = myString.length();
43+
Suggested versions
44+
* `hdf5-1.14.6`, build with `--enable-fortran`, `--enable-cxx`/`--enable-parallel`.
45+
* `netcdf-c-4.9.3`
46+
* `netcdf-fortran-4.6.1`
47+
* `zlib-1.3.1`
48+
* `curl-8.14.1`
8849

89-
char charArray = new char * [length];
50+
Again the shell script downloads the required files and builds the libraries at a user location.
9051

91-
charArray = myString;
92-
for(int i = 0; i < length; ++i){
93-
cout << charArray[i] << " ";
94-
}
9552

96-
return 0;
53+
**None of the scripts require admin privileges, so building these libraries should be self-sufficient.**
9754

98-
}
55+
After building these libraries, you must update the system `$PATH$` variable for future use. Individual simulation codes require independent path to the libraries.
9956

100-
{% endhighlight %}
57+
Hope this helps!

0 commit comments

Comments
 (0)