Skip to content

Commit

Permalink
Introduce new JSON parser utility
Browse files Browse the repository at this point in the history
This patch introduces a utility in OPAL based on the 3rd-party project
https://github.com/json-parser/json-parser.git

The utility provides APIs to read JSON into memory along with getters to
retrieve C values.

Please see the unit test opal_json.c for example usage.

Signed-off-by: Wenduo Wang <[email protected]>
  • Loading branch information
wenduwan committed May 8, 2024
1 parent 8b4237c commit e494d37
Show file tree
Hide file tree
Showing 13 changed files with 2,187 additions and 132 deletions.
227 changes: 117 additions & 110 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -334,78 +334,6 @@ opal/tools/wrappers/opal.pc
opal/util/show_help_lex.c
opal/util/keyval/keyval_lex.c

test/monitoring/aggregate_profile.pl
test/monitoring/profile2mat.pl

test/simple/abort
test/simple/accept
test/simple/attach
test/simple/bad_exit
test/simple/bcast_loop
test/simple/binding
test/simple/concurrent_spawn
test/simple/connect
test/simple/crisscross
test/simple/delayed_abort
test/simple/hello_barrier
test/simple/hello_nodename
test/simple/hello_output
test/simple/hello_show_help
test/simple/hello
test/simple/hello++
test/simple/intercomm1
test/simple/interlib
test/simple/loop_child
test/simple/loop_spawn
test/simple/mpi_barrier
test/simple/mpi_no_op
test/simple/mpi_spin
test/simple/multi_abort
test/simple/parallel_r8
test/simple/parallel_r64
test/simple/parallel_w8
test/simple/parallel_w64
test/simple/pinterlib
test/simple/pmix
test/simple/pubsub
test/simple/read_write
test/simple/reduce-hang
test/simple/ring
test/simple/segv
test/simple/simple_spawn
test/simple/slave
test/simple/spawn_multiple
test/simple/xlib
test/simple/ziaprobe
test/simple/ziatest
test/simple/*.dwarf
test/simple/junk*
test/simple/sio
test/simple/sendrecv_blaster
test/simple/early_abort
test/simple/spawn_problem/ch_rec
test/simple/spawn_problem/output
test/simple/spawn_problem/start
test/simple/debugger
test/simple/server_port_name.txt
test/simple/singleton_client_server
test/simple/intercomm_create
test/simple/spawn_tree
test/simple/init-exit77
test/simple/mpi_info
test/simple/info_spawn
test/simple/client
test/simple/server
test/simple/paccept
test/simple/pconnect
test/simple/thread_init
test/simple/memcached-dummy
test/simple/coll_test
test/simple/badcoll
test/simple/iof
test/simple/no-disconnect
test/simple/nonzero
test/simple/add_host

oshmem/include/shmem.h
oshmem/include/shmem_portable_platform.h
Expand All @@ -418,12 +346,12 @@ oshmem/shmem/c/profile/p*.c
oshmem/shmem/c/profile/*.c

oshmem/shmem/fortran/libshmem_fortran.la
oshmem/shmem/fortran/profile/pshmem_*_f.c
oshmem/shmem/fortran/profile/pshpdeallc_f.c
oshmem/shmem/fortran/profile/pshpclmove_f.c
oshmem/shmem/fortran/profile/pmy_pe_f.c
oshmem/shmem/fortran/profile/pshpalloc_f.c
oshmem/shmem/fortran/profile/pnum_pes_f.c
oshmem/shmem/fortran/profile/pshmem_*_f.c
oshmem/shmem/fortran/profile/pshpalloc_f.c
oshmem/shmem/fortran/profile/pshpclmove_f.c
oshmem/shmem/fortran/profile/pshpdeallc_f.c
oshmem/shmem/fortran/profile/pstart_pes_f.c

oshmem/tools/oshmem_info/oshmem_info
Expand All @@ -432,32 +360,32 @@ oshmem/tools/wrappers/oshmem-c.pc
oshmem/tools/wrappers/oshmem-cxx.pc
oshmem/tools/wrappers/oshmem-fort.pc
oshmem/tools/wrappers/oshmem.pc
oshmem/tools/wrappers/shmemc++-wrapper-data.txt
oshmem/tools/wrappers/shmemcc-wrapper-data.txt
oshmem/tools/wrappers/shmemfort-wrapper-data.txt
oshmem/tools/wrappers/shmemc++-wrapper-data.txt

test/asm/atomic_math_noinline
test/asm/atomic_barrier
test/asm/atomic_barrier_noinline
test/asm/atomic_barrier_noinline.c
test/asm/atomic_cmpset
test/asm/atomic_cmpset_noinline
test/asm/atomic_cmpset_noinline.c
test/asm/atomic_math
test/asm/atomic_cmpset
test/asm/atomic_spinlock_noinline.c
test/asm/atomic_barrier_noinline.c
test/asm/atomic_math_noinline
test/asm/atomic_math_noinline.c
test/asm/atomic_cmpset_noinline.c
test/asm/atomic_spinlock_noinline
test/asm/atomic_barrier_noinline
test/asm/atomic_spinlock
test/asm/atomic_spinlock_noinline
test/asm/atomic_spinlock_noinline.c

test/class/*.txt
test/class/ompi_bitmap
test/class/ompi_bitmap_test_out.txt
test/class/ompi_circular_buffer_fifo
test/class/ompi_fifo
test/class/ompi_rb_tree
test/class/ompi_bitmap
test/class/opal_bitmap
test/class/opal_fifo
test/class/opal_cstring
test/class/opal_fifo
test/class/opal_hash_table
test/class/opal_lifo
test/class/opal_list
Expand All @@ -466,63 +394,142 @@ test/class/opal_proc_table
test/class/opal_tree
test/class/opal_value_array

test/datatype/ddt_test
test/datatype/ddt_pack
test/datatype/external32
test/datatype/to_self
test/datatype/checksum
test/datatype/position
test/datatype/ddt_pack
test/datatype/ddt_raw
test/datatype/ddt_raw2
test/datatype/ddt_test
test/datatype/external32
test/datatype/large_data
test/datatype/opal_datatype_test
test/datatype/partial
test/datatype/position
test/datatype/position_noncontig
test/datatype/unpack_ooo
test/datatype/reduce_local
test/datatype/to_self
test/datatype/unpack_hetero
test/datatype/unpack_ooo

test/event/signal-test
test/event/event-test
test/event/signal-test
test/event/time-test

test/monitoring/monitoring_test
test/monitoring/aggregate_profile.pl
test/monitoring/check_monitoring
test/monitoring/example_reduce_count
test/monitoring/monitoring_test
test/monitoring/profile2mat.pl
test/monitoring/test_overhead
test/monitoring/test_pvar_access

test/mpi/environment/chello

test/mpool/mpool_memkind

test/runtime/opal_init_finalize
test/runtime/orte_init_finalize
test/runtime/parse_context
test/runtime/sigchld
test/runtime/start_shut
test/runtime/opal_init_finalize
test/runtime/orte_init_finalize

test/simple/*.dwarf
test/simple/abort
test/simple/accept
test/simple/add_host
test/simple/attach
test/simple/bad_exit
test/simple/badcoll
test/simple/bcast_loop
test/simple/binding
test/simple/client
test/simple/coll_test
test/simple/concurrent_spawn
test/simple/connect
test/simple/crisscross
test/simple/debugger
test/simple/delayed_abort
test/simple/early_abort
test/simple/hello
test/simple/hello++
test/simple/hello_barrier
test/simple/hello_nodename
test/simple/hello_output
test/simple/hello_show_help
test/simple/info_spawn
test/simple/init-exit77
test/simple/intercomm1
test/simple/intercomm_create
test/simple/interlib
test/simple/iof
test/simple/junk*
test/simple/loop_child
test/simple/loop_spawn
test/simple/memcached-dummy
test/simple/mpi_barrier
test/simple/mpi_info
test/simple/mpi_no_op
test/simple/mpi_spin
test/simple/multi_abort
test/simple/no-disconnect
test/simple/nonzero
test/simple/paccept
test/simple/parallel_r64
test/simple/parallel_r8
test/simple/parallel_w64
test/simple/parallel_w8
test/simple/pconnect
test/simple/pinterlib
test/simple/pmix
test/simple/pubsub
test/simple/read_write
test/simple/reduce-hang
test/simple/ring
test/simple/segv
test/simple/sendrecv_blaster
test/simple/server
test/simple/server_port_name.txt
test/simple/simple_spawn
test/simple/singleton_client_server
test/simple/sio
test/simple/slave
test/simple/spawn_multiple
test/simple/spawn_problem/ch_rec
test/simple/spawn_problem/output
test/simple/spawn_problem/start
test/simple/spawn_tree
test/simple/thread_init
test/simple/xlib
test/simple/ziaprobe
test/simple/ziatest

test/spc/spc_test

test/threads/opal_atomic_thread_bench
test/threads/opal_condition
test/threads/opal_thread

test/util/aaa
test/util/test_session_dir_out
test/util/opal_os_path
test/util/bipartite_graph
test/util/ompi_numtostr
test/util/ompi_pack
test/util/opal_argv
test/util/opal_os_create_dirpath
test/util/opal_if
test/util/opal_basename
test/util/opal_bit_ops
test/util/opal_error
test/util/opal_if
test/util/opal_json
test/util/opal_os_create_dirpath
test/util/opal_os_path
test/util/opal_path_nfs
test/util/opal_path_nfs.out
test/util/opal_sha256
test/util/opal_sos
test/util/opal_timer
test/util/orte_sys_info
test/util/orte_session_dir
test/util/orte_sys_info
test/util/orte_universe_setup_file_io
test/util/opal_basename
test/util/ompi_numtostr
test/util/ompi_pack
test/util/test-file
test/util/opal_sos
test/util/opal_path_nfs
test/util/opal_path_nfs.out
test/util/opal_bit_ops
test/util/bipartite_graph
test/util/opal_sha256
test/util/test_session_dir_out

opal/test/reachable/reachable_netlink
opal/test/reachable/reachable_weighted
Expand Down
4 changes: 3 additions & 1 deletion config/opal_config_files.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Copyright (c) 2020 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
# Copyright (c) Amazon.com, Inc. or its affiliates. All Rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand All @@ -21,6 +21,8 @@ AC_DEFUN([OPAL_CONFIG_FILES],[
opal/include/Makefile
opal/datatype/Makefile
opal/util/Makefile
opal/util/json/Makefile
opal/util/json/3rd-party/Makefile
opal/util/keyval/Makefile
opal/mca/base/Makefile
opal/tools/wrappers/Makefile
Expand Down
8 changes: 6 additions & 2 deletions opal/util/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Copyright (c) 2016 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
# Copyright (c) 2020 Amazon.com, Inc. or its affiliates.
# Copyright (c) Amazon.com, Inc. or its affiliates.
# All Rights reserved.
# Copyright (c) 2021 Google, LLC. All rights reserved.
# $COPYRIGHT$
Expand All @@ -27,7 +27,9 @@
# $HEADER$
#

SUBDIRS = keyval
SUBDIRS = \
json \
keyval

dist_opaldata_DATA = help-opal-util.txt

Expand Down Expand Up @@ -127,8 +129,10 @@ libopalutil_core_la_SOURCES += timings.c
endif

libopalutil_core_la_LIBADD = \
json/libopalutil_json.la \
keyval/libopalutilkeyval.la
libopalutil_core_la_DEPENDENCIES = \
json/libopalutil_json.la \
keyval/libopalutilkeyval.la

# Conditionally install the header files
Expand Down
15 changes: 15 additions & 0 deletions opal/util/json/3rd-party/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# Copyright (c) Amazon.com, Inc. or its affiliates.
# All Rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#

noinst_LTLIBRARIES = libopalutil_json_3p.la

libopalutil_json_3p_la_SOURCES = \
json.h \
json.c
Loading

0 comments on commit e494d37

Please sign in to comment.