Skip to content

Commit

Permalink
Update to the latest Motr Client API
Browse files Browse the repository at this point in the history
  • Loading branch information
andriytk committed Nov 10, 2020
1 parent 7c53b07 commit 55d6b93
Show file tree
Hide file tree
Showing 20 changed files with 253 additions and 829 deletions.
24 changes: 12 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ FSZ := $(shell expr $(DDZ) \* $(CNT) )
BSZ := 4

#compiler/linker options
LFLAGS += -lm -lpthread -lrt -lgf_complete -lyaml -luuid -lmero
CFLAGS += -I/usr/include/mero
LFLAGS += -lm -lpthread -lrt -lgalois -lyaml -luuid -lmotr
CFLAGS += -I/usr/include/motr
CFLAGS += -D_REENTRANT -D_GNU_SOURCE -DM0_INTERNAL='' -DM0_EXTERN=extern
CFLAGS += -fno-common -Wall -Werror -Wno-attributes -fno-strict-aliasing
CFLAGS += -fno-omit-frame-pointer -g -O2 -Wno-unused-but-set-variable
CFLAGS += -rdynamic
ifneq ($(M0_SRC_DIR),)
LFLAGS += -L$(M0_SRC_DIR)/mero/.libs -Wl,-rpath,$(M0_SRC_DIR)/mero/.libs
LFLAGS += -L$(M0_SRC_DIR)/extra-libs/gf-complete/src/.libs -Wl,-rpath,$(M0_SRC_DIR)/extra-libs/gf-complete/src/.libs
LFLAGS += -L$(M0_SRC_DIR)/motr/.libs -Wl,-rpath,$(M0_SRC_DIR)/motr/.libs
LFLAGS += -L$(M0_SRC_DIR)/extra-libs/galois/src/.libs -Wl,-rpath,$(M0_SRC_DIR)/extra-libs/gf-complete/src/.libs
CFLAGS += -I$(M0_SRC_DIR)
endif

Expand All @@ -100,13 +100,13 @@ all: $(C0CP) $(C0CT) $(C0RM) isc-all
-include $(SRC_ALL:.o=.d)

$(C0CP): $(SRC) c0cp.c
gcc $(SRC) c0cp.c -I/usr/include/mero $(CFLAGS) $(LFLAGS) -o $(C0CP)
gcc $(SRC) c0cp.c -I/usr/include/motr $(CFLAGS) $(LFLAGS) -o $(C0CP)

$(C0CT): $(SRC) c0ct.c
gcc $(SRC) c0ct.c -I/usr/include/mero $(CFLAGS) $(LFLAGS) -o $(C0CT)
gcc $(SRC) c0ct.c -I/usr/include/motr $(CFLAGS) $(LFLAGS) -o $(C0CT)

$(C0RM): $(SRC) c0rm.c
gcc $(SRC) c0rm.c -I/usr/include/mero $(CFLAGS) $(LFLAGS) -o $(C0RM)
gcc $(SRC) c0rm.c -I/usr/include/motr $(CFLAGS) $(LFLAGS) -o $(C0RM)

test: $(C0CP) $(C0CT) $(C0RM)
$(SUDO) ./$(C0RM) 0 1048577 -y
Expand Down Expand Up @@ -214,7 +214,7 @@ bigtest:
EXE6 = mpix

mpix:
mpicc c0appz.c mpiapp.c -I/usr/include/mero $(CFLAGS) $(LFLAGS) -o $(EXE6)
mpicc c0appz.c mpiapp.c -I/usr/include/motr $(CFLAGS) $(LFLAGS) -o $(EXE6)

mpi-clean:
rm -f m0trace.*
Expand All @@ -230,11 +230,11 @@ mpi-sagercf:
#

$(ISC_REG): $(SRC) c0isc_register.c
gcc $(SRC) c0isc_register.c -I/usr/include/mero -g $(CFLAGS) $(LFLAGS) -o $(ISC_REG)
gcc $(SRC) c0isc_register.c -I/usr/include/motr -g $(CFLAGS) $(LFLAGS) -o $(ISC_REG)
$(LIBISC): isc_libdemo.c
gcc isc_libdemo.c -I/usr/include/mero $(CFLAGS) -fpic -shared -o $(LIBISC)
gcc isc_libdemo.c -I/usr/include/motr $(CFLAGS) -fpic -shared -o $(LIBISC)
$(ISC_INVK): $(SRC) c0isc_demo.c
gcc $(SRC) c0isc_demo.c -I/usr/include/mero -g $(CFLAGS) $(LFLAGS) -o $(ISC_INVK)
gcc $(SRC) c0isc_demo.c -I/usr/include/motr -g $(CFLAGS) $(LFLAGS) -o $(ISC_INVK)
isc-all: $(ISC_REG) $(ISC_INVK) $(LIBISC)
isc-clean:
rm -f $(ISC_REG) $(ISC_INVK) $(LIBISC)
Expand All @@ -244,7 +244,7 @@ isc-clean:
#

ecmwf:
gcc c0appz.c c0fgen.c ecmwf.c -I/usr/include/mero $(CFLAGS) $(LFLAGS) -lssl -lcrypto -o ecmwfx
gcc c0appz.c c0fgen.c ecmwf.c -I/usr/include/motr $(CFLAGS) $(LFLAGS) -lssl -lcrypto -o ecmwfx

ecmwf-clean:
rm -f m0trace.*
Expand Down
34 changes: 28 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# clovis-sample-apps
# Motr client sample apps

There are three sample applications.
A running instance of Motr such as singlenode Motr is a prerequisite for
compiling, building and running these applications.

There are three sample applications. A running instance of Mero such as singlenode Mero is a prerequisite for compiling, building and running these clovis applications.
1. c0cp
2. c0cat
3. c0rm
Expand All @@ -27,15 +30,29 @@ $ make vmrcf
```sh
make clean
```

### Clean install mero
The clean install mero script stops currently running m0singlenode, uninstall mero and mero-devel packages, removes all configuration and storage disks. It then installs the new version pointed by directory path, configuraes it as a m0singlenode and starts services.

The clean install mero script stops currently running m0singlenode,
uninstall mero and mero-devel packages, removes all configuration and
storage disks. It then installs the new version pointed by directory path,
configuraes it as a m0singlenode and starts services.

```sh
$ ./scripts/clean_install_mero <rpms directory path>
$ # (example) ./scripts/clean_install_mero ./rpms/jenkins-OSAINT_mero-1400-29-g7a51cbd/
```

### Clovis apps resource file <.[app]rc>
Each Clovis application requires a clovis resource file residing in the same directory where the application is residing. This resource file contains all clovis related resource parameters for running the clovis application on a particular client machine where the application is executed. This file can be generated using the cappsrcgen utility for dev VMs. The name of the file should be .[application name]rc. Replace the application name with your application's basename. A c0cp example is shown below:
### Apps resource file <.[app]rc>
Each application requires a resource file residing in the same directory
where the application is residing. This resource file contains all
Motr-client related resource parameters for running the application
on a particular client node where the application is executed.
This file can be generated using the cappsrcgen utility for dev VMs.
The name of the file should be .[application name]rc. Replace the
application name with your application's basename. A c0cp example
is shown below:

```sh
$ ./scripts/c0appzrcgen > .c0cprc # Generates configuration
```
Expand All @@ -59,7 +76,12 @@ Containts of `.c0cprc` is as follows
```

### How to generate resource files on the Sage cluster?
Pre-registration with Sage userID and application names is required. Once registered the sage-user-application-assignment script can be used on the CMU to generate this information.This script takes Username, app name and the client IP as input and outputs the required resource information. See example below:

Pre-registration with Sage userID and application names is required.
Once registered the sage-user-application-assignment script can be used
on the CMU node to generate this information. This script takes Username,
app name and the client IP as input and outputs the required resource
information. See example below:

```
[sage0004@sage-cmu]$ sage-user-application-assignment ganesan c0del 172.18.1.21
Expand Down
33 changes: 16 additions & 17 deletions buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
#include <inttypes.h>
#include <assert.h>

#include "clovis/clovis.h"
#include "clovis/clovis_idx.h"
#include "motr/client.h"
#include "layout/layout.h" /* M0_DEFAULT_LAYOUT_ID */
#include "c0appz.h"
#include "c0appz_internal.h"
Expand Down Expand Up @@ -140,7 +139,7 @@ int c0appz_mr(char *buf, uint64_t idhi, uint64_t idlo, uint64_t off,
int rc;
unsigned cnt_per_op;
struct m0_uint128 id = { idhi, idlo };
struct m0_clovis_obj obj = { };
struct m0_obj obj = { };
struct m0_indexvec ext;
struct m0_bufvec data;
struct m0_bufvec attr;
Expand All @@ -157,7 +156,7 @@ int c0appz_mr(char *buf, uint64_t idhi, uint64_t idlo, uint64_t off,
}

/* Set the object entity we want to write */
m0_clovis_obj_init(&obj, &clovis_uber_realm, &id,
m0_obj_init(&obj, &uber_realm, &id,
M0_DEFAULT_LAYOUT_ID);

rc = open_entity(&obj.ob_entity);
Expand Down Expand Up @@ -193,7 +192,7 @@ int c0appz_mr(char *buf, uint64_t idhi, uint64_t idlo, uint64_t off,
}
free:
free_segs(&data, &ext, &attr);
m0_clovis_entity_fini(&obj.ob_entity);
m0_entity_fini(&obj.ob_entity);

return rc;
}
Expand All @@ -210,7 +209,7 @@ int c0appz_mw(const char *buf, uint64_t idhi, uint64_t idlo, uint64_t off,
int rc;
unsigned cnt_per_op;
struct m0_uint128 id = { idhi, idlo };
struct m0_clovis_obj obj = { };
struct m0_obj obj = { };
struct m0_indexvec ext;
struct m0_bufvec data;
struct m0_bufvec attr;
Expand All @@ -227,7 +226,7 @@ int c0appz_mw(const char *buf, uint64_t idhi, uint64_t idlo, uint64_t off,
}

/* Set the object entity we want to write */
m0_clovis_obj_init(&obj, &clovis_uber_realm, &id,
m0_obj_init(&obj, &uber_realm, &id,
M0_DEFAULT_LAYOUT_ID);

rc = open_entity(&obj.ob_entity);
Expand Down Expand Up @@ -260,15 +259,15 @@ int c0appz_mw(const char *buf, uint64_t idhi, uint64_t idlo, uint64_t off,
}
free:
free_segs(&data, &ext, &attr);
m0_clovis_entity_fini(&obj.ob_entity);
m0_entity_fini(&obj.ob_entity);

return rc;
}

/*
* c0appz_mw_async()
* Writes data from memory buffer to a mero object in async mode op_cnt
* Clovis operations at a time. Writes cnt number of blocks, each of size
* operations at a time. Writes cnt number of blocks, each of size
* bsz at off (byte) offset of the object.
*/
int c0appz_mw_async(const char *buf, uint64_t idhi, uint64_t idlo, uint64_t off,
Expand All @@ -279,23 +278,23 @@ int c0appz_mw_async(const char *buf, uint64_t idhi, uint64_t idlo, uint64_t off,
uint32_t nr_ops_sent;
uint32_t cnt_per_op;
struct m0_uint128 id = {idhi, idlo};
struct clovis_aio_op *aio;
struct clovis_aio_opgrp aio_grp;
struct m0_aio_op *aio;
struct m0_aio_opgrp aio_grp;

CHECK_BSZ_ARGS(bsz, m0bs);

cnt_per_op = m0bs / bsz;

/* Initialise operation group. */
rc = clovis_aio_opgrp_init(&aio_grp, bsz, cnt_per_op, op_cnt);
rc = m0_aio_opgrp_init(&aio_grp, bsz, cnt_per_op, op_cnt);
if (rc != 0) {
fprintf(stderr, "%s(): clovis_aio_opgrp_init() failed: rc=%d\n",
fprintf(stderr, "%s(): m0_aio_opgrp_init() failed: rc=%d\n",
__func__, rc);
return rc;
}

/* Open the object. */
m0_clovis_obj_init(&aio_grp.cag_obj, &clovis_uber_realm,
m0_obj_init(&aio_grp.cag_obj, &uber_realm,
&id, M0_DEFAULT_LAYOUT_ID);
rc = open_entity(&aio_grp.cag_obj.ob_entity);
if (rc != 0) {
Expand Down Expand Up @@ -338,15 +337,15 @@ int c0appz_mw_async(const char *buf, uint64_t idhi, uint64_t idlo, uint64_t off,
/* Finalise ops and group. */
rc = rc ?: aio_grp.cag_rc;
for (i = 0; i < nr_ops_sent; i++)
clovis_aio_op_fini_free(aio_grp.cag_aio_ops + i);
m0_aio_op_fini_free(aio_grp.cag_aio_ops + i);

/* Not all ops are launched and executed successfully. */
if (rc != 0)
break;
}
fini:
m0_clovis_entity_fini(&aio_grp.cag_obj.ob_entity);
clovis_aio_opgrp_fini(&aio_grp);
m0_entity_fini(&aio_grp.cag_obj.ob_entity);
m0_aio_opgrp_fini(&aio_grp);

return rc;
}
Expand Down
Loading

0 comments on commit 55d6b93

Please sign in to comment.