Skip to content

Commit

Permalink
Updating Docs (#48)
Browse files Browse the repository at this point in the history
* initial notes added to docs for installing clients

* completing manual build instructions for the uda client for all platformsv of interest in the documentation

* removing some old build instructions from readme.md and instead referencing updated instructions in the docs

* updating readme

* adding a new page 'api_changes' to the documentation

* Fix typos in api_changes.md

* Update client_installation.md
  • Loading branch information
stephen-dixon authored Oct 18, 2024
1 parent 61a277c commit 90dce77
Show file tree
Hide file tree
Showing 7 changed files with 490 additions and 191 deletions.
235 changes: 52 additions & 183 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ See LICENCE.txt for details.

## Getting UDA

UDA binaries can be downloaded from:

<url>

The source code can be downloaded from:

https://github.com/ukaea/UDA/releases/
Expand All @@ -25,7 +21,17 @@ The UDA git repository can be cloned:

git clone git@github.com:ukaea/UDA.git

## Building from source
## Getting the UDA client

The easiest way to obtain the client is to pip install the python wrapper (pyuda), wheels are uploaded for every tagged release from version 2.7.6. Further details are available on [pypi](https://pypi.org/project/uda/).

```sh
pip install uda
```

For any other use cases please see the documentation to build from source [here](https://ukaea.github.io/UDA/client_installation/).

## Building UDA Server from source

### Dependencies

Expand All @@ -35,184 +41,47 @@ UDA requires the following to avail in order to build:
| --- | --- | --- |
| cmake | \> 3.0 | |
| OpenSSL | | |
| PostgreSQL | | |
| LibXml2 | | |
| LibMemcached | | to enable caching |
| swig | 3.0.0 | Python & HTTP wrappers |
| python | \> 3.0 | Python & HTTP wrappers |
| libfmt | | |
| spdlog | | |
| capnproto | | |
| boost | | C++, Python & HTTP wrappers |
| java | | Java wrapper |
| hdf5 | | hdf5 plugin |
| netcdf | | netcdf plugin |
| MDSplus | | MDS+ plugin |

#### Windows

> Note: If you want to use Visual Studio 2019 to compile UDA, please refer to sections [Visual Studio](#visual-studio) and [vcpkg](#vcpkg) below
Building extlibs (running in Powershell):

cd extlib
mkdir build
cd build
cmake.exe .. -G"MinGW Makefiles" -DBUILD_SHARED_LIBS=ON
mingw32-make.exe
cd ..
.\install.bat

Building extlibs (running in MinGW64 Shell):

cd extlib/portablexdr-4.9.1
./configure
make
cd ..
./install.sh

Building extlibs (running in VS2019 x64 Native Tools):

cd extlib
mkdir build
cd build
cmake.exe .. -G"Visual Studio 16 2019"
msbuild.exe ALL_BUILD.vcxproj /p:configuration=release /p:platform=x64
cd ..
install.bat

Tested and built on Windows 10 (built using MinGW 64-bit, running in Powershell):

mkdir build
cd build
..\scripts\cmake-win.bat
mingw32-make.exe
mingw32-make.exe install

Tested and built on Windows 10 (built using MinGW 64-bit, running in MinGW64 Shell):

mkdir build
cd build
cmake .. -G"Unix Makefiles" -DBUILD_SHARED_LIBS=ON -DTARGET_TYPE=OTHER
make
make install

Tested and built on Windows 10 (built using VS2019 x64 Native Tools):

mkdir build
cd build
cmake.exe .. -G"Visual Studio 16 2019" -DCMAKE_TOOLCHAIN_FILE="C:\vcpkg\scripts\buildsystems\vcpkg.cmake" -DNO_MODULES=ON -DTARGET_TYPE=OTHER -DBUILD_SHARED_LIBS=ON
msbuild ALL_BUILD.vcxproj /p:configuration=release /p:platform=x64
msbuild INSTALL.vcxproj /p:configuration=release /p:platform=x64

Running Python client:

$python_dir = (Get-Item (Get-Command python).Source).DirectoryName
rm $python_dir\Lib\site-packages\pyuda
copy -Recurse .\include\pyuda $python_dir\Lib\site-packages\
cp .\extlib\lib\libxdr.dll $python_dir\Lib\site-packages\pyuda\

Set-Item -Path env:UDA_HOST -Value "idam3.mast.ccfe.ac.uk"
Set-Item -Path env:UDA_HOST -Value "56565"
python

#### CentOS

Packages needed for CentOS

$ LANG=C sudo yum -y groupinstall 'Development Tools'
$ sudo yum -y install openssl-devel boost-devel swig-devel python-devel \
postgresql-devel libxml2-devel gsl-devel libgcrypt-devel bzip2-devel \
java-1.8.0-openjdk-devel

#### Ubuntu

sudo apt-get install git python3-dev libssl-dev libboost-dev python3-numpy python3-matplotlib

#### OSX

### Running cmake configuration

To configure the UDA build you first need to run cmake:

cmake -B<build_dir> -H. -DTARGET_TYPE:STRING=<target>

Where `<build_dir>` is the build directory to create and `<target>` is the target specific configuration to use. The
different targets available are `MAST`, `ITER` and `OTHER`. These are available in the `cmake/Config` directory with
the file name `target-<target>.cmake`. To add a new target simply copy one of these files and rename to the desired target name.

An example configuration command is:

cmake -Bbuild -H. -DTARGET_TYPE:STRING=OTHER

By default UDA will configure to build in client-server mode with both the client and server being built.

To only build the client use:

cmake -DCLIENT_ONLY:BOOL=TRUE ...

To build UDA in fat-client mode use:

cmake -DFAT_BUILD:BOOL=TRUE ...

### Building

make -C <build_dir>

### Installing

make -C <build_dir> install

### Packaging

On Linux system:

make -C <build_dir> package

On Windows system (MinGW):

make -C <build_dir> package

On Windows system (VS2019):

msbuild.exe INSTALL.vcxproj /p:configuration=release /p:platform=x64

## Visual Studio

UDA can be compiled with Visaul Studio 2019.
To do that, Vidual Studio need to be iunstalled witrh at least the following packages:

- C++ Desktop development tools
- CMake tools
- Python 3.7
- MFC and ATL libraries
- English language pack (even if you choose another language)
- Windows 10 SDK v10.0.17134.0

## vcpkg

vcpkg if a library manager designed by Microsoft to procure standard libraries for Visual Studio.

It supports CMake toolchain, easily usable with UDA CMakeList.txt files.

To use vcpkg, follow theses steps:

git clone https://github.com/Microsoft/vcpkg
cd vcpkg
bootstrap-vcpkg.bat

After that, vcpkg tool is ready to acquire libraries.
For UDA, severals libraries are mandatory, the following command download, compile and install them :

vcpkg install libxml2:x64-windows openssl:x64-windows boost:x64-windows python3:x64-windows dlfcn-win32:x64-windows libpq:x64-windows netcdf-c:x64-windows blitz:x64-windows

## Other Notes

Ninja installation for CentOS:

git clone https://github.com/ninja-build/ninja.git

cd ninja
./configure.py --bootstrap
export PATH="${HOME}/ninja:${PATH}"

Add the following to your .bashrc file:
| LibMemcached | | to enable caching |
| python | \> 3.0 | Python wrapper |

An example installation for ubuntu 22.10 would be as follows.

Start by install all system-level dependencies.
```sh
sudo apt update && sudo apt install -y
git
libboost-dev
libboost-program-options-dev
libssl-dev
cmake
build-essential
pkg-config
libxml2-dev
libspdlog-dev
ninja-build
capnproto
libcapnp-dev
python3-dev
python3-pip
python3-venv
```

Configure the cmake project.
```sh
cmake -G Ninja -B build . \
-DBUILD_SHARED_LIBS=ON \
-DSSLAUTHENTICATION=ON \
-DCLIENT_ONLY=OFF \
-DENABLE_CAPNP=ON \
-DCMAKE_INSTALL_PREFIX=install
```

```sh
cmake --build build -j --config Release --target install
```

export PYTHONPATH=/usr/local/include
82 changes: 82 additions & 0 deletions docs/api_changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
layout: default
title: API changes
nav_order: 6
---

# API changes

This page aims to detail specific changes to the UDA client API, as well as describing how deprecations will be managed.


## Notable release history

| UDA version | Description of API changes |
|:------------|:---------------------------|
| 2.7.0 | Some accidental breaking api changes are introduced, including some name changes from idam to uda, and the introduction of a new `client_flags` argument to some functions |
| 2.7.6 | A legacy mapping header is introduced which reintroduces the syntax that was lost in 2.7.0, while keeping the option to use new updated names (such as udaFree instead of idamFree) |
| (planned) 3.0.0 | Removal of all references to legacy "idam" name in all api functions. Imposing consistent naming convention in all API functions. Legacy API mapping header to be updated to permit continued use of old names for a more forgiving deprecation of old syntax |


## The legacy api headers

Where old functions names are deprecated the old syntax may still be available in a header file mapping the old syntax to the new. This will allow codes to continue to build against newer UDA library versions until they are ready to update.

The naming convention for these header files is that they mirror the existing headers they correspond to but with the word legacy added. For example to create a name mapping for a function which is declared in the `client.h` file, such as `udaFree`, the new header will be called `legacy_client.h`. To make use of a previous API function signature that is being replaced, client code simply needs to include the corresponding legacy header.

The full set of existing legacy api header files will be described below.

### legacy_client.h
This header contains the mappings for all functions from `client/client.h` The format of the file is as shown below and simply provides a mapping from the new names (`udaFree`) back to the deprecated syntax (`idamFree`). By including this header in client code, the old names are made available again.

```c++
LIBRARY_API inline void idamFree(int handle)
{
udaFree(handle);
}

LIBRARY_API inline void idamFreeAll()
{
udaFreeAll();
}

```
### legacy_accAPI.h
This header contains the mappings for all functions from `clent/accAPI.h` whose definitions were changed in release 2.7.0. Note that to implement this header some API functions had to be changed to pre-empt the new v3.0 syntax (such as `udaUnlockThread` instead of `unlockUdaThread` ). It's also worth being aware of the two options available: either to enable the interface using the extra `client_flags` argument or the one without. The version without `client_flags` is the default and the other behaviour can be enabled by setting a compile flag called `UDA_CLIENT_FLAGS_API`.
```c++
#ifdef UDA_CLIENT_FLAGS_API
LIBRARY_API inline DATA_BLOCK* acc_getCurrentDataBlock(CLIENT_FLAGS* client_flags)
{
return udaGetCurrentDataBlock();
}
LIBRARY_API inline void unlockUdaThread(CLIENT_FLAGS* client_flags)
{
udaUnlockThread();
}
LIBRARY_API inline void freeIdamThread(CLIENT_FLAGS* client_flags)
{
udaFreeThread();
}
#else
LIBRARY_API inline DATA_BLOCK* acc_getCurrentDataBlock()
{
return udaGetCurrentDataBlock();
}
LIBRARY_API inline void unlockUdaThread()
{
udaUnlockThread();
}
LIBRARY_API inline void freeIdamThread()
{
udaFreeThread();
}
```
Loading

0 comments on commit 90dce77

Please sign in to comment.