Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1327,3 +1327,10 @@ foreach( pattern_file ${pattern_files} )
list( APPEND pattern_files_dest "${pattern_file}" )
endforeach( pattern_file )
add_custom_target(build_with_parsec ALL DEPENDS ${pattern_files_dest})

# Optional language bindings. Each lives in-tree (not as an outer wrapper
# repository) so paths to tests/apps and the build tree are parent-relative.
option(PARSEC_JULIA_BINDINGS "Build Julia bindings (PaRSEC4Julia)" OFF)
if(PARSEC_JULIA_BINDINGS)
add_subdirectory(julia)
endif()
17 changes: 17 additions & 0 deletions julia/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated C wrappers
src/*.so
src/*.o
src/*.d

# Generated env helper
parsec_env.sh

# Local Julia environments (cluster-specific MPI prefs, Manifest)
.runenv/
Manifest.toml
julia_depot/

# IDE
.vscode/
.idea/
*.jl.cov
56 changes: 56 additions & 0 deletions julia/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Julia bindings (PaRSEC4Julia)
#
# Builds the C shared libraries that Julia ccall()s into.
# Outputs land in julia/src/ so existing paths like
# joinpath(@__DIR__, "libdtd_wrapper.so")
# keep working when this directory lives inside the PaRSEC tree.

find_package(Threads REQUIRED)

add_library(parsec_julia_dtd SHARED src/dtd_wrapper.c)
set_target_properties(parsec_julia_dtd PROPERTIES
OUTPUT_NAME dtd_wrapper
PREFIX "lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src"
POSITION_INDEPENDENT_CODE ON
)
target_include_directories(parsec_julia_dtd PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src")
target_link_libraries(parsec_julia_dtd PRIVATE parsec m Threads::Threads)
if(TARGET MPI::MPI_C)
target_link_libraries(parsec_julia_dtd PRIVATE MPI::MPI_C)
elseif(PARSEC_HAVE_MPI AND MPI_C_LIBRARIES)
target_include_directories(parsec_julia_dtd PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(parsec_julia_dtd PRIVATE ${MPI_C_LIBRARIES})
endif()

# Stencil wrapper compiles PaRSEC test/app C + JDF-generated sources.
# Only available when the stencil test target is part of this build.
if(TARGET testing_stencil_1D)
set(STENCIL_1D_C "${CMAKE_BINARY_DIR}/tests/apps/stencil/stencil_1D.c")
set_source_files_properties("${STENCIL_1D_C}" PROPERTIES GENERATED TRUE)

add_library(parsec_julia_stencil SHARED
src/stencil_wrapper.c
"${PROJECT_SOURCE_DIR}/tests/apps/stencil/stencil_internal.c"
"${STENCIL_1D_C}"
)
add_dependencies(parsec_julia_stencil testing_stencil_1D)
set_target_properties(parsec_julia_stencil PROPERTIES
OUTPUT_NAME stencil_jl
PREFIX "lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src"
POSITION_INDEPENDENT_CODE ON
)
target_include_directories(parsec_julia_stencil PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/src"
"${PROJECT_SOURCE_DIR}/tests/apps/stencil"
"${CMAKE_BINARY_DIR}/tests/apps/stencil"
)
target_link_libraries(parsec_julia_stencil PRIVATE parsec m Threads::Threads)
if(TARGET MPI::MPI_C)
target_link_libraries(parsec_julia_stencil PRIVATE MPI::MPI_C)
elseif(PARSEC_HAVE_MPI AND MPI_C_LIBRARIES)
target_include_directories(parsec_julia_stencil PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(parsec_julia_stencil PRIVATE ${MPI_C_LIBRARIES})
endif()
endif()
18 changes: 18 additions & 0 deletions julia/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Makefile for PaRSEC4Julia (lives inside parsec/julia/)

.PHONY: help build-parsec wrappers clean

help:
@echo "Available targets:"
@echo " build-parsec Build parent PaRSEC + Julia wrappers (julia build_parsec4julia.jl)"
@echo " wrappers Rebuild C wrappers only (requires ../build/install)"
@echo " clean Remove generated .so files and parsec_env.sh"

build-parsec:
julia build_parsec4julia.jl

wrappers:
julia build_parsec4julia.jl --skip-parsec

clean:
rm -f src/libdtd_wrapper.so src/libstencil_jl.so parsec_env.sh
23 changes: 23 additions & 0 deletions julia/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name = "PaRSEC4Julia"
uuid = "12345678-1234-5678-9012-123456789abc"
authors = ["PaRSEC4Julia Contributors"]
version = "0.1.0"

[deps]
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
ArgParse = "c7e460c6-2913-53be-9146-3f0a8656e37c"

[compat]
MPI = "0.20"
julia = "1.6"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c1634f0c40"

[targets]
test = ["Test"]
94 changes: 94 additions & 0 deletions julia/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# PaRSEC4Julia

A Julia interface for PaRSEC (Parallel Runtime System for Extreme Scale Computing).

This directory (`julia/`) lives inside the PaRSEC source tree and provides
C wrappers plus Julia modules for the PaRSEC runtime (DTD, matrices,
redistribute, and the stencil 1D example).

## Quick Start

From this directory (`julia/`):

```bash
# CPU-only: build PaRSEC in ../build, then compile the Julia wrappers
julia build_parsec4julia.jl

# Optional GPU support
julia build_parsec4julia.jl --enable-cuda
julia build_parsec4julia.jl --enable-hip
```

The script:
1. Configures and builds PaRSEC via CMake in `../build/`
2. Installs PaRSEC to `../build/install/`
3. Compiles `src/libdtd_wrapper.so` (and `src/libstencil_jl.so` when stencil sources exist)
4. Writes `parsec_env.sh` for runtime library paths

Alternatively, enable the wrappers from the PaRSEC CMake build:

```bash
cmake -S .. -B ../build -DPARSEC_JULIA_BINDINGS=ON
cmake --build ../build
```

### If PaRSEC is already built

```bash
export PARSEC_ROOT=/path/to/parsec/install # or use ../build/install
julia build_parsec4julia.jl # rebuilds only if needed
source parsec_env.sh
```

## Run examples

```bash
source parsec_env.sh

julia examples/dtd_redistribute.jl
julia examples/ptg_redistribute.jl
julia examples/simple_dtd_gemm.jl
julia examples/stencil_1d.jl 16 16 4 4 20 2
```

On a cluster, launch with the same MPI that PaRSEC was built against, e.g.
`mpirun -np 1 julia examples/dtd_redistribute.jl`.

## Tests

```bash
source parsec_env.sh
julia test/runtests.jl
```

## Layout

```
julia/
├── src/ # Julia modules + C wrappers
│ ├── dtd_simple.jl # DTD API (matches py-parsec names)
│ ├── dtd_wrapper.c # C ABI for ccall
│ ├── stencil_core.jl
│ └── stencil_wrapper.c
├── examples/
├── test/
├── setup.jl
├── Project.toml
└── build_parsec4julia.jl
```

C wrapper include paths for stencil internals are the parent-repo
`tests/apps/stencil` sources (and JDF-generated files under `../build/`),
not a nested `parsec/` submodule.

## Requirements

- Julia 1.6+
- MPI.jl (configured against the same MPI as PaRSEC)
- C compiler and CMake
- MPI library (OpenMPI or MPICH)
- PaRSEC (built from the parent directory)

## License

See the top-level LICENSE.txt file for details.
Loading