macros:
    HAS_MTEST: 1

subcode: mtest_malloc(size)
    MTestArgList *head = MTestArgListCreate(argc, argv)
    int send_rank = 0, recv_rank = 1;
    $(for:a in send,recv)
        $if grank == $(a)_rank
            $my mtest_mem_type_e $(a)_memtype, int $(a)_device
            $(a)_memtype = MTestArgListGetMemType(head, "$(a)mem")
            $(a)_device = MTestArgListGetInt_with_default(head, "$(a)dev", 0)
            MTestMalloc($(size), $(a)_memtype, NULL, &buf, $(a)_device)
            MTestPrintfMsg(1, "Allocating buffer: memtype=%s, device=%d, size=%d\n", MTest_memtype_name($(a)_memtype), $(a)_device, $(size))
    MTestArgListDestroy(head)
